fix: normalise indexer path keys on Windows (#18)#19
Conversation
Main has grown indexer_tests.rs with common helpers; integrate the regression test there instead of creating a standalone file.
Code ReviewOverviewThis PR fixes a real data-loss bug on Windows: the indexer was keying paths with backslashes while the downloader used forward slashes, so What's good
IssuesHigh: docs/superpowers files should not be in this PRThe two files added under
High:
|
Summary
plats\pates-carbo.cook) while the downloader keys them with forward slashes (plats/pates-carbo.cook).compare_recordstreated the two as different paths, so every downloaded file produced a spuriousDeleteForm(and subsequent re-create) per indexer cycle. End result: data loss on first Windows sync.path.strip_prefix(base)?.to_string_lossy()toto_slash_lossy()inclient/src/indexer.rs::build_file_record.path-slashwas already a runtime dependency and is used the same way at the upload boundary inclient/src/remote.rs:259.build_file_record, and an integration test simulating the post-download state inclient/tests/indexer_tests.rs..github/workflows/test.yml— multi-platform CI matrix (ubuntu-latest,macos-latest,windows-latest) runningcargo test --workspaceon push and PR. The repo had no test-running CI before; this gap is the structural reason the bug went unnoticed.--all-featureswas deliberately avoided because the server'sdatabase_postgresfeature requireslibpqwhich isn't available on the Windows runner and is unrelated to this fix.Out of scope
The issue also called out two defense-in-depth follow-ups for the destructive paths in
check_download_once(registry guard, first-run sync ordering). Those are deferred to a separate PR — they address the broader "remote tombstone replay on an unindexed local" foot-gun, not the Windows-specific manifestation this PR fixes.Test plan
cargo test --workspacepasses on macOS (host)cargo test --workspacepasses on Ubuntu (CI)cargo test --workspacepasses on macOS (CI)cargo test --workspacepasses on Windows (CI) — the proof that First sync on Windows uploads tombstones for every downloaded file (path-separator mismatch) #18 is fixedThe CI Test workflow will fill in the last three boxes automatically.