eval-cache: track local sources copied into the store during evaluation#2899
Open
domenkozar wants to merge 1 commit into
Open
eval-cache: track local sources copied into the store during evaluation#2899domenkozar wants to merge 1 commit into
domenkozar wants to merge 1 commit into
Conversation
Local files and directories pulled into the Nix store by path coercion (e.g. `scripts.foo.exec = ./foo.sh;` or `languages.rust.import ./.`) were not recorded as eval-cache dependencies, so editing them returned stale `devenv build`/shell results until the cache was manually refreshed. The "copied source" event was only emitted as a free-text log line at lvlChatty, above devenv's lvlTalkative capture threshold, so it was never observed. The Nix backend (cachix/nix devenv-2.34) now emits it as a structured `eval-copy-source` activity carrying the source and destination paths; activities are delivered regardless of verbosity. - parse the `eval-copy-source` activity into an `EvalOp::CopiedSource` - copied directories are hashed recursively over their contents (new `recursive` flag + `file_input.recursive` column) so edits to nested files invalidate the cache; `readDir`-only directories keep the cheaper name-only hashing - bump the cachix/nix pin to the commit emitting the activity Fixes #2886, #2893. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
🔍 Suggested ReviewersBased on git blame analysis of the changed lines, the following contributors have significant experience with the modified code:
Please consider reviewing this PR as you have authored significant portions of the code being modified. Your expertise would be valuable! 🙏 This comment was automatically generated by git-blame-auto-reviewer Last updated: 2026-06-04T02:58:48.352Z |
Deploying devenv with
|
| Latest commit: |
1ddd71a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a59938af.devenv.pages.dev |
| Branch Preview URL: | https://fix-track-eval-source-copies.devenv.pages.dev |
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.
Fixes #2886 and #2893 — two reports of the same root cause: local files and directories pulled into the Nix store by path coercion (e.g.
scripts.foo.exec = ./foo.sh;orlanguages.rust.import ./.) were not recorded as eval-cache dependencies, so editing them returned staledevenv build/shell results until the cache was manually refreshed with--refresh-eval-cache.Root cause
devenv's eval-cache dependency tracker observes Nix's structured log stream, capturing messages up to
lvlTalkative. Thecopied source '…' -> '…'event — emitted whenever a path is copied into the store via coercion — was a free-text log line atlvlChatty(one level above the capture threshold), so it was never observed.builtins.path/filterSourceworked only because they separately emitdevenv path:at Talkative.Fix
Rather than chase verbosity levels (raising the global capture knob would ingest unbounded per-derivation
instantiated …chatter), source copies are now a structured activity, which the JSON/FFI logger delivers regardless of verbosity.Nix backend (
cachix/nixdevenv-2.34, commit4bc81008c, pin bumped here):copyPathToStoreemits anactEvalCopySourceactivity carrying the source and destination store paths as fields (the activity text preserves the previous human-readable line for-vv).This repo:
eval-copy-sourceactivity into anEvalOp::CopiedSource(eval_op.rs,internal_log.rs,nix_log_bridge.rs).recursiveflag +file_input.recursivecolumn) so edits to nested files invalidate the cache;readDir-only directories keep the cheaper name-only hashing to avoid spurious invalidation.cachix/nixpin (flake.lock+devenv.lock).Verification
End-to-end against the patched Nix, with no
--refresh-eval-cache:scripts.any.exec = ./any.sh— editany.sh→ new output (was stale).devenv buildreturns stale rust output #2886:${./mydir}directory — edit a nested file → store path changes (was stale).Unit tests: 169 devenv-core + 223 eval-cache/cache-core green.
🤖 Generated with Claude Code