Skip to content

Eval: canonical forward-slash path values - #94

Merged
aoinoikaz merged 1 commit into
mainfrom
audit-wave3
Jul 22, 2026
Merged

Eval: canonical forward-slash path values#94
aoinoikaz merged 1 commit into
mainfrom
audit-wave3

Conversation

@aoinoikaz

Copy link
Copy Markdown
Contributor

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.

canonPathValue is the producer gate, applied where platform-tainted text becomes a path value: literal resolution (both eval modes), path concatenation, toPath, findFile candidates, and the fetchGit scratch dir. Folding is by isPathSeparator, 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. extractBaseName collapses into canonBaseName now that one spelling regime holds.

Eval-visible change on Windows: toString ./x spells C:/... instead of C:\... - 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.

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.
@aoinoikaz
aoinoikaz merged commit 6686503 into main Jul 22, 2026
11 checks passed
@aoinoikaz
aoinoikaz deleted the audit-wave3 branch July 22, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Audit: boundary string types carry their proven invariants

1 participant