Repository navigation
fix(request-cache): scope worktree-bound entries to their originating root - #511
Merged
Merged
Conversation
… root PCH (`.pch` / `.gch`) and MSVC compiles bake absolute include paths into the artifact in a form `-ffile-prefix-map` and friends cannot scrub. The depgraph context-key layer already accounts for this via `requires_worktree_in_key` + a worktree-salt term, but the request-level fast-path cache did not. It computed `cross_root_shareable` purely from "are all captured paths root-relative?" — which is `true` for a PCH whose header lives inside the worktree. Net effect (Windows, issue #489): a build in `C:\...\fastled10` populated a `FastLED.h.pch` entry whose request fingerprint then matched a fresh `--clean` rebuild in sibling worktree `C:\...\fastled7`. The HIT replayed a PCH carrying baked `fastled10` paths into the `fastled7` build, which surfaced as compiler diagnostics referencing the wrong worktree and a deterministic set of nine DLLs failing to load with Windows error 126. Add a `worktree_bound: bool` parameter to `request_cache_entry`; when set, force `cross_root_shareable = false` regardless of path layout. Plumb it through `FastHitProbe` / `DepgraphHitProbe` from `pipeline.rs`, where it is derived from the same `requires_worktree_in_key(family, source_mode)` predicate already used for the context-key salt — so the two cache layers agree by construction. TDD coverage in `tests/cache_trim.rs::request_cache_entry_worktree_bound_rejects_cross_worktree_match`: - Builds a PCH-flavored entry with `worktree_bound=true` and asserts a cross-root lookup via `request_cache_entry_matches_root` returns false. - Builds an otherwise-identical non-PCH entry (`worktree_bound=false`) and asserts the cross-root lookup still succeeds, proving the flag is the single discriminator and we have not regressed the worktree-equivalent HIT path for normal `.o` artifacts. Pre-fix the new test would not compile (missing parameter); post-fix all 15 `cache_trim` tests + all 85 `daemon::server::tests` are green. Clippy + rustfmt clean. Fixes #489 Co-Authored-By: Claude Opus 4.7 <[email protected]>
6 tasks
zackees
added a commit
that referenced
this pull request
May 31, 2026
Patch release covering the fixes and CI hardening that landed since 1.11.8: - fix(persist): retry artifact rename through AV-scanner share lock on Windows (#509) - fix(request-cache): scope worktree-bound entries to their originating root (#511) - fix(cli): add `analyze` + `kv` to KNOWN_SUBCOMMANDS to stop wrap-mode misroute (#507) - perf(guard): gate rust-workspace-link Cold ratio (issue #517) (#519) - perf(bench): emit zccache_rust_miss_profile lines in benchmark-stats logs (#521) - ci(cache-cleanup): switch to count-based policy, broader per-commit families, on-demand trigger (#515, #516, #520) - ci: setup-soldr pin bumps v0.9.21 -> v0.9.38 (#485–#518) Co-authored-by: Claude Opus 4.7 <[email protected]>
This was referenced Jun 6, 2026
zackees
added a commit
that referenced
this pull request
Oct 30, 2026
Maps std::fs write/create_dir*/remove_*/rename/metadata/canonicalize call sites whose drop-in accessor already ships in the pinned kernal-api v0.1.35 (facade_burn MAP wave 1). Read-side, read_dir and File/OpenOptions sites stay for the #510/#511 release; every touched file therefore remains allowlisted, so the allowlist is unchanged at 63 entries.
zackees
added a commit
that referenced
this pull request
Nov 1, 2026
kernal-api v0.1.36 (released 2026-10-31T20:01Z) ships #511's read-side accessors, which is the release this burn was paused on: read_file, read_to_string, symlink_metadata, copy, set_permissions and read_dir_paths. Pin the workspace and the ban_raw_subprocess_in_daemon dev-dependency at =0.1.36 (they must move together or the dylint lane resolves two kernal-api copies) and route seven allowlisted files off std::fs, 15 call sites: rust_plan/manifest.rs read x2 handle_compile_multi_preflight.rs (test) read x1 handle_compile/pch_overlay_aliases.rs read x5, read_to_string x1 handle_compile/pch_overlay.rs read x1 handle_compile/pipeline/store_outcome_scan.rs read x1 handle_exec.rs read x2 handle_link.rs read x1 Every mapping is signature- and semantics-identical (io::Result, same NotFound behaviour), so no error mapping changes. Allowlist 63 -> 56; the dylint crate goes to 0.1.2 so the cached .so is rebuilt with the new list. staged_lock.rs stays allowlisted: its remaining std::fs use is File and OpenOptions (streaming handles), which is kernal-api #510, not the read side.
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.
Summary
worktree_bound: booltorequest_cache_entry. Whentrue, forcecross_root_shareable = falseregardless of path layout — so PCH / GCH / MSVC entries can never be served as cross-worktree HITs even when every captured path is technically root-relative.pipeline.rsfrom the samerequires_worktree_in_key(family, source_mode)predicate that already gates the depgraph context-key salt. Both cache layers now agree by construction.FastHitProbe/DepgraphHitProbe.Why
A build in worktree
fastled10populated aFastLED.h.pchrequest-cache entry whose fingerprint then matched a--cleanrebuild in sibling worktreefastled7. The HIT replayed a PCH carrying bakedfastled10paths into thefastled7build, surfacing as compiler diagnostics referencing the wrong worktree + a deterministic set of nine DLLs failing to load with WindowsERROR_MOD_NOT_FOUND(126). The depgraph context-key already handled this via the worktree salt, but the request-level fast path skipped the same gate.Test plan
request_cache_entry_worktree_bound_rejects_cross_worktree_matchintests/cache_trim.rs:worktree_bound=true) does NOT match a different root; otherwise-identical non-PCH entry (worktree_bound=false) still matches. The flag is the single discriminator.cache_trimtests green.daemon::server::testsgreen.soldr cargo clippy -p zccache --lib --tests -- -D warningsclean.soldr cargo fmt --all -- --checkclean.Fixes #489
🤖 Generated with Claude Code