Skip to content

impl(027): increment 5, the WebAssembly package - #130

Merged
bartekus merged 1 commit into
mainfrom
impl/027-wasm
Oct 21, 2026
Merged

bartekus merged 1 commit into
mainfrom
impl/027-wasm

Conversation

@bartekus

@bartekus bartekus commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Spec 027, increment 5: the WebAssembly package. Stacked on #129.

  • integrations/rustev-wasm (publish = false, npm only; excluded from the crates.io release set): version, check, compile, show, replay, eval, gate, calibrateFit, calibrateQualify through rustev-surface with an in-memory host (rustev_surface::host::Memory, new, also used by the surface's tests). No runtime, backend, sink or clock; time is an argument; external items resolve through a synchronous host callback.
  • make bindings: exact pins (wasm-bindgen-cli 0.2.129 = crate, wasm-opt 116), web/bundler/nodejs targets at -Oz (a wasm cargo profile used only here), declaration drift check plus strict type-check, import allowlist, size and instantiation budgets with a measurement document, and the JavaScript conformance runner.
  • Declarations: rustev-documents.d.ts generated offline from the committed schemas by json-schema-to-typescript 16.0.0 (committed lockfile), type-checked by TypeScript 5.9.3 strict. Generated: 10k of this PR's lines.
  • Imports: only wasm-bindgen glue, each reviewed in wasm-imports.json.
  • Conformance: the harvest marks pure-command cases for the wasm surface and records rules programs' derived descriptors; all 23 such cases print the CLI's golden bytes and exit codes on WebAssembly.
  • Measurement (local): raw 2,215,589 B (over the 2,097,152 B budget by 5.6%), gzip 762,689 B (under 786,432), Brotli 543,501 B, Node instantiation median 3.5 ms (budget 50). make bindings fails at the raw gate as 3.10.4 requires; the budget change is drafted as spec 046 for the owner. Chromium timing and the CI measurement come with the bindings job (increment 7).

Review round 1 (2 findings): (1) the resolver passes up to maxBytes plus one byte on purpose, so the library classes an item past its budget oversized exactly as for the CLI's store, which reads one byte past the maximum; the comment now says so (anything longer is inaccessible). (2) Fixed: the memory host names the case: an output that already exists, or a label that names an input. Declarations regenerated after #126's schema change (Timestamp range).

Review round 2 (3 findings): (1) fixed: make bindings refuses first when cargo metadata names no target directory, so no path is built from an empty prefix. (2) fixed: Memory's outputs are private, with an output(label) copy accessor; only create and write_all borrow them, never across a call. (3) No case names wasm on a run (the harvest gives run cases cli and native; run is no WebAssembly command, 3.1.1), so none throws today; the runner now reports such a case as a failure instead of ending, and the code says why. Restacked on #129.

Review round 3 (4 findings): (1) "private": true is deliberate until publication: spec 031 owns the npm release and makes the package publishable then, so no build of this increment can be published by accident; the spec record says so. (2) fixed: a test pins join: an empty directory is the binding's top level, so the label is the name alone. (3) lodash 4.18.1 is published on the public registry (npm view [email protected] version answers 4.18.1) and the lockfile resolves it from registry.npmjs.org with its integrity hash. (4) fixed: a throwing module call fails its case and the runner continues.

Review round 4 (4 findings): (1) fixed: a derived descriptor that does not canonicalize fails the harvest naming its program, never a silent gap. (2) fixed: Memory's inputs are private like its outputs, read through inputs(). (3) Repeated: lodash 4.18.1 is on the public registry (npm view [email protected] version answers 4.18.1); the lockfile resolves it from registry.npmjs.org with its integrity hash, so the slot is not unclaimed. (4) No run case names wasm: the harvest gives a case wasm only when its command is pure, and every run case's surfaces are ["cli"] in this branch (native joins in #132). Restacked on #129.

Review round 5 (6 findings): (1) Refusing an output that names an input is deliberate and matches the CLI: on a file system the input is a file at that path and the file host refuses to replace it, so every surface gives the same outcome; the code says so. (2) fixed: CARGO_TARGET is read by parsing cargo's JSON, not by a regex. (3) fixed: the unreachable error arm is an expect stating why (ms admits at most 2^53 - 1). (4) fixed: the harvest refuses a --rules argument that is not a plain relative path before writing a descriptor under it. (5) fixed: wasm-check.mjs parses --chromium-ms, records the median and fails it against the 3.10.6 budget (the CI job of increment 7 supplies it). (6) Repeated and wrong: lodash 4.18.1 is published (npm view [email protected] version), and npm ci installs it from the lockfile locally and in CI. Restacked on #129.

Review round 6 (3 findings): (1) fixed: the message states the requirement (must be a non-negative integer). (2) No case names wasm on a run: every case whose command is run lists ["cli"] in this branch (checked over all case files), and the manifest aggregates them unchanged. (3) fixed: a flag without a value fails the case naming it; every flag of the harvested commands takes one value (checked over all case files).

Review round 7 (1 finding, fixed): CARGO_TARGET is evaluated lazily, once, on first use, so only make bindings runs cargo metadata and node; other targets pay nothing.

Review round 8 (2 findings, the same as rounds before): no run case names wasm. The diff placed new derived entries on the run cases next to the wasm surface added to neighbouring pure cases. To leave nothing to misread, the harvest now records derived descriptors only for the cases the WebAssembly surface runs (plan check, plan compile, plan show, replay), so this PR no longer changes any run case: every run case keeps its surfaces ["cli"] and gains nothing. wasm 23/23.

Also fixed here (raised on #131, rounds 1 to 4): in the plan namespaces, AddressOverride.to and RemediationDecl.for showed the Party type's description instead of their own rule. The schemas were right; the generator took whichever description a referenced type was first resolved with. gen-types.mjs now wraps a reference that has its own description in allOf, so every field keeps its own text (to: never caller) and shared types become named (Party, Grade, Predicate) instead of inlined; shapes are unchanged and tsc --strict passes.

Review round 9 (2 findings, fixed): (1) the store resolver is resolveItem, no longer shadowing path.resolve. (2) a failed instantiation sample is recorded as a 3.10.5 failure and the measurement document is still written.

Review round 10 (5 findings): (1) fixed: the wasm-opt pin matches the whole version token (wasm-opt version 116 then a space or the end), so 1160 fails it. (2) Repeated: refusing an output that names an input matches the file host, where the input is an existing file and ensure_absent refuses it the same way; the code says so. (3) Known and recorded: the raw size is over its 3.10.4 budget, which draft spec 046 addresses; until the owner decides, the gate reports it rather than the budget being weakened. (4) fixed: an output without normalize is read as having none. (5) The allowlist is every module name with every base name on purpose: the same reviewed glue is imported from wbg or ./rustev_wasm_bg.js depending on the target; the check says so.

Review round 11 (4 findings): (1) fixed: make expands a recipe's lines before running the first, so the target directory is read before the Node check whatever the order; the refusal now names what it needs (cargo metadata and Node 20 or later on PATH). (2) Not a defect: max_bytes goes to the host only as a hint; the guard compares the returned length with it as integers, and on wasm32 a usize is 32 bits, exact as an f64; the code says so. (3) A harvest that would write outside its fixtures is a broken test, not a case to skip: the test fails loudly, and the harvest rewrites its output on the next run. (4) Verified: the lockfile's integrity for lodash 4.18.1 equals the registry's (npm view [email protected] dist.integrity gives the same sha512-dMIn...0Q==).

Review round 12 (1 finding, fixed): each case, comparison included, runs in its own runCase under the per-case catch, so a throw while reading a golden fails that case only.

Review round 13 (1 finding, fixed): a replay case without --now-ms fails naming the flag (flags().need) instead of passing NaN on (which the Rust side would also refuse).

Review round 14 (3 findings, all raised before): (1) lodash 4.18.1 is published, and its lockfile integrity equals the registry's (verified in round 13 and earlier). (2) A case that names the wasm surface for a command it lacks is a failure by design, counted as run: the suite must not silently skip a case it claims. (3) To settle it, the allowlist is now the exact reviewed module:name pairs (22, both targets' module names), checked as pairs.

Review round 15 (3 findings): (1) fixed: a case file from an earlier harvest must record the same derived descriptors this harvest wrote, or the harvest fails and says to rebuild; run cases now carry the harvest's own "derived": [], so every committed case file is reproduced byte for byte by make conformance-harvest (the wall-clock replay bundles aside). (2) fixed: the flags a command cannot run without (definition, out, plan, bundle, now-ms) fail the case by name when absent. (3) No WebAssembly case pins a written output today (every one pins stdout), so nothing passed vacuously; a case that did is now compared against the artifact the command published under that name, never skipped.

Review round 16 (1 finding, raised in earlier rounds too): lodash 4.18.1 was published on the public registry on 2026-04-01 (after the reviewer's knowledge cutoff), and the lockfile's integrity equals the registry's sha512-dMIn...0Q== (npm view [email protected] time dist.integrity); it is json-schema-to-typescript 16.0.0's dependency and npm ci installs it. The package now records this in its // note, so the diff carries the evidence.

Review round 17 (1 finding): verified, and now verified on every build: npm view [email protected] dist.integrity equals the lockfile's sha512-dMIn...0Q==, and make bindings now runs npm audit signatures after npm ci, which checks every installed package's registry signature (locally: 16 packages with verified registry signatures, lodash 4.18.1 among them).

Review round 18 (2 findings): (1) fixed: every path the bindings recipe builds from BINDINGS_OUT or CARGO_TARGET is quoted, so a target directory with a space is passed whole. (2) The spec says nothing about lodash (no "4.18.1" appears in it), and lodash 4.18.1 is published (2026-04-01) and now verified by registry signature on every make bindings (npm audit signatures: 16 packages verified); npm ci installs it.

Review round 19 (3 findings): (1) js-yaml 4.3.2 is published (npm view [email protected] version dist.integrity), as is every package in the lockfile; the package's note now covers the whole tree rather than one package at a time: npm ci checks each package against its locked integrity, and make bindings verifies every installed package's registry signature (16 verified). (2) fixed: each scope mode's fields are required, so a replay case without them fails by name. (3) The hash width is fixed by the exact wasm-bindgen pin (0.2.129, 3.10.2); a new pin that changes it fails the allowlist loudly, which is wanted; the code says so.

Review round 20 (4 findings): (1) fixed: a test pins that an output naming an input is refused. (2) fixed: a case file from an earlier harvest must also record the same surfaces. (3) fixed: each built target directory carries its module type (web and bundler ES modules, node CommonJS, written by make bindings), and the exports name the matching conditions (import, require); Node no longer warns that the module type is unspecified. (4) Already done as asked: make bindings runs npm audit signatures after npm ci (16 packages with verified registry signatures, lodash 4.18.1 among them), which checks provenance, not only content.

Review round 21 (1 finding, resolved): the owner ratified spec 046 (A-43, #136), raising the raw budget to 2,621,440 bytes and keeping the gzip and instantiation budgets and the gate; wasm-opt could not close the gap (-Oz is the smallest at 2,216,152 bytes). The measurement check now applies the 046 budget, and make bindings passes end to end (wasm conformance 23/23). The spec 027 record says so.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

Reviewing the group 1 files for bugs, security problems, and inconsistencies.

integrations/rustev-wasm/src/lib.rs — Callback::resolve

The acceptability check for the JS callback's return value is:

Ok(a) if (a.length() as usize) <= max_bytes.saturating_add(1) => {
    Resolution::Bytes(a.to_vec())
}

The doc comment directly above the struct says: "a throw, a non-byte value or an oversized answer is inaccessible, as for the CLI's store." But the condition admits arrays of size max_bytes + 1, treating them as valid bytes rather than Resolution::Inaccessible. The +1 is inconsistent with the stated contract. If the surface layer already calls resolve with max + 1 (following the read_classified "ask one extra byte" pattern), the bound becomes max + 2, which is doubly wrong. If it calls with max exactly, an oversized response of max + 1 bytes silently passes through. Either way the condition should be <= max_bytes.

crates/rustev-surface/src/host.rs — Memory::ensure_absent error message

The check was extended to also reject labels present in inputs:

if self.outputs.borrow().contains_key(label) || self.inputs.contains_key(label) {
    return Err(IoFail { ..., detail: "already exists; outputs are never overwritten".into() });
}

When the label is found in inputs, the error detail "outputs are never overwritten" is factually incorrect and misleading for callers interpreting the failure.

crates/rustev-surface/tests/memory_host.rs — join behaviour change

The deleted in-test Memory::join returned format!("{dir}/{name}"), producing a leading slash when dir is empty (i.e. "/name"). The promoted library version correctly branches on dir.is_empty(). Tests that previously produced a leading-slash path will now produce bare names; if any golden comparison depended on that slash the test will silently diverge. Worth verifying no golden fixture bakes a /-prefixed output key.

No issues found in the conformance JSON case updates, Cargo manifests, TypeScript declarations, or the Makefile pin-checking logic.

{"head": "12dfcd01d233455853fe2f963315af7fcc67e2a7", "verdict": "findings", "findings": [{"path": "integrations/rustev-wasm/src/lib.rs", "line": 211, "summary": "Callback::resolve accepts arrays up to max_bytes+1 as Resolution::Bytes, contradicting the doc comment that says oversized answers are inaccessible; condition should be <= max_bytes."}, {"path": "crates/rustev-surface/src/host.rs", "line": 107, "summary": "ensure_absent error detail says 'outputs are never overwritten' but the guard now also fires when the label matches an input, making the message factually wrong in that branch."}]}

Group 2 of 2

Reviewing group 2: manifest/case JSON updates, new descriptor fixtures, updated replay bundles, new JS tooling (run.mjs, wasm-check.mjs, gen-types.mjs), and src/lib.rs struct additions.

Manifest/case JSON (manifest.json, support.run.json, support.show.json):

  • derived entries are added consistently across standalone case files and the manifest.
  • "wasm" surface is only added to plan check, plan compile, plan show, and replay command cases — never to run command cases. This is internally consistent with the switch in run.mjs which has no run branch.
  • SHA-256 updates for lodging.replay and support.replay bundles are consistent with the updated fixture files.

Descriptor fixtures:

  • All support.* descriptors are byte-identical (sha256 98070801…); all lodging.* descriptors are byte-identical (a3c75a…). Consistent with the same backend being referenced across all cases.

run.mjs:

  • pinned() is applied both to c.inputs and to c.derived, so all file bytes are integrity-verified before use.
  • The derived-substitution logic (derived.get(name) ?? bytes) correctly replaces rules files with their pre-compiled descriptors for surfaces without a rules backend.
  • The scope() function maps CLI flag value tenant-only to JSON field tenant_only (hyphen→underscore). This appears intentional and consistent with Rust enum conventions.
  • The resolve callback in replay draws only from files, which has already been populated with pinned() content. No integrity gap.

wasm-check.mjs:

  • The child process spawned for timing samples uses process.execPath (trusted path) and passes the child script via -e through spawnSync, not a shell — no injection surface.
  • JSON.stringify is used to embed gluePath/wasmPath into the child script string, preventing code injection.

gen-types.mjs:

  • The --check branch skips the missing rustev-node target with t.includes('rustev-node'), which is unambiguous given the two-element targets array.
  • If the wasm types file is absent under --check, got becomes '' and the check correctly fails — appropriate behavior.

src/lib.rs:

  • Derived struct is deny_unknown_fields, consistent with the other structs. derived field on Case uses #[serde(default)] so it's backwards-compatible with existing case files that lack the field.

No bugs, security issues, or meaningful inconsistencies found.

{"head": "12dfcd01d233455853fe2f963315af7fcc67e2a7", "verdict": "no-findings", "findings": []}

Subject: d3ddd6f...12dfcd0, diff digest 4d866bd52791f3d4ccbb0431574f63bf19b68e9d488372608abad24c2dffa1af, 2 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

Reviewing the group 1 changed files for bugs, security problems, and inconsistencies.

Makefile — CARGO_TARGET can collapse to an empty string

CARGO_TARGET := $(shell cargo metadata --format-version 1 --no-deps 2>/dev/null | sed -n 's/.*"target_directory":"\([^"]*\)".*/\1/p')
BINDINGS_OUT := $(CARGO_TARGET)/bindings

If cargo metadata fails (no Cargo in PATH, network error, etc.) or the sed pattern doesn't match (e.g. a JSON value with an escaped character), CARGO_TARGET becomes the empty string, so BINDINGS_OUT becomes /bindings. This causes:

  • rm -rf /bindings/rustev-wasm — silently no-ops unless /bindings happens to exist, in which case it destroys it.
  • node … /wasm-measurement.json — attempts to write to the root filesystem.

A safe fix is a fallback: $(or $(shell …), target).

crates/rustev-surface/src/host.rs — pub outputs: RefCell<…> on a pub struct

Memory is now a public API type. Its outputs field is exposed as pub RefCell<…>. Any caller that takes a &Memory, calls outputs.borrow() or outputs.borrow_mut(), and then calls create() or write_all() on the same reference will trigger a runtime RefCell borrow panic, because those methods also borrow outputs internally. The current WASM bindings don't hit this (they only call into_outputs()), but the public API admits the pattern. Fields should be private.

Everything else looks correct and consistent with the spec: the command_of → pure → surfaces logic is sound, replay_config handles NaN/infinity correctly via the range check, the Callback resolver's saturating_add(1) is intentional, the rollback in write_all is correct, and the bundle hash changes are expected.

{"head": "c77d57143f147612455fab8f1b6a0f2ef95c639e", "verdict": "findings", "findings": [{"path": "Makefile", "line": 94, "summary": "CARGO_TARGET is derived via sed on cargo metadata with stderr suppressed; if the shell command produces nothing, BINDINGS_OUT becomes /bindings, causing rm -rf /bindings/rustev-wasm and writes to /wasm-measurement.json on subsequent targets."}, {"path": "crates/rustev-surface/src/host.rs", "line": 74, "summary": "outputs is pub RefCell on a pub struct, so a caller that borrows outputs directly while also calling create() or write_all() will trigger a runtime RefCell borrow panic; the field should be private."}]}

Group 2 of 2

Reviewing the diff for group 2, focused on the new JS tooling and fixture changes.

Finding: run.mjs — missing run command handler

runWasm dispatches on a.command (the non-flag prefix of c.argv). The switch handles plan check, plan compile, plan show, and replay, then falls through to:

default:
  throw new Error(`${c.id}: the WebAssembly surface has no command ${a.command}`);

Six cases now list "wasm" in their surfaces and use command: "run" in the manifest: actionable.run-needs, actionable.run-propose, actionable.run-refused, actionable.run-unresolved, lodging.run, and support.run. When the runner filters manifest.cases by surface and calls runWasm(c) on any of these, the uncaught exception propagates out of the for loop and crashes the process. No failures are recorded; the process exits non-zero from an unhandled throw, not the clean if (failures.length || ran === 0) path at line 134.

run.mjs:106 — the for-loop has no try/catch around runWasm(c), so the first run-command case kills the runner.

Everything else looks consistent: the Derived struct in src/lib.rs matches the JSON shape added to the manifest and individual case files; SHA-256 pins in the manifest are updated in sync with the regenerated bundle fixtures; the import allowlist in wasm-imports.json excludes time, randomness, network and WASI imports as the comment states; the gen-types.mjs --check path correctly skips the absent rustev-node target.

{"head": "c77d57143f147612455fab8f1b6a0f2ef95c639e", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/run.mjs", "line": 106, "summary": "runWasm has no case for the 'run' command, so the six wasm-surface cases that use command:run throw an uncaught error and crash the conformance runner instead of recording failures."}]}

Subject: ff4477d...c77d571, diff digest 65c95d5dd1a60177e8b4728de0595852b81a1d8cd855e734dffc3bb80785200a, 2 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

integrations/rustev-wasm/package.json — "private": true directly contradicts the spec's stated intent: the spec says this package is "shipped only through npm" (integrations/rustev-wasm/Cargo.toml even annotates publish = false to mean excluded from crates.io, shipped via npm). With "private": true, npm publish will error unconditionally, making the package unpublishable to any registry. This is not the same issue as the declared-but-exceeded raw-byte budget (which has a spec amendment path); this flag would silently block the entire distribution channel.

crates/rustev-surface/src/host.rs — the join implementation now special-cases an empty dir to return just name rather than /{name}. This is a silent behavior change from the test-only Memory it replaces (which always format!("{dir}/{name}")), and the test suite does not exercise join directly. The new behavior is correct for the empty-dir case, but existing callers that pass non-empty directories were relying on a different contract; worth verifying no surface command ever hands in a non-empty dir that now resolves differently.

{"head": "9e68054e12cf506af7138263a4c3bfeec922fb4d", "verdict": "findings", "findings": [{"path": "integrations/rustev-wasm/package.json", "line": 5, "summary": "\"private\": true prevents npm publish, contradicting the spec's stated delivery mechanism of shipping the module only through npm."}, {"path": "crates/rustev-surface/src/host.rs", "line": 121, "summary": "join() now returns just `name` when dir is empty, silently changing behaviour from the replaced test-only Memory which always produced \"{dir}/{name}\"; the change is likely correct but is untested and diverges from the prior contract."}]}

Group 2 of 2

Reviewing this group (conformance JS tooling, fixture descriptor files, bundle updates, manifest additions, Rust lib.rs change).

Finding 1 — package-lock.json: lodash resolved at a non-existent version

tools/rustev-conformance/js/package-lock.json pins lodash at version 4.18.1. The lodash 4.x series has had no releases since 4.17.21 (late 2021); 4.18.x has never been published to npm. The parent [email protected] lists the constraint "lodash": "^4.18.1", which would resolve to nothing on the public registry. This lockfile entry either cannot install (npm ci would fail) or resolves from an undeclared private registry, indicating the lockfile was hand-crafted rather than generated. Either scenario is a supply-chain integrity concern.

Finding 2 — run.mjs: exceptions from WASM glue crash the runner

runWasm() calls glue.check(...), glue.compile(...), glue.show(...), and glue.replay(...) with no try/catch. If the WebAssembly module throws (e.g., on a malformed fixture or a contract violation), the exception propagates to the top-level loop, crashing the runner and leaving subsequent test cases unexecuted and unreported. The pattern should record the failure and continue, consistent with how the null branch is already handled (lines 115–118).

No other significant issues: the import-allowlist check in wasm-check.mjs is post-hoc on the module's declared imports (not a running module), the scope() function's tenant-only → tenant_only transform appears intentional, the Derived struct in lib.rs is correctly marked deny_unknown_fields, and the new descriptor fixture files are internally consistent (all support-routing descriptors share one hash, all lodging descriptors share another, matching the derived entries in the manifest).

{"head": "9e68054e12cf506af7138263a4c3bfeec922fb4d", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/package-lock.json", "line": null, "summary": "lodash is resolved at version 4.18.1, which has never been published to npm (4.x peaked at 4.17.21 with no releases since 2021), indicating a fabricated or private-registry lockfile entry that cannot install from the public registry."}, {"path": "tools/rustev-conformance/js/run.mjs", "line": 112, "summary": "runWasm() calls glue.check/compile/show/replay with no try/catch, so any exception thrown by the WebAssembly module crashes the entire conformance runner rather than recording the case as failed and continuing."}]}

Subject: 88a7b22...9e68054, diff digest 6ca2043067d183750a329be9793169c1492c164b79f45da2ccfdc48bf5656e36, 2 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

Reviewing the diff for the WebAssembly binding increment (spec 027-5).

Overall: The implementation is structurally sound. The Memory host promotion from test-local to library code is clean, the WASM binding follows the spec's no-runtime / no-backend constraints, and the conformance fixture changes are consistent with adding derived descriptors and the wasm surface.

Specific findings:

harvest.rs, line ~220: Document::canonical(b.descriptor()).unwrap() — the call is unconditionally unwrapped. If canonicalization fails (e.g., a malformed descriptor from a rules backend), the harvest mode test panics rather than skipping or continuing. This is test-only code run under RUSTEV_HARVEST=1, so it would only affect developers regenerating fixtures, but a graceful continue would be safer.

host.rs, Memory.inputs is pub: The outputs field is private (guarded by RefCell with the rationale documented in the comment), but inputs is public. Any caller holding a &mut Memory can inject or remove inputs after a command's create calls have already run ensure_absent against those inputs, which could silently change what an in-flight operation sees. In the current WASM binding a fresh Memory is created per call so this can't be triggered in practice, but the exposure is wider than necessary given that new(inputs) and the Default constructor already cover construction.

lib.rs, Callback::resolve: When max_bytes is passed as JsValue::from_f64(max_bytes as f64), for very large limits (> 2^53) f64 would lose precision. The spec bounds inputs to max_projection_bytes (a definition-declared small value), so this is harmless in practice but worth noting if limits are ever raised.

No security vulnerabilities found. The --ignore-scripts flag in the npm ci call is appropriately defensive. The version pin strategy (=0.2.129, =0.3.106) for wasm-bindgen crates is correct. The documented raw-budget exceedance is honest and the spec amendment path is noted.

{"head": "df762d09f564d24e0cb1e9f379268b4da9c9ae9f", "verdict": "findings", "findings": [{"path": "crates/rustev-cli/tests/common/harvest.rs", "line": 220, "summary": "Unconditional unwrap on Document::canonical(b.descriptor()) during harvest mode will panic instead of skipping if canonicalization fails for any loaded rules backend."}, {"path": "crates/rustev-surface/src/host.rs", "line": 72, "summary": "Memory.inputs is pub, allowing callers to mutate the inputs map after ensure_absent has already checked it, which could silently alter what a subsequent create call observes in the same Memory instance."}]}

Group 2 of 2

Reviewing the changes in group 2. The bulk of the diff is mechanical: new .descriptor.json fixture files, derived fields added to case definitions, and "wasm" added to surfaces arrays. I'll focus on anomalies.

Finding 1 – Nonexistent lodash version in package-lock.json

tools/rustev-conformance/js/package-lock.json pins [email protected]. The latest 4.x release of lodash is 4.17.21 (2021); no 4.18.x exists in the registry. The parent [email protected] entry also declares "lodash": "^4.18.1" as a dependency floor—an impossible lower bound. npm ci against this lockfile will either fail to resolve the package or, if a malicious actor registers [email protected] later, install attacker-controlled code. The entire package-lock.json should be regenerated against a verified install.

Finding 2 – support.run incorrectly listed under the wasm surface

In tools/rustev-conformance/cases/cli/support.run.json (and its mirror in manifest.json) the diff adds "wasm" to surfaces. The command is "run". The conformance runner in tools/rustev-conformance/js/run.mjs falls through to default for run, returns null, and then immediately appends a failure:

if (r === null) {
  failures.push(`${c.id}: the WebAssembly surface has no command ${flags(c.argv).command}`);

The code comment even says "the harvest never names wasm on a run case". Marking support.run as a wasm case will make the WASM conformance run unconditionally report one failure.

{"head": "df762d09f564d24e0cb1e9f379268b4da9c9ae9f", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/package-lock.json", "line": null, "summary": "Pins [email protected], a version that does not exist in the npm registry (latest 4.x is 4.17.21), creating a supply-chain risk if that slot is ever claimed."}, {"path": "tools/rustev-conformance/cases/cli/support.run.json", "line": null, "summary": "Adds 'wasm' to the surfaces of a 'run' command case; the WASM conformance runner has no 'run' command and will unconditionally report this case as a failure."}]}

Subject: 76ad8ab...df762d0, diff digest 6605d9691b4c7e963a9c7989f54baa8d7398481d8ef8b898922177b2d4ba3321, 2 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception October 20, 2026 17:45 — with GitHub Actions Inactive
@bartekus
bartekus force-pushed the impl/027-conformance branch from 76ad8ab to 7c30621 Compare October 20, 2026 17:48
@bartekus
bartekus force-pushed the impl/027-wasm branch 2 times, most recently from bc678f4 to 6054b28 Compare October 20, 2026 17:49
@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

Looking at the changed code in group 1:

Makefile — wasm-opt version pin uses prefix matching

@$(WASM_OPT) --version | grep -q "^$(WASM_OPT_PIN)" || ...
WASM_OPT_PIN := wasm-opt version 116

grep -q "^wasm-opt version 116" is a prefix test, not an exact match. A hypothetical future binary reporting wasm-opt version 1160 would silently pass the pin check. The wasm-bindgen pin above uses exact equality (= "wasm-bindgen 0.2.129"); this one should too.

crates/rustev-surface/src/host.rs — Memory::ensure_absent silently extends the Host contract

The file-system host fails on a conflicting path with an OS error; the new Memory adds a new rejection class (label matching an input key) that the trait contract does not document. Any surface code that passes the same label for both an input and a requested output will get an IoFail from Memory but would succeed (or fail differently) on the file host. The divergence is intentional per the comments but invisible at the trait boundary — callers written against the file host could be surprised. At minimum the Host trait's ensure_absent documentation should state this invariant.

crates/rustev-surface/src/host.rs — write_all hold-then-release ordering is safe but worth confirming

Inside write_all, on failure at index i the code immediately borrows self.outputs mutably for rollback. Because self.create() returns a plain Result (both internal borrows are dropped before it returns), no RefCell borrow is live at that point, so no panic. Correct, but non-obvious — the inline comment documents only the "all or none" intent, not the borrow-safety argument.

specs/027-node-and-wasm-bindings/spec.md — make bindings is documented to fail its own gate

The spec text explicitly states the raw-size gate (make bindings, section 3.10.4) will fail because the WASM module is 5.6% over the 2 MB budget, and draft spec 046 must ratify a new budget before it can pass. Any CI job that runs make bindings will permanently fail until that amendment lands. This is intentional per the spec, but it means the bindings workflow cannot be green-lit in this increment.

integrations/rustev-wasm/src/lib.rs:220 — max_bytes as f64 truncation

&JsValue::from_f64(max_bytes as f64),

For max_bytes values above 2^53 the cast loses precision and the JavaScript callback receives a rounded value; the subsequent length comparison against the original max_bytes is still done exactly in Rust, so oversized detection remains correct. In practice document-size limits won't approach 2^53, making this a theoretical rather than practical concern.

{"head": "04eed4d46ef09689a539f72307ff0580dcd658f2", "verdict": "findings", "findings": [{"path": "Makefile", "line": 108, "summary": "wasm-opt version pin uses prefix matching (grep '^wasm-opt version 116') instead of an exact check, so a future binary reporting e.g. 'wasm-opt version 1160' would silently satisfy the pin."}, {"path": "crates/rustev-surface/src/host.rs", "line": 104, "summary": "Memory::ensure_absent rejects labels that name an input, which is not part of the Host trait contract and diverges silently from the file-system host; callers written against the file host will see unexpected IoFail."}, {"path": "specs/027-node-and-wasm-bindings/spec.md", "line": 892, "summary": "The spec documents that make bindings will always fail the raw-size gate (module is 5.6% over budget), meaning any CI job running that target cannot pass until spec 046 is ratified."}]}

Group 2 of 2

Reviewing the JS tooling, manifest updates, fixture files, and Rust struct additions.

tools/rustev-conformance/js/run.mjs, line 89: o.normalize.length will throw a TypeError if any output object in the manifest omits the normalize field (accessing .length on undefined). The Rust Output struct likely uses #[serde(default)] so this is unlikely to fire today, but the JS side is not defensive — it should be (o.normalize ?? []).length.

tools/rustev-conformance/js/wasm-check.mjs, lines 65–66: The import allowlist check validates module and name independently:

if (!allowed.modules.includes(i.module) || !allowed.names.includes(base))

An import from an allowed module with a name that happens to appear in the names list (even if that pairing was never reviewed) would pass silently. The allowlist intent is to gate specific (module, name) pairs; the check should verify the tuple, not each side independently.

Everything else looks consistent: the Derived struct in lib.rs is correct and deny_unknown_fields-guarded, the manifest derived arrays are properly empty for cases that use bundles (replay) or have no rules file (refusal-16/17), the descriptor fixture files are internally consistent per backend type, the bundle updates reflect minor timing changes with unchanged decision outcomes, and the release-set.json exclusion is correctly reasoned.

{"head": "04eed4d46ef09689a539f72307ff0580dcd658f2", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/run.mjs", "line": 89, "summary": "Accessing `o.normalize.length` throws TypeError when the `normalize` field is absent from a manifest output object; should guard with `(o.normalize ?? []).length`."},{"path": "tools/rustev-conformance/js/wasm-check.mjs", "line": 66, "summary": "Import allowlist check validates module and name independently rather than as (module, name) pairs, so an unanticipated import combining two individually-allowed values would not be caught."}]}

Subject: 116fbd7...04eed4d, diff digest 960a1aaf8bfb83f7c054456fcc51c834b9f7c3ed612fc033848761641ada55e6, 2 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 20, 2026 21:26 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/027-conformance branch from 116fbd7 to a7f99df Compare October 20, 2026 21:34
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Group 1 of 2

Reviewing the diff group 1 carefully across all files.

crates/rustev-surface/src/host.rs — Memory::ensure_absent broadened check

The production Memory correctly checks both outputs and inputs:

} else if self.inputs.contains_key(label) {
    "names an input; an output never replaces one"

This is new behavior vs. the deleted test-local version (which only checked outputs). The write_all rollback logic only unwinds from outputs, which is correct — if create fails at i=0 because the label conflicts with an input, files[..0] is empty and no rollback is needed.

crates/rustev-surface/src/host.rs — join empty-dir fix

Old (deleted) test-local version produced /name for an empty directory prefix. New version returns name directly. This is the correct behavior for the WASM binding's top-level artifact namespace. New test covers both cases.

integrations/rustev-wasm/src/lib.rs — replay_config integer validation

The ms closure bounds f64 to [0.0, 2^53 - 1] before casting to u64, then i64::try_from is guaranteed not to panic since 2^53 - 1 < i64::MAX. Sound.

integrations/rustev-wasm/src/lib.rs — Callback::resolve size check

Ok(a) if (a.length() as usize) <= max_bytes.saturating_add(1) => {

a.length() is u32, saturating_add(1) handles the hypothetical usize::MAX edge case. Matches the spec's "max plus one byte" oversized classification design. Correct.

crates/rustev-cli/tests/common/harvest.rs — path traversal guard

assert!(
    Path::new(name)
        .components()
        .all(|c| matches!(c, std::path::Component::Normal(_))),
    "--rules {name:?} is not a plain relative path"
);

Correctly prevents .. or absolute paths from escaping the fixtures tree when writing derived descriptors. Good.

harvest.rs — command_of used twice with same args

Both the pure check and the "command" field use command_of(&seen.args) on the same immutable args. Results are identical.

Spec 027 — documented size budget exceedance

The raw WASM budget of 2,097,152 bytes is acknowledged to be exceeded by ~5.6%, make bindings is documented to fail at that gate, and draft spec 046 is cited. make bindings is not called by existing CI workflows (no workflow files changed), so this doesn't break CI.

Conformance case SHA256 updates

The lodging-emb.bundle.json and support-emb.bundle.json SHA256 values changed because the bundle fixtures were regenerated (those files are in the changed paths listed in group 2). The case files correctly reflect the new digests.

No bugs, security issues, or material inconsistencies found.

{"head": "2a8eeeb1fe1cb8ab9936454ee78e1152d040312d", "verdict": "no-findings", "findings": []}

Group 2 of 2

The diff adds WebAssembly surface support to the conformance harness: new descriptor fixtures, updated bundle fixtures (timing-only changes), a JS conformance runner, a WASM check tool, and a type generator. Below are my observations.

tools/rustev-conformance/js/gen-types.mjs — the targets array includes integrations/rustev-node/types/rustev-documents.d.ts, which does not exist in the repo. Both --check and write modes guard this correctly (existsSync(dirname(p)) / skip on missing rustev-node), and the comment explains it lands in a later increment. No issue.

tools/rustev-conformance/js/run.mjs — SHA-256 is verified via pinned() before any fixture is consumed (line 29–33). The resolveItem callback only looks up in an in-memory Map, never touches the filesystem again, so there is no path-traversal concern. The flags() parser assumes every flag takes exactly one value, which matches the harvested manifest argv entries.

tools/rustev-conformance/js/wasm-check.mjs — paths embedded in the child-process script string are escaped with JSON.stringify (lines 97–99), so no injection is possible. The import normalisation strips __wbg_ prefix and lowercase 16-hex-char suffix; wasm-bindgen consistently uses lowercase, so this is reliable.

tools/rustev-conformance/js/wasm-imports.json — the allowlist contains no time, randomness, network, storage, DOM, WASI or env entries, which matches the stated constraint.

Manifest changes — lodging.run, support.run, actionable.run-* are not given the wasm surface, consistent with the runner explicitly returning null for the run command (line 143 of run.mjs). SHA-256 values for the new descriptor files are consistent across all identical copies (same content → same hash). The bundle SHA-256 updates match the minor timing mutations in the bundle files.

tools/rustev-conformance/src/lib.rs — Derived struct is deny_unknown_fields, consistent with Input. The derived field on Case is #[serde(default)], so existing cases without it deserialise cleanly.

tools/rustev-release/release-set.json — exclusion of rustev-wasm from the crates.io release set is correctly placed before rustev-conformance.

No bugs, security problems, or meaningful inconsistencies found.

{"head": "2a8eeeb1fe1cb8ab9936454ee78e1152d040312d", "verdict": "no-findings", "findings": []}

Subject: a7f99df...2a8eeeb, diff digest 666d03e84d011e206abdaf1df91731844df9f2eed762b1aed2aa66b7b57c5b00, 2 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

Reviewing the diff for bugs, security problems, and inconsistencies.


Findings

Makefile — misleading error when Node is absent

The CARGO_TARGET lazy-evaluation trick calls node in its shell pipeline (cargo metadata ... | node -e '...'). If Node is not installed, the pipeline produces empty stdout; CARGO_TARGET is set to the empty string. The very first guard in the bindings recipe then fires with the message "bindings: cargo metadata named no target directory", which is misleading — the real problem is that node is missing. The explicit Node version check (@node -e 'process.exit(...)') appears three lines later, after CARGO_TARGET has already been evaluated and found empty. The ordering should be reversed so the clear error fires first.

integrations/rustev-wasm/src/lib.rs:205 — max_bytes as f64 precision loss

&JsValue::from_f64(max_bytes as f64),

usize → f64 is exact only up to 2^53 − 1. For any configured size limit larger than ~9 PB the JavaScript callback receives a rounded value, meaning the host could return up to (max_bytes_rounded + 1) bytes and they would still pass the a.length() as usize <= max_bytes.saturating_add(1) guard — classifying an oversized document as valid. In practice today's limits are far smaller, but the cast should be a JsValue::from_f64(max_bytes.min(9_007_199_254_740_991) as f64) or the interface should use a BigInt binding.

crates/rustev-cli/tests/common/harvest.rs:215 — assert! panics the test process on path-traversal input

assert!(
    Path::new(name)
        .components()
        .all(|c| matches!(c, std::path::Component::Normal(_))),
    "--rules {name:?} is not a plain relative path"
);

assert! panics the whole test binary rather than failing the specific test case. If a harvest run encounters a --rules ../secret argument (e.g., from a misconfigured seed), the entire rustev-cli test binary crashes mid-harvest, leaving partial fixture state on disk. A panic! with the same message is no different here; a more robust approach would return an error or use std::process::abort only at the point the filesystem write would occur. Minor in practice since harvest runs are controlled, but the blast radius is wider than needed.

crates/rustev-surface/src/host.rs — write_all rollback does not cover input-collision errors introduced in this PR

The new ensure_absent rejects labels that name an input as well as an existing output. If write_all is called and one of the later files collides with an input label, the rollback loop correctly removes the successfully written earlier files from outputs. No double-borrow occurs. This is correct. However the memory_host.rs tests do not cover the new "names an input" error path, so this branch is untested. Not a bug, but a gap in coverage given the deliberate behavioral expansion.


{"head": "4712dee31863fd4d8f0dc4c2bc71ec00753ea83f", "verdict": "findings", "findings": [{"path": "Makefile", "line": 93, "summary": "CARGO_TARGET is evaluated before the Node version check, so a missing Node installation produces the misleading error 'cargo metadata named no target directory' rather than the clear 'need Node 20 or later' message."}, {"path": "integrations/rustev-wasm/src/lib.rs", "line": 205, "summary": "max_bytes as f64 loses precision for values above 2^53-1, potentially allowing an oversized document to pass the length guard in Callback::resolve."}, {"path": "crates/rustev-cli/tests/common/harvest.rs", "line": 215, "summary": "Using assert! for the path-traversal check panics the entire test binary rather than failing just the offending case, leaving partial harvest state on disk."}]}

Group 2 of 2

Looking at the diff, the changes add WebAssembly surface support to the conformance harness: new descriptor fixtures, updated bundle files, JS tooling (run.mjs, wasm-check.mjs, gen-types.mjs), and a Derived struct in lib.rs. The logic is generally consistent, but I found one notable anomaly:

tools/rustev-conformance/js/package-lock.json — lodash is pinned at 4.18.1:

"node_modules/lodash": {
  "version": "4.18.1",
  "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz",
  "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q=="

The 4.x series of lodash has been at 4.17.21 for years with no 4.18.x published on npm as of my training data. This either reflects a genuine post-cutoff release or is an anomalous entry. Since gen-types.mjs uses json-schema-to-typescript which pulls in lodash transitively, and the generated output is committed and checked with --check, the blast radius is limited to the type-generation step — but it is still worth verifying the integrity hash against the npm registry before merging.

No other bugs or security issues found. The flags() parser, pinned() integrity checks, wasm-check.mjs import allowlist, and the derived-substitution logic in run.mjs are all correct. The wasm surface is appropriately restricted to pure/deterministic commands (plan check, plan compile, plan show, replay) and excluded from run cases in the manifest.

{"head": "4712dee31863fd4d8f0dc4c2bc71ec00753ea83f", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/package-lock.json", "line": 69, "summary": "lodash is locked at 4.18.1, a version beyond the known stable 4.17.21; verify the integrity hash against the npm registry before merging to rule out a fabricated or substituted entry."}]}

Subject: b22983d...4712dee, diff digest d5ebacebcf56bbe8b7cb9ab0ae5e7c3ca93091dc98ad1951e661097e72acb3c0, 2 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

Reviewing the diff, which introduces the WebAssembly integration (integrations/rustev-wasm), the Memory host implementation, and conformance case updates.

crates/rustev-surface/src/host.rs — Memory host

The write_all rollback is sound: create calls ensure_absent which borrows immutably and releases before returning; if it errors, create returns before the mutable borrow, so the borrow_mut() in the rollback path has no active borrows to conflict with. The ensure_absent check for both inputs and outputs (not just outputs as the old test mock did) correctly mirrors file-system semantics per the comment.

integrations/rustev-wasm/src/lib.rs — WASM bindings

replay_config: ms(now_ms, "nowMs")? gates to 0.0..=2^53-1; the subsequent i64::try_from(u64) is always in range. host_cap_ms.map(|c| ms(c, "hostCapMs")).transpose()? correctly converts Option<Result<u64>> to Result<Option<u64>>.

Callback::resolve: the saturating_add(1) guard on the Uint8Array length correctly implements the "one byte past budget = oversized" rule. The max_bytes as f64 hint is explicitly documented as advisory-only; the hard guard is the integer comparison. On wasm32, u32 length cast to usize is lossless.

CommandResult::out returns a clone on each call — minor inefficiency, not a bug.

crates/rustev-cli/tests/common/harvest.rs

The --rules path component check (Component::Normal only) correctly prevents path-traversal in descriptor file writes. The command_of refactor preserves identical JSON output (was .join(" "), still a string).

Makefile

CARGO_TARGET lazy evaluation is gated by @test -n "$(CARGO_TARGET)" || ... exit 1 before the rm -rf, so the dangerous case of an empty target path can't reach that line. The wasm-opt version pin regex ^wasm-opt version 116( |$) correctly rejects 1160 or similar prefix matches.

Conformance cases

Bundle sha256s changed for lodging.replay and support.replay (expected — descriptors were embedded). The "derived": [] for cases without --rules (replay, refusal-16, refusal-17) is consistent with the logic in harvest.rs.

Spec note (acknowledged, not a code bug)

The spec explicitly documents that the 2 MiB raw WASM size budget is exceeded (~5.6%) and that make bindings fails at that gate as intended, pending spec 046.

No bugs or security issues found.

{"head": "a9bd08168caa9191dd847deb66874fdbf088de24", "verdict": "no-findings", "findings": []}

Group 2 of 2

Reviewing the changed files in group 2.

tools/rustev-conformance/js/run.mjs

The per-case try/catch (lines ~134–137) only wraps runWasm(c). The output-verification loop that follows is outside it:

const golden = pinned(o.golden, o.sha256);           // can throw
if (!Buffer.from(r.out).equals(golden)) {              // can throw if r.out is absent
  failures.push(`... got ${Buffer.from(r.out)...}`);
}

pinned() throws if the golden file is absent or its SHA-256 mismatches. Buffer.from(r.out) throws if r.out is undefined (e.g., a WASM binding that returns no out field for a particular command). Either exception propagates out of the for (const c of ...) loop entirely, killing the runner and suppressing results for all subsequent cases instead of recording a per-case failure.

Everything else looks consistent:

  • The Derived struct in src/lib.rs is correct and deny_unknown_fields-guarded.
  • The derived → bytes substitution in inputs.add (run.mjs lines ~87–88) correctly maps rules file names to descriptor bytes before passing them to the WASM API.
  • The manifest SHA-256 values for the new .descriptor.json files are internally consistent (all lodging descriptors share blob 16a5d52, all support descriptors share blob 2a31e76).
  • wasm-imports.json is appropriately minimal; the wbg/./rustev_wasm_bg.js dual-module list matches wasm-bindgen's two web-target import module names.
  • The wasm-check.mjs instantiation measurement (3 discarded + 21 measured, median at index 10, p95 at index 19) is arithmetically correct.
  • The updated bundle digests in manifest.json (cdd5a901… for lodging.replay, 51a2c421… for support.replay) are consistent with the actual content changes in the bundle files.
  • release-set.json exclusion for rustev-wasm is correctly reasoned.
{"head": "a9bd08168caa9191dd847deb66874fdbf088de24", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/run.mjs", "line": 150, "summary": "The output-verification loop (pinned() and Buffer.from(r.out)) runs outside the per-case try/catch, so any thrown exception aborts the entire conformance run rather than recording a single-case failure."}]}

Subject: 8ad51a0...a9bd081, diff digest cef37fff368db25409eb7da966152fa889b710ce7de286e3ce23c25ef694ec99, 2 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

Reviewing the diff for the WebAssembly package implementation (spec 027, increment 5).

crates/rustev-surface/src/host.rs — Memory host

The write_all rollback (files[..i] removal) is correct. The ensure_absent now rejects labels that name existing inputs, which is a tighter contract than the old test-local Memory (which only checked outputs); this is intentional and documented. The join fix for empty directory is correct and tested.

integrations/rustev-wasm/src/lib.rs

  • Callback::resolve: the <= max_bytes.saturating_add(1) sentinel correctly mirrors the CLI store's one-byte-over probe; anything longer becomes Inaccessible. JS exceptions and non-Uint8Array values also become Inaccessible. Safe.
  • replay_config: the 0.0..=9_007_199_254_740_991.0 guard (2⁵³ − 1, exactly representable as f64) followed by i64::try_from is correct; host_cap_ms returns Option<u64> through .transpose().
  • canonicalDefinition surfaces parse errors as JsError rather than panicking. Safe.
  • Inputs::add silently replaces existing entries — intentional for builder ergonomics, consistent with the API description.

crates/rustev-cli/tests/common/harvest.rs

  • The Component::Normal assertion before constructing rel = format!("{name}.descriptor.json") correctly blocks .. and absolute paths before writing to the fixture directory.
  • command_of refactoring is semantically equivalent to the old inline collect + join.
  • pure matches "plan check" | "plan compile" | "plan show" | "replay" — 23 cases across the conformance set, consistent with the spec count.

Makefile

  • Lazy CARGO_TARGET expansion is correct; only the bindings target references it.
  • The for loop correctly maps nodejs target → node directory while keeping the wasm-bindgen --target nodejs flag.
  • The @test -n "$(CARGO_TARGET)" guard catches missing node/cargo.

Cargo.toml — wasm profile

inherits = "release", opt-level = "z", lto = true, codegen-units = 1, panic = "abort", strip = true are all correct for a size-optimised WASM build. debug = false is redundant (release default) but harmless.

Conformance cases

  • derived arrays are populated exactly for cases using --rules; replay and no-rules refusal cases correctly carry "derived": [].
  • lodging.replay and support.replay bundle sha256 changes are expected (bundles regenerated with descriptor content for WASM compatibility).
  • The shared sha256 for all support.rules.json descriptor entries (98070801…) and all lodging.rules.json descriptor entries (a3c75a…) are internally consistent.

No bugs, security issues, or inconsistencies found.

{"head": "64388f5b46be2fa8a0192d7c84cc396bc3cca0a5", "verdict": "no-findings", "findings": []}

Group 2 of 2

Reviewing the group 2 files: manifest updates, new fixture descriptors, updated bundle fixtures, new JS tooling, and conformance lib additions.

tools/rustev-conformance/cases/manifest.json — The derived arrays and surfaces: ["cli","wasm"] additions look consistent across all cases. lodging.replay, support.replay, refusal-16, and refusal-17 correctly get "derived": [] since they carry no rules program (bundles embed descriptors; refusal-16/17 have no rules input). SHA-256 hashes for the updated bundles match the new blob content. lodging.run and support.run are deliberately absent from the WASM surface, consistent with the runner comment at line 117 of run.mjs.

Descriptor JSON files — All 22 new .descriptor.json files are internally consistent: support cases all share the same synthetic-rules-support descriptor, lodging cases share synthetic-rules-lodging. Artifact hashes and operation sets match between the descriptor files and the descriptor embedded in the replay bundles.

Bundle files — The changes are minor timing adjustments (a few dispatched_ms/ended_ms fields) that cause the run-document digest to change, which is why the outer sha256 in the manifest was updated. Judgment outcomes and all evidence/step data are identical to the prior version.

tools/rustev-conformance/js/run.mjs line ~104 — The replay case passes Number(a.one('now-ms')) directly. If --now-ms is absent from a case's argv, a.one('now-ms') returns undefined, Number(undefined) is NaN, and NaN is silently forwarded to glue.replay() as the now parameter. The WASM function would receive a nonsensical timestamp; depending on the binding, this either silently produces wrong output (which the golden comparison would catch only by accident) or triggers an opaque WASM trap rather than a diagnostic failure. A guard (if (a.one('now-ms') == null) throw new Error(...)) before the call would make the failure explicit.

tools/rustev-conformance/js/wasm-check.mjs — Import allowlist logic, size budget checks, and the instantiation-timing harness (3 warm-up + 21 measured, median at sorted index 10) all look correct. JSON.stringify is used for embedding paths in the child process script, preventing injection. The --chromium-ms validation correctly catches NaN via !(NaN >= 0).

tools/rustev-conformance/js/gen-types.mjs — The write path guards correctly against writing to a directory that doesn't exist (existsSync(dirname(p))), so the future rustev-node target is skipped harmlessly. The --check path similarly skips the missing rustev-node path.

tools/rustev-conformance/src/lib.rs — Derived struct uses deny_unknown_fields and default on Case.derived; backward compatible.

tools/rustev-release/release-set.json — Straightforward exclusion of rustev-wasm.

{"head": "64388f5b46be2fa8a0192d7c84cc396bc3cca0a5", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/run.mjs", "line": 104, "summary": "Number(a.one('now-ms')) silently produces NaN when --now-ms is absent from a replay case's argv, passing an invalid timestamp to glue.replay() instead of failing explicitly."}]}

Subject: 752fd43...64388f5, diff digest 3da3ea146f28ac5b9a99a25b156941015a5157eedc98bbbc1bb27f388993d347, 2 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

Reviewing the diff for bugs, security problems, and inconsistencies.

crates/rustev-surface/src/host.rs — Memory host

The read_classified truncation is correct: callers detect oversized inputs by requesting limit + 1 bytes and comparing the returned length. b[..b.len().min(max)] returns exactly max bytes (= limit+1) when the content is at or beyond the limit, allowing detection.

ensure_absent now rejects both existing outputs and inputs (new vs. the old test-only version). The comment explains the rationale ("same outcome on every surface"). Safe and intentional.

write_all atomic rollback: if create(l, b) fails, the borrow inside ensure_absent is dropped before the function returns, so borrow_mut() for rollback does not risk a RefCell panic. Entries in files[..i] all passed ensure_absent (neither inputs nor outputs at that point), so they were written to outputs; out.remove(written) correctly removes them. ✓

join — old test implementation returned format!("{dir}/{name}") giving "/plan.json" for an empty dir (a latent bug). The new implementation correctly returns name.to_string() when dir.is_empty(). The new test covers this. ✓

integrations/rustev-wasm/src/lib.rs — WASM bindings

Callback::resolve: (a.length() as usize) <= max_bytes.saturating_add(1) — on wasm32, both u32 and usize are 32-bit; the comparison is exact. Edge case: max_bytes = usize::MAX saturates to usize::MAX, making the check trivially true, but this value won't appear in practice from library internals. ✓

replay_config: f64 → u64 via the closure ms is bounded to [0, 2^53-1], which fits i64. The .expect("2^53 - 1 fits an i64") is correct. host_cap_ms.map(|c| ms(c, "hostCapMs")).transpose()? correctly propagates errors. ✓

finish: r.unwrap_or_else(|d| d) extracts Done from both Ok and Err arms cleanly. ✓

crates/rustev-cli/tests/common/harvest.rs

Path validation components().all(|c| matches!(c, Normal(_))) guards against .. traversal before writing the .descriptor.json file. The output path is root().join(fixtures).join(rel) where rel = format!("{name}.descriptor.json") — safe. ✓

command_of is used consistently for both the pure predicate and the JSON "command" field. ✓

Makefile — bindings target

rm -rf $(BINDINGS_OUT)/rustev-wasm — guarded by test -n "$(CARGO_TARGET)" earlier in the recipe, so an empty CARGO_TARGET is caught before the destructive step. ✓

Version pin regex ^wasm-opt version 116( |$) correctly requires exactly version 116 without matching 1160. ✓

Conformance case JSON files

Cases with no --rules arg (lodging.replay, support.replay, refusal-16, refusal-17) correctly have "derived": []. Cases with --rules have the descriptor entry. The wasm surface is added only to plan check, plan compile, plan show, and replay — consistent with the pure predicate in the harvest code. ✓

No bugs, security issues, or inconsistencies found.

{"head": "886c1a6d7ae427d09c10426697eea8dba31b608e", "verdict": "no-findings", "findings": []}

Group 2 of 2

Reviewing the group 2 changes: manifest additions, new descriptor fixtures, updated bundles, new JavaScript tooling, and the release-set exclusion.

tools/rustev-conformance/js/package-lock.json
lodash is pinned at 4.18.1, but the lodash 4.x line has been frozen at 4.17.21 since 2021 — no 4.18.x release exists on npm. The dependency is declared transitively via [email protected], which itself specifies "lodash": "^4.18.1". As written, npm ci in tools/rustev-conformance/js/ will fail to resolve lodash at this version, making the entire conformance JS tooling uninstallable.

tools/rustev-conformance/js/run.mjs (line ~162)
In runCase, when the WASM surface returns null for an unsupported command the runner records a failure and continues, but the ran counter is still incremented before runCase is called. A manifest case that legitimately isn't a WASM command (returns null) counts toward ran yet also generates a failure string. This means adding any non-WASM case to the wasm surfaces list would both inflate ran and produce a spurious failure entry rather than being silently skipped.

tools/rustev-conformance/js/wasm-check.mjs (line 62–67)
The import allowlist check verifies allowed.modules.includes(i.module) AND allowed.names.includes(base) independently, but permits any combination. A future wasm-bindgen import with an allowed module name and an independently allowed base name (even if that specific pair was never reviewed) would pass without flagging. The per-pair review described in the comment field of wasm-imports.json is not enforced by the code.

The descriptor fixture files, the manifest SHA-256 updates for the two bundles, the Rust Derived struct, and the release-set.json exclusion all look consistent and correct.

{"head": "886c1a6d7ae427d09c10426697eea8dba31b608e", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/package-lock.json", "line": null, "summary": "Pins [email protected], a version that has never been published to npm (latest 4.x is 4.17.21), making npm ci fail and the JS tooling uninstallable."}, {"path": "tools/rustev-conformance/js/run.mjs", "line": 162, "summary": "runCase increments `ran` before checking for a null return, so a case whose command the WASM surface does not support both inflates the run count and records a spurious failure instead of being silently skipped."}, {"path": "tools/rustev-conformance/js/wasm-check.mjs", "line": 63, "summary": "The import allowlist checks module names and base names independently rather than as pairs, so any novel import whose module and base name each appear separately on the list passes without being reviewed as a pair."}]}

Subject: f054fda...886c1a6, diff digest 403b590815365aa4280d934e8cedf9998f249e871b743fbcecabb59129f84f39, 2 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

Review

crates/rustev-surface/src/host.rs

The Memory host implementation is solid. One behavioral difference from the previous test-local version is intentional and correct: ensure_absent now also rejects an output that collides with an input name (the old test implementation only checked existing outputs). The join fix (dir=="" → return name alone, not "/name") is a genuine bug fix from the old local implementation.

integrations/rustev-wasm/src/lib.rs

Callback resolver (resolve): the max_bytes.saturating_add(1) guard is correct—it admits at most one byte over the limit so the caller can distinguish "fits" from "oversized", matching the Memory::read_classified contract. NaN and ±Inf are rejected by the fract()==0.0 / range check in replay_config. No injection surface: JS throws and non-Uint8Array values map to Inaccessible, not used bytes.

Inputs::add silently replaces entries; intentional for a pre-call map builder.

write_all rollback: atomically removes already-written entries on failure, correct.

crates/rustev-cli/tests/common/harvest.rs

Real issue — the derived field (and the updated "surfaces" list) is only written in the unwrap_or_else branch, i.e., when a case file is being created for the first time. For existing case files that are joined by a second golden invocation, the derived variable is computed (and the .descriptor.json is written to disk with a fresh sha256), but the case JSON's "derived" array is not updated to reflect the new sha256. If a rules-backend descriptor ever changes between harvests, a phase-1-only run (RUSTEV_HARVEST=1 cargo test -p rustev-cli) would leave the case JSON with a stale sha256 while the descriptor file on disk has the new one. The conformance runner (which verifies sha256 for referenced files by the same pattern used for inputs) would then fail the WASM cases. The full conformance-harvest target (which bless-regenerates case files) avoids this, but a partial re-harvest does not.

Makefile

wasm-opt -o file file (in-place) is safe because wasm-opt loads the whole module before writing. Lazy CARGO_TARGET evaluation with $(eval …) is idiomatic for once-computed expensive variables. Tool-version pinning checks are consistent with the Cargo dependencies.

Conformance case JSON files

All 23 cases that name "wasm" in "surfaces" also carry a correct "derived" list (or [] when no --rules argument is present, e.g. refusal-16/17 and the replay cases). Bundle sha256s for lodging.replay and support.replay changed consistently with the bundle content regeneration.

{"head": "0c0d1c0a7fca33493169ce51f4e2c60c79897947", "verdict": "findings", "findings": [{"path": "crates/rustev-cli/tests/common/harvest.rs", "line": 249, "summary": "The `derived` field is only populated in the new-case `unwrap_or_else` branch; existing case files joined by a second golden invocation do not have their `derived` sha256 updated, so a partial re-harvest that changes a descriptor will leave a stale hash in the case JSON while writing a fresh descriptor file to disk, causing conformance failures."}]}

Group 2 of 2

Looking at the files assigned to this call (manifest, descriptor fixtures, updated bundles, the new JS tooling, src/lib.rs, and release-set.json).

tools/rustev-conformance/js/run.mjs

In the replay branch of runWasm, a.one('bundle') is used where a.need('bundle') is used for 'now-ms' on the very same branch. If a manifest entry is malformed and omits --bundle, undefined is silently forwarded to the WASM function instead of failing with a clear message — an inconsistency with the explicit need pattern used one line later.

In the output comparison loop (the for (const o of c.outputs) block), every non-stdout stream is silently skipped (if (o.stream !== 'stdout') continue). plan compile cases have been added to the wasm surface, but on the CLI surface the compiled plan is written to the path given by --out (a file-stream output). If the golden for those cases declares "stream": "file" rather than "stdout", the WASM conformance run verifies only the exit code and never the compiled output bytes — the test passes vacuously for WASM compile.

Everything else looks consistent: descriptor sha256 values are identical across the manifest and the new fixture files for the same backend, the bundle updates reflect minor timing changes while keeping the judgments and outputs unchanged, the Derived struct adds deny_unknown_fields and defaults correctly, and wasm-imports.json lists only expected wasm-bindgen glue without time/randomness/WASI/network entries.

{"head": "0c0d1c0a7fca33493169ce51f4e2c60c79897947", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/run.mjs", "line": 123, "summary": "replay branch uses a.one('bundle') instead of a.need('bundle'), inconsistent with a.need('now-ms') on the same path; absent flag silently passes undefined to WASM."}, {"path": "tools/rustev-conformance/js/run.mjs", "line": 141, "summary": "Only stdout-stream outputs are compared; plan compile cases added to the wasm surface likely declare file-stream goldens, so WASM compile output is never verified and the test passes vacuously on exit code alone."}]}

Subject: 707f974...0c0d1c0, diff digest e304d386eea5f50766fcf97d7d6319dec6e8248981648c000959e312b9d001ff, 2 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Group 1 of 2

Reviewing the PR, which implements the WebAssembly surface (Increment 5 of spec 027).

crates/rustev-surface/src/host.rs

The Memory::join for an empty directory now returns just name rather than /name (the old test-only implementation used format!("{dir}/{name}") which prepended a slash when dir is empty). This is an intentional and correct change—artifacts keyed by name at the top level should not have a leading slash. The new test confirms this.

The ensure_absent implementation now also rejects writes that would shadow an input, which the original test-local version did not. This is a correct stricter behavior matching the file host.

crates/rustev-cli/tests/common/harvest.rs

The path-traversal guard on --rules values:

assert!(
    Path::new(name).components()
        .all(|c| matches!(c, std::path::Component::Normal(_))),
    "--rules {name:?} is not a plain relative path"
);

correctly prevents .. and absolute paths from escaping the fixtures directory when writing descriptor files.

integrations/rustev-wasm/src/lib.rs

The Callback resolver correctly passes max_bytes + 1 bytes to the library so it can classify oversized items, matching the CLI store's behavior. Throws and non-Uint8Array returns map to Inaccessible. The replay_config range check (0.0..=9_007_199_254_740_991.0) correctly fits into both u64 and i64 before the Timestamp range check.

Makefile

The lazy CARGO_TARGET variable, Node.js version check, and exact-version pin checks (wasm-bindgen 0.2.129, wasm-opt version 116) all look correct.

Conformance case JSON files

derived: [] on run/replay commands and on plan check without --rules (refusal-16, refusal-17) is correct; derived descriptor entries on cases that pass --rules are consistent with the harvest logic. The SHA256 hash updates on the embedded replay bundles are expected since descriptors are now embedded.

Known exceeded budget

The spec update explicitly documents the raw WASM size exceeding the declared budget by 5.6%, with make bindings failing at that gate as required by 3.10.4, and proposes spec 046 to amend the budget. No code defect.

No bugs or security issues found.

{"head": "89a6ffdfbba9cd2541c36ac2916b926c1d7ce7be", "verdict": "no-findings", "findings": []}

Group 2 of 2

Reviewing the PR: new WASM conformance tooling (spec 027), fixture updates, and manifest/struct additions. I'll check for bugs, security issues, and cross-file inconsistencies.

tools/rustev-conformance/js/run.mjs

The core WASM conformance runner looks sound:

  • pinned() verifies SHA-256 before using any fixture file, protecting against tampering
  • resolveItem callback does a Map lookup (not filesystem access) so reference traversal is harmless
  • All switch cases return, no fall-through risk
  • if (failures.length || ran === 0) process.exit(1) correctly guards against silent empty runs

tools/rustev-conformance/js/wasm-check.mjs

  • The import-stripping regex /_[0-9a-f]{16}$/ matches wasm-bindgen's 16-char hex suffix correctly
  • Both ./rustev_wasm_bg.js:* and wbg:* variants in the allowlist correctly covers both bundler and Node targets
  • JSON.stringify(gluePath) and JSON.stringify(wasmPath) in the spawned child script prevent injection
  • Median index sorted[10] for 21 samples is correct; p95 sorted[Math.ceil(0.95 * 21) - 1] = sorted[19] is reasonable

tools/rustev-conformance/js/gen-types.mjs

  • ownDescriptions() wraps $ref+description in allOf to preserve field-level descriptions — correct JSON Schema draft-07 technique
  • Skip logic for missing rustev-node file in --check mode is intentional and correctly guarded

tools/rustev-conformance/src/lib.rs

Derived added with deny_unknown_fields and #[serde(default)] on the Case field — backward-compatible with all pre-existing cases that lack derived.

Manifest / fixtures

  • All new .descriptor.json files are consistent: support cases use artifact sha256:dd216677… / synthetic-rules-support; lodging cases use sha256:33740007… / synthetic-rules-lodging; these match their sha256 entries in the manifest
  • lodging.replay and support.replay sha256 pins updated to match their regenerated bundle content — consistent
  • run cases correctly remain surfaces: ["cli"] only; the run.mjs default: case enforces this by returning null
  • refusal-16 / refusal-17 have derived: [] (no rules file → no descriptor needed) — consistent

No bugs, security issues, or inconsistencies found.

{"head": "89a6ffdfbba9cd2541c36ac2916b926c1d7ce7be", "verdict": "no-findings", "findings": []}

Subject: 707f974...89a6ffd, diff digest 8e52635cb749f9a5b84df114d5fb005ce6d445392b1611af2f4013d63d886307, 2 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

Reviewing the diff carefully across the changed files in group 1.

.gitignore — Correct addition; node_modules/ was missing.

Cargo.toml — The [profile.wasm] inherits from release and adds size/LTO settings. debug = false is redundant (release default), but harmless.

Makefile — bindings target:

  • CARGO_TARGET lazy-eval pattern is correct; the guard test -n "$(CARGO_TARGET)" handles both missing cargo and missing node.
  • Profile wasm puts artifacts under target/wasm32-unknown-unknown/wasm/, matching the path used in the Makefile.
  • The for loop correctly maps nodejs target to node output dir, consistent with package.json exports.
  • Version pin checks (grep -Eq "^$(WASM_OPT_PIN)( |$$)") use shell $ correctly in Make context.

crates/rustev-surface/src/host.rs — Memory:

  • ensure_absent checks both outputs and inputs. The outputs.borrow() temporary is released before inputs.contains_key() is evaluated — no RefCell panic risk.
  • write_all rollback correctly removes only entries written within the current call (files[..i]), leaving pre-existing outputs untouched.
  • join correctly returns name alone when dir is empty (fixing the prior test-only impl which always prepended dir/).

crates/rustev-surface/tests/memory_host.rs — Updated to use Memory::new() and m.output(); the new join_names_an_output_by_its_directory_or_alone test verifies the empty-dir case. Consistent.

crates/rustev-cli/tests/common/harvest.rs:

  • command_of correctly collects tokens before the first - flag.
  • The assert! on path components (all Normal) prevents directory traversal when writing derived descriptor files during harvest.
  • derived is included in all cases (empty [] for non-pure or pure-with-no---rules); the staleness check (assert_eq!) enforces consistency.

integrations/rustev-wasm/src/lib.rs:

  • Callback::resolve: arrays > max_bytes + 1 return Inaccessible, as documented. The dyn_into failure path also returns Inaccessible. Correct.
  • replay_config: ms closure admits [0, 2^53-1]; i64::try_from of 2^53-1 succeeds (fits in i64). Timestamp::from_ms(now) handles range errors.
  • host_cap_ms: Option<Result<u64,String>> correctly transposed with .transpose()?.
  • #[allow(clippy::too_many_arguments)] on eval and calibrate_fit — expected given their rich argument surfaces.

integrations/rustev-wasm/Cargo.toml:

  • crate-type = ["cdylib", "rlib"] is correct (cdylib for WASM, rlib for tests).
  • Exact version pins "=0.2.129" and "=0.3.106" are intentional and match the Makefile check.
  • publish = false correctly prevents accidental publication before spec 031.

Conformance case JSON files:

  • "derived": [] consistently added to all cases; cases with --rules include the descriptor entry.
  • "surfaces" extended to ["cli","wasm"] exactly for plan check, plan compile, plan show, and replay — matching the pure set in harvest.rs.
  • SHA256 updates for lodging-emb.bundle.json and support-emb.bundle.json are consistent with those fixture files appearing in the changed-paths list.

No bugs, security issues, or inconsistencies found.

{"head": "4159d3c75b8155178eb364c9e7f97c8d2f97bc41", "verdict": "no-findings", "findings": []}

Group 2 of 2

Reviewing the JS tooling, updated fixtures, and manifest changes for the WASM conformance surface.

run.mjs

The conformance runner is sound. pinned() verifies SHA-256 before use; flags() is strict about flag arity; failures accumulate rather than abort; ran === 0 guard prevents a silent pass. The derived substitution (replacing rules-file bytes with descriptor bytes in inputs) cleanly implements the "no rules backend" pattern for WASM.

One design note confirmed correct: the manifest only adds "wasm" to surfaces for pure commands (plan check, plan compile, plan show, replay), not for run. The default: return null branch in runWasm would record a failure if a run case ever did reach it, which is the right behaviour.

wasm-check.mjs

Import-allowlist enforcement is straightforward. The stripping regex (/^__wbg_/ + /_[0-9a-f]{16}$/) handles wasm-bindgen's naming convention correctly. Both wbg: and ./rustev_wasm_bg.js: module variants are included, covering the two wasm-bindgen targets. Child processes use JSON.stringify for path embedding—no injection risk.

gen-types.mjs

The ownDescriptions workaround (wrapping $ref + description pairs in allOf) is a known json-schema-to-typescript workaround and is implemented correctly. The --check path skips missing rustev-node files (not yet present) but would fail if the committed WASM types file diverges—correct enforcement order.

package-lock.json

"lodash": "4.18.1" is declared as a resolved dependency. As of my knowledge cutoff (Aug 2025) lodash's latest stable was 4.17.21; the diff was authored after that date so this may be legitimate, but the integrity hash (sha512-dMInic...) and json-schema-to-typescript's declared peer range (^4.18.1) should be verified against the live npm registry before merging, to confirm the package exists and the hash matches.

Manifest and descriptor fixtures

Descriptor files are byte-identical across all cases sharing the same rules backend (synthetic-rules-support / synthetic-rules-lodging). Bundle updates (timing field deltas, new run-document digests) are internally consistent with their declared SHA-256 pins in the manifest. The Derived struct in lib.rs correctly uses #[serde(deny_unknown_fields)].

{"head": "4159d3c75b8155178eb364c9e7f97c8d2f97bc41", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/package-lock.json", "line": null, "summary": "Lodash 4.18.1 is declared as a resolved dependency but was not a published npm version as of the knowledge cutoff (Aug 2025); verify the package exists and the integrity hash matches before merging."}]}

Subject: 5764d8b...4159d3c, diff digest 8e52635cb749f9a5b84df114d5fb005ce6d445392b1611af2f4013d63d886307, 2 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

Reviewing the diff for bugs, security issues, and inconsistencies.

crates/rustev-surface/src/host.rs — Memory::ensure_absent

The new ensure_absent now also rejects writes to a label that matches an existing input, not just an existing output. This is a behavioral change from the old test-only Memory, but it's intentional (matches CLI file-host semantics) and explicitly documented in the inline comment. ✓

crates/rustev-surface/src/host.rs — write_all rollback

The all-or-none rollback in write_all (lines ~145-162) relies on RefCell borrow semantics. create calls borrow() inside ensure_absent (dropped on return) and then borrow_mut() to insert — no overlap. When the rollback path is reached, create has returned and released all borrows before borrow_mut() is called for cleanup. Safe in single-threaded WASM. ✓

integrations/rustev-wasm/src/lib.rs — float-to-integer validation

The range check (0.0..=9_007_199_254_740_991.0).contains(&v) correctly bounds to 2^53−1 (max safe JS integer), NaN fails the fract() == 0.0 test, and −0.0 (which equals 0.0 in IEEE 754) maps to 0u64 correctly. ✓

integrations/rustev-wasm/src/lib.rs — Callback resolver, line ~187

a.length() returns u32. On wasm32, usize is 32 bits, so the cast is lossless. The saturating_add(1) prevents overflow. The one-byte-over-budget pass-through is intentional and documented. ✓

integrations/rustev-wasm/src/lib.rs — module doc comment

The canonicalDefinition export is not listed in the module-level doc comment (line 1–10), which lists check, compile, show, replay, eval, gate, calibrateFit, calibrateQualify. This is a minor documentation omission, not a code bug.

Makefile — wasm-opt in-place

$(WASM_OPT) -Oz $(WASM_FEATURES) -o $(BINDINGS_OUT)/…/rustev_wasm_bg.wasm $(BINDINGS_OUT)/…/rustev_wasm_bg.wasm

The input and output paths are identical (in-place optimization). Modern wasm-opt handles this via an internal temp-and-rename, but the tool's version is pinned to 116, which supports this usage. Acceptable.

Conformance case consistency

The surfaces and derived fields in the conformance cases are consistent with the pure command logic in harvest.rs: plan check, plan compile, plan show, and replay get ["cli","wasm"] and may have derived descriptors; run stays ["cli"] with "derived":[]. refusal-16 and refusal-17 have no --rules argument, so "derived":[] is correct even though they become wasm-surfaced.

No actionable bugs or security issues found.

{"head": "fcaa1e45f7694b15d919b7a1fed639b1022105df", "verdict": "no-findings", "findings": []}

Group 2 of 2

Reviewing the group 2 files: the manifest, new fixture descriptor files, updated bundles, the JS tooling (gen-types, run, wasm-check), the conformance Rust struct extension, and the release-set exclusion.

tools/rustev-conformance/js/package-lock.json — [email protected]

[email protected] is a version that did not exist prior to 2026-04-01 (per the package.json comment). The package.json "//" note calls this out explicitly and states the lockfile integrity matches npm view [email protected] dist.integrity. That transparency is good practice, but reviewers cannot verify the integrity hash (sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==) without running that npm view command independently. A newly-published version of a widely-deployed utility that requires a range bump (^4.18.1) is exactly the kind of supply-chain vector worth confirming out-of-band before merge.

Everything else looks correct:

  • The manifest's derived arrays and wasm surface additions are internally consistent: run cases get "derived": [] but no wasm surface (consistent with run.mjs's comment that run is not a WASM command), and all plan check / compile / show / replay cases that receive wasm carry matching derived entries or empty ones where no rules backend is needed (refusal-16/17).
  • All descriptor JSON files share a consistent SHA-256 within each backend family (98070801… for support, a3c75af9… for lodging), matching the manifest entries.
  • The bundle file SHA-256s in the manifest (cdd5a901…, 51a2c421…) reflect the updated bundles; the internal content change in support-emb (slight timing delta in one attempt) is synthetic fixture data only.
  • run.mjs: pinned() enforces hash-before-use on every file; the derived substitution logic is correct; ran === 0 exit-1 guard prevents silent vacuous passes.
  • wasm-check.mjs: paths through JSON.stringify before embedding in the child process script string; spawnSync with array args avoids shell injection.
  • gen-types.mjs: the rustev-node skip-when-absent logic is correct; the ownDescriptions $ref+description wrapper is a legitimate workaround for the generator's field-description clobbering behavior.
  • src/lib.rs: Derived struct with deny_unknown_fields and the #[serde(default)] on Case::derived are correct.
{"head": "fcaa1e45f7694b15d919b7a1fed639b1022105df", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/package-lock.json", "line": 146, "summary": "[email protected] is a newly-published version (2026-04-01) not in prior registry history; the package.json comment provides a provenance note, but the lockfile integrity hash should be independently verified against `npm view [email protected] dist.integrity` before merge to rule out supply-chain substitution."}]}

Subject: 5764d8b...fcaa1e4, diff digest 070aebc620b039fef2a3d8a88133dd993cd31983cc8d01a6a8c3d75867b749aa, 2 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

Reviewing the diff for bugs, security issues, and inconsistencies across all group-1 files.

.gitignore / Cargo.lock / Cargo.toml: Routine additions. The [profile.wasm] settings (opt-level = "z", lto = true, panic = "abort", strip = true) are correct for size-first WASM.

Makefile (bindings target): Version pin checks are correct. wasm-opt in-place (-o file file) is safe for this tool; it reads input fully before writing. One note: $(BINDINGS_OUT) and $(CARGO_TARGET) are expanded unquoted in shell commands within the for loop — any space in the Cargo target directory would break those lines silently. This is a real (if unlikely) portability gap in the new target.

crates/rustev-cli/tests/common/harvest.rs: The command_of extraction is clean. The path safety assertion (Component::Normal only) before writing the derived descriptor file is correct — it prevents path traversal into fixtures. The stale-check assert_eq on derived is correctly positioned after the case read.

crates/rustev-surface/src/host.rs (Memory host): The new ensure_absent check — refusing output labels that match input labels — is intentional and documented. The write_all rollback (removing indices 0..i on failure) is correct; duplicate labels within one call are handled safely. The join fix for empty dir ("" → returns just name, not "/name") is correct and tested.

crates/rustev-surface/tests/memory_host.rs: Tests updated cleanly to use the library Memory; the new join_names_an_output_by_its_directory_or_alone test covers the empty-dir fix.

integrations/rustev-wasm/src/lib.rs:

  • Callback::resolve: the (a.length() as usize) <= max_bytes.saturating_add(1) gate is intentional (mirrors the CLI store's "read one past" detection). On wasm32, usize is u32, so the as f64 and as usize casts are lossless for any realistic size.
  • replay_config: the f64 integer validation (fract() == 0.0, range [0, 2^53-1]) and i64::try_from are correct; the comment is accurate.
  • usage uses internal string interpolation into JSON bytes — no injection vector.
  • Inputs::add allowing overwrite is correct here (it's a builder, not the host itself).

Conformance case JSON files: "derived" and "surfaces" additions are mechanically consistent with the harvest logic. SHA256 changes on the replay bundle fixtures correspond to bundle updates in group 2.

integrations/rustev-wasm/package.json: "private": true is correctly set.

specs/027-node-and-wasm-bindings/spec.md: Prose mentions "lodging 4.18.1" — no such lodash version is published (latest 4.x is 4.17.21). This looks like a typo in the spec narrative (package files are in group 2 and not visible here to confirm).

{"head": "e437191aec171928c97f977e867a0bfcda5ef8d0", "verdict": "findings", "findings": [{"path": "Makefile", "line": null, "summary": "The `bindings` target expands `$(BINDINGS_OUT)` and `$(CARGO_TARGET)` unquoted in shell commands inside the `for` loop; a space in the Cargo target directory (e.g. from CARGO_TARGET_DIR) would silently misparse paths and corrupt the build artifacts."}, {"path": "specs/027-node-and-wasm-bindings/spec.md", "line": null, "summary": "Spec prose references \"lodging 4.18.1\" but no lodash release with that version exists on npm (latest 4.x is 4.17.21); if this is the actual pinned version in the lockfile, `npm ci` will fail."}]}

Group 2 of 2

Reviewing the group-2 files: manifest updates, descriptor fixtures, bundle updates, the new JS tooling, and the Rust Derived struct.


tools/rustev-conformance/cases/manifest.json

Derived SHA-256 values are internally consistent: all support-routing descriptor entries use 98070801…, all lodging descriptor entries use a3c75af9…, matching the new .descriptor.json files (which are byte-identical to one another within each backend). The updated input SHA-256s for lodging.replay and support.replay match the updated bundle files. The "wasm" surface is added only to cases whose command maps to a WASM entry-point (plan check, plan compile, plan show, replay); run cases remain cli-only, consistent with the runner's default: return null fallback.

Descriptor fixture files

All 16 new .descriptor.json files are identical within their backend group, correctly declared as deny_unknown_fields in the Rust struct, and their identity hashes in the bundles are distinct (bundle identity ≠ file hash, by design).

Bundle files

The only functional differences are timing values (dispatched_ms, ended_ms, elapsed_ms) in the run sub-document. The judgment, snapshot, plan, and supplies are identical; the new run.digest values reflect only those timing changes. This is consistent with a re-recorded run.

tools/rustev-conformance/js/run.mjs

  • The derived-substitution mechanism (lines 113–118) is correct: it builds a Map keyed by input name and replaces raw rules bytes with the pre-computed descriptor before calling inputs.add. The WASM module receives the descriptor bytes when it looks up the rules file by name.
  • resolveItem (lines 74–77) constructs a lookup key but only reads from the in-memory Map, so there is no file-system path-traversal exposure.
  • Normalization short-circuit at line 149 is intentional: WASM output must be byte-exact.
  • ran === 0 exits with code 1, guarding against misconfigured surface filters.

tools/rustev-conformance/js/wasm-check.mjs

  • Import stripping regex (/^__wbg_/ + /_[0-9a-f]{16}$/) correctly handles both prefixed (__wbg_call_…) and non-prefixed (__wbindgen_string_get, Error) names.
  • Child-process benchmarking uses JSON.stringify for path injection safety.
  • Brotli is measured but has no budget gate; this matches the spec's declared budget fields.

tools/rustev-conformance/js/gen-types.mjs

Namespace wrapping prevents name collisions between schemas. The ownDescriptions transform correctly re-wraps {$ref, description} nodes as {allOf, description} to preserve per-field descriptions.

tools/rustev-conformance/js/package.json / package-lock.json

[email protected] and [email protected] are pinned versions; the package.json comment explicitly acknowledges them and cites npm audit signatures as the verification step. [email protected] is a devDependency. All lockfile integrity hashes are in the standard npm SHA-512 format.

tools/rustev-conformance/src/lib.rs

Derived is deny_unknown_fields and serde(default) on the Case.derived field preserves backward compatibility with existing manifest entries that have no derived key.

tools/rustev-release/release-set.json

rustev-wasm exclusion entry is correctly placed and well-justified.

No bugs, security issues, or inconsistencies found.

{"head": "e437191aec171928c97f977e867a0bfcda5ef8d0", "verdict": "no-findings", "findings": []}

Subject: 5764d8b...e437191, diff digest 5d7297fabf8afd103b56faaa91fc7cfabc3eb9dec4d9a691ef530cd72c8ceda8, 2 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

Reviewing the group 1 files for bugs, security issues, and inconsistencies.

Makefile
The lazy CARGO_TARGET evaluation pattern is GNU Make-specific and valid. The @test -n "$(CARGO_TARGET)" guard correctly catches an empty result. The npm audit signatures step running after npm ci is a good supply-chain check. No issues.

crates/rustev-surface/src/host.rs
The new Memory host correctly implements the over-read protocol: read_classified(label, max) truncates to min(len, max), so a caller requesting limit + 1 bytes can distinguish "exactly limit" from "over limit" by comparing lengths. The write_all all-or-nothing rollback is correct; borrow_mut for rollback is only taken after create has already returned and dropped its borrows. The new join fix (empty dir → name only, not /name) is intentional and the new unit test covers it.

crates/rustev-cli/tests/common/harvest.rs
command_of is used both to store "command" and to determine pure — these two uses are kept in sync because they run the same algorithm on the same args. The --rules path validation (Component::Normal check) prevents path traversal. Silently continuing when a backend fails to parse is appropriate: those cases don't get a descriptor entry, and the surface then skips the wasm surface for them. Correct.

integrations/rustev-wasm/src/lib.rs
max_bytes as f64 is safe on wasm32 (usize = u32, all values representable exactly as f64). The comment confirms this. The Callback resolver correctly converts JS errors and wrong types to Resolution::Inaccessible. replay_config range-checks now_ms through a closure; i64::try_from(ms(...)?) is infallible because 2^53−1 < i64::MAX. host_cap_ms.map(|c| ms(c, "hostCapMs")).transpose()? is valid Rust. publish = false and "private": true in package.json correctly prevent accidental crates.io/npm publication.

specs/027-node-and-wasm-bindings/spec.md
The spec explicitly and transparently documents that make bindings fails the 2 MB raw-size gate (5.6% over), identifies the cause (serde code from specs 032/033 schemas), and defers the budget amendment to draft spec 046. This is a known, documented limitation — not a hidden bug.

Conformance case files
"derived": [] entries for non-pure commands and "derived": [...] for pure ones are consistent. "surfaces" correctly gains "wasm" only for pure commands (plan check, plan compile, plan show, replay). The updated sha256 hashes for lodging-emb.bundle.json and support-emb.bundle.json reflect bundle regeneration for the new surface.

No bugs, security problems, or inconsistencies found.

{"head": "f4ddc3b6aca27832d55423a2d5646502683c5990", "verdict": "no-findings", "findings": []}

Group 2 of 2

Reviewing the changed files in group 2.

tools/rustev-conformance/js/package-lock.json — suspicious js-yaml version

The lockfile declares [email protected] as a nested dependency of @apidevtools/json-schema-ref-parser. The js-yaml 4.x branch published 4.0.0 in January 2021 and 4.1.0 in March 2021 and has had no subsequent 4.x releases in any public record. Jumping directly to 4.3.2 with no 4.2.x intermediary is anomalous. The package.json comment explicitly calls out [email protected] and explains how its registry signature can be verified, but makes no equivalent note for [email protected], which is a higher-concern omission — js-yaml is a parsing library with a wider attack surface than a utility library. If this version does not exist on the registry, npm ci will fail; if it was published under a squatted slot, it is a supply-chain risk.

tools/rustev-conformance/js/run.mjs — scope() silently drops required fields

The scope() helper calls a.one(k) (returns undefined when the flag is absent) and passes the result directly into an object literal that JSON.stringify then serialises. JSON.stringify silently omits keys whose value is undefined, so a replay case that lacks --tenant, --context-revision, or --principal-scope in its argv produces {"mode":"principal"} with all three required fields missing. The WASM API then receives an invalid scope document. All currently wired-up replay cases in the manifest appear to carry these flags, so this is latent rather than immediately broken, but a future case that omits one flag will produce a cryptic WASM-internal error instead of a clear test failure.

tools/rustev-conformance/js/wasm-check.mjs — hash-strip regex may miss future wasm-bindgen hash widths

The import normalisation /_[0-9a-f]{16}$/ hard-codes a 16-hex-digit suffix. wasm-bindgen has changed its hash width between major versions; if the project upgrades wasm-bindgen to a version that uses a different hash length, every import will fail the allowlist check with a spurious 027 3.10.3 error rather than a useful message about the actual new import. A looser pattern like /_[0-9a-f]+$/ would be more robust, or the expected hash length should be documented.

Everything else in group 2 — the manifest derived/sha256 updates, the new .json.descriptor.json fixture files (all byte-identical to their counterparts within each surface family), and the updated bundle fixtures — appears mechanically consistent with the spec-027 WASM surface additions.

{"head": "f4ddc3b6aca27832d55423a2d5646502683c5990", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/package-lock.json", "line": 47, "summary": "[email protected] is listed as a nested dependency but no 4.x release beyond 4.1.0 is known; an anomalous or fabricated lockfile entry is a supply-chain risk, and unlike [email protected] no verification note accompanies it."}, {"path": "tools/rustev-conformance/js/run.mjs", "line": 47, "summary": "scope() silently produces JSON with required fields (tenant, context_revision, principal_scope) omitted when their argv flags are absent, passing an invalid scope document to the WASM replay API."}, {"path": "tools/rustev-conformance/js/wasm-check.mjs", "line": 78, "summary": "The import hash-strip regex /_[0-9a-f]{16}$/ hard-codes a 16-hex-digit suffix; a future wasm-bindgen version with a different hash width will produce spurious allowlist failures for every import."}]}

Subject: 5764d8b...f4ddc3b, diff digest d6b20b23cfb2ede9e57536e4da5425a1fef2477306810b51052ca501a1995679, 2 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

Reviewing the diff for bugs, security problems, and inconsistencies.

crates/rustev-surface/src/host.rs

The production Memory::ensure_absent adds a new input-blocking check that the prior test-only implementation lacked:

} else if self.inputs.contains_key(label) {
    "names an input; an output never replaces one"

This is intentional and correct, but the test file (memory_host.rs) never exercises this path — only the output-overwrite case is tested. If this guard were accidentally dropped, no test would catch it.

crates/rustev-cli/tests/common/harvest.rs

The harvest staleness detection asserts derived (new assertion near the end of golden) but never validates surfaces. A case file whose surfaces field becomes stale (e.g., because a new surface is added for a command) would silently pass re-harvest validation while derived staleness would be caught. This is a gap in the integrity check.

integrations/rustev-wasm/src/lib.rs — replay_config

The range check (0.0..=9_007_199_254_740_991.0).contains(&v) looks correct for max_bytes.saturating_add(1) and the subsequent i64::try_from is safe since 2^53-1 < i64::MAX. No bug here.

integrations/rustev-wasm/src/lib.rs — Callback resolver

Accepts arrays of length 0..=max_bytes+1 and forwards to the downstream Resolution::Bytes check, matching the documented CLI-store semantics. Correct.

Makefile — CARGO_TARGET lazy evaluation

The $(eval CARGO_TARGET := ...)$(CARGO_TARGET) pattern is a valid Make lazy-init idiom; the test -n guard below catches empty result from a failed cargo metadata. No issue.

integrations/rustev-wasm/package.json

No "type" field. The node/ export is CJS (wasm-bindgen nodejs target), and web/ and bundler/ are ES modules. Without "type": "module" or explicit "import"/"require" export conditions, some toolchains may misidentify the module format of the ESM targets. Minor but worth noting for the eventual npm publication gate (spec 031 owns that, so it's not blocking here).

{"head": "befe66992927a547602ecb65179431b4fadb8fc9", "verdict": "findings", "findings": [{"path": "crates/rustev-surface/tests/memory_host.rs", "line": null, "summary": "The new production Memory::ensure_absent blocks writes whose label matches an input ('names an input; an output never replaces one'), but no test exercises this path — only the output-overwrite case is covered."}, {"path": "crates/rustev-cli/tests/common/harvest.rs", "line": null, "summary": "Harvest staleness detection asserts 'derived' but never validates 'surfaces'; a case file with a stale surfaces list silently passes re-harvest checks."}, {"path": "integrations/rustev-wasm/package.json", "line": null, "summary": "Missing 'type' field and no 'import'/'require' export conditions may cause module-format ambiguity for the web and bundler ESM targets in some toolchains."}]}

Group 2 of 2

Review group 2 of 2

Reviewing the JS tooling, fixture descriptor files, updated bundles, the manifest schema extension, and the release-set exclusion.


tools/rustev-conformance/js/package-lock.json — lodash is pinned at version 4.18.1. As of my knowledge cutoff (August 2025), lodash's latest 4.x release was 4.17.21 and the project had been in maintenance mode for years with no new minor series. The package.json comment preemptively calls this out as "newer than some references know," which is unusual phrasing for a routine lockfile. Reviewers should verify that [email protected] was actually published by the lodash team (npm audit signatures) before merging; the integrity hash in the lockfile would only catch tampering, not an entirely synthetic package published by a third party under that version string.


tools/rustev-conformance/js/run.mjs — The ran counter (line 148) is incremented for every manifest case that names the wasm surface, including cases whose command falls through to null (line 113). Those cases push to failures and are also counted as ran, so the summary line "conformance wasm: N case(s), N failure(s)" could appear to show N real attempts when N manifests a bad command entry. This is documented in the comment ("a case that did is a failure, reported with the others") and is intentional behaviour, but it could mask a manifest authoring error without surfacing the case count discrepancy clearly.


Bundle updates (lodging-emb.bundle.json, support-emb.bundle.json) — Changes are limited to per-attempt timing fields (dispatched_ms, ended_ms) and the derived run digest; the plan, snapshot, and supply-output digests are stable. Consistent with a re-recording under the new WASM seam.


Everything else — Descriptor files are consistent (same artifact and backend-id as the embedded descriptors in the bundles). Manifest derived entries match file paths and the stated SHA-256 values. Derived struct in src/lib.rs uses deny_unknown_fields and serde(default) correctly. release-set.json exclusion is appropriate. wasm-imports.json allowlist covers both ./rustev_wasm_bg.js:… and wbg:… module variants. gen-types.mjs ownDescriptions wrapping and namespace isolation look correct.

{"head": "befe66992927a547602ecb65179431b4fadb8fc9", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/package-lock.json", "line": null, "summary": "lodash is pinned at 4.18.1, a version not known to exist prior to August 2025; reviewers should run `npm audit signatures` and verify the package's provenance on the public registry before merging, as the lockfile integrity hash would only catch content tampering, not an entirely synthetic release."}]}

Subject: 5764d8b...befe669, diff digest ddd460b7777284efc4589eb807ef09e85e8c44e9b5026a2d386b751446eca236, 2 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

Reviewing the diff for the WASM bindings increment of spec 027.

integrations/rustev-wasm/src/lib.rs

The Callback resolver correctly gates Resolution::Bytes on a.length() as usize <= max_bytes.saturating_add(1), passing up to one byte past the limit so the library can classify oversized items the same way the CLI's store does. The replay_config integer validation (fract() == 0 && 0..=2^53-1) is correct for JavaScript number semantics. No issues.

crates/rustev-surface/src/host.rs

Memory::ensure_absent now refuses both existing outputs and existing inputs. This is the correct cross-surface behavior (a rules file in Inputs must not be clobberable by a command writing to the same label). The old test-only Memory::join returned format!("{dir}/{name}") even for an empty dir, producing a leading-slash label; the new join correctly returns just name when dir is empty. write_all's rollback is safe: create completes and releases the RefCell borrow before the rollback acquires borrow_mut().

Makefile / Cargo.toml

Version-pin checks (wasm-bindgen 0.2.129, wasm-opt version 116) are exact for the CLI tool and prefix-matched via regex for wasm-opt, appropriate for that tool's version output format. The lazy-evaluated CARGO_TARGET memoization pattern is standard Make; the subsequent test -n "$(CARGO_TARGET)" guard covers failure cases. The wasm cargo profile (opt-level = "z", lto = true, panic = "abort", strip = true) is correct for size-first WASM builds.

crates/rustev-cli/tests/common/harvest.rs

The --rules path validation (all(|c| matches!(c, Component::Normal(_)))) correctly rejects .., absolute paths and CurDir. rel = format!("{name}.descriptor.json") is safe because name is a flat or subdirectory-relative path with only Normal components. One minor robustness note: if name contains a subdirectory component and the parent directory does not yet exist inside the fixtures tree, std::fs::write will unwrap-panic; in practice, all current --rules arguments are flat filenames, so this is not a live issue.

Size budget

The spec itself documents (section 3.10.6) that the optimized rustev_wasm_bg.wasm is 2,215,589 bytes raw, 5.6% over the declared 2,097,152-byte budget, and that make bindings deliberately fails at that gate as spec 3.10.4 requires. Draft spec 046 is cited as the tracking vehicle for a budget amendment. Any CI job that runs make bindings will fail on this until 046 is ratified.

Conformance fixtures

lodging.replay and support.replay bundle sha256 values were updated (the bundles embed descriptors whose content changed). refusal-16 and refusal-17 correctly receive "wasm" surface and "derived": [] because plan check without --rules produces no derived descriptor.

{"head": "a551d9dc8e318fec99f1c484371a4a4ce309cb8b", "verdict": "findings", "findings": [{"path": "Makefile", "line": 118, "summary": "make bindings fails at the raw-size gate (2,215,589 bytes > 2,097,152 byte budget) as the spec documents; any CI job invoking this target will fail until spec 046 raises the budget."}]}

Group 2 of 2

Reviewing the files in group 2 of this PR, which adds WebAssembly conformance infrastructure: manifest updates, new descriptor fixtures, updated bundle fixtures, JavaScript tooling, and release-set.json.

tools/rustev-conformance/cases/manifest.json: The derived additions are structurally consistent. All support-backend descriptor hashes use the same SHA-256 (98070801...) and all lodging-backend ones use a3c75af9..., matching the identical content of the new .descriptor.json fixture files. The SHA-256 values for lodging.replay and support.replay bundles are updated in step with the bundle file changes. run cases and definition-only cases correctly get "derived": [] and run cases do not gain the wasm surface.

tools/rustev-conformance/js/run.mjs: pinned() verifies SHA-256 before returning bytes. The derived-substitution logic (inputs.add(name, derived.get(name) ?? bytes)) correctly swaps rule bytes for precompiled descriptors. The flags() parser handles multi-value flags properly. scope() correctly maps tenant-only (CLI) to tenant_only (JSON). The zero-cases guard (ran === 0) prevents silent false-passes.

tools/rustev-conformance/js/wasm-check.mjs: Import allowlist matching regex (/^__wbg_/ prefix strip + 16-hex hash suffix strip) is correct for wasm-bindgen's naming convention, and the check is noted as tied to a pinned wasm-bindgen version. Median (sorted[10] of 21) and p95 (sorted[19] of 21) calculations are correct. The budget checks cover raw_bytes and gzip_bytes consistently with the defined BUDGET object; brotli_bytes is informational only, matching spec intent.

tools/rustev-conformance/js/gen-types.mjs: The ownDescriptions transform and namespace-wrapping approach are sound. The --check mode correctly skips the absent rustev-node target while enforcing the WASM target.

tools/rustev-conformance/js/package-lock.json: lodash 4.18.1 and typescript 5.9.3 are beyond my knowledge cutoff (August 2025), but given today's date (October 2026), these are plausible releases. The [email protected] manifest constrains "lodash": "^4.18.1", confirming that version was published before the tool; npm's integrity verification and npm audit signatures provide supply-chain assurance as documented.

tools/rustev-conformance/src/lib.rs: #[serde(default)] on derived gives correct backwards-compatibility. #[serde(deny_unknown_fields)] on Derived is appropriately strict.

tools/rustev-conformance/fixtures/cli/*.descriptor.json: All support-backend descriptors are byte-identical to each other, and all lodging-backend descriptors are byte-identical to each other, matching the manifest's SHA-256 assertions.

tools/rustev-release/release-set.json: The rustev-wasm exclusion is correctly placed and reasoned.

No bugs, security issues, or inconsistencies found.

{"head": "a551d9dc8e318fec99f1c484371a4a4ce309cb8b", "verdict": "no-findings", "findings": []}

Subject: 5764d8b...a551d9d, diff digest 6ca278258286b70703f0313b9f09b15157610041f55e55c24f00d4d2be234fcc, 2 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Group 1 of 2

Reviewing the changes focused on the new WASM integration, the Memory host promotion to production, and the conformance case updates.

crates/rustev-surface/src/host.rs — Memory::join fixes a latent bug

The old test-only join used format!("{dir}/{name}"), which with an empty dir produced /name (leading slash). The production Memory::join correctly handles dir = "" by returning name alone. The new test join_names_an_output_by_its_directory_or_alone validates this. No issue, just noting the fix.

crates/rustev-surface/src/host.rs — Memory::write_all rollback

The rollback removes entries files[..i] after a failure at index i. Since create can only fail in ensure_absent (before any borrow_mut), all RefCell borrows are released when create returns Err, so the subsequent borrow_mut() for rollback cannot panic. Correct.

integrations/rustev-wasm/src/lib.rs — replay_config timestamp handling

The ms closure admits [0.0, 2^53−1] and the i64::try_from expect is sound since 2^53−1 < i64::MAX. The -0.0 edge case is harmless (-0.0f64 as u64 == 0). NaN and infinity are both rejected by the range check. Correct.

integrations/rustev-wasm/src/lib.rs — Callback::resolve oversized check

a.length() returns u32; on wasm32, as usize is identity. max_bytes.saturating_add(1) prevents overflow. A caller-supplied Uint8Array of u32::MAX bytes would pass the length check only if max_bytes is also u32::MAX, which is unreachable in practice given the WASM heap limit. Acceptable.

crates/rustev-cli/tests/common/harvest.rs — path validation

The Path::new(name).components().all(|c| matches!(c, Normal(_))) assertion correctly blocks .. and absolute paths before writing descriptor files to disk. No path traversal possible.

Makefile — npm ci --ignore-scripts + npm audit signatures

Correctly separates vulnerability audits (--no-audit in npm ci) from signature verification (npm audit signatures). The --ignore-scripts prevents arbitrary install-time script execution. Sound.

wasm-opt in-place optimization

$(WASM_OPT) -Oz ... -o "...rustev_wasm_bg.wasm" "...rustev_wasm_bg.wasm"

wasm-opt reads input fully before writing, supporting in-place paths. Standard usage.

Conformance case JSON consistency

The 23 cases gaining "wasm" surface match the four pure commands (plan check, plan compile, plan show, replay). Non-pure run cases correctly stay ["cli"] only. Counts are consistent with the spec's claimed 23.

No bugs, security issues, or inconsistencies found.

{"head": "a17ad46681a3eff42ebd3ba9be83e33b4d1031de", "verdict": "no-findings", "findings": []}

Group 2 of 2

Reviewing the changes in group 2: the conformance manifest, new fixture descriptor files, updated bundle fixtures, and the new JavaScript tooling (run.mjs, wasm-check.mjs, gen-types.mjs, lock/package files) plus the src/lib.rs and release-set.json updates.

Manifest (manifest.json): The derived entries are structurally consistent — lodging descriptor SHA-256 values (a3c75af9...) and support descriptor SHA-256 values (98070801...) are repeated identically across all cases that share the same descriptor file, matching the identical git blobs committed. run-command cases correctly receive only "derived": [] without "wasm" in their surfaces array, consistent with the comment in run.mjs ("the harvest never names wasm on a run case"). SHA-256 hashes for the updated bundles are updated correspondingly.

run.mjs: flags(c.argv) is called on every case — argv is not in the Rust Case struct visible in the diff, but the JS runner reads JSON directly (not via the Rust type), so it relies on argv being an existing manifest field not changed here. Assuming argv exists in the full manifest, the logic is correct. The resolveItem callback uses JSON.stringify-escaped paths, no injection risk. The null-return guard for unsupported commands (like run) is correct.

wasm-check.mjs: The median index for 21 samples (sorted[10]) is correct. The p95 calculation (sorted[Math.ceil(0.95 * 21) - 1] = sorted[19]) is correct. Budget values (786_432 gzip, 2_621_440 raw) are arithmetically consistent with the spec comment (768 KB gzip, 2.5 MB raw). The hash-stripping regex for wasm-bindgen import names (__wbg_ prefix + 16-hex-char suffix) is appropriately specific.

gen-types.mjs: The ownDescriptions wrapper correctly handles $ref+description co-occurrence via allOf. The --check mode correctly skips rustev-node if it doesn't exist yet, per the "later increment" comment.

Fixtures: The two bundle files (lodging-emb, support-emb) have updated run-document digests reflecting changed timing values (elapsed_ms: 4→3 for lodging, minor dispatched_ms adjustments for support), while all judgment outcomes, evidence, and scores are unchanged. The descriptor files are identical within each backend group (lodging vs. support), consistent with the deduplicated git blobs.

release-set.json: The rustev-wasm exclusion entry is well-formed and correctly motivated.

No bugs, security problems, or inconsistencies found.

{"head": "a17ad46681a3eff42ebd3ba9be83e33b4d1031de", "verdict": "no-findings", "findings": []}

Subject: 5764d8b...a17ad46, diff digest 654fdcb55153259df09634e69a5d81ce51e7d1b903d11406d932acdbbb2334b7, 2 call(s). An AI comment is not an approval.

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