Skip to content

fix(tests): repair test-stages + rust-test regressions from #161 (iteexpr) - #167

Merged
mahaloz merged 2 commits into
mainfrom
fix/iteexpr-stages-regression
Jul 12, 2026
Merged

mahaloz merged 2 commits into
mainfrom
fix/iteexpr-stages-regression

Conversation

@mahaloz

@mahaloz mahaloz commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

What

main has been red on make test-stages and make rust-test since #161 merged — that PR added the iteexpr settable but left five test expectations stale (its "gates green" claim was incorrect). This restores all four gates. No engine behavior change — test data + expectations only.

The five stale expectations

gate test cause fix
test-stages ghangr-iteexpr.xml four comment lines contained -- (illegal in XML comments) → ASCII parser errored the file rephrased to drop --
test-stages CATALOG #6 iteexpr is source_decompiler=angr → 30 entries, assertion expected 29 added iteexpr, 29→30
test-stages CATALOG #7 iteexpr is change_kind=structure-recovery → 19 entries, expected 18 added iteexpr, 18→19
rust emit_catalog_json_static_form one more settable → 75 },\n, expected 74 74→75
rust option_values_…_suppressed_for_38 iteexpr has no live reader (print-only, like iteregion) but wasn't in the allowlist added to allowlist, suppressed 38→39

docs/baseline-stages.json regenerated (261/261).

Gates

  • make test — 675/675 PARITY OK
  • make test-stages — 261/261 PARITY OK
  • make rust-test — green (0 failures)
  • make check-spec — OK

🤖 Generated with Claude Code

mahaloz and others added 2 commits July 12, 2026 19:52
kuna now decompiles entirely client-side in a web browser — the engine runs
in the page as WebAssembly, with no server and no upload. Feasibility was
proven end-to-end (compiles + runs + byte-identical output) before building.

Approach: wasm32-wasip1 + a JS WASI shim, NOT wasm-bindgen. The engine reaches
the outside world only through plain std::fs path reads (the binary via
LoadImage; the SLEIGH .sla/.pspec/.cspec/.ldefs via scan_language_database) —
no threads, no rayon, and its only subprocess/time calls are CLI-layer or
test-only. A WASI virtual filesystem maps onto those reads, so the full
engine+analysis stack compiles to wasm with ZERO source changes. wasm-bindgen
(wasm32-unknown-unknown) was rejected: it has no filesystem and would require
refactoring the engine's spec/image reads to take byte buffers.

What's added (purely additive — no engine file changed, no new stage-model
option, no output change):

- decompiler/crates/kuna-wasm: a leaf crate (lib+bin `kuna_wasm`) that is a
  faithful restatement of `kuna decompile-all`'s core loop over the existing
  kuna-console in-process path (bootstrap_from_object -> listing-on ->
  commit_pending_analysis -> decompile_func_full_with_override_dyn + print_c).
  Its --json matches `kuna decompile-all --json` field-for-field. Builds
  natively too (the parity oracle). No new external dependency.

- integrations/web: the browser harness — index.html (upload a binary, pick a
  function, see C), kuna-web.js (drives the vendored @bjorn3/browser_wasi_shim,
  preloads specs + binary into an in-memory FS, captures stdout), build.sh
  (builds the wasm and assembles a self-contained dist/), and tests.

- Tests (Node, no browser needed for CI): test/parity.mjs runs the wasm under
  node:wasi and asserts output byte-identical to native across list + several
  decompile cases; test/glue.mjs drives the real browser WASI shim + kuna-web.js
  over HTTP. Committed x86-64 ELF fixture. The full DOM was also verified in
  headless Chrome (puppeteer, not committed to avoid the dep).

- Docs: docs/web-integration.md (architecture/seams/testing) + the
  integrations/web/README.md; AGENTS.md layout table updated.

Payload for a full x86-64 decompiler in the tab: ~1.7 MB wasm + ~0.46 MB specs
(gzipped) ~= 2.2 MB; cold decompile ~0.45 s. The minimal x86-64 spec set
(536 KB) is byte-identical to the full 29 MB tree. x86-64 is the demo's shipped
arch (a payload choice, not an engine limit).

Gates: binaries/check-spec/test(PARITY OK)/test-stages green; `make rust-test`
carries the 3 failures that already fail identically on main (the
ghangr-iteexpr.xml em-dash + two kuna_phases catalog-count tests) — this change
adds zero new failures.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01AWQn87SXCEpwJfJPeY6SNz
…expr)

#161 added the `iteexpr` settable but left five test expectations stale, so
`make test-stages` and `make rust-test` have been red on main since it merged
(the merge's "gates green" claim was wrong). No engine behavior change — test
data + expectations only.

- tests/stages/ghangr-iteexpr.xml: four comment lines contained `--`, which is
  illegal inside an XML comment, so the ASCII stages parser errored the whole
  file out. Rephrased to drop the `--`.
- tests/stages/kuna-catalog.xml: iteexpr is tagged source_decompiler=angr and
  change_kind=structure-recovery, so the catalog now has 30 angr / 19
  structure-recovery entries. Added iteexpr to assertions #6/#7 and bumped their
  counts 29→30 and 18→19.
- docs/baseline-stages.json: regenerated (now 261/261, PARITY OK).
- kuna_phases/tests.rs: emit_catalog_json_static_form `},\n` count 74→75 (one
  more settable); option_values test — added iteexpr to the no-live-reader
  allowlist (print-only, like iteregion) and renamed the suppressed count 38→39.

Gates: make test 675/675 PARITY OK, test-stages 261/261, rust-test green,
check-spec OK.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_0197dWa5QYabZofMfLDC1YP4
@mahaloz
mahaloz merged commit 3144554 into main Jul 12, 2026
@mahaloz
mahaloz deleted the fix/iteexpr-stages-regression branch July 12, 2026 22:54
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