Repository navigation
fix(ts): rebuild a target directory when its std sysroot changes - #256
Conversation
Quest-Claim: 2614a0f63268764e
…ingerprints Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 53 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit e7498a0ca68add117252cfba47941533089c1367.
No actionable bugs found in this static review. The sysroot identity is exposed through the wrapper's version query, with Cargo's executable-only version cache disabled and separate-nightly metadata enabled in the same invocation. The actual --sysroot argument remains restricted to wasm32 compilation, preserving host build-script and proc-macro std. This avoids replacing package-specific rustflags or introducing a second artifact cache.
Direction: a small fix at Cargo's compiler-identity boundary is preferable to cleaning the whole target directory or refusing package overrides. The A/B/A regression checks registry dependency invalidation and reuse. Its B uses an alternate path to identical std contents, so the reported genuinely different-std and package-override exercises remain valuable complementary evidence, not coverage established by that fixture alone. Path identity also intentionally relies on immutable Nix store paths; an in-place rebuild at the same path remains outside this guarantee.
Verification limits: GitHub-only inspection of CLI/driver integration, shared Cargo launching, Nix sysroot construction and test wiring, with an independent pass. I did not run Cargo, translation, builds, or the regression suite, and did not independently reproduce the reported timings or two-sysroot experiments.
(Written by OpenAI)
Completes and deletes quest/m2/ts-sysroot-fingerprint.md.
Problem
After #237, the wrapper adds
--sysrootitself, so nothing cargo fingerprints names the sysroot. If a second sysroot differs from the first only in std's flags, a target directory keeps crates checked against the old std. Reproduced: I translatedcrates, then translated it again against a sysroot built with onlyprofile.toml's std line changed. It failed with E0463 oncrates_dep, andstockfails with E0460. It kept failing until the target directory was cleaned.Approach
rustc -vVadds a linerust2-ts-sysroot: <path>. Cargo hashes that output into every unit's fingerprint, and with-Zseparate-nightlies, which the CLI sets, into-C metadatatoo. Switching sysroots therefore rechecks every crate. Each sysroot also keeps its own artifacts, so switching back rechecks nothing.CARGO_CACHE_RUSTC_INFO=0. Otherwise cargo would reuse the version cached in.rustc_info.json, which it keys only by the executables' paths and mtimes. That costs about 13 ms per query on this host.--sysrootonly for wasm32 crates, so build scripts and proc macros keep the host std.codec: registry crates, proc macros, and build scripts.stock: with itsprofile.dev.package.getrandom.rustflagsoverride.sysrootints/tests/fixtures.rsruns in the merge gate (about 1.7 s). It censusesrejectin one target directory against the flake's sysroot, then against the same std by another path (<sysroot>/../<name>), then the first again. It checks thatbytes(a registry crate) is rechecked and then stays Fresh. It fails without the fix. It does nothing in the nightly run that leavesRUST2_TS_SYSROOTempty.just cipasses.Impact
-Zseparate-nightlies, a target directory keeps artifacts for each nightly instead of replacing them.Alternatives
--sysrootin the profile's rustflags, which the quest suggested: implemented first and dropped. A package-levelprofile.dev.package.<pkg>.rustflagsreplaces the profile's flags. That crate then compiles against the toolchain's std:stock's getrandom override failed with E0460 on a single sysroot. Covering it would mean refusing such overrides, a breaking change.__CARGO_DEFAULT_LIB_METADATA: an internal variable meant for building std, and it also renames dylibs and executables.-Zseparate-nightlies: E0460 would still be fixed, but on a nightly, sysroots would evict each other's artifacts.Follow-ups
RUST2_TS_SYSROOT, and its store paths change with their inputs. No quest filed.Review
Codex gpt-6.1-sol, medium effort,
quest reviewround 1 against origin/maincff3177b, on head e7498a0: no findings.Checks:
just cipassed on e7498a0.Merge of main at
2a8cd4cbd3219513d5357df256d5d124cfe36937: git merged it without conflicts andjust cipassed on this exact tree; it is a recorded skip, too trivial to review, on top of round 1's clean review ofe7498a0c.(written by Claude Opus 5.5)
🤖 Generated with Claude Code