ReviewOS

also looking at this

craft-native/craft

fix(dev): validate the pinned Zig toolchain before builds

#299
Merged glennmichael123 wants to merge codex/pinned-zig-toolchain into main
5 files +137 -14
.github/CONTRIBUTING.mdmodified+14-6
Changes to .github/CONTRIBUTING.md
@@ -6,9 +6,17 @@ Thank you for your interest in contributing to Craft! This document provides gui
66
77### Prerequisites
88
9- **Pantry-managed stable Zig**: run `eval "$(pantry env | sed -n '/^export /,$p')"`, then invoke `zig` (locally only — CI does not: the pantry action already puts `zig` on PATH, and `pantry env` runs a workspace setup that re-installs JS deps with its own `--linker`, rewriting `node_modules` mid-job)
9- **Pinned Zig toolchain**: use the exact snapshot in `pantry.lock`. Root `bun run build:core`, `test`, `fmt`, `run`, and `zig` scripts validate the selected compiler and print its path/version before use. Activate your Pantry environment locally, or set `CRAFT_ZIG=/absolute/path/to/zig` to a matching compiler. The scripts do not invoke `pantry env` automatically because it can reinstall workspace dependencies. CI receives the pinned toolchain from the Pantry action.
1010- **Bun**: Install from [bun.sh](https://bun.sh)
1111
12To intentionally test another Zig snapshot, use both an explicit compiler and the opt-in:
13
14```bash
15CRAFT_ZIG=/absolute/path/to/experimental/zig CRAFT_ALLOW_UNPINNED_ZIG=1 bun run build:core
16```
17
18This override is for compatibility testing; it does not change the checked-in lockfile.
19
1220#### Platform-specific Dependencies
1321
1422**macOS:**
@@ -41,19 +49,19 @@ cd craft
4149
4250```bash
4351# Debug build
44zig build
52bun run build:debug
4553
4654# Release build
47zig build -Doptimize=ReleaseSafe
55bun run build:core
4856
4957# Run tests
50zig build test
58bun run test
5159
5260# Run example
53zig build run
61bun run run:demo
5462
5563# Run the craft CLI
56zig build run
64bun run run
5765```
5866
5967## Project Structure