Skip to content

test: parallel assertion judges with execution receipts and negative controls (J2a) - #65

Merged
oisee merged 6 commits into
mainfrom
feat/J2a-fast-judge
Oct 2, 2026
Merged

oisee merged 6 commits into
mainfrom
feat/J2a-fast-judge

Conversation

@oisee

@oisee oisee commented Oct 2, 2026

Copy link
Copy Markdown
Owner

J2a: fast, honest assertion judges

The old assertion matrix had false passes: 9 asserts never executed and were still counted as passing. This PR makes the regression gate show what actually ran, and adds negative controls so the gate can show it detects breakage.

What it adds

  • Shared parallel judges (scripts/assert_matrix.py, scripts/fuzz_diff.py, scripts/compile_sweep.py), covering all 9 frontends: .c, .nanz, .pas, .plm, .abap, .frl, .lanz, .lizp, .m.
  • The compiler lists its own asserts (--list-asserts, including the tuple arity). With --assert-receipt it prints an execution receipt: ASSERTS: executed=N passed=P failed=F. The receipt is opt-in, so default compiler output is unchanged.
  • Negative controls: each assert is re-run with its expected value perturbed, and must then fail. Tuples get one control per element.
  • Known-failure audit: each of the 3 known C/Z80 failures is matched on its exact error text and cannot excuse a new failure.
  • Tuple asserts: every element is now checked on MIR2 and Z80, and examples/nanz/tuple_assert_gate.nanz is tracked.
  • scripts/test_assert_mutants.py: builds checker mutants and requires the matrix to reject them:
    • M4: checks only element 0
    • M5: skips element 0

Numbers (vs origin/main 05402e1 with the listing instrumentation applied; -j16, controls on)

  • Z80: 1,304 pass on both builds, 353 fail on both, 1 newly passes (a sandbox the baseline never executed), 0 newly fail.
  • MIR2: 1,476 pass on both, 182 fail on both, 0 newly fail.
  • Coverage: 1,665 execution units per pass. 1,673 controls run, with 0 unexpected passes and 0 flaky results.
  • Default-mode sweep: 829 sources and 307 output files (.a80 and .bin) compared byte for byte, with 0 differences in exit code, stdout, stderr or output files. An independent critic sweep agrees.
  • Wall time: ~3.5 min at -j16. At -j4, about 4.4 min with controls (--no-controls: 263 s).
  • Mutants the gate catches:
    • MIR2 xor broken
    • Z80 xor emitted as or
    • .pas asserts dropped from the listing
    • tuple M4 and M5

Behaviour kept compatible

--asserts wasm|llvm still runs MIR2 asserts, and llvm mode still runs Z80 asserts. WASM sandbox asserts still skip a missing export and accept void results. P7's CLI behaviour is unchanged.

Recommended CI use (follow-up C2)

  • Every PR: both passes, with the baseline build cached.
  • Controls: required whenever assert, pipeline or script code changes, and nightly with --runs 2. --no-controls cannot detect a weakened checker.

Gate

  • Cross-family critic: MERGE GO after 5 rounds.
  • Go gates: -race ./pkg/hir, hir/mir2/c89/pascal/plm/cmd, -short pipeline.
  • scripts/test_judges.py: 25/25.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Wrwo36SzxKRZYTgpDo7hzo

oisee and others added 6 commits October 2, 2026 14:13
Add a tracked-corpus assertion matrix with isolated sources, repeated runs,
timeouts and regression reports. Port the seeded differential fuzzer with
wrong-value reduction and record the current main findings. Parallelize HIR
judge input sweeps with private CPUs/images and ordered diagnostics.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wrwo36SzxKRZYTgpDo7hzo
Enumerate assertions with frontend JSON listings and require execution receipts
for isolated checks and shared sandbox units. Add expected-value controls,
separate baseline/candidate inventories, flaky classification and strict tool
errors. Diagnose malformed C directives and accept trailing comments.

Distinguish MIR2/oracle discrepancies, Z80/MIR2 discrepancies and assembly
failures in differential fuzzing, and correct the literal-width findings.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wrwo36SzxKRZYTgpDo7hzo
Record the three pre-existing Z80 C assertion failures and exempt only exact
candidate diagnostics. Fail the gate when an entry passes, changes or loses
its assertion, and retain negative control and inventory safeguards.
Add tests for matching, stale entries, repeated outcomes and CLI behavior.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wrwo36SzxKRZYTgpDo7hzo
Apply assertion filters and negative controls only when explicitly requested.
Check all Z80 tuple returns and preserve assertion source lines after #embed.
Run separate Z80 and MIR2 matrix passes across all assertion frontends, and
prevent known failures from exempting baseline-passing regressions.

Add default-mode source comparisons and regression tests for each fix.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wrwo36SzxKRZYTgpDo7hzo
Make execution receipts opt-in and compare complete emitted files and raw
compiler diagnostics in the default sweep. Add tracked tuple assertions that
catch a checker ignoring later results, restore optional backend behavior,
and support repeated controls and controls-only CI passes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wrwo36SzxKRZYTgpDo7hzo
Generate independent negative controls for every tuple element and verify
that the matrix rejects both first-only and first-skipping checkers. Restore
Z80 assertion execution in LLVM mode and empty-return acceptance for WASM
sandbox assertions, with regressions and CI control guidance.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wrwo36SzxKRZYTgpDo7hzo
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

PR tests: 🟢 pass

Commit: 52097f11 · Full test log

Check Result
Build mz, mza, mze, mzv 🟢 pass
Stable Go package tests 🟢 pass
Fibonacci compile + assemble 🟢 pass
Nanz language regressions 🟢 pass
Z3 West of House demo 🟢 pass
Z3 small conformance fixtures 🟢 pass

The external CZECH and full Zork I stories are not part of this PR gate.

@oisee
oisee merged commit 38c3ddb into main Oct 2, 2026
2 checks passed
@oisee
oisee deleted the feat/J2a-fast-judge branch October 2, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant