Skip to content

chore(deps): put thrust-preview-provisioner in Cargo.lock where cargo sorts it - #284

Merged
aRustyDev merged 1 commit into
mainfrom
chore/cargo-lock-order
Nov 17, 2026
Merged

aRustyDev merged 1 commit into
mainfrom
chore/cargo-lock-order

Conversation

@aRustyDev

Copy link
Copy Markdown
Owner

Cargo.lock on main has the thrust-preview-provisioner entry one place too late, after thrust-profiling where cargo sorts it before. This moves it where cargo puts it. No dependency or version changes.

Why it matters

cargo metadata --locked, which CI runs, accepts the file as committed, so nothing has failed. But any cargo command without --locked rewrites it, so a clean checkout is dirty after its first plain cargo run. I met it as a stray M Cargo.lock after switching a worktree to main; it is not part of anyone's change, and the next person's first cargo build makes it theirs to notice and discard, or to commit by accident.

Shown

  • On main at 15bcfb0: cargo metadata --locked exit 0, nothing changed; cargo metadata without it rewrites the file, 14 lines moved and nothing else.
  • A pure move: the old and new files have the same 5225 lines (a sorted comparison of the two is identical), so no dependency, version or checksum changed.
  • In the committed file exactly 2 of 491 packages are not where sorting puts them (thrust-profiling and thrust-preview-provisioner); in the new file none (a throwaway script that compares in cargo's order, versions as versions, so that 0.9.1 comes before 0.10.1; my first version compared them as text and reported ten false positives, which is why the check is stated that way).
  • A second plain cargo run leaves the new file byte-identical, and cargo metadata --locked still accepts it.
  • All 6 steps of the lint and build set (fmt, clippy for the workspace, for thrust-api-v1 with its feature and for the Worker's and the edge's wasm32 targets, cargo metadata --locked) and all 22 steps of the deps job pass on this tree, and none of them changed the file.

Not established

  • Why the entry was out of order. Add preview provisioning control plane #279 added it and is a single-parent squash commit, so it was not the resolution of a merge conflict; a hand-written entry is the likely cause. --locked does not catch one, so this can happen again. A guard would be cheap (a plain cargo metadata, then git diff --exit-code Cargo.lock), but it is not in this PR.
  • The whole CI run.

Refs: #279

🤖 Generated with Claude Code

… sorts it

#279 added the `thrust-preview-provisioner` entry after `thrust-profiling`; cargo sorts it before. `cargo metadata --locked`, which
is what CI runs, accepts the file as committed, so nothing failed. But any cargo command without `--locked` rewrites it, so a clean
checkout is dirty after its first plain cargo run (measured on main at 15bcfb0: 14 lines moved, nothing else). This commits what
cargo writes.

Shown: in the committed file exactly 2 of 491 packages are not where sorting puts them (the pair), and in this one none (a script
that compares in cargo's order, versions as versions, so that 0.9.1 comes before 0.10.1). The two files have the same 5225 lines
(a sorted comparison is identical): a move, with no dependency or version changed. A second plain cargo run leaves the new file
byte-identical, and `cargo metadata --locked` accepts it.

Not established: why the entry was put there. #279 is a single-parent squash commit, so it was not the resolution of a merge
conflict; a hand-written entry is the likely cause, and `--locked` does not catch one.

Refs: #279
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@aRustyDev
aRustyDev enabled auto-merge (squash) November 17, 2026 21:13
@aRustyDev
aRustyDev merged commit 9eaf8a1 into main Nov 17, 2026
46 checks passed
@aRustyDev
aRustyDev deleted the chore/cargo-lock-order branch November 17, 2026 21:17
aRustyDev added a commit that referenced this pull request Nov 17, 2026
…fails CI and not the next checkout (#288)

`cargo metadata --locked`, which every other step runs, accepts a lockfile whose packages are in the wrong order, and a cargo command
without `--locked` then rewrites the file. #279 added `thrust-preview-provisioner` one place late and #284 moved it; nothing had failed
in between, and a clean checkout of `main` was dirty after its first cargo run. Nothing in CI could have said so.

`scripts/check-cargo-lock.sh` runs `cargo metadata` without `--locked` and fails (exit 1, with the diff) when the lockfile is not what
cargo wrote back, which also catches a lockfile that has not heard of a change to a manifest. It exits 2 when it cannot vouch (no
Cargo.toml, no lockfile, cargo failing). It puts the lockfile back as it found it whatever the result, so it never leaves a checkout
dirty. `--self-test` builds small workspaces with no dependencies and checks the accept and refuse cases against cargo's own output (no
network).

- `.github/workflows/lint.yml`: two steps of the `deps` job, the self-test and the check.
- `.github/scripts/plan-ci.py`: the script is a guard of the `deps` job (`deps` and `ci-scripts`), and not "a script this planner does
  not know", which runs everything. `Cargo.lock` itself already runs everything.
- `docs/src/testing/running.md`: the two commands and the `deps` row.

Controls (AGENTS.md rule 8): the guard on the lockfile as it was before #284 (`git show 15bcfb0:Cargo.lock`) exits 1 and prints the
14-line move, and leaves that file as it found it; on the real lockfile it exits 0 (491 packages) and the tree stays clean. Four
broken copies of the script each fail the self-test on the cases that guard the broken line: cargo run with `--locked` (the disorder
is accepted, 2 cases fail), no restore after a rewrite (2), a cargo failure counted as success (1), a check that accepts any change
(4). The self-test is 10 of 10 on macOS and under dash on Linux.

Refs: #284

Co-authored-by: Claude Sonnet 5.5 <[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.

1 participant