Skip to content

testgen: emit the upstream json-from-wast schema - #293

Merged
lannbot merged 1 commit into
mainfrom
testgen/json-from-wast
Sep 7, 2026
Merged

testgen: emit the upstream json-from-wast schema#293
lannbot merged 1 commit into
mainfrom
testgen/json-from-wast

Conversation

@lannbot

@lannbot lannbot commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

What

crates/testgen now drives the upstream json-from-wast crate (0.258, the wasm-tools json-from-wast implementation, also what wasmtime's own wast runner uses in-process) instead of its bespoke emitter. convert.rs and json.rs are deleted; the JSON schema is upstream's, unmodified.

Why

The README's reasons for owning the emitter were stale: the wasm-tools CLI's parser lag was version skew (linking the crate at the pinned release train fixes it — 67/67 files parse), and upstream's component-value encoding is specified by its serde derives. The kind: module|component extension is replaced by a preamble sniff in the runner (artifactKind); the executor routing is unchanged.

Harness migration

  • schema.ts / value-mapping.ts: upstream shapes (bool as boolean, record [name, v][], variant {case, payload?}, result {Ok|Err}, signed core ints).
  • line semantics: upstream keys module-/action-bearing asserts by the inner form's line. xfail.ts and harness/browser/expectations/webkit.ts were remapped mechanically by command index against the previous output (same command count and type sequence per file; 509/1511 lines moved). The webkit overlay remap is verified mechanically only — no local browser cache; the post-merge browser lane is the check.
  • 10 pre-existing dead xfail entries (async/trap-if-sync-and-waitable-set.json old lines 281–299, which the file's own comment says were displaced when it grew) deleted. The stale-xfail detector only catches xfails that pass, not entries matching no command — follow-up candidate.

Gates

just gha::core exit 0 locally (corpus 67 files/1511 commands/0 failures; conformance 1284 passed / 0 failed / 127 xfail / 95 pending-runtime / 5 unsupported-directive — same as before modulo the 10 dead entries; test-rust drift check, test-runtime 702, sched-seeds, shells sm/node/bun all green). Independent review round applied (accretion deletions in schema.ts, comment fixes).

No published surface touched; no lockstep bump. Automerge armed.

Replace testgen's hand-written wast->JSON emitter (~700 lines, its own
`kind` tag and component-value encoding) with the upstream `json-from-wast`
crate at the pinned wasm-tools release train (0.258) - the implementation
of `wasm-tools json-from-wast` and the same conversion wasmtime's wast
runner performs in-process. The reasons recorded for owning the emitter
no longer hold: the parser lag was version skew (fixed by linking the
crate, not owning a copy), and upstream's value encoding is specified by
its serde derives.

Harness migrates to upstream's schema unmodified: `schema.ts` mirrors the
exercised subset of json-from-wast's lib.rs; `value-mapping.ts` handles
bool-as-boolean, record `[name, v][]`, variant `{case, payload?}`,
result `{Ok|Err}`; the runner classifies core module vs component from
the binary preamble (`artifactKind`) since the JSON no longer says.

Upstream's `line` for module-/action-bearing asserts is the inner form's
line, so the (file, line)-keyed xfail entries and the webkit lane overlay
were remapped by command index against the previous output (same
directive order; 509 of 1511 lines moved). Ten xfail entries in
async/trap-if-sync-and-waitable-set.json referenced lines that had not
existed in the corpus since the file grew upstream; deleted.
@lannbot
lannbot enabled auto-merge September 7, 2026 01:46
@lannbot
lannbot merged commit f367f95 into main Sep 7, 2026
4 checks passed
@lannbot
lannbot deleted the testgen/json-from-wast branch September 7, 2026 01:51
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.

2 participants