Eval: canonical forward-slash path values - #94
Merged
Merged
Conversation
The path-value spec, git's model: a path value's text is its absolute path spelled with forward slashes; on Windows a drive designator precedes the root; platform spelling exists only at the filesystem boundary. canonPathValue is the producer gate - separator folding by isPathSeparator, so POSIX backslash file names keep upstream semantics untouched and the fold is a no-op copy-free path there - applied at literal resolution, path concatenation, toPath, findFile candidates, and the fetchGit scratch dir. extractBaseName collapses into canonBaseName now that one spelling regime holds. DB comments record the platform-keyed rows and trust-on-read stances as decisions.
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.
Audit wave 3: the path-value spelling spec, plus the documentation decisions. With this, every #85 finding is either fixed (#86, #87, here) or tracked with reasoning (#88-#93).
The spec
A path value's text is its absolute path spelled with forward slashes; on Windows a drive designator precedes the root. Platform spelling exists only at the filesystem boundary. This is git's split - tree identity is slash-canonical, the working-tree boundary converts - and it is what the nixpkgs corpus already assumes: the world's path-string manipulation (
hasPrefix "/",splitString "/", regexes) now behaves identically on every platform this evaluator targets.canonPathValueis the producer gate, applied where platform-tainted text becomes a path value: literal resolution (both eval modes), path concatenation,toPath,findFilecandidates, and thefetchGitscratch dir. Folding is byisPathSeparator, so it is platform-correct with no conditional - on POSIX a backslash is an ordinary file-name character and passes through untouched, preserving upstream semantics exactly - and it copies only when a fold is needed, which on POSIX is never. Store-path text was already canonical; the mixed-spelling regime (store paths/, other paths native) is gone, and with it the separator-bug class wave 1 fixed two instances of.extractBaseNamecollapses intocanonBaseNamenow that one spelling regime holds.Eval-visible change on Windows:
toString ./xspellsC:/...instead ofC:\...- host-dependent strings only, never store identities (the Parity job pins those). Two tests that asserted the native spelling now assert the spec; new tests pin the canonical spelling from a native base dir and the platform-fold semantics on both platforms.Documented decisions
The store DB's platform-keyed rows and its trust-on-read query surface each gain a comment recording the stance as a decision: the DB is host-local state describing this host's tree, written and read in one spelling by one module; identity artifacts spell canonically and the DB is deliberately not one.
Measurement
Allocation delta versus main: +5,216 bytes on a 2.5 GB eval (the backslash-bearing paths that genuinely fold), timing inside the noise band.
Closes #85.