Skip to content

deps(app-contract): depend on octosense-app-contract by version; patch to the local crate - #47

Merged
ymote merged 1 commit into
mainfrom
deps/contract-from-crates-io
Oct 1, 2026
Merged

ymote merged 1 commit into
mainfrom
deps/contract-from-crates-io

Conversation

@ymote

@ymote ymote commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

OctoSense ADR 0005, plan step 2 (follow-up to #46): consumers get the contract from crates.io, and only one copy of it.

Why

app-policy named the contract as { path = "../app-contract", version = "1" }. A consumer that takes App Hub from git (the OctoSense shell) then resolves the contract from that git checkout. Cargo treats that as a different crate from the crates.io octosense-app-contract that apps (Rinx 1.1.0) use, so a build with both would link two contracts.

What changes

  • crates/app-policy/Cargo.toml: octosense-app-contract = "1" (version only, no path). It is the only App Hub crate that depends on the contract directly. The others reach it through app-policy's re-export.
  • Root Cargo.toml: [patch.crates-io] octosense-app-contract = { path = "crates/app-contract" }, so App Hub develops against its local copy. A [patch] never applies to consumers, so they link crates.io 1.x.
  • Cargo.lock: unchanged. The patched path package is recorded the same way as the path dependency was.
  • Contract CI (app-contract.yml) and publish-app-contract.yml: unchanged and unaffected. Both copy the crate out of the workspace before building.

Verified locally

  • cargo test --workspace --locked: all green (207 tests, 30 test binaries).
  • cargo tree -i octosense-app-contract resolves to crates/app-contract through the patch.
  • cargo publish -p octosense-app-contract --dry-run (clean tree): OK.
  • Contract CI steps on a copy outside the workspace (cargo test --all-targets, cargo test --doc, cargo clippy --all-targets --no-deps -D warnings, cargo publish --dry-run): OK.

Merge order

This PR (A) → Rinx 1.1.0 (contract from crates.io, no App Hub git dependency) → OctoSense repins App Hub to this PR's merge commit.

🤖 Generated with Claude Code

app-policy named the contract as { path = "../app-contract", version = "1" }.
A consumer that takes App Hub from git (the OctoSense shell) then resolved
the contract from that git checkout, a different crate from the crates.io
copy every app (Rinx) uses, so a build with both linked two contracts.

Every App Hub crate now writes octosense-app-contract = "1" (OctoSense
ADR 0005 section 3), and the workspace adds
[patch.crates-io] octosense-app-contract = { path = "crates/app-contract" }
so App Hub develops against its local copy. A [patch] never applies to
consumers, so they link crates.io. The contract CI and the publish workflow
copy the crate out of the workspace and are unaffected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant