Repository navigation
Fix cache invalidation on Windows, and the tests that fail on Windows and macOS - #134
Open
armada45-pixel wants to merge 2 commits into
Open
armada45-pixel wants to merge 2 commits into
armada45-pixel wants to merge 2 commits into
Conversation
The scan cache keyed its parent and leaf lookups by splitting on '/'. On Windows the keys are canonical `\?\C:\...` paths with no '/', so `invalidate` never found an indexed ancestor and the fresh-subtree catalog never matched: a deleted file stayed in `--json` output after `disktree-cli invalidate`, and a wider scan never reused a cached subtree. The helpers now go through `Path`, which is unchanged on Unix. Test-only adjustments, each where the test was wrong for the platform: - stdio: macOS keeps its cache in `$HOME/Library/Caches` and ignores XDG_CACHE_HOME, so the persistence test also points HOME at its temporary directory and looks for the DB at the macOS path. - db roundtrip: root the synthetic tree in a canonical temp directory, as real scan roots are, instead of a driveless `/fake` on Windows. - btrfs mount-table tests: gate to unix; the code only runs on Linux and `/@home` is not an absolute path on Windows. - streaming hardlink test: the streaming walker has no file identity off Unix, so a hardlink is counted twice there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
APFS refuses a name that is not UTF-8, so the lossy-name removal tests cannot set up their case there. And volume candidates come fullest first on the machine running the test, so the pseudo-filesystem test compares which disks remain, not their order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
CI is red on
mainon Windows and macOS, so every open PR shows failing checks. One of the failures is a real cache bug on Windows; the rest are tests that assumed another platform.The bug. The scan cache found a path's parent and leaf by splitting on
/. On Windows its keys are canonical\?\C:\...paths, soinvalidatenever found an indexed ancestor, and the lookup for cached subtrees never matched. A deleted file stayed in--jsonoutput afterdisktree-cli invalidate, and a wider scan never reused a cached subtree. The helpers indb.rsnow go throughPath.Test-only changes.
stdio.rs: macOS keeps its cache in$HOME/Library/Cachesand ignoresXDG_CACHE_HOME, so the persistence test setsHOMEtoo and looks there.db.rs: the roundtrip test is rooted in a canonical temporary directory, as a real scan is, instead of a driveless/fake.space.rs,mounts.rs: the two btrfs mount-table tests arecfg(unix). They use POSIX paths, which are not absolute on Windows.removal.rs: the two lossy-name tests are skipped on macOS. APFS refuses a name that is not UTF-8, so they cannot set up their case. They still run on Linux.space.rs: the pseudo-filesystem test compares which volumes remain, not their order, which depends on how full the runner's disks are.stream.rs: the hardlink test expects a double count off Unix, because the streaming walker has no file identity there. This records the current behaviour rather than fixing it.Verified.
cargo xtask lintand the workspace tests are green on Windows. A trial run of this workflow on my fork ended with all 6 jobs green: armada45-pixel#1.Two flaky tests, fixed in #135. In that trial run the Linux "Lint and test" job passed only on a rerun of the same commit:
escape_cancels_the_first_scan_and_r_starts_it_againfailed on the first attempt of that run.enter_in_the_focused_volume_picker_scans_the_selected_rootfailed on the run before it, one commit earlier.The fixture's scan can finish before the test acts on it; #135 reproduces both failures with a delay and fixes the cause. This PR does not touch disktree-app, and its tests use in-memory storage, so they do not reach the changed code.
Overlap. #132 also gates one of the btrfs tests (
local_btrfs_scan_keeps_distinct_subvolumes_but_not_aliases_or_network).🤖 Generated with Claude Code