Repository navigation
ci: fail when cargo remove drops the dev profile's package entries - #323
Merged
Merged
Conversation
bnb
approved these changes
Oct 30, 2026
botandbang
enabled auto-merge
October 30, 2026 16:42
SizeCompared with main. KiB are 1,024 bytes.
|
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.
What and why
cargo removecleans up the root Cargo.toml after every removal and deletes each[profile.*.package.<name>]whose crate isn't a direct dependency of some member (gc_workspace in remove.rs, since rust-lang/cargo#11194, Cargo 1.67). Six of our dev-profile entries are for transitive crates (inout, hybrid-array, clap_builder, referencing, symphonia-core, symphonia-codec-pcm), so anycargo removedeletes them with their comments. It happens on every cargo from 1.95 to nightly 1.101. Patches had the same bug and were fixed in rust-lang/cargo#12454; profiles weren't.Added:
tools/policy/cargo.regowith the crates the dev profile optimises (dev_optimised). It fails when one of them is still in Cargo.lock but its[profile.dev.package.*]entry is gone, and when Cargo.toml has an entry the list doesn't have. A crate that leaves Cargo.lock doesn't trip it..github/CONTRIBUTING.mdunder Checks on how to put the entries back.Changed:
tools/policy.shgives conftest Cargo.lock asCargo.lock.toml, since conftest picks its parser by extension..github/NEW_PROJECT.md's summary of the policies mentions the new one.Fixes LOC-135
How it was tested
tools/policy.shon main: OPA 63/63 with coverage complete, conftest 43/43.cargo remove -p locallibrary-cli --dev walkdirleft behind, conftest fails with exactly the 6put back [profile.dev.package.X]failures.& locked, invertnot dev_packages[name], invertnot name in dev_optimised): the matching new test fails, then passes restored.shellcheck tools/policy.sh, andoxfmt --checkon the two .github docs.Checklist
docs/and--helpstill say what the code does