Skip to content

fix(cargo-revendor): sort [patch.crates-io] entries deterministically (#205)#206

Open
CGMossa wants to merge 1 commit intomainfrom
fix/issue-205-revendor-deterministic-patch-sort
Open

fix(cargo-revendor): sort [patch.crates-io] entries deterministically (#205)#206
CGMossa wants to merge 1 commit intomainfrom
fix/issue-205-revendor-deterministic-patch-sort

Conversation

@CGMossa
Copy link
Copy Markdown
Collaborator

@CGMossa CGMossa commented Apr 17, 2026

Closes #205.

Summary

  • Freeze step collected patched crate names into a HashSet, which randomized iteration order per process, producing different [patch.crates-io] orderings on every just vendor.
  • Switched to BTreeSet so output is alphabetical and stable.
  • Added regression test.

Test plan

  • cargo test --manifest-path cargo-revendor/Cargo.toml freeze_manifest passes
  • just revendor-test (full cargo-revendor suite) passes
  • just vendor run twice in a row produces identical rpkg/src/rust/Cargo.toml
  • just clippy clean
  • cargo clippy --workspace --all-targets --locked -- -D warnings clean (CI clippy_default)
  • cargo clippy --workspace --all-targets --locked --features rayon,rand,... clean (CI clippy_all)
  • just fmt
  • just vendor (regenerates inst/vendor.tar.xz)

Generated with Claude Code

…#205)

Closes #205.

The freeze step collected patched crate names into a `HashSet`, whose
iteration order is randomized per-process. Every `just vendor` therefore
produced a different ordering of the `[patch.crates-io]` entries in the
frozen `rpkg/src/rust/Cargo.toml`, causing spurious diffs on every
vendor run and frequent "Your local changes would be overwritten"
failures when switching branches.

Switch to `BTreeSet` so iteration is alphabetical and stable. Adds a
regression test asserting alphabetical output.

Co-Authored-By: Claude Opus 4.6 <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.

cargo-revendor: sort [patch.crates-io] entries deterministically when rewriting Cargo.toml

1 participant