Repository navigation
Conversation
zig 0.17 splits `zig build` into a configurer and a maker, renames OptimizeMode to Optimize (with lower-case tags), and reworks its cache: - build.zig: `b.root` for `b.build_root`; the checked boot's install directory as an install-prefix LazyPath, since `getInstallPath` is gone (the prefix is the maker's, unknown when build.zig runs). - build/zig.tl: `zig build` takes no `--global-cache-dir`; the shared global cache goes in ZIG_GLOBAL_CACHE_DIR instead. - ci/cosmic_ci/zig_prune.tl: read 0.17's binary manifests (named by bare hex, keyed anew) and its configuration cache (`c/<digest>`); pass by the `.txt` manifests an older zig left in a restored cache. Known answers taken from a cache 0.17 wrote. - core/compress.c: the flush passes "" rather than NULL to deflate_chunk, which 0.17's analyzer (core.NullPointerArithm) flags. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CA9Ta9WPb5KjCoDaYyN7qE
zig 0.17 caches build.zig's configuration, keyed only by what it reads through the build API. build.zig lists core/'s headers and reads the patched-trees manifest directly, so a new header went uncopied (its compile failed) and a new vendor patch would have built the old trees. Declare both as configure dependencies. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CA9Ta9WPb5KjCoDaYyN7qE
build.zig moves off the calls 0.17 deprecates (addDirectoryArg, addFileArg, addPrefixedDirectoryArg, addOutputFileArg, b.dupe, .cwd_relative) to their replacements, ahead of their removal. bin/zig passes --cache-poison=disallowed, so a build.zig that would make zig configure again on every build (findProgram, say) fails instead. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CA9Ta9WPb5KjCoDaYyN7qE
bin/zig's SIGINT now reaches the maker `zig build` execs in its place, which exits and leaves its compile jobs orphaned (checked on 0.17). The CI cache-growth suspect is now the maker and the configurer, each built for the runner's CPU. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CA9Ta9WPb5KjCoDaYyN7qE
zig 0.17's Cache.checkInputPath compares a direct input whose stat moved, re-hashed, against a digest nothing computed, so every vendored source a tar restore gives a new inode recompiles (a 100 s boot where 0.16 took 8 s). Nothing here can keep the inodes; the fix is zig's. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CA9Ta9WPb5KjCoDaYyN7qE
…h for A cache restored from a 0.16 build holds `<name>.txt` manifests that 0.17 never reads; their outputs were orphans here, and superseded ones were removed while the manifests stayed, so 0.16 restoring the saved entry would trust an output that was gone (the queue's first 0.17 entry is seeded from main's 0.16 one). Each such manifest now goes too, ahead of any output. Also accept an input with an empty path, which 0.17 writes for a prefix's own root, rather than keeping every cache whole. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CA9Ta9WPb5KjCoDaYyN7qE
whilp
marked this pull request as ready for review
October 3, 2026 04:34
This was referenced Oct 3, 2026
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.
Moves
bin/zig.pin(andbuild/bom/zig.pin) to zig 0.17.0, with sha256s from ziglang.org's index. The x86_64-linux one was checked against a download.zig 0.17 splits
zig buildinto a configurer and a maker, renamesOptimizeMode, and reworks its cache. This PR follows each change:build.zig:
b.rootin place ofb.build_rootandstd.lang.Optimize(.debug/.safe/.fast) in place ofOptimizeModegetInstallPathis gone, because the install prefix belongs to the maker and isn't known when build.zig runs. The checked boot now gets thesanitizeddirectory as an install-prefix LazyPath (make_absolute).core/'s headers and readso/patched.tsvdirectly, so neither keyed it. I reproduced the first: a header added tocore/went uncopied and its compile failed. A changed vendor patch would have silently built the old trees. Both are now declared withdependOnDirectoryContents/dependOnFileContents, and after the fix the same header case builds.addDirectoryArg,addFileArg,addPrefixedDirectoryArg,addOutputFileArg,b.dupe,.cwd_relative) to their replacementsbuild/zig.tl:
zig buildno longer takes--global-cache-dir, so the shared global cache goes inZIG_GLOBAL_CACHE_DIRinstead (Zig.build_environment)--cache-poison=disallowed, so a build.zig that would turn the configure cache off (findProgram, say) fails instead of reconfiguring on every build. I checked that a probepoisonCache()panics.ci/cosmic_ci/zig_prune.tl: the pruner now reads 0.17's manifest format:
Manifest.Filerecords, named by bare hex, under a newhasher_initkey; an input may have an empty path (a prefix's own root)zig build's configuration cache: a manifest that vouches for the filec/<digest><name>.txtmanifests, in a cache restored from a build on it, are removed ahead of any output. 0.17 never reads them, so their outputs are orphans here and may go. Leaving them behind would make the older zig trust outputs that are gone. The queue's first 0.17 entry is seeded from main's 0.16 one, so this path is real. An adversarial review found it, and a regression test covers it.The known answers come from a cache 0.17 wrote. Run over that cache, the reader resolved all 5,411 non-empty manifests to their outputs.
core/compress.c: 0.17's clang analyzer adds
core.NullPointerArithm, which flaggeddata + in_poswhendeflate_chunkis called with NULL to flush. The flush now passes""instead.Known cost: a restored cache recompiles its C files
After a tar round trip at the same path,
bin/zig build boottakes about 100 s on 0.17, against 8 s on 0.16; a second run takes 7 s. The cause is in zig itself, in both 0.17.0 and upstream master.Cache.Manifest.checkInputPathre-hashes a direct input whose stat changed, then compares the result againstinput_file.digest.addInputPathnever computes that digest; it starts as zeros. So any input with a new inode misses, and the compiler adds every C source that way (src/Compilation.zig:1323,:3378). The compile is correct, only slower. Local checkouts share one cache with stable inodes and aren't affected; each CI leg pays it once per restore. A TODO at.github/workflows/ci.ymlrecords it. A minimal reproducer and an upstream report are drafted and not yet filed.Validation
bin/zig build boot,analyzeandsanitizedpass.o/bin/cosmic test: 3450 tests pass (sandboxed).fix --check .,ci/'sfix --checkandbuild/workflows_test.tlpass.ci/cosmic_ci/zig_prune_test.tl: all 8 pass as CI runs it (unsandboxed). Under the sandbox,test_the_answers_are_the_pinned_zigscan't read../bin/zig.pin, which fails the same way on main.ci/run-localpasses on the head (19df425), fixtures included.FUZZ_ITERS=1000andFUZZ_SEED=2600, on the sanitized 0.17 core. All pass.strnlen-check(0.2 s).bin/perf, main (0.16) against this branch (0.17), 50 pairs: no regression. All 15 workloads are within noise, and 12 of 15 medians are slightly faster..txtdefect, now fixed; the rest checked out.TODOs
o/bin/cosmic todosover the changed paths lists one added:.github/workflows/ci.yml:304: a restored cache recompiles every C file. It waits on zig fixingCache.checkInputPath, which is not yet reported upstream.Three existing ones were re-checked against 0.17:
build.zig:151(musl debug info): still holds. The checked core has 294 musl units naming the checkout, and 0.17 has no way to pass flags to its libc build.build/zig.tl:616(SIGINT): still holds, with new wording.zig buildexecs its maker in zig's pid, which exits on the signal; its compile jobs were seen orphaned and still compiling..github/workflows/ci.yml:293(cache growth): the suspect is now named as 0.17's maker (11 MB, global cache) and configurer (22 MB, project cache), each built for the runner's CPU.🤖 Generated with Claude Code
https://claude.ai/code/session_01CA9Ta9WPb5KjCoDaYyN7qE