Measure the size budget on a copy, not on the canary itself - #509
Merged
Conversation
`just size-budget` passed cargo a `patch.crates-io.<pkg>.path` for every Cranpose crate while pointing it at apps/isolated-demo/Cargo.toml. Cargo re-resolved under those patches and rewrote the tracked apps/isolated-demo/Cargo.lock, stripping `source` and `checksum` from all 18 Cranpose entries. That lockfile is the canary proving a release is consumable from crates.io, so running the gate and committing the result would have quietly converted it to a path build that verifies nothing. A patched build now compiles a staged mirror of the package under target/patched-packages/, where the rewritten lockfile is a build artifact. What gets mirrored comes from `cargo metadata --no-deps` -- the manifest, the lockfile and the directories holding the package's declared targets -- so another build system's output next to the sources (android/app/build, ios/build, pkg) never gets dragged in. The mirror copies only the files whose bytes differ, which keeps the fat-LTO measurement incremental: a no-op re-run finishes in 0.17s. `just versions` now enforces the invariant that was being destroyed: every Cranpose crate in the canary lockfile must resolve from crates.io with a checksum, so a patched lockfile can never be committed unnoticed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
samoylenkodmitry
force-pushed
the
claude/xenodochial-davinci-4258f5
branch
from
August 27, 2026 16:11
a8ed283 to
def75a4
Compare
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.
The bug
just size-budget(and sojust budgets) rewrote the trackedapps/isolated-demo/Cargo.lockon every run, leaving the working tree dirty.The gate passes cargo a
patch.crates-io.<pkg>.pathfor all 18 Cranpose crateswhile pointing it at
apps/isolated-demo/Cargo.toml. Cargo re-resolves underthose patches and strips
sourceandchecksumfrom every Cranpose entry.Confirmed by removal — no build needed, the resolve alone does it:
cargo metadata --format-version 1 --manifest-path apps/isolated-demo/Cargo.toml --config "patch.crates-io.cranpose.path=\"$PWD/crates/cranpose\""apps/isolated-demois the canary proving a release is consumable fromcrates.io. A developer running the gate and committing the result would have
quietly converted it to a path build that verifies nothing.
The fix
A patched build now compiles a staged mirror under
target/patched-packages/,where the rewritten lockfile is a build artifact like any other.
cargo metadata --no-deps(which does not touch the lockfile) reports the package's target
src_paths;staging copies the manifest, the lockfile and those directories. Copying the
package wholesale would drag in
android/app/build,ios/build,pkg.a full fat-LTO rebuild every run. A no-op re-run now takes 0.17s.
dist-mintakes the same--manifest-path+--patch-workspace-cranposepair and routes through the same staging.
Regression test first
The invariant being destroyed is "the canary lockfile references published
crates", so it is now the
just versionsgate: every Cranpose crate inapps/isolated-demo/Cargo.lockmust resolve from crates.io with a checksum. Iverified it goes red on the mutated lockfile and green on the clean one before
touching xtask. Five xtask unit tests cover staging end-to-end, incrementality,
pruning, the two no-staging paths, and the outside-the-package rejection.
Verification
git status --porcelainstays empty through both:just size-budgetjust test/clippy/fmt-check/versions/typos/docNote for the reviewer
The second commit (
Give the non-UTF8 toggle fixture a path the tmpfs gate allows) fixes a test that is red at main's tip from a1f64e5. PRs #503,#506 and #507 each fix that same one line differently. It is a separate commit
here so it drops cleanly once any of them lands — say the word and I will
remove it.
just dep-budgetfails on macOS hosts on duplicateobjc2*families,reproducible on a pristine main; that is #507's subject, not this PR's.
🤖 Generated with Claude Code