Compare a pin file's tree by name, not by the platform's path separator - #54
Merged
Conversation
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.
Main went red on
fmt, clippy, test (windows-latest)immediately after #53. Linux, macOS, MSRV, the corpus gates and CodeQL were all green; only Windows failed, ona_pin_file_compared_against_another_tree_is_refused.What was actually wrong
run_pindecided whether a pin file was taken over the tree being scanned withbut a pin header can only ever hold a
/-separated path — the writer normalises, deliberately, because the pin format has no escapes and a Windows\would write a header no later run could read back. So on Windows the stored side readsC:/xwhile the scanned side isC:\x, and whether a pin file matched its own tree was left to the platform's path semantics rather than decided by the tree.The refusal message had the same split: it printed
pinned.corpusas stored andpath.display()as scanned, so the two paths appeared with different separators and the message read as though the separator were the difference.Both sides are now normalised once, before the comparison and in the message.
Why CI had not caught it
The failing assertion sits before the test's positive half — "and the tree it does name still passes, so the check is not simply refusing everything". Windows panicked on the message assertion and never reached it, so the case that matters most on Windows — a pin file matching the tree it names — has never been exercised there. With this fix the Windows job reaches it for the first time.
This is the same class as #43, where
write_baselinerecorded a Windows path with\andparse_baselinerefused escapes by design: the writer normalises and something downstream did not.Verified
cargo fmt --all --checkrc 0cargo clippy --all-targets -- -D warningsrc 0cargo test --test edge_pinsrc 0 — 35 passed, 0 failedThe Windows job is the real proof and runs on this PR.
🤖 Generated with Claude Code
https://claude.ai/code/session_01SF9KvRKVzA2vEYqtFq23zm