From 68422f1e2632a3d6c0e4e89d4b9a962886f5db73 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 19:54:13 +0000 Subject: [PATCH] fix(soundness): restore the #833 ledger row and drop a stale anchor (main red) On main (464f7c6), tools/check-soundness-ledger.sh fails (CI/gate red on 220d6f1 and 0af0ab8): - property 3: tools/soundness-anchors.sha256 kept two lines for suite:test/test_intrinsic_shadow.ml. 3b74c20f... is the hash from before #829 extended that suite; 20e73d88... is the current one. Both survived the squash merges of #841 and #829. The stale line is removed. - The squash of #843 (220d6f1) did not carry its docs/SOUNDNESS.adoc change, so the #833 row (fixed, anchored to test/test_interp_eval.ml) and its stamp bump were lost although lib/interp.ml changed. The row is restored verbatim from fix/833-interp-recursion-mut. The stamp advances to 464f7c6, current main, verified with this change: dune runtest --force 849 + 32 + 3 tests pass; the wasm, Bun-ESM (legacy) and native Bun-ESM codegen corpora pass (48, 42, 9); just guard exits 0 with all 5 ledger properties OK. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01J4QvDfgDTxx9Bumfa2XXcQ --- docs/SOUNDNESS.adoc | 22 +++++++++++++++++++++- tools/soundness-anchors.sha256 | 1 - 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/docs/SOUNDNESS.adoc b/docs/SOUNDNESS.adoc index 21bccb16..151a45a0 100644 --- a/docs/SOUNDNESS.adoc +++ b/docs/SOUNDNESS.adoc @@ -4,7 +4,7 @@ // Freshness stamp — a real main-ancestor commit (survives squash-merge); advance // it (and --reseal) in any change that touches a soundness path. See "Keeping // this honest" and tools/check-soundness-ledger.sh (property 4). -:ground-truth-sha: 84eca60 +:ground-truth-sha: 464f7c6 :ground-truth-date: 2026-12-01 :stamp-verified-by: tools/check-soundness-ledger.sh :toc: macro @@ -311,6 +311,26 @@ write into the literal region. Layout invariant: `test_wasm_heap_literals_intact_after_alloc` — run under Bun's WASI; `test_wasm_heap_exhaustion_traps`); `lib/codegen.ml` `memory_layout_of_datas` / `check_memory_layout` + +| #833 +| The tree-walking interpreter — the oracle the compiled backends are compared +against — runs the programs the checker accepts and agrees with Bun-ESM on +them. It used to refuse a function that calls itself, one that calls a later +declaration, any `let mut` / `const mut` assignment, and any use of an +imported `Some` / `None` / `Ok` / `Err` (all loud). One shape was *silent*: an +early `return` evaluated its operand and carried on, so +`if c { return 1; } 2` yielded `2`. (The assignment arm also ignored a +compound operator — `a += 5` would have stored `5` — which a +`let mut` program could not reach, because the assignment failed first.) `affinescript eval` also type-checked +with its own fold of `Typecheck.check_decl`, without the signature +pre-registration of `Typecheck.check_program`, so it rejected forward and +mutual references that `check` and `compile` accept; it now calls +`check_program`. Not changed: `eval` still does not run the borrow checker +(`check` and `compile` do), so it accepts programs they reject. +| `fixed` +| `test/test_interp_eval.ml` (18 cases: each program passes the full frontend, +then its interpreter output is compared with the expected lines and with the +Bun-ESM output of the same program; all 18 fail on `4248912`). |=== == Still open — read before claiming "sound" diff --git a/tools/soundness-anchors.sha256 b/tools/soundness-anchors.sha256 index 2d788c56..8d9a6543 100644 --- a/tools/soundness-anchors.sha256 +++ b/tools/soundness-anchors.sha256 @@ -9,7 +9,6 @@ 20e73d88738c8fd075f81a36803554f92fa4ee53f71e33fa6759eae07c6e70f4 suite:test/test_intrinsic_shadow.ml 2bbd1b989fd0097530eede3e5230258e0e1092271a23ff7dff20cca65c0e612e suite:test/test_wasm_call_resolution.ml 2dfe36a21983a7dfb7ffa1157f7ddec9865a531a92682976b8fd677e4825e78d test:test_801_impl_methods_refused -3b74c20f201d0d53c2fbab5582a681d3dfc3cf978a0aea676ecc6400087452d9 suite:test/test_intrinsic_shadow.ml 45eb0f3aa5f643afbd003248998dd5a046688418647b491e0f2d4bb55fcbd0f2 test:test_wasm_heap_exhaustion_traps 546939eaa3c64c82edd23da0a3ba7f74bcf7378cfe1e426132dd1a9f8fd46050 test:test_801_transitive_public_and_const 5b84a4f71aa65f9aa9383e31c0cb624291c4f9d0de7cca4a0ea6a76fe85aea35 fixture:test/e2e/fixtures/handle_resume_nontail.affine