Repository navigation
fix(external-only): prune feature entries that name a stripped path dependency - #1
Merged
josecelano merged 3 commits intoNov 4, 2026
Conversation
…ependency --external-only removed path dependencies from every manifest but left the [features] entries that name them, so an optional workspace dependency behind a feature (testing = ["dep:internal"]) made cargo reject the skeleton manifest and cargo chef cook fail with status 101. Prune dep:name, name, name/feature and name?/feature for the removed dependencies, keep the feature (possibly empty), and keep a plain entry that names an existing feature. Co-authored-by: Copilot <[email protected]>
…dencies Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Member
Author
|
ACK ac66921 |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the external-only feature-pruning change.
No open issues 🎉
What changed in this PR
Fixes cargo chef prepare --external-only leaving invalid feature references after removing path dependencies, allowing the resulting skeleton manifests to be used by cargo chef cook.
Changes:
- Prunes feature entries that reference stripped dependencies while preserving feature definitions and references to explicit features.
- Adds unit and skeleton integration coverage and documents the behavior.
- Bumps
torrust-cargo-chefto version0.1.79.
| File | Description |
|---|---|
tests/skeletons/tests/external_only.rs |
Adds integration coverage for pruning feature references to stripped dependencies. |
src/skeleton/external_only.rs |
Tracks removed dependency names, prunes feature references, and adds unit tests. |
README.md |
Documents feature pruning in external-only mode. |
CHANGELOG.md |
Records the invalid-manifest fix. |
Cargo.toml |
Bumps the package version to 0.1.79. |
Cargo.lock |
Updates the locked package version to 0.1.79. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cargo chef prepare --external-onlyremovespath = "..."dependencies from every manifest, but it left the[features]entries that name them. An optional workspace dependency behind a feature is a valid and now planned pattern intorrust/torrust-tracker(testing = ["dep:torrust-tracker-swarm-coordination-registry"], see torrust/torrust-tracker#2711). With the currenttorrust-cargo-chef0.1.78 the skeleton manifest is then invalid andcargo chef cookexits with status 101:What changes
src/skeleton/external_only.rs: after stripping a manifest, prune the[features]entries that name a removed dependency:dep:name,name(the implicit feature of an optional dependency),name/featureandname?/feature. The feature itself is kept, possibly empty, so entries of other features that refer to it stay valid. A plainnamethat is also the name of a feature is kept (it then refers to the feature). Names removed from top-level, target-specific andworkspace = truedependency tables count;[workspace.dependencies]names do not, because no feature can refer to them.dep:entry, implicit entry,name/featureandname?/feature,workspace = truereference, target-specific dependency, plain entry that names a feature) next to control tests that passed; one skeleton integration test covers the failing shape end to end.CHANGELOG.mdandREADME.mddescribe the behaviour; the last commit bumps the version to 0.1.79 so theContainerfileof the tracker can pin it.Verification
cargo testpasses in the whole crate (18 unit tests in the module, the skeleton and caching integration tests);cargo fmt --checkpasses.cargo clippy --all-targets -- -D warningsreports one error insrc/skeleton/read.rs(useless_borrows_in_formatting), which is also present without this change and is not touched here.torrust-cargo-chef0.1.78cargo chef prepare --external-onlythencargo chef cook --tests --workspace --all-featuresexits 101 with the message above; the build of this branch (0.1.79) writestesting = []in the skeleton ofudp-serverand the samecookexits 0.After merging
Tag
v0.1.79-torrustand publishtorrust-cargo-chef0.1.79; the tracker then bumps[email protected]in itsContainerfile. Rows 4 to 7 of torrust/torrust-tracker#2482 need it.