Skip to content

fix(rust): name a member NAME@VERSION when a dependency shares its name - #232

Merged
adityankale190895 merged 2 commits into
DiffCI:mainfrom
FredApps:rust/ambiguous-package-specs
Nov 18, 2026
Merged

adityankale190895 merged 2 commits into
DiffCI:mainfrom
FredApps:rust/ambiguous-package-specs

Conversation

@FredApps

@FredApps FredApps commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #224

A workspace member whose name another package in the metadata also uses (an older release of itself, say) is now named NAME@VERSION everywhere the adapter hands it to Cargo: testPackages, the cargo tree -p units and the feature coverage keys. The planner accepts [email protected][-pre] as a literal argument. It still refuses ranges, partial versions, +build and anything with spaces. A member with a unique name keeps the bare name, so existing plans don't change.

If the version can't tell them apart (missing, or the same as the dependency's), the repository falls back with a new reason, documented in docs/using-diffci.md: Cargo package … has no unambiguous package specification; full validation required.

Tests:

  • a synthetic-metadata case for the spec and the fallback;
  • a planner case for the spec, including what it refuses;
  • a real-Cargo case: a member dup 0.2.0 depends on a local Git dup 0.1.0 with default-features = false, so cargo tree runs, and the synthesized cargo test -p [email protected] passes. It's skipped without Cargo or Git.

Validation (Linux, Node 22, Cargo 1.100): npm run typecheck and the Rust test files (tests/repo/rust-*.test.ts, tests/planner/rust-command.test.ts) pass. The new test fails on main and passes here. tests/fallback-reasons-docs.test.ts passes too.

Not changed: parseCargoFeatureTree still keys packages by name vX.Y.Z. Two packages with the same name and version from different sources would share a key. I left that alone because it's much rarer, and the new fallback already covers it for workspace members.

Merge order (#131 series: #232, #234, #248, #250, #252, #254, #256, #277, #258). These all edit the one-line Rust paragraph in docs/using-diffci.md, and some also touch rust.ts/types.ts, so they conflict textually with each other. #258 already includes #232, #248, #250 and #254 with those conflicts resolved. The simplest path: merge #258 (GitHub marks those four as merged), then #234, #252, #256 and #277. After each one lands I merge main into the next and resolve the docs line. Merging them one at a time in number order works too, with the same main merge after each.

I, FredApps <[email protected]>, hereby add my Signed-off-by to this commit: 9e06c4b

Signed-off-by: FredApps <[email protected]>
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.

Rust adapter: cargo -p NAME is ambiguous when a dependency shares a member's name

2 participants