test(build): #231 hermetic regression gate for #147 cache-survives-tar-extract DoD#232
Conversation
…r-extract DoD Adds `crates/fbuild-build/tests/cache_survives_tar_extract.rs` with three cases that pin the invariants closed by #147: 1. `fingerprint_survives_tar_roundtrip` -- tars a project, extracts into a fresh location, stomps mtimes to a known-different value, asserts `hash_watch_set_stamps` returns the same hash. Catches any regression that reintroduces mtime into the watch hash. 2. `fingerprint_survives_workspace_relocation` -- extracts under a different parent path; asserts the hash is unchanged. Pins the `relative_path_for_hash` invariant against absolute-path leakage. 3. `compiler_signature_survives_toolchain_path_change` -- two compiler paths with the same filename produce identical `build_rebuild_signature`s; a third with a different filename produces a distinct one. Pins the `compiler_identity` substitution at compiler.rs:307. Adds `tar = { workspace = true }` to fbuild-build dev-dependencies. The tests pass on main today; their job is to turn RED instead of silently going slow in `bench-fastled-examples` if anyone re-introduces mtime or absolute paths into the fingerprint contract. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR adds a regression test suite and corresponding ChangesBuild Cache Fingerprint Invariance
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
#233) Adds `cache_survives_tar_extract_uno` to `crates/fbuild-build/tests/avr_build.rs` as the integration-level companion to the hermetic unit test landed in #232. The unit test exercises the watch-set hash and `build_rebuild_signature` directly; this test drives a real AVR Uno build through `AvrOrchestrator.build()`, tars the resulting project tree, extracts it under a different parent directory, stomps mtimes, and rebuilds. It then asserts the warm rebuild hits the fast-path (`reused cached artifacts` in `BuildResult::message`), produces a byte-identical firmware.hex, and runs faster than the cold build. Catches failure modes the unit test cannot: - orchestrator state persisted outside the watch set - fast-path predicate bugs that pass per-layer unit tests but reject a legitimately-cached `BuildResult` - absolute paths baked into `build_fingerprint.json` or other artifacts the predicate reads Test sets `FBUILD_NO_ZCCACHE=1` (via an RAII guard) on purpose: zccache has its own fingerprint-state machinery that is covered by `zccache_hit_across_workspace_rename.rs`, and decoupling lets this test focus on the fbuild-owned fast-path predicate that the #147 fix actually changed. Gated `#[ignore]` per the established AVR-test pattern (downloads avr-gcc + Arduino-AVR core on first run). Also re-adds `tar = { workspace = true }` to fbuild-build dev-deps (the dependency was introduced on the #232 branch and the test on this branch also uses it). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Closes #231. Adds the hermetic regression gate called out in the issue: a three-case integration test that pins the invariants whose union closed #147.
fingerprint_survives_tar_roundtrip— tar a project, extract into a fresh location, stomp mtimes, asserthash_watch_set_stampsreturns the same hash. Catches any future change that re-introduces mtime into the watch hash.fingerprint_survives_workspace_relocation— extract under a different parent directory; assert the hash is unchanged. Pins therelative_path_for_hashinvariant against absolute-path leakage.compiler_signature_survives_toolchain_path_change— two compiler paths with the same filename produce identicalbuild_rebuild_signatures; a third with a different filename produces a distinct one. Pins thecompiler_identitysubstitution atcompiler.rs:307.Together with commit 2e8bc4c (AC#5 ≤ 50 ms warm threshold in
bench-fastled-examples), this gives #147 both an empirical speed gate and a hermetic correctness gate.The tests pass on
maintoday — the fixes are already in tree. Their job is to turn RED instead of silently going slow on the next AC run if anyone re-introduces mtime or absolute paths into the fingerprint contract.Test plan
uv run --script ci/test.py -p fbuild-build --test cache_survives_tar_extract— all 3 pass locallyuv run --script ci/test.py -p fbuild-build— full crate suite passes (acceptance testsignoredas expected for CI-only)uv run soldr cargo clippy --workspace --all-targets -- -D warnings— clean🤖 Generated with Claude Code
Summary by CodeRabbit
Tests