Skip to content

Upgrade to Zig 0.17.0 - #119

Merged
christianhelle merged 25 commits into
mainfrom
feature/zig-v0-17-upgrade
Oct 12, 2026
Merged

christianhelle merged 25 commits into
mainfrom
feature/zig-v0-17-upgrade

Conversation

@christianhelle

@christianhelle christianhelle commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Upgrades the project to Zig 0.17.0.

Build system

  • Zig 0.17 removed custom build steps (makeFn). The package snapshot (test-package) and the install-release* / install-debug steps now run a small helper, tools/build_tools.zig, through a Run step. tools is added to the package paths.
  • b.args → run_cmd.addPassthruArgs(); b.build_root → b.root; pathFromRoot → b.root.joinString.
  • Build info (git tag/commit, build date) is read at configure time, so build.zig now calls b.graph.poisonCache() to keep the configure cache from serving stale values.
  • std.builtin.OptimizeMode → std.lang.Optimize.
  • Behavior change: b.install_prefix can no longer be read at configure time, so the install-release* steps no longer honor --prefix. They install to INSTALL_DIR, then $HOME/.local/bin, then %USERPROFILE%\.local\bin.

Language / std

  • @typeInfo struct and union info is now struct-of-arrays (field_names / field_types / field_attrs). Ported in document_filter.zig and in vendored zig-yaml.
  • ErrorBundle.Wip.init now returns the value (zig-yaml); std.ascii.indexOfIgnoreCase → findIgnoreCase; Fn.params → param_types; std.meta.declarations returns names; getLast → last().?.
  • zig fmt in 0.17 rewrites @intFromEnum → @backingInt. Applied so CI's zig fmt --check passes. The generator never emits @intFromEnum, so generated clients are unaffected.
  • std.testing.allocator is now SafeAllocator. Whether it can resize in place varies between runs, which made one checkAllAllocationFailures test fail with NondeterministicMemoryUsage. That test now goes through a no-resize wrapper allocator.

Toolchain pins and docs

minimum_zig_version (root, package_consumer, vendored zig-yaml), CI, release, mise, devcontainer, coverage Dockerfile, README, PACKAGE.md, copilot-instructions (and its download URL, which used the old zig-linux-x86_64 naming), and the website.

Verification (Windows, Zig 0.17.0)

  • zig build test: 11/11 steps, 586/592 tests passed (6 skipped). This includes the generated-code compile tests and the test-package consumer build.
  • zig build build-all: all 5 cross targets build.
  • zig build run-generate: generated output is byte-identical, and generated/main.zig and lmstudio_example.zig compile. examples/compile_examples.zig passes.
  • zig build run -- --version (passthru args) and install-debug with INSTALL_DIR both work.
  • zig fmt --check . is clean on an LF checkout.

Not done (follow-ups)

  • std.heap.DebugAllocator (about 570 test call sites) and std.fmt.allocPrint are deprecated in 0.17 but still work, so they are left for a separate cleanup.
  • On Windows, 0.17 sometimes fails with unable to load "<std file>.zig": Unexpected under high build parallelism. This is a compiler/OS issue, not something in this repo. Rerunning or passing -j2 avoids it.

Summary by CodeRabbit

  • New Features
    • Package snapshots and release installation now use the updated build tooling. Install destinations are selected from INSTALL_DIR or the user’s home directory.
  • Compatibility
    • Updated the project’s documented and configured Zig version to 0.17.0.
    • Updated examples and bundled YAML support to remain compatible with Zig 0.17.0.

Copilot AI balanced review requested due to automatic review settings October 5, 2026 21:34
@christianhelle christianhelle self-assigned this Oct 5, 2026
@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 24897cf4-e367-440d-a49f-f5efa7d34ca5
📥 Commits

Reviewing files that changed from the base of the PR and between 2c439f4 and 34f5432.

