Add behavioural parity gate (closes #8); drop duplicate Python CLI - #9
Merged
Conversation
Byte-identical kernel.kl across hosts is necessary but not sufficient: the same KL can still execute differently per target (integer width, symbol interning, hash iteration order, memoisation), so a slice can pass every byte-identity check and still return wrong, boot-order-dependent answers on one target. This is the failure shen-cas hit on shen-rust (issue #8). Add `ratatoskr parity PROG OUTDIR`: shake once, then build + run the slice on each stage-2 target twice (two separate boots) and diff the output against a reference (--reference, default lisp) or a committed golden (--expect FILE). Checks per target: vs-truth (cross-target divergence), two-boot (cross-boot nondeterminism), and two-pass (in-process boot-order nondeterminism, via the fixture convention of two identical passes separated by a "===" line). Exit 0/1/3 = pass / fail / nothing checkable. --time is advisory only. Fixture: tests/parity.shen + tests/parity.expected — a content-addressed memo (the hash/intern axis) that is deterministic on correct impls. Verified PASS across all 8 targets (lisp/lua/go/rust/js/julia/scheme/swift). Consolidate on the Go binary: remove the duplicate Python CLI (ratatoskr_cli.py, test_portable.py, the portability workflow) — go.yml already tests the same cross-platform helpers + embedded builders.json on the 3-OS matrix. The uvx/pip packaging (pybin/ + pyproject.toml) stays. Docs: new docs/parity.md; README gets the subcommand, a parity-gate section, and the cross-platform paragraph rewritten for the Go binary. Closes #8 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
Adds the behavioural parity gate requested in #8, and consolidates the CLI on the Go binary by removing the duplicate Python implementation.
Byte-identical
kernel.klacross hosts is necessary but not sufficient — the same KL can still execute differently per target (integer width, symbol interning, hash iteration order, memoisation). That gap is what bit shen-cas on shen-rust. This adds an opt-in gate that proves the slice computes the same thing on every target it ships to.ratatoskr parity PROG OUTDIRShakes once, then builds + runs the slice on each stage-2 target twice (two separate boots) and diffs output against a reference (
--reference, defaultlisp) or a committed golden (--expect FILE).vs-truthtwo-boottwo-passtwo-passis target-agnostic via a fixture convention: print two identical passes separated by a line that is exactly===. Exit0/1/3= pass / fail / nothing checkable.--timeis advisory.Verified PASS across all 8 targets:
Negative path (corrupt golden →
FAILexit 1 with first-diff) and skip-only path (exit 3) also verified.Also
tests/parity.shen+tests/parity.expected(content-addressed memo — the hash/intern axis).ratatoskr_cli.py,test_portable.py,.github/workflows/portability.ymlremoved;go.ymlalready covers the same helpers + embeddedbuilders.jsonon the 3-OS matrix. Unit tests for the new pure helpers added inparity_test.go. Theuvx/pip packaging (pybin/+pyproject.toml) is kept.docs/parity.md; README subcommand table + parity-gate section + cross-platform paragraph rewritten for the Go binary.Closes #8
🤖 Generated with Claude Code