refactor: add environment accessor for Zig 0.16 prep - #374
Merged
Conversation
Zig 0.16 removes both std.posix.getenv and std.heap.GeneralPurposeAllocator. DebugAllocator is what GeneralPurposeAllocator already aliases in 0.15.2, so this is a rename.
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.
Issue
Prepare the environment-access and allocator portions of the staged Zig 0.16 migration (Task 3).
Solution
src/env.zigwith the planned process-environment accessor and tests.getenvcall sites across 11 files throughenv.get, including aliasedposix.getenvcalls inshell.zigandlogging.zig.GeneralPurposeAllocatorinstances toDebugAllocator.controlmodule to resolve the plan-prescribed relative environment import.Context
This is the Zig 0.15.2-compatible preparation commit for the later Zig 0.16 toolchain flip. The environment accessor retains the exact
std.posix.getenvreturn type. The MCP build-graph alias is necessary because Task 2 compilessrc/app/control.zigas a separate module whose root otherwise rejects../env.zigas outside its module path.Test plan
zig build— passed locally with directly installed Zig 0.15.2.zig build test— passed locally, run unpiped for the exit-code verdict.just lint— passed locally; test registry reports all 45 test files registered.zig fmt --check src/and./scripts/check-test-registry.sh— passed.~path abbreviation) could not be performed in this Linux sandbox because it requires the SDL3/macOS UI. A human on macOS or CI with an appropriate runtime must perform/cover it; it is not being claimed as completed.