GeezerVison is showing github.com — feat(id): Zig counter example world on the Zig SDK (#12596) by dezren39 · Pull Request #12837 · developing-today/code
Conversation
dezren39
commented
Nov 23, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Slice 3 of #12596: the playable example world for the Zig guest SDK — examples/zig-counter/, the third twin of roc-counter/rust-counter (same counter scenario, same Plaza ABI v1 surface from roc-world/ABI.md).
Stacked on PR #12827 (base xaltha/12596-zig-sdk-screen-cap), which is stacked on PR #12793; this PR retargets to main as the stack merges.
What it adds
src/main.zig — the pure program (init/update/view/layout/records/wants/snapshot/restore) plus the plaza_* glue mirroring the Rust SDK's plaza_guest! plumbing: leaked model pointer, one shared output slot released by the next output call, plaza_alloc/plaza_free over the guest allocator, diagnostic pair reading empty at rest. Uses the SDK's screen helper for the boxed 20x3 view (30 wide at viewport width >= 30) and its json helper to encode the {"count":N} records document.
build.zig/build.zig.zon — path-depends on ../zig-sdk; builds an import-free wasm32-freestanding module exporting exactly the 14 documented exports + memory (verified against the built module; rdynamic roots the exports since there is no entry point).
build.sh — toolchain guard + host tests + guest build, refreshing the checked-in counter.wasm (65,445 bytes) so the F12.7 conformance suite can load it as the zig-counter fixture with no Zig toolchain, like its twins.
zig-sdk/zig-sdk-test.sh now also covers the example (fmt check, host tests, guest build); zig-sdk/README.md updated; root .gitignore gains the zig-counter build-output lines mirroring the zig-sdk ones.
Verification (pinned Zig 0.16.0, local)
zig-sdk-test.sh green end to end: SDK suites, counter host tests 3/3 (mirrors of the rust-counter suite, including byte-equality of the boxed screen document), SDK + counter wasm32-freestanding builds OK, zig fmt --check clean.
- The checked-in
counter.wasm driven at the raw ABI level (WebAssembly instantiation, host-side alloc/write/free exactly as the runner does): plaza_abi_version = 1; inc x2 (one event whitespace-padded) then view = the twins' boxed screen document with count=2, byte-identical; records {"count":2}; wants {}; snapshot 2 -> restore round-trips; restore total on junk input; zero imports.
Remaining on #12596
The F12.7 conformance run — add zig-counter to CONFORMANCE_MODULES in crates/id-worlds/src/sandbox.rs and record the pass for the Phase 12 exit audit (#12231) — plus wiring zig-sdk-test.sh into the roc-test just recipe once the nix Zig version is confirmed 0.16.0.
Refs #12596

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Slice 3 of #12596: examples/zig-counter/, the third twin of
roc-counter/rust-counter — the same counter scenario on the Plaza
ABI v1 surface, built on the Zig guest SDK (screen for the boxed
view/layout, json for the records document).
- src/main.zig: the pure program (init/update/view/layout/records/
wants/snapshot/restore) plus the plaza_* glue mirroring the Rust
SDK's plaza_guest! plumbing (leaked model pointer, one shared
output slot, alloc/free over the guest allocator); host tests
mirror the rust-counter suite.
- build.zig builds an import-free wasm32-freestanding module with
exactly the 14 documented exports + memory; build.sh runs the
tests and refreshes the checked-in counter.wasm so the F12.7
conformance suite can load it without a Zig toolchain.
- zig-sdk-test.sh now also covers the example (fmt, host tests,
guest build); root .gitignore gains the zig-counter build-output
lines, mirroring the zig-sdk ones.
Verified with pinned Zig 0.16.0: zig-sdk-test.sh green (SDK suites
53 tests + counter 3/3 host tests, both wasm builds OK); the
checked-in counter.wasm driven at the raw ABI level (init, inc x2
with a trimmed event, view byte-identical to the twins' boxed
screen document, records {"count":2}, wants {}, snapshot/restore
round-trip, restore total on junk) — all checks pass, zero imports.
Refs #12596. Stacked on xaltha/12596-zig-sdk-screen-cap (PR #12827);
retargets to main as the stack merges.
coderabbitai
Bot
commented
Nov 23, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Warning
Review limit reached
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 49 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
6794e6b2-647f-4734-91fd-83a9a8788021
Commits
-
Reviewing files that changed from the base of the PR and between ac21bf0 and 96b246b.
Files ignored due to path filters: 1
-
pkgs/id/examples/zig-counter/counter.wasm is excluded by !**/*.wasm
Files selected for processing: 8
-
.gitignore
pkgs/id/examples/zig-counter/README.md
pkgs/id/examples/zig-counter/build.sh
pkgs/id/examples/zig-counter/build.zig
pkgs/id/examples/zig-counter/build.zig.zon
pkgs/id/examples/zig-counter/src/main.zig
pkgs/id/examples/zig-sdk/README.md
pkgs/id/examples/zig-sdk/zig-sdk-test.sh
- Autofix · 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
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
dezren39
added a commit
that referenced
this pull request
Nov 23, 2026
…2596)
The Zig guest SDK's playable example (examples/zig-counter, PR #12837)
joins roc-counter, rust-counter and tic-tac-toe in CONFORMANCE_MODULES,
so the ABI.md export-surface, abi-version and snapshot/restore
round-trip conformance tests now run against the checked-in Zig module
with no Zig toolchain required.
|
agent-note:v1
lane: lane-aaj (stale-PR warden shepherd, deferred merge-ready list)
outcome: not merged — stacked two levels deep
This PR's base is xaltha/12596-zig-sdk-screen-cap (PR #12827), which is itself stacked on PR #12793; both are still open and unmerged as of 2026-11-23T17:2xZ. The PR body states it retargets to main as the stack merges. The warden's merge-ready tag reflects mergeability against its stacked base only.
Shepherd action: none taken, to avoid landing a stack out of order under its author's active management. Unblock path: land #12793, then #12827, retargeting each time, re-run the zig SDK + counter example verification (zig-sdk-test.sh / build.sh), then merge. No review findings are outstanding on this PR.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|