Repository navigation
Conversation
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.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
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.
This branch has not been deployed
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.
Slice 3 of #12596: the playable example world for the Zig guest SDK —
examples/zig-counter/, the third twin ofroc-counter/rust-counter(same counter scenario, same Plaza ABI v1 surface fromroc-world/ABI.md).Stacked on PR #12827 (base
xaltha/12596-zig-sdk-screen-cap), which is stacked on PR #12793; this PR retargets tomainas the stack merges.What it adds
src/main.zig— the pure program (init/update/view/layout/records/wants/snapshot/restore) plus theplaza_*glue mirroring the Rust SDK'splaza_guest!plumbing: leaked model pointer, one shared output slot released by the next output call,plaza_alloc/plaza_freeover the guest allocator, diagnostic pair reading empty at rest. Uses the SDK'sscreenhelper for the boxed 20x3 view (30 wide at viewport width >= 30) and itsjsonhelper to encode the{"count":N}records document.build.zig/build.zig.zon— path-depends on../zig-sdk; builds an import-freewasm32-freestandingmodule exporting exactly the 14 documented exports +memory(verified against the built module;rdynamicroots the exports since there is no entry point).build.sh— toolchain guard + host tests + guest build, refreshing the checked-incounter.wasm(65,445 bytes) so the F12.7 conformance suite can load it as thezig-counterfixture with no Zig toolchain, like its twins.zig-sdk/zig-sdk-test.shnow also covers the example (fmt check, host tests, guest build);zig-sdk/README.mdupdated; root.gitignoregains thezig-counterbuild-output lines mirroring thezig-sdkones.Verification (pinned Zig 0.16.0, local)
zig-sdk-test.shgreen 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 + counterwasm32-freestandingbuilds OK,zig fmt --checkclean.counter.wasmdriven at the raw ABI level (WebAssembly instantiation, host-side alloc/write/free exactly as the runner does):plaza_abi_version= 1;incx2 (one event whitespace-padded) then view = the twins' boxed screen document withcount=2, byte-identical; records{"count":2}; wants{}; snapshot2-> restore round-trips; restore total on junk input; zero imports.Remaining on #12596
The F12.7 conformance run — add
zig-countertoCONFORMANCE_MODULESincrates/id-worlds/src/sandbox.rsand record the pass for the Phase 12 exit audit (#12231) — plus wiringzig-sdk-test.shinto theroc-testjust recipe once the nix Zig version is confirmed 0.16.0.Refs #12596
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.