Skip to content

fix(plan,cargo-failure): build publish graph from manifest deps; classify dep-resolution failures as permanent (#173)#175

Merged
EffortlessSteven merged 1 commit into
mainfrom
fix/plan-graph-from-manifest-deps-20260511
May 11, 2026
Merged

fix(plan,cargo-failure): build publish graph from manifest deps; classify dep-resolution failures as permanent (#173)#175
EffortlessSteven merged 1 commit into
mainfrom
fix/plan-graph-from-manifest-deps-20260511

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Fixes #173. Two related bugs, one root cause:

Primary: planning graph misses optional workspace deps

build_plan in crates/shipper-core/src/plan/mod.rs constructed the workspace dependency DAG from cargo_metadata's feature-resolved resolve.nodes. That graph omits optional path+version dependencies that are not active under the default feature set. cargo publish, however, still needs every optional workspace path+version dep to be resolvable from the registry at publish time, so those edges must participate in publish ordering.

Concretely, uselesskey-aws-lc-rs declares optional normal path+version deps on uselesskey-rsa/uselesskey-ecdsa/uselesskey-ed25519. Because those edges were absent from resolve.nodes, Shipper saw uselesskey-aws-lc-rs as indegree zero, the deterministic BTreeSet<(name, id)> ready queue emitted it early by name, and the plan looked alphabetical. It was a correct topological sort of an incomplete graph.

The "publishable depends on non-publishable workspace member" guard at the same site (mod.rs:160-189) had the same defect — same iteration source.

Fix: switch both edge construction and the validation guard to manifest-level Package.dependencies. Include DependencyKind::Normal | DependencyKind::Build, including optional and target-specific deps; exclude Dev. Path deps are resolved to workspace members via a directory→PackageId map.

Not switching to cargo metadata --all-features: that would surface optional deps but couples planning to "all features build", an unrelated and expensive constraint.

Secondary: ambiguous classification on dep-resolution failures

crates/shipper-cargo-failure/src/lib.rs did not match Cargo's dep-resolution error messages, so a publish failure caused by a missing registry dep (exactly the failure mode produced by the planning bug above) fell through to Ambiguous. The retry loop then hid the actionable Cargo stderr behind a sequence of "publish outcome ambiguous; registry did not show version" retries.

Adds four permanent patterns:

  • failed to select a version for the requirement
  • no matching package named
  • candidate versions found which didn't match
  • required dependency is missing from the registry

Tests

New regression tests:

  • build_plan_orders_optional_workspace_dependenciesaaa-adapter optional-depends on zzz-core. Alphabetical order is aaa-adapter, zzz-core; correct publish order is zzz-core, aaa-adapter. Fails on the prior implementation.
  • build_plan_rejects_optional_normal_dep_on_non_publishable_workspace_member — same defect in the validation path.
  • realworld_dep_resolution_without_verify_framing — Cargo dep-resolution stderr without the surrounding "failed to verify package tarball" framing. Misclassified as Ambiguous before this PR.
  • realworld_no_matching_package_named — the package-not-found shape.

Existing 234 plan tests and 190 classifier tests continue to pass.

Validation performed locally

  • cargo check --workspace --all-targets --locked — clean
  • cargo clippy -p shipper-core -p shipper-cargo-failure --all-targets --locked -- -D warnings — no issues
  • cargo fmt --all -- --check — clean
  • cargo test -p shipper-core --lib plan:: — 236 passed (234 existing + 2 new)
  • cargo test -p shipper-cargo-failure — 192 passed (190 existing + 2 new)

Snapshot permanent_pattern_exhaustive.snap updated with the four new patterns.

Test plan

…sify dep-resolution failures as permanent (#173)

Two related bugs surfaced by the uselesskey workspace publish failure
(#173):

## Primary: planning graph misses optional workspace deps

build_plan constructed the workspace dependency DAG from
cargo_metadata's feature-resolved `resolve.nodes`. That graph omits
optional path+version deps that are not active under the default
feature set. cargo publish, however, still needs every optional
workspace path+version dep to be resolvable from the registry at
publish time, so those edges must participate in publish ordering.

Concretely, `uselesskey-aws-lc-rs` declares optional normal path+version
deps on `uselesskey-rsa`/`uselesskey-ecdsa`/`uselesskey-ed25519`.
Because those edges were absent from `resolve.nodes`, Shipper saw
`uselesskey-aws-lc-rs` as indegree zero, the deterministic
`BTreeSet<(name, id)>` ready queue emitted it early by name, and the
plan looked alphabetical. It was actually a correct topological sort of
an incomplete graph.

The "publishable depends on non-publishable workspace member" guard at
the same site had the same defect — same iteration source.

Fix: switch both edge construction and the validation guard to use
manifest-level `Package.dependencies`. Include `Normal | Build`,
including optional and target-specific deps; exclude `Dev`. Path deps
are resolved to workspace members via a directory→PackageId map.

Not switching to `cargo metadata --all-features`: that would surface
optional deps but couples planning to "all features build", an
unrelated and expensive constraint.

## Secondary: ambiguous classification on dep-resolution failures

`crates/shipper-cargo-failure` did not match Cargo's dep-resolution
error messages, so a publish failure caused by a missing registry dep
(exactly the failure mode produced by the planning bug above) fell
through to `Ambiguous`. The retry loop then hid the actionable Cargo
stderr behind a sequence of "publish outcome ambiguous; registry did
not show version" retries.

Add four permanent patterns:
- `failed to select a version for the requirement`
- `no matching package named`
- `candidate versions found which didn't match`
- `required dependency is missing from the registry`

## Tests

- `build_plan_orders_optional_workspace_dependencies` — `aaa-adapter`
  optional-depends on `zzz-core`; alphabetical order is
  `aaa-adapter, zzz-core` but the correct publish order is
  `zzz-core, aaa-adapter`. Fails on the prior implementation.
- `build_plan_rejects_optional_normal_dep_on_non_publishable_workspace_member` —
  same defect in the validation path.
- `realworld_dep_resolution_without_verify_framing` — Cargo's
  dep-resolution stderr without the surrounding "failed to verify
  package tarball" framing. Misclassified as Ambiguous before.
- `realworld_no_matching_package_named` — the package-not-found shape.

Existing 234 plan tests and 190 classifier tests continue to pass.
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@EffortlessSteven has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 15 minutes and 14 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 473f2dee-006a-49d8-b604-3b0db766c29a

📥 Commits

Reviewing files that changed from the base of the PR and between f4d7c1e and 049ba91.

⛔ Files ignored due to path filters (1)
  • crates/shipper-cargo-failure/src/snapshots/shipper_cargo_failure__tests__permanent_pattern_exhaustive.snap is excluded by !**/*.snap
📒 Files selected for processing (2)
  • crates/shipper-cargo-failure/src/lib.rs
  • crates/shipper-core/src/plan/mod.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/plan-graph-from-manifest-deps-20260511

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@factory-droid

factory-droid Bot commented May 11, 2026

Copy link
Copy Markdown

Droid finished @EffortlessSteven's task —— View job


Droid Review — PR #175

Status: approved — no actionable findings.

Inspected surfaces

  • crates/shipper-core/src/plan/mod.rs::build_plan — dependency edge construction, topological sort, validation guard
  • crates/shipper-cargo-failure/src/lib.rs::PERMANENT_PATTERNS — dep-resolution pattern additions
  • Both test modules (plan + classifier), snapshot update

Checks performed

  • Diff read in full (364 lines across 3 files + 1 snapshot)
  • Evidence of correctness: regression tests build_plan_orders_optional_workspace_dependencies and build_plan_rejects_optional_normal_dep_on_non_publishable_workspace_member directly exercise shipper publish: plan order appears alphabetical rather than topological; first-listed crate has unmet workspace deps #173
  • Evidence of correctness: classifier tests realworld_dep_resolution_without_verify_framing and realworld_no_matching_package_named directly exercise the new permanent patterns
  • Snapshot permanent_pattern_exhaustive.snap updated with 4 new entries
  • PR description states 234 plan tests + 190 classifier tests pass; snapshot updated

Why no comments

No publish-state or registry-truth changes outside the intended fix surface. The change is a targeted bug fix in two isolated subsystems (plan graph construction + error classification). No unsafe code introduced. No token handling, event ordering, or state projection changes. The regression tests provide direct coverage of the reported failure modes.

Residual risk

Registry-side ambiguity remains; this PR does not address the broader Reconcile gap tracked in #102/#99. This is known and out of scope for #173.

Validation signal

  • Observed: PR description reports cargo test -p shipper-core --lib plan:: (236 passed) and cargo test -p shipper-cargo-failure (192 passed)
  • Not verified: local execution not performed in this review pass; rely on CI signal

@EffortlessSteven EffortlessSteven merged commit c063376 into main May 11, 2026
22 checks passed
@EffortlessSteven EffortlessSteven deleted the fix/plan-graph-from-manifest-deps-20260511 branch May 11, 2026 15:23
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.

shipper publish: plan order appears alphabetical rather than topological; first-listed crate has unmet workspace deps

1 participant