Repository navigation
fix(tests): repair test-stages + rust-test regressions from #161 (iteexpr) - #167
Merged
Merged
Conversation
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
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.
What
main has been red on
make test-stagesandmake rust-testsince #161 merged — that PR added theiteexprsettable 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
ghangr-iteexpr.xml--(illegal in XML comments) → ASCII parser errored the file--source_decompiler=angr→ 30 entries, assertion expected 29change_kind=structure-recovery→ 19 entries, expected 18emit_catalog_json_static_form},\n, expected 74option_values_…_suppressed_for_38docs/baseline-stages.jsonregenerated (261/261).Gates
make test— 675/675 PARITY OKmake test-stages— 261/261 PARITY OKmake rust-test— green (0 failures)make check-spec— OK🤖 Generated with Claude Code