fix(cache): prevent diff from corrupting disk cache#158
Closed
rocketman-code wants to merge 1 commit intomainfrom
Closed
fix(cache): prevent diff from corrupting disk cache#158rocketman-code wants to merge 1 commit intomainfrom
rocketman-code wants to merge 1 commit intomainfrom
Conversation
3 tasks
Owner
Author
|
Closing: patch contents already on main. Branch has zero diff after rebase. |
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
no_cache=trueinbuild_snapshot_from_working_treeso the working-tree side of a diff neither reads nor writes the disk cache, preventing cross-contamination from the git-ref side's reduced graph.Closes #142
What was happening
When running
chainsaw diff <ref> --entry <file>, the git-ref side builds a reduced graph (nonode_modules, read from git tree) and writes it to the disk cache. The working-tree side then callsloader::load_graph(entry, false)(no_cache=false), which reads the contaminated cache entry and produces incorrect results. Subsequentchainsaw tracecommands also read the corrupted cache until it is manually cleared.The fix
Change the
no_cacheargument fromfalsetotrueinbuild_snapshot_from_working_tree, matching the behavior already used bybuild_snapshot_from_ref. This ensures neither side of a diff pollutes the shared cache.Test plan
cargo test --workspacepasses (all 274 tests)cargo clippy --workspace --all-targets -- -D warningspasses (via pre-commit hook)chainsaw diff HEAD~1 --entry <file>followed bychainsaw trace <file>produces correct, consistent results