⛔ Files ignored due to path filters (5)
  • generated/compile_generated.zig is excluded by !**/generated/**
  • generated/lmstudio-multi/main.zig is excluded by !**/generated/**
  • generated/lmstudio_example.zig is excluded by !**/generated/**
  • generated/main.zig is excluded by !**/generated/**
  • generated/multi/main.zig is excluded by !**/generated/**
📒 Files selected for processing (27)
  • .devcontainer/README.md
  • .devcontainer/devcontainer.json
  • .github/copilot-instructions.md
  • .github/workflows/ci.yml
  • .github/workflows/release.yml
  • .mise.toml
  • Dockerfile.coverage
  • README.md
  • build.zig
  • build.zig.zon
  • docs/index.html
  • examples/PACKAGE.md
  • examples/compile_examples.zig
  • examples/package_consumer/build.zig.zon
  • src/cli/file_names.zig
  • src/document_filter.zig
  • src/generators/unified/model_generator/unions.zig
  • src/input_loader.zig
  • src/tests/parameters_as_struct_tests.zig
  • src/tests/test_utils.zig
  • tools/build_tools.zig
  • vendor/zig-yaml/build.zig.zon
  • vendor/zig-yaml/src/Parser.zig
  • vendor/zig-yaml/src/Parser/test.zig
  • vendor/zig-yaml/src/Tokenizer.zig
  • vendor/zig-yaml/src/Tree.zig
  • vendor/zig-yaml/src/Yaml.zig

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The project now targets Zig 0.17.0 across its package requirements, development environments, CI, and documentation. Source and vendored YAML code use updated Zig APIs. Build orchestration uses a new host utility for package snapshots and release installation.

Changes

Zig 0.17.0 Upgrade

Layer / File(s) Summary
Zig version alignment
.devcontainer/*, .github/*, .mise.toml, Dockerfile.coverage, README.md, build.zig.zon, docs/index.html, examples/PACKAGE.md, examples/package_consumer/build.zig.zon, vendor/zig-yaml/build.zig.zon
Project requirements, development and CI environments, and documentation now specify Zig 0.17.0.
Application and test compatibility updates
examples/compile_examples.zig, src/cli/file_names.zig, src/document_filter.zig, src/generators/unified/model_generator/unions.zig, src/input_loader.zig, src/tests/*
Application code uses updated Zig reflection, collection, string-search, and integer-conversion APIs. The allocation-failure test uses a new no-resize allocator utility.
Vendored YAML compatibility updates
vendor/zig-yaml/src/*
YAML parsing, token iteration, tree access, and encoding use updated Zig integer conversions and reflection metadata.
Package snapshots and release installation
build.zig, build.zig.zon, tools/build_tools.zig
The build invokes a host utility to create package snapshots and install release executables. Snapshot paths are explicit, and install destinations use INSTALL_DIR or a home-directory fallback.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to 34f54

No actionable merge-blocking risk remains. The package-content guide can be corrected as a low-impact documentation follow-up.

Architecture Summary

Architecture risk: 🔵 Low · up to 34f54

The change affects 8 systems.

Changed systems: src, examples, build.zig, build.zig.zon, Dockerfile.coverage, docs, README.md, tools

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — src (service) was modified; 6 changed files map to changed impact.
  • observed — examples (service) was modified; 3 changed files map to changed impact.
  • observed — build.zig (service) was modified; 1 changed file maps to changed impact.
  • observed — build.zig.zon (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in Dockerfile.coverage: The default ZIG_VERSION changes from 0.16.0 to 0.17.0, updating the Zig release used by the subsequent download and version check.
  • observed — Modified behavior in README.md: The Zig version badge changes from 0.16.0+ to 0.17.0+.
  • observed — Modified behavior in README.md: The build-from-source requirement changes from Zig v0.16.0 to v0.17.0.
  • observed — Modified behavior in README.md: The development prerequisite changes from Zig v0.16.0 to v0.17.0.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary change: upgrading the project and its toolchain to Zig 0.17.0.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The broad compiler and build-system migration warrants final human validation despite the comprehensive reported verification.

Review effort: Balanced
Findings: None

What changed in this PR

Upgrades the project and vendored zig-yaml code to Zig 0.17.0 while preserving generation behavior.

Changes:

  • Migrates language and standard-library APIs to Zig 0.17.
  • Replaces removed custom build steps with a host build-helper executable.
  • Updates toolchain pins, documentation, generated fixtures, and deterministic allocation-failure testing.
File Description
build.zig Migrates build, snapshot, installation, and runtime steps.
build.zig.zon Raises Zig minimum and packages build tools.
tools/​build_tools.zig Adds snapshot and installation helper commands.
Dockerfile.coverage Updates coverage compiler version.
.mise.toml Updates local toolchain pin.
.github/​workflows/​ci.yml Runs CI with Zig 0.17.
.github/​workflows/​release.yml Builds releases with Zig 0.17.
.github/​copilot-instructions.md Updates development instructions.
.devcontainer/​devcontainer.json Updates container Zig feature.
.devcontainer/​README.md Updates container documentation.
README.md Updates supported Zig version.
docs/​index.html Updates website version references.
examples/​PACKAGE.md Updates package documentation.
examples/​package_consumer/​build.zig.zon Updates consumer minimum version.
examples/​compile_examples.zig Migrates declaration reflection.
src/​document_filter.zig Migrates struct reflection.
src/​input_loader.zig Migrates enum integer conversion.
src/​cli/​file_names.zig Migrates list access API.
src/​generators/​unified/​model_generator/​unions.zig Migrates ASCII search API.
src/​tests/​test_utils.zig Adds deterministic no-resize allocator.
src/​tests/​parameters_as_struct_tests.zig Uses the allocator in failure testing.
vendor/​zig-yaml/​build.zig.zon Raises vendored package minimum version.
vendor/​zig-yaml/​src/​Yaml.zig Migrates reflection to struct-of-arrays metadata.
vendor/​zig-yaml/​src/​Tree.zig Migrates reflection and enum conversions.
vendor/​zig-yaml/​src/​Tokenizer.zig Migrates token-index conversions.
vendor/​zig-yaml/​src/​Parser.zig Migrates parser APIs and reflection.
vendor/​zig-yaml/​src/​Parser/​test.zig Updates enum conversions in tests.
generated/​compile_generated.zig Migrates function parameter reflection.
generated/​main.zig Applies Zig 0.17 formatting conversion.
generated/​multi/​main.zig Applies Zig 0.17 formatting conversion.
generated/​lmstudio-multi/​main.zig Applies Zig 0.17 formatting conversion.
generated/​lmstudio_example.zig Applies Zig 0.17 formatting conversion.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Oct 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.06%. Comparing base (c85e185) to head (34f5432).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #119      +/-   ##
==========================================
- Coverage   97.06%   97.06%   -0.01%     
==========================================
  Files         136      136              
  Lines       16941    16957      +16     
==========================================
+ Hits        16444    16459      +15     
- Misses        497      498       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@christianhelle christianhelle added the enhancement New feature or request label Oct 12, 2026
@christianhelle
christianhelle merged commit a000657 into main Oct 12, 2026
8 checks passed
@christianhelle
christianhelle deleted the feature/zig-v0-17-upgrade branch October 12, 2026 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants