Skip to content

Store: NAR names as raw bytes - nova-cache 0.7 and the write-boundary decode - #83

Merged
aoinoikaz merged 1 commit into
mainfrom
nar-byte-adoption
Jul 22, 2026
Merged

Store: NAR names as raw bytes - nova-cache 0.7 and the write-boundary decode#83
aoinoikaz merged 1 commit into
mainfrom
nar-byte-adoption

Conversation

@aoinoikaz

Copy link
Copy Markdown
Contributor

What and why

nova-cache 0.7.0.0 carries NAR entry names and symlink targets as raw byte strings, as upstream does; the parser no longer rejects a non-UTF-8 name, so those bytes now reach the store. The store's invariant is unchanged: every materialized name is valid Unicode - a name every platform the store targets can hold - so the decode moves to the write boundary. decodeNarText decodes each directory entry name and symlink target at unpack, and bytes with no Unicode reading refuse the unpack with a typed error before anything is written.

The name machinery (isSafeNarName, case-hack renaming, collision detection, link ordering) is unchanged and stays Text-based: under the invariant, every policy-passed name is decoded text. caseHackSuffix's Text form is derived once from the library constant (a total latin1 read of the ASCII suffix). NAR building from the filesystem (builtins.path / filterSource) encodes its Unicode names to UTF-8 at the two construction sites.

Bounds move to nova-cache >= 0.7 && < 0.8, built against the published Hackage release.

Tests and measurement

Two new refusal tests (non-UTF-8 entry name, non-UTF-8 symlink target); the rest of the suite is unchanged and green. Benchmarked before and after on the profiling harness: allocation and residency identical to the byte, timing differences within run-to-run noise.

… decode

nova-cache 0.7 carries NAR entry names and symlink targets as raw
bytes, as upstream does, so non-UTF-8 names now reach the store. The
store invariant is unchanged - every materialized name is valid
Unicode - so the decode moves to the write boundary: decodeNarText
refuses bytes with no Unicode reading before anything is written. The
Text name machinery is untouched; NAR building from the filesystem
encodes its Unicode names at the two construction sites.
@aoinoikaz
aoinoikaz merged commit 8f1757a into main Jul 22, 2026
11 checks passed
@aoinoikaz
aoinoikaz deleted the nar-byte-adoption branch July 22, 2026 15:36
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.

1 participant