Skip to content

zig: migrate to latest 0.17 nightly - #602

Open
ajroetker wants to merge 15 commits into
mainfrom
codex/zig-0.17-dev-1933
Open

zig: migrate to latest 0.17 nightly#602
ajroetker wants to merge 15 commits into
mainfrom
codex/zig-0.17-dev-1933

Conversation

@ajroetker

@ajroetker ajroetker commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • pin every Zig consumer to the current official nightly, 0.17.0-dev.1936+5a625d5f3, with all seven published archive SHA-256 values centralized in zig/toolchain.env
  • verify every directly downloaded Zig archive before extraction and add a scheduled/manual probe against the moving latest nightly without changing the committed pin
  • migrate current main directly to Zig 0.17 build APIs, including LazyPath constructors, the new output/artifact/directory argument APIs, b.addFmt, tracked Python environment inputs, and cache-poisoned CI builds
  • convert all ten reflection call sites to Zig 0.17 parallel field_names / field_values arrays and remove the temporary reflection compatibility layer
  • restore LoRA/DoRA adapter binary save/load support, including DoRA magnitude tensors
  • move production inference entry points toward owner-injected std.Io; model-manager coordination, multistage readers, artifact writing, native smoke/generation, layout/GLiNER2 materialization, and benchmark discovery no longer create an implicit runtime at those boundaries
  • enable Zig 0.17 std.Io.Evented/io_uring on Linux for enrichment and native storage
  • replace the stale per-store Evented branch with one retained NativeStorageState implementation: Threaded is state-owned, while Evented is an explicitly process-owned shared handle retained by stores, leases, FD permits, range futures, and atomic writers
  • preserve the existing FD admission/cache namespace contract while allowing retained children to finish safely after NativeStorage.deinit
  • retain the restored wasm32 browser and standalone inference builds from the earlier migration work, with Vellum/regex kept on WASI-specific modules instead of leaking the Linux host target into the browser graph
  • reconcile current main's glibc-linked release-compiler change: its pinned Nixpkgs exposes only Zig 0.16, so the migrated release workflows keep using the checksum-verified 0.17 nightly required by the source tree

This supersedes the implementation approach in #140 with a fresh migration from current main.

Evented lifetime contract

EventedRuntime starts with one process-owner reference. Each native storage state retains it, and releases it only after its owner plus every lease, FD permit, future, and atomic writer have drained. Teardown closes the retain race atomically and asserts that the process owner is the final reference before deinitializing Zig's Evented executor on its initializing thread.

The Linux regression uses two stores sharing one executor, keeps a lease, FD permit, and atomic writer alive across the first store's teardown, completes and reads the atomic write through retained state, then drains the children and second store before destroying Evented.

Validation

  • official Zig download index rechecked on 2026-08-30: 0.17.0-dev.1936+5a625d5f3 remains latest
  • python3 scripts/ci/verify_zig_toolchain.py (all seven consumers checksum-verified)
  • actionlint .github/workflows/zig-tests.yml .github/workflows/zig-nightly-probe.yml
  • actionlint on the container, release, and Darwin release-diagnostic workflows after merging current main
  • make -C zig generated-check (TLS drift, OpenAPI, Snowball, SQL grammar, and C ABI checks)
  • zig build install --cache-poison=disallowed in zig/pkg/inference
  • zig build test-finetune --cache-poison=disallowed (all available suites passed; CUDA/real-model-only cases skipped as expected; native/Metal gradient parity passed)
  • focused LoRA adapter-set tests (12 passed)
  • zig build wasm --cache-poison=disallowed (embedded shared smoke passed)
  • cold aarch64-Linux zig build install-wasm --cache-poison=disallowed, followed by the Node embedded shared smoke against the Linux-produced artifact
  • zig build unit-storage-compile --cache-poison=disallowed
  • zig build unit-storage-compile -Dtarget=x86_64-linux-gnu --cache-poison=disallowed
  • native Linux/aarch64 Docker execution of evented native storage retained children outlive their owner with --cache-poison=disallowed
  • earlier branch validation: root/openapi/embedded/inference suites, both supported wasm32 entry points, real amd64 and arm64 Docker Zig-stage builds, Dockerfile checks, and generated-source checks
  • git diff --check

@ajroetker
ajroetker force-pushed the codex/zig-0.17-dev-1933 branch from 29a95b0 to bf6d317 Compare August 30, 2026 04:19
@ajroetker ajroetker added this to the v0.3.0 milestone Sep 8, 2026
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