Skip to content

impl(027): increment 6, the native conformance cases - #132

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

bartekus merged 1 commit into
mainfrom
impl/027-node-conformance

Conversation

@bartekus

@bartekus bartekus commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Spec 027, increment 6 (second change): the native conformance adapter. Stacked on #131.

  • tools/rustev-conformance/js/run.mjs gains the native adapter: every CLI case runs natively (pure commands compared whole with exit codes; run compared on the judgment and the run record, the envelope's paths, receipt and exit code being CLI presentation), and every runtime case runs with TypeScript scripted seams driven on a manual clock. All 34 native cases produce their expected bytes, repeatedly; the 23 WebAssembly cases still pass.
  • The manifest names each case's surfaces explicitly (pure commands cli/native/wasm, run cli/native, runtime cases rust-api/native).
  • The runtime-case driver is now deterministic for asynchronous host seams: advance_timer { delay_ms } advances only when that retry delay is pending and no attempt is in flight (via ManualClock::pending_delays, impl(027): increment 6, the native crate #131). Both runners use it.
  • The cancellation case shared by both runners mirrors cancel.rs::no_answer_means_local_waiting_stopped_and_nothing_more; the confirmed-stop case stays Rust-only (runtime.cancel-stop), because the runtime polls a cancelled attempt once and a host seam can never answer within that poll (recorded in the spec as an owner finding).
  • make bindings runs the native conformance after the native tests.

Review round 1 (3 findings, fixed): (1) rawMember walks the document's structure and matches only a top-level key, never a nested key or text inside a string. (2) The sink's records are now checked: a run case requires the sink to have received exactly the bytes the result carries. (3) An attempt whose scripted backend ignores cancellation is settled when its case ends, as the late resolution the engine discards, so no promise is left pending. Restacked on #131; native 34/34 (three runs) and wasm 23/23.

Review round 2 (2 findings, fixed): (1) rawMember tolerates whitespace around the colon and before the value (canonical goldens are compact, but nothing depends on it); checked on nested keys, spaced JSON and a key inside a string. (2) An attempt whose scripted backend ignored cancellation is settled after its case by resolving, never rejecting, so a discarded late settlement cannot surface as an unhandled rejection. Restacked after #133 merged; native 34/34 (twice), wasm 23/23.

Review round 3 (3 findings, fixed): (1) an unknown on_cancel value rejects at once as a script error instead of leaving the attempt waiting. (2) the sink check runs for every run case, whatever outputs it pins: the sink must have received exactly the result's record bytes. (3) rawMember's string scans are bounded by the text's length, so malformed JSON ends the scan. Native 34/34 (twice), wasm 23/23.

Review round 4 (1 finding): by design: the native package links the rules backend (3.3.2) and reads a rules program itself, as the CLI does, so the native adapter passes the program's own bytes and every check and compile case with a rules program produces the CLI's bytes natively (34/34); only the WebAssembly adapter, which cannot read a rules program (3.10.1), substitutes the derived descriptor. The code now says so.

Restacked after #130 stopped recording derived descriptors on run cases: this PR now records them for run cases itself (the harvest gives them to pure and run cases; the native runner prepares a compiled plan against them), restored byte-identical to the descriptors the pure cases carry. Native 34/34, wasm 23/23.

Review round 5 (3 findings): (1) ManualClock::pending_delays is in crates/rustev-runtime/src/clock.rs from #131, this PR's base, so it is in the tree this PR builds on; the workspace compiles and the Rust runner uses it. (2) fixed: valueAt has one exit per kind of value: a container ends at its matching bracket, a scalar before the delimiter after it; checked on nested, spaced, string and number members. (3) fixed: each runtime case keeps its own list of ignored attempts and settles it when the case ends, however it ends, so none reaches a later case. Native 34/34 (twice), wasm 23/23.

Review round 6 (1 finding, fixed): a record output is compared byte for byte, and every normalization its case declares must already hold: timing requires the record's timings to be the normalized zeros (they are, under the manual clock), and any other normalization fails the case, so none passes unchecked. Native 34/34 (twice), wasm 23/23.

Review round 7 (2 findings, both verified against #131): DecideResult.completion is the declared field (index.d.ts), and the native gauges object's key is backendInFlight (src/lib.rs builds it in camelCase for JavaScript); every runtime case drives advance_timer through it, and native passes 34/34.

Review round 8 (1 finding, fixed): the WebAssembly adapter's store resolver returns an item that exists but is empty; only an absent item is null. Restacked after #129 was split (#134 holds the runtime cases).

Review round 9 (1 finding): the late settlement's value is never read: the native seam (integrations/rustev-node/src/seams.rs, #131) takes a host's settlement as plain JSON, and when the attempt has already finished it discards and counts it before anything parses it, so no shape can cause a rejection; the runner's comment now says so. Restacked; native 34/34 (twice), wasm 23/23.

Restacked on #134's fixes: the native runner gains the wait_sleeper step (the deadline case now waits for the runtime's timer) and fails a release_all that frees nothing, as the Rust runner does. Native 34/34 (twice), wasm 23/23.

CI code failed on the previous head: this PR had removed the Rust runner's wait_sleeper step (its retry case moved to advance_timer) while #134 now uses it in the deadline case. Restored, with both runners supporting it; verified from a clean build of rustev-runtime and rustev-conformance (an earlier local run had used a stale shared build). Native 34/34 (twice).

Restacked on #130's last round: the runner's pure-command comparison (comparePure) checks written outputs against the published artifact (never skipping one), and the WebAssembly path requires its commands' flags by name. Native 34/34 (twice), wasm 23/23.

Review round 10 (2 findings): (1) The record goldens hold the normalized form (timings zero, written by the CLI tests through the shared normalization), and a decision under the manual clock produces exactly those bytes, so the byte comparison is the right one; native passes 34/34. The comment says so. (2) fixed: the pure-command engine decides nothing, so its sink now throws if ever delivered to, failing the case, instead of answering a placeholder receipt.

Restacked on #135 after #131 was split: this PR is now increment 6's third change, on the JavaScript layer. Native 34/34 (twice), wasm 23/23.

Rebased after #130 merged: the harvest keeps main's staleness checks (inputs, derived descriptors, surfaces) with this PR's surfaces (native on every CLI case) and derived descriptors on run cases; the runner keeps its scope object with main's required fields. A re-harvest reproduces every case file (the wall-clock replay bundle aside). Native 34/34 (twice), wasm 23/23.

Review round 11 (3 findings): (1) fixed: the attempt loop no longer shadows the flags object. (2) Not so: the native command takes its arguments as a JSON value and deserializes scope from an object (integrations/rustev-node/src/commands.rs, replay_config), and the native replay cases pass; the comment says why it differs from the WebAssembly call, which takes a string. (3) Repeated: ManualClock::pending_delays is in #131, this PR's base.

Review round 12 (1 finding, raised before): the record goldens are written in their normalized form by the CLI tests (timings zero), so normalizing them would change nothing; the runner now checks that on the golden too, failing with a message naming it if a golden were ever stored unnormalized, as it checks the record. Native 34/34 (twice).

Split (the AI review was cancelled at its 15-minute limit twice): this PR is now increment 6's third change, the native conformance cases (surfaces, derived descriptors on run cases, the runtime driver's corrections and the Rust-only cancel-stop case); the JavaScript runner's native adapter (run.mjs and its make bindings step) moves to a PR stacked on this one.

Review round 13 (1 finding, raised before): ManualClock::pending_delays is on main (crates/rustev-runtime/src/clock.rs, from #131, increment 6's first change), so this PR does not change that file and the crate builds; the spec record now names where the accessor comes from rather than reading as if this change adds it.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Reviewing the PR, which adds the native conformance adapter for rustev-node alongside the existing WebAssembly adapter. Key areas: the new run.mjs native adapter, the runtime.cancel split into two cases, and the AdvanceTimer driver step replacing WaitSleeper + AdvanceMs.

Finding 1 — rawMember is fragile (run.mjs ~line 82)

const at = text.indexOf(`"${key}":`);

This performs a raw string scan for "judgment": on the compact JSON golden file. It finds the first occurrence, not a semantically top-level one. If "judgment": appears earlier in the buffer — e.g., inside another key's value string or a nested object — the function silently extracts the wrong bytes and the comparison either passes incorrectly or fails with a confusing message. For the current golden files this likely works, but it is brittle: any change to the CLI run-output field ordering or embedding of the word "judgment" in a preceding field would cause a hard-to-diagnose failure.

Finding 2 — dead records variable in runCase (run.mjs ~line 157)

const records = [];
...
sink: { ..., deliver: async (rec) => (records.push(rec), 'ack') },

records is populated by the sink's deliver callback but never read. The evidence comparison instead uses res.raw.evidence (a different path). The variable is dead code — either a leftover from an earlier implementation where records[0] was used, or a sign that the comparison and the sink are now duplicating work. If the intent was to compare the sink record (which the Rust runner does), the current code skips that path entirely for runCase.

Finding 3 — permanently pending Promise when on_cancel === 'ignore' (run.mjs ~line 330)

call.signal.addEventListener('abort', () => {
  gates.delete(call.attemptId);
  const on = b.on_cancel;
  if (on === 'ignore') return;  // promise stays pending forever
  ...
});

The Promise returned by scripted() is never settled. The test passes because plan.decide() resolves when the decision is cancelled without waiting for backends, but every gate entry for the cancel case leaks a permanently-pending Promise and its closure. For a short-lived test runner this is acceptable, but if nativeAdapter were reused across multiple calls (e.g., in a longer loop) each cancelled ignore attempt accumulates an irrecoverable Promise.

No issues found with the AdvanceTimer logic, the cancel / cancel-stop case split, SHA256 consistency between individual case files and manifest.json, or the harvest.rs surface list change.

{"head": "9aaaec6218326301fd27c3dea31a69cb1e78c782", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/run.mjs", "line": null, "summary": "rawMember scans for the first occurrence of the key string rather than parsing JSON structurally, so it silently extracts the wrong value if 'judgment:' appears earlier in the golden file (e.g., nested or inside a string value)."}, {"path": "tools/rustev-conformance/js/run.mjs", "line": null, "summary": "The `records` array in `runCase` is populated by the sink's deliver callback but never read; `res.raw.evidence` is used for comparison instead, making the sink accumulation dead code."}, {"path": "tools/rustev-conformance/js/run.mjs", "line": null, "summary": "When on_cancel is 'ignore', the Promise returned by scripted() is never resolved or rejected, creating a permanently leaked Promise per cancelled attempt."}]}

Subject: 30f0d54...9aaaec6, diff digest e211b76c8d7136e13dc11abbe9f790bb7105c93fc6404b8815339eca84349b41, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 20, 2026 17:06 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/027-node-conformance branch from 9aaaec6 to cdfebed Compare October 20, 2026 17:12
@bartekus
bartekus force-pushed the impl/027-node-conformance branch from cdfebed to 9e5fad5 Compare October 20, 2026 17:18
@bartekus
bartekus force-pushed the impl/027-node-conformance branch from 9e5fad5 to 92aeaad Compare October 20, 2026 17:21
@bartekus
bartekus force-pushed the impl/027-node-conformance branch from 92aeaad to 401ea61 Compare October 20, 2026 17:32
@bartekus
bartekus force-pushed the impl/027-node-conformance branch from 401ea61 to d4e8298 Compare October 20, 2026 17:36
@bartekus
bartekus force-pushed the impl/027-node-conformance branch from d4e8298 to f489c8f Compare October 20, 2026 17:39
@github-actions

Copy link
Copy Markdown

AI review (findings)

Reviewing the diff carefully across the JavaScript runner, the runtime case split, and the conformance manifest.

run.mjs — rawMember assumes compact JSON

Lines adding rawMember (around line 78):

const isKey = depth === 1 && text[k + 1] === ':';
if (isKey && ...) return valueAt(text, k + 2);

k+1 is assumed to be : and k+2 the value start. If any golden file ever contains a space after : (e.g. "judgment": {...}) rawMember silently returns null, causing a false failure with no diagnostic. The current golden files are produced by Rust's compact serializer so this is latent, not active.

run.mjs — ignored late-rejection mechanism

In scripted, when on_cancel === 'ignore':

ignored.push(() => rejectP(new rustev.SeamFailure({...})));

Called after await Promise.all(running). If the native engine has already released its internal .then() handler on the infer promise before this rejection fires, Node.js ≥15 (with --unhandled-rejections=throw) would abort the process. The comment claims "the engine discards" such settlements, implying a .catch() is attached, but this is an external assumption not verifiable from the diff alone.

manifest.json / runtime.cancel split — consistent

The split of the old runtime.cancel (confirmed-stop) into runtime.cancel (ignore) + runtime.cancel-stop (stop-with-charge) is consistent across all three representations: standalone case files, manifest entries, and Rust test case generation in tests/runtime.rs. The SHA updates for d1.record.json match the new expected bytes. ✓

advance_timer replacement — correct

The AdvanceTimer step correctly waits for clock.pending_delays().contains(delay_ms) && backend_in_flight == 0 before advancing, preventing the clock from racing ahead of an async host seam answer. The JS native counterpart mirrors this condition exactly. ✓

runtime.cancel-stop surfaces: ["rust-api"] only — correctly excluded from native

The rationale (a synchronous Rust seam can poll the on_cancel answer before returning; a host seam answers asynchronously so the confirmed-stop cannot be observed) is correct and consistent with the runtime.cancel native behavior (charge: "unknown", remote: "possibly_continuing"). ✓

{
  "head": "f489c8fadb940aca232af5efc949d65872540db4",
  "verdict": "findings",
  "findings": [
    {
      "path": "tools/rustev-conformance/js/run.mjs",
      "line": 80,
      "summary": "rawMember assumes compact JSON: `text[k+1] === ':'` breaks silently for any golden that contains a space after the colon, returning null and reporting a false failure with no diagnostic."
    },
    {
      "path": "tools/rustev-conformance/js/run.mjs",
      "line": 331,
      "summary": "Late rejection of `ignored` infer-promises after Promise.all completes may produce unhandled rejections in Node.js ≥15 strict mode if the native engine does not attach a .catch() to abandoned infer promises before the decide() settles."
    }
  ]
}

Subject: 904e9c9...f489c8f, diff digest 213cea627412821d9b048d9382b7555ddc2ace5d475a1e6160acaef4d37e2417, 1 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Review

tools/rustev-conformance/js/run.mjs — incomplete on_cancel handling in scripted

Line ~(scripted function, abort listener):

call.signal.addEventListener('abort', () => {
  gates.delete(call.attemptId);
  const on = b.on_cancel;
  if (on === 'ignore') { ignored.push(...); return; }
  if (on === 'unconfirmed') { rejectP(...); }
  else if (on.stop) { rejectP(...); }
  // implicit else: promise never settles
});

If on_cancel is any value other than 'ignore', 'unconfirmed', or {stop:…} (e.g. null, an empty object, or a future policy string), the abort listener is a no-op and the promise returned by scripted is never resolved or rejected. Promise.all(running) then hangs forever with no timeout — the 100 000-iteration until guard only applies to driver-step waits, not to the overall gather. This is a latent defect; it does not affect the current cases but will silently hang the runner if a new on_cancel policy is added without updating the adapter.

tools/rustev-conformance/js/run.mjs — sink-delivery assertion is unreachable for native run cases

Inside runCase, the else branch:

} else {
  const got = Buffer.concat([Buffer.from(res.raw.evidence), Buffer.from('\n')]);
  if (!got.equals(golden)) failures.push(...);
  if (records.length !== 1 || ...) failures.push(...);
}

CLI run conformance cases declare exactly one output with stream: 'stdout'; no non-stdout output entry exists. The else branch therefore never executes, so the sink-delivery invariant ("the sink received exactly the bytes the result carries") is never asserted for native run cases. The judgment comparison does run (the if (o.stream === 'stdout') branch), so correctness of the decision outcome is checked, but the evidence record going to the sink is not verified against any golden.

tools/rustev-conformance/js/run.mjs — rawMember inner while loop has no bounds guard

rawMember, inner string-skip loop (~line 82):

while (text[k] !== '"') k += text[k] === '\\' ? 2 : 1;

text[k] returns undefined when k >= text.length; undefined !== '"' is true, so a malformed or truncated JSON string causes an infinite loop. Inputs are pinned by SHA-256, so this cannot trigger with current fixtures, but a test that builds golden data dynamically (e.g. future RUSTEV_CONFORMANCE_DUMP-based round-trip) could trigger it. A simple k < text.length && guard would harden the loop.


Everything else looks consistent: the AdvanceTimer / WaitSleeper rename is coherent between the Rust runner and the JS adapter; the runtime.cancel / runtime.cancel-stop split correctly reassigns mirrors and expected-record SHA-256s; the scope() refactor (now returning an object instead of a JSON string) is handled correctly for WASM (JSON.stringify(scope(a))) and for native (args.scope = scope(a)); and the manifest SHA-256s for the two updated bundle fixtures are consistent with the corresponding case files.

{"head": "03b24c324762be89d7a00a5a5c6251f97d0a02d0", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/run.mjs", "line": null, "summary": "In the scripted backend's abort listener, if on_cancel is any value other than 'ignore', 'unconfirmed', or {stop:…}, the promise returned by scripted() is never resolved or rejected, causing Promise.all(running) to hang indefinitely with no timeout."}, {"path": "tools/rustev-conformance/js/run.mjs", "line": null, "summary": "The sink-delivery assertion inside runCase's else branch is unreachable for CLI run cases (which declare only stdout outputs), so native run conformance cases never verify that evidence bytes were delivered to the sink."}, {"path": "tools/rustev-conformance/js/run.mjs", "line": null, "summary": "The inner while loop in rawMember has no bounds check on k; a malformed or truncated JSON string would cause an infinite loop."}]}

Subject: da7b57e...03b24c3, diff digest 28bd10a15b1d5045630468f90a4390cb874b9c08c8269da87914cee4cd202468, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception October 20, 2026 19:16 — with GitHub Actions Inactive
@bartekus
bartekus force-pushed the impl/027-node-conformance branch from 03b24c3 to d1520b5 Compare October 20, 2026 19:27
@bartekus
bartekus force-pushed the impl/027-node-conformance branch from d1520b5 to 3ecc132 Compare October 20, 2026 19:28
@bartekus
bartekus force-pushed the impl/027-node-conformance branch from 3ecc132 to b34691f Compare October 20, 2026 19:38
@bartekus
bartekus force-pushed the impl/027-node-conformance branch from 8563bae to 7a00fda Compare October 20, 2026 22:48
@github-actions

Copy link
Copy Markdown

AI review (findings)

Looking at this PR, which adds a native (Node.js) conformance adapter, splits runtime.cancel into two cases, and replaces the wait_sleeper/advance_ms driver protocol with advance_timer.

tools/rustev-conformance/js/run.mjs — d.ok.completion property assumption

In runtimeCaseWith, the decide result's status is read as:

status = { decision_id: id, status: d.ok.completion };

The field name completion is assumed without a visible API definition in this diff. The expected golden d1.result.json contains "status":"cancelled". If the native plan.decide() result uses status rather than completion, this would silently produce {"decision_id":"d1","status":null} (or omit the field entirely), failing every native runtime comparison. The existing index.d.ts (unchanged, not shown) should be checked to verify the field name is completion.

tools/rustev-conformance/js/run.mjs — backendInFlight camelCase assumption in advance_timer

Object.values(engine.gauges().backendInFlight).every((n) => n === 0)

The Rust conformance runner uses backend_in_flight (snake_case). If the Node.js gauges API exposes this field in snake_case as well, engine.gauges().backendInFlight is undefined and Object.values(undefined) throws a TypeError, breaking the advance_timer step in both retry and cancel native cases. Again, index.d.ts is the authoritative reference.

Everything else looks sound: the rawMember/valueAt JSON extraction correctly tracks string boundaries to avoid false depth changes; the ignored mechanism in runtimeCase's finally block correctly resolves in-flight "ignored cancel" promises without leaving unhandled rejections; harvest.rs's new !(pure || is_run) condition correctly extends descriptor recording to run cases; the runtime.cancel-stop exclusion from the native surface is correctly motivated (async host seams can never observe a confirmed stop synchronously); and the AdvanceTimer Rust step correctly fences on both the specific pending delay and zero in-flight attempts before advancing the clock.

{"head": "7a00fda2d5d8169e66c7ed2f2ed35f2af822fd7f", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/run.mjs", "line": null, "summary": "In runtimeCaseWith, d.ok.completion is read for the decision status, but if the native plan.decide() result uses a different field name (e.g. status), all runtime native comparisons silently produce wrong JSON — verify against index.d.ts."}, {"path": "tools/rustev-conformance/js/run.mjs", "line": null, "summary": "The advance_timer condition uses engine.gauges().backendInFlight (camelCase), but the Rust API uses backend_in_flight; if the Node.js gauges object uses snake_case, Object.values(undefined) throws a TypeError and breaks every advance_timer step."}]}

Subject: d131805...7a00fda, diff digest 4741e52c9c9352023c5c529458d0d6e8d4f3cf23edcec971a0eb0d5ebab1fb80, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 20, 2026 22:58 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/027-node-conformance branch from 7a00fda to 4e4aaed Compare October 20, 2026 23:00
@github-actions

Copy link
Copy Markdown

AI review (findings)

Reviewing the PR, which adds a "native" (Node-API) conformance surface alongside WebAssembly, splits the runtime.cancel case into two, and replaces wait_sleeper+advance_ms with a combined advance_timer step.

run.mjs — || vs ?? in WASM resolveItem (semantic regression)

The refactored WASM adapter changed the resolveItem lambda from the original ?? (nullish coalescing) to || (logical OR):

Original (inside runWasm):

const b = store !== undefined ? files.get(`${store}/${reference}`) : undefined;
return b ?? null;

New (inside wasmAdapter):

return (store !== undefined && files.get(`${store}/${reference}`)) || null;

|| treats any falsy value — including Buffer.alloc(0) — as absent. ?? only treats null/undefined as absent. If any fixture resolves to an empty Buffer, the new code returns null instead of the Buffer. Fixture files are SHA-256-validated so this can't fire today, but the semantic change is a latent bug.

rawMember / valueAt — string-scanning correctness (no bug, noted)

Both functions handle \\-escaped chars and nested containers correctly for valid JSON. The depth tracker properly skips over string contents so no false-positive key matches can occur inside nested values.

advance_timer protocol consistency

The Rust AdvanceTimer and the JS advance_timer case both gate on pending_delays().contains(delay_ms) && backend_in_flight.all(0) before advancing the clock. They are equivalent; the change is sound.

runtime.cancel / runtime.cancel-stop split

The split is internally consistent: runtime.cancel now mirrors no_answer_means_local_waiting_stopped_and_nothing_more with on_cancel: "ignore", producing "remote":"possibly_continuing" / "final_cost":"unknown" / "liability":15. runtime.cancel-stop mirrors a_confirmed_stop_is_recorded_as_stopped_with_its_charge with on_cancel: {stop: ...}, retaining the old bf82b57d... record SHA. The runtime.cancel-stop case correctly stays rust-api-only because the JS scripted seam answers asynchronously and can never produce the synchronous poll result that confirms a stop.

harvest.rs condition

!(pure || is_run) || a != "--rules" correctly restricts descriptor derivation to run commands and pure commands only. Logic is sound.

{"head": "4e4aaed25d63f1594b2b1cb506c40e0c86a0aa46", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/run.mjs", "line": null, "summary": "In wasmAdapter, resolveItem uses `||` instead of `??`, so a found-but-empty Buffer is incorrectly treated as absent and returns null; the original code used `??` (nullish coalescing)."}]}

Subject: 9c164ee...4e4aaed, diff digest 4fd61e2390640a434873b7ddb9011a6d263e55fdc0b4cab0e6f1bceae2c9038a, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 20, 2026 23:07 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/027-node-conformance branch 2 times, most recently from 0558532 to 6e0226e Compare October 20, 2026 23:10
@bartekus
bartekus force-pushed the impl/027-node-conformance branch from 6e0226e to f2e36e1 Compare October 20, 2026 23:13
@github-actions

Copy link
Copy Markdown

AI review (findings)

Reviewing this PR, which adds the native conformance adapter (increment 6, second change of spec 027), splits runtime.cancel into two variants, and updates all fixtures.

Key areas reviewed:

harvest.rs logic change (lines 205-215): The new condition !(pure || is_run) || a != "--rules" correctly extends descriptor generation to run cases. The new surfaces ["cli", "native", "wasm"] for pure and ["cli", "native"] for run are consistent with all the case-file updates.

run.mjs — rawMember / valueAt: The custom compact-JSON member extractor correctly tracks depth, skips string content, and handles escape sequences. It is scoped to top-level keys (depth === 1) and is appropriate for canonical single-line JSON blobs.

run.mjs — scripted ignore-cancel settlement: When on_cancel === 'ignore', the late resolution sends { output: {}, charge: { observed: { units: 0 } }, remote }. The empty output: {} is not shaped like a real inference result. Although the engine is specified to discard late settlements, if validation occurs before discard an unhandled rejection could surface in a test run. The object should at minimum carry a plausible output field.

runtime.rs — AdvanceTimer: Correctly waits for the exact delay_ms to be pending with no in-flight attempts before advancing. Consistent with the JS adapter's advance_timer case.

Cancel-case split: runtime.cancel → on_cancel: "ignore" / no_answer_means_local_waiting_stopped_and_nothing_more, runtime.cancel-stop → on_cancel: stop / a_confirmed_stop_is_recorded_as_stopped_with_its_charge. The sha256 migrations, mirror references, expected-record bytes, surface lists, and assert!(ran >= 6) are all internally consistent.

Manifest consistency: Standalone case files and manifest.json agree on sha256, mirrors, on_cancel values, and surfaces for both cancel variants.

{
  "head": "f2e36e1043fc647fcdbac993e82bf4ecc7332888",
  "verdict": "findings",
  "findings": [
    {
      "path": "tools/rustev-conformance/js/run.mjs",
      "line": null,
      "summary": "In `scripted()`, the late resolution for `on_cancel === 'ignore'` passes `output: {}` (an empty object not shaped like a real inference result); if the engine validates the payload before discarding it, this could cause an unhandled rejection in test runs."
    }
  ]
}

Subject: 61f70d2...f2e36e1, diff digest 3702edbe0a3b18ab846df27439f9f6e8ef2e44a817b7ab23adf1f3482b6c0b0d, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 20, 2026 23:23 — with GitHub Actions Error
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewed the diff thoroughly across the Rust runtime changes, JavaScript conformance runner refactor, fixture updates, and case manifest changes.

tools/rustev-conformance/js/run.mjs — rawMember string-scanner depth tracking

The outer scanner tracks depth by incrementing on {/[ and decrementing on }/], but only outside of strings. Inside the ch === '"' branch it advances i to k (the closing quote) so inner brackets are never counted — correct. After i = k the for-loop increments to k+1, skipping the colon/whitespace naturally. valueAt mirrors this discipline. No defect.

nativeAdapter runCase — byte-exact record comparison before normalization check

The code first tests got.equals(golden) byte-for-byte, then iterates o.normalize and checks that all timing values in the record are zero. The author's comment explains this is intentional: under the manual clock, all timing fields in the golden are already zero, so the normalization walk is only a defensive assertion, not a correction step. No defect.

scripted — on_cancel: 'ignore' resolves with { output: {}, … }

The comment explicitly says the native seam discards the settlement value once the attempt is marked finished. The finally block in runtimeCase calls these deferred resolves only after runtimeCaseWith has already returned, so the resolution is unreachable by the engine. No defect.

advance_timer in both Rust and JS

The Rust AdvanceTimer step waits until clock.pending_delays().contains(delay_ms) && backend_in_flight.values().all(|n| *n == 0), then advances. The JS mirrors this with engine.clockDelays().includes(arg.delay_ms) && Object.values(engine.gauges().backendInFlight).every(n => n === 0). The symmetry is intentional and correct; the old wait_sleeper + advance_ms split was racy under async host seams.

runtime.cancel / runtime.cancel-stop split

The split correctly separates "backend ignored cancellation → possibly_continuing" from "backend confirmed stop → stopped + charge". The cancel-stop case deliberately stays rust-api-only because a JS host seam always answers asynchronously, so the synchronous poll at 3.7.3 can never observe the confirmation. Consistent across the standalone JSON, manifest, and Rust test generator.

Minor variable shadow in runCase

for (const a of q.attempts) in the normalization walk shadows the outer a (the flags object). Not a runtime bug since a.dispatched_ms / a.ended_ms correctly address the attempt object at that scope.

No actionable defects found.

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

Subject: 1a218ba...b6b0f0a, diff digest 9030006ab8cfb0f306fa7715b5099263661477abbce1bc2e4f2d7c8844c2afde, 1 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Reviewing the diff, the main changes are: (1) adding "native" surface to all conformance cases, (2) splitting runtime.cancel into two cases (ignore vs. confirmed-stop), (3) replacing wait_sleeper/advance_ms with advance_timer in retry cases, and (4) adding the full native adapter in run.mjs.

harvest.rs logic
The new condition !(pure || is_run) || a != "--rules" correctly extends derived-descriptor collection from pure-only to also cover run commands. The surface arrays (["cli","native","wasm"] vs ["cli","native"]) are consistent with the spec.

runtime.cancel / runtime.cancel-stop split
The split is well-motivated: host seams answer asynchronously, so a synchronous poll for the cancel answer (spec 003, 3.7.3) can never observe "stopped". runtime.cancel mirrors no_answer_means_local_waiting_stopped_and_nothing_more with on_cancel:"ignore", runtime.cancel-stop mirrors a_confirmed_stop_is_recorded_as_stopped_with_its_charge and stays Rust-only. Standalone files, manifest, and test cases are consistent.

run.mjs — rawMember / valueAt
Both functions correctly track depth (only outside string literals), handle escape sequences, and return the raw bytes of top-level JSON values. The key-at-depth-1 check is correct.

run.mjs — runCase record comparison

The else branch for non-stdout outputs:

const got = Buffer.concat([Buffer.from(res.raw.evidence), Buffer.from('\n')]);
if (!got.equals(golden)) failures.push(`${c.id}: the record differs from ${o.golden}`);

The byte comparison is unconditional. When a case declares "normalize": ["timing"], the golden (generated by the CLI) may contain non-zero dispatched_ms/ended_ms fields, while the native runner under a manual clock produces zeros. The normalization check below only validates that native timings are already zero — it never corrects the already-logged failure. If CLI-generated run-record goldens carry non-zero timing fields, every native run case with timing normalization will report a spurious byte-mismatch failure even when the logic is correct.

run.mjs — quiet sink acknowledgment

The engine used for pure commands is created with:

const quiet = { queueCapacity: 1, deliver: async () => 'unused' };

The replay surface cases run through pureCase via this engine. If the native SDK validates the delivery acknowledgment value (the run cases explicitly use 'ack'), replaying a bundle that delivers evidence to the sink would produce an unexpected ack string, potentially surfacing as an engine error thrown past comparePure.

{
  "head": "eab4cd41af33ce628af76e36e8c17c11f7008e70",
  "verdict": "findings",
  "findings": [
    {
      "path": "tools/rustev-conformance/js/run.mjs",
      "line": 270,
      "summary": "In runCase, record bytes are compared against the golden unconditionally before normalization is checked; if CLI-generated golden records contain non-zero timing fields, every native run case with normalize:[\"timing\"] logs a false byte-mismatch failure even when the logic is correct."
    },
    {
      "path": "tools/rustev-conformance/js/run.mjs",
      "line": 191,
      "summary": "The pure engine's sink returns 'unused' instead of 'ack'; if the native SDK validates the acknowledgment string after delivering replay evidence, replay conformance cases on the native surface will throw rather than pass."
    }
  ]
}

Subject: 1d0b10b...eab4cd4, diff digest 1056eb4f07855c76fa6ce8cf3d40c2facf882959181efbb80e2126756d623b15, 1 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Looking through this PR, which adds a "native" conformance adapter for the Node.js package alongside new runtime test cases (runtime.cancel-stop), I found one substantive bug.

tools/rustev-conformance/tests/runtime.rs — mirrors function, "runtime.cancel-stop" arm

The new runtime.cancel-stop arm (lines ~352–365 of the diff hunk) was copy-pasted from the updated runtime.cancel arm without being updated for the stop semantics:

"runtime.cancel-stop" => {
    ...
    assert_eq!(
        q.attempts[0].cancellation,
        Cancellation::Requested {
            answer: CancelAnswer::NotObserved  // ← wrong
        }
    );
    assert_eq!(q.attempts[0].remote, RemoteState::PossiblyContinuing);  // ← wrong
    assert_eq!(r.cost.liability, 15);  // ← wrong
}

But the golden file tools/rustev-conformance/expected/runtime/runtime.cancel-stop/d1.record.json (and the case it mirrors — a_confirmed_stop_is_recorded_as_stopped_with_its_charge) shows "answer":"stopped", "remote":"stopped", and "observed":6 (3 attempts × 2 units). The correct assertions should be CancelAnswer::Stopped, RemoteState::Stopped, and r.cost.observed == 6. When the_manifest_runtime_cases_pass_through_the_runner runs the runtime.cancel-stop case and calls mirrors("runtime.cancel-stop", &out), the actual Rust runtime output (which matches the golden) will disagree with these assertions and the test will fail.

No other substantive bugs found. The rawMember / valueAt JSON byte-extraction logic, the advance_timer condition in both src/runtime.rs and run.mjs, the scope refactoring, the cancel/ignore scripted seam, and the split of runtime.cancel into ignore vs. stop cases all look consistent with the spec description and the golden files.

{"head": "ae1ee146f5f4432053cf1d36d159466690ff476e", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/tests/runtime.rs", "line": 362, "summary": "The `runtime.cancel-stop` arm in `mirrors` asserts `CancelAnswer::NotObserved`, `RemoteState::PossiblyContinuing`, and `liability==15` — copy-pasted from the updated `runtime.cancel` arm — but the golden file and the mirrored test require `CancelAnswer::Stopped`, `RemoteState::Stopped`, and `cost.observed==6`, so the conformance test will fail."}]}

Subject: 1d0b10b...ae1ee14, diff digest 9ba17169d5c0616494e206ab52e25704201e0e0df3a1471b737f910781b04543, 1 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff carefully across all changed paths.

crates/rustev-cli/tests/common/harvest.rs — The rewritten condition !(pure || is_run) || a != "--rules" correctly extends descriptor recording to run commands, mirroring the spec note at 3.12.3. The surfaces array change (["cli","native","wasm"] / ["cli","native"]) is consistent with the conformance case additions throughout. ✓

tools/rustev-conformance/js/run.mjs — Large rewrite; no critical issues found:

  • rawMember: depth starts at 0, the opening { increments it to 1 via the else if branch, keys are matched only at depth === 1. String interiors (including {/}) are skipped by setting i = k. Escaped-quote handling (k += text[k] === '\\' ? 2 : 1) is correct.
  • valueAt: container depth and string-skip logic match standard JSON traversal. ✓
  • scope(a) now returns a plain object; wasmAdapter re-wraps with JSON.stringify(scope(a)) to preserve the original WASM API contract; pureCase passes the plain object to the native API. ✓
  • The ignored settle-on-exit pattern (resolveP({output:{},…}) for on_cancel:'ignore') resolves (never rejects) so there are no unhandled rejections; the comment explicitly notes the engine discards already-finished attempts before parsing. ✓
  • Variable shadowing: a inside for (const a of q.attempts) shadows the outer flags-parser a, but the outer a is not accessed within that loop. Confusing, not a bug.

tools/rustev-conformance/src/runtime.rs / tests/runtime.rs — AdvanceTimer waits for the exact delay pending and no attempt in-flight before advancing; this correctly serialises clock advancement with async host answers. The test count guard raised from 5 to 6 matches the new runtime.cancel-stop case. ✓

runtime.cancel / runtime.cancel-stop split — runtime.cancel now tests no_answer_means_local_waiting_stopped_and_nothing_more (backend ignores cancellation → remote:possibly_continuing, final_cost:unknown). runtime.cancel-stop carries the old confirmed-stop golden and is rust-api-only with the correct rationale (a host seam's Promise answer arrives asynchronously so the synchronous poll at 3.7.3 always sees it as not yet observed). Both the standalone .json files and the manifest entries are internally consistent. ✓

SHA-256 hashes — All sha256 values in case and fixture files are 64 hex characters. The updated bundle digests (lodging-emb.bundle.json, support-emb.bundle.json) reflect timing differences between the synchronous Rust rules backend and the asynchronous Node.js runner, which is expected.

No bugs, security issues, or inconsistencies found.

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

Subject: 21bb55f...8cdf584, diff digest 8e924cd7c27976176d804d70fd69fa5e6b689205ab7b5e7ef01032e7e8b958af, 1 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff carefully across all changed files.

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

The condition change at line ~213 from if !pure || a != "--rules" to if !(pure || is_run) || a != "--rules" is correct: it enables descriptor tracking for run cases (non-pure) in addition to pure commands. The surface list change (["cli", "native"] / ["cli", "native", "wasm"]) is consistent with all conformance case JSON edits.

tools/rustev-conformance/js/run.mjs — rawMember / valueAt

Both functions correctly handle escape sequences (\\ advances by 2), and the depth tracking never peeks inside string contents because the string-skip sets i = k before the outer loop's i++ fires. No bugs in the custom parser for the targeted use.

run.mjs — runCase (native run)

The comparison for stdout outputs extracts the judgment field from the golden envelope and compares it to res.raw.judgment. For the record output it concatenates res.raw.evidence + '\n' and compares byte-for-byte. The trailing sink-delivery check (records.length !== 1) is correct for a single admitted decision.

One variable-name shadow: the inner for (const a of q.attempts) shadows the outer a (the flags object) in the timing-normalization loop. This is harmless because the outer a is not needed there, but it is confusing.

run.mjs — scripted / cancel handling

For on_cancel === 'ignore', the resolution value { output: {}, charge: { observed: { units: 0 } }, remote } is documented as "discarded by the engine before parsing." If the native seam ever changes to parse before discarding, this would silently produce bad data instead of a test failure.

tools/rustev-conformance/src/runtime.rs — AdvanceTimer

The new step correctly calls clock.pending_delays().contains(delay_ms) and waits for zero in-flight attempts before advancing. This matches the JS counterpart in run.mjs.

Manifest / case file consistency

  • runtime.cancel now mirrors no_answer_means_local_waiting_stopped_and_nothing_more, uses "on_cancel": "ignore", and its expected record has "remote":"possibly_continuing" / "charge":"unknown" — consistent.
  • runtime.cancel-stop mirrors a_confirmed_stop_is_recorded_as_stopped_with_its_charge, uses the stop-with-charge policy, and its expected record still has "remote":"stopped" / "charge":{"observed":{"units":2}} — consistent.
  • runtime.cancel-stop is correctly excluded from "native" surfaces in both the standalone case file and the test-generated manifest, matching the spec rationale (host seams answer asynchronously; a polling-based cancel confirmation can never be observed).
  • SHA-256 hashes for all four new support.rules.json.descriptor.json fixtures match (all four share identical content 98070801…). The lodging descriptor hash a3c75a… differs correctly.

No security issues found. The one latent risk is the { output: {} } ignored-cancel settlement — not a bug today, but fragile if the seam's discard-before-parse guarantee ever changes.

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

Subject: 2fdea99...cd65eb7, diff digest e8d87ec082e38dc833f64fe9f703231bb9b5c4e477f601f75259d72a2ad6b317, 1 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Review

tools/rustev-conformance/js/run.mjs — shadowed variable in runCase

Inside runCase(c, a, files, derived), the outer parameter a (the CLI flags object) is shadowed by the inner loop variable:

for (const q of record.requests) for (const a of q.attempts) t.push(a.dispatched_ms, a.ended_ms);

Any future code added to that inner loop that reaches for a.one(...) or a.need(...) will silently operate on the attempt object instead of the flags object. The outer a is not used in the inner loop today, so there is no immediate functional failure, but it is a latent hazard.

tools/rustev-conformance/js/run.mjs — scope() returns object in native pureCase but a JSON string for WebAssembly

scope() was refactored from returning a JSON string to returning a plain JS object. The WebAssembly path re-wraps it correctly with JSON.stringify(scope(a)). In the native pureCase, it is passed as a raw object:

args.scope = scope(a);   // object, not a JSON string

Whether the native Engine.command('replay', files, args) API accepts a JavaScript object or expects a JSON-encoded string for scope is not verified from the diff. If the native binding passes args.scope straight to the Rust layer (which would expect JSON bytes, consistent with every other file argument), the replay case will fail silently for the native surface with a deserialization error rather than an assertion failure.

tools/rustev-conformance/src/runtime.rs — AdvanceTimer references clock.pending_delays(), implementation not in diff

The new Step::AdvanceTimer step calls clock.pending_delays(), a method described in the spec as newly added to ManualClock. The file crates/rustev-runtime/src/clock.rs is present in the repo but is not among the changed paths in this PR. If pending_delays() is genuinely new, its implementation is missing from this diff and the crate will not compile. If the method pre-existed, the spec note is misleading but there is no compilation problem.

{"head": "b9ea88a8e824c330f61ebc60fb7cd25f28cc6776", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/run.mjs", "line": null, "summary": "The `runCase` function parameter `a` (CLI flags object) is shadowed by the inner loop `for (const a of q.attempts)`, making it easy to accidentally use the attempt object in place of the flags object in future edits."}, {"path": "tools/rustev-conformance/js/run.mjs", "line": null, "summary": "In `pureCase`, `args.scope = scope(a)` passes scope as a JS object rather than a JSON string; if the native `command('replay', ...)` binding serialises args to bytes before passing to Rust, this type mismatch will silently break replay cases on the native surface."}, {"path": "tools/rustev-conformance/src/runtime.rs", "line": null, "summary": "`Step::AdvanceTimer` calls `clock.pending_delays()`, described in the spec as a newly-added method, but `crates/rustev-runtime/src/clock.rs` is absent from the changed paths, leaving the implementation unverified in this diff."}]}

Subject: c6315bb...b9ea88a, diff digest fb710f01a1c00b2ca91e8eacdd3657738957d2ddb436ff71fdeab47804e4ed66, 1 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Reviewing the changes carefully across the spec update, the Rust conformance driver, the JS runner, and the corpus of fixture/case files.

Makefile / spec / fixture files: The additions look consistent. The new runtime.cancel-stop case correctly splits the old runtime.cancel case — the "confirmed stop" scenario stays Rust-only because a host seam answers asynchronously and the runtime polls only once.

crates/rustev-cli/tests/common/harvest.rs: The condition change from !pure to !(pure || is_run) is logically correct: run cases now emit a derived descriptor so the native adapter can call compile() with it (3.12.3).

tools/rustev-conformance/src/runtime.rs / tests/runtime.rs: AdvanceTimer is added cleanly; the wait condition ("pending delay present AND no attempt in flight") mirrors what the JS side does, and the Rust test correctly uses it for retry cases. The mirror-function change for runtime.cancel and the new runtime.cancel-stop case are consistent.

tools/rustev-conformance/js/run.mjs: The major rewrite looks structurally sound. One substantive concern:

In runCase (for native run cases), the record output is compared byte-for-byte against the CLI golden:

const got = Buffer.concat([Buffer.from(res.raw.evidence), Buffer.from('\n')]);
if (!got.equals(golden)) failures.push(`${c.id}: the record differs from ${o.golden}`);

The comment says the golden "holds the normalized form (timings zero)". This relies entirely on the CLI test producing zero-millisecond timings for the rules backend. The normalization loop that follows is a post-hoc sanity check, not a pre-comparison normalizer — if the golden was captured with non-zero dispatched_ms/ended_ms (e.g., on a slower machine), the byte comparison will permanently fail with a misleading "record differs" message until the golden is regenerated. The normalize entries declared in the case (e.g., "normalize": ["timing"]) are never applied to golden before comparison, only used to assert that got already has zeros. This is fragile: the guarantee is implicit and environmental, not enforced.

All other pieces — rawMember/valueAt (used only on controlled canonical JSON), scripted cleanup via ignored, advance_timer TOCTOU safety (single-threaded event loop), and scope object vs string handling between adapters — look correct.

{"head": "de50f99f3571408d30ad03b7c96fdf78d1c9f442", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/run.mjs", "line": 249, "summary": "runCase compares the record output byte-for-byte against the CLI golden without applying timing normalization to the golden first; if any golden was captured with non-zero dispatched_ms/ended_ms the test permanently fails with a misleading message, because the normalize entries are only used to assert zeros in `got`, never to normalize `golden`."}]}

Subject: 6a59143...de50f99, diff digest 8f124e11a65cebb2f1b5e5362d937a673294f7ef5680c8d9c215261e8d73b4bc, 1 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (no-findings)

The PR adds the native conformance surface to the JavaScript runner, splits runtime.cancel into two cases (runtime.cancel for on_cancel: "ignore" and runtime.cancel-stop for on_cancel: {stop: ...}), and replaces wait_sleeper/advance_ms pairs with the new advance_timer step.

Consistency checks:

  • Manifest entries and individual case files agree on surfaces, derived, sha256, and mirrors values throughout.
  • runtime.cancel-stop.json standalone file and its manifest entry both correctly list "surfaces": ["rust-api"] only, matching the tests/runtime.rs special-case exclusion and the spec's reasoning (a host seam can never be polled synchronously for a confirmed stop).
  • The four new descriptor fixture files for actionable.run-* and support.run all carry the same sha256: 98070801... consistent with their identical content. The lodging.run descriptor carries a different hash for the lodging artifact.
  • The harvest.rs guard change !(pure || is_run) || a != "--rules" correctly adds derived entries for run cases so the native adapter's runCase can find them via derived.get(r).
  • runtime.rs count assertion bumped from >= 5 to >= 6 accounts for the new cancel-stop case.

Code review of run.mjs:

  • rawMember / valueAt: hand-rolled JSON scanner handles escape sequences with k += text[k] === '\\' ? 2 : 1. For canonical (compact) JSON with no \uXXXX keys or deeply-escaped strings the parsing is correct; depth is only incremented for brackets outside strings since string content is skipped by i = k.
  • scope() now returns an object (not a string). The WebAssembly path correctly wraps it in JSON.stringify(scope(a)) while the native replay path passes the object directly — consistent with the stated difference in the binding APIs.
  • advance_timer in the JS driver (engine.clockDelays().includes(arg.delay_ms) && ...every((n) => n === 0)) mirrors the Rust AdvanceTimer condition (clock.pending_delays().contains(delay_ms) && rt.gauges().backend_in_flight.values().all(|n| *n == 0)) exactly. No race: both are checked atomically within a single event-loop turn.
  • The ignore backend's deferred settle (ignored.push(...)) correctly prevents unhandled rejections and matches the expected "charge":"unknown" / "remote":"possibly_continuing" output for runtime.cancel.
  • One cosmetic issue: two separate /** ... */ JSDoc blocks appear directly above scripted() (lines ~440–443 in the new file), where only the last one would be picked up by documentation tools. Not a correctness bug.

No correctness bugs, security issues, or inconsistencies found.

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

Subject: 3864be6...6b12322, diff digest 6d1ed0c530b9c839d2addd00aef388479dd1ac2902977cc3586cf54b3d114df6, 1 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Reviewing the PR, which adds a native (Node.js) conformance adapter, splits runtime.cancel into two cases (no_answer / confirmed_stop), and wires advance_timer as a safer retry-clock step.

crates/rustev-cli/tests/common/harvest.rs — condition logic

Old: if !pure || a != "--rules" (skip unless pure and arg is --rules)
New: if !(pure || is_run) || a != "--rules" (skip unless pure-or-run and arg is --rules)

De Morgan check: for a non-pure, non-run case !(false||false)||… = true → always skip, correct. For a run case !(false||true)||… = false||… = a != "--rules" → collects only on --rules. Correct; no bug.

tools/rustev-conformance/js/run.mjs — rawMember / valueAt

The hand-rolled JSON scanner skips strings by advancing k with k += text[k]==='\\' ? 2 : 1 and sets i=k before the loop's i++. Depth tracking only counts {/[ outside string content. For canonical (compact) JSON this is correct.

tools/rustev-conformance/js/run.mjs — scripted function, non-gate string answers

const answer = list.length ? list[...] : null;
if (answer !== 'gate') return Promise.resolve().then(() => settle(answer));

settle handles null, a.output, and a.fail, but throws unknown answer for any plain string other than 'gate' (e.g., if someone wrote ["finished"] in an answer list). All current test data uses only ["gate"], so this is latent rather than active, but worth noting for future case authors.

tools/rustev-conformance/js/run.mjs — advance_timer type safety

engine.clockDelays().includes(arg.delay_ms)

If the native module returns delays as BigInt (common in NAPI for 64-bit values) and arg.delay_ms is a plain number, includes uses strict equality and silently returns false, causing the until loop to exhaust 100 000 iterations and report "waited forever for the timer". This is not confirmed without seeing the native module's return type, but is the most likely runtime surprise.

Cancel-case split consistency

  • runtime.cancel → mirrors no_answer_means_local_waiting_stopped_and_nothing_more, on_cancel:"ignore", expected: charge:"unknown", remote:"possibly_continuing", answer:"not_observed" ✓
  • runtime.cancel-stop → mirrors a_confirmed_stop_is_recorded_as_stopped_with_its_charge, Rust-only, expected bytes match old cancel golden ✓
  • SHA-256 values in case files are consistent with the updated golden content ✓

tools/rustev-conformance/src/runtime.rs — AdvanceTimer

Step::AdvanceTimer { delay_ms } => {
    until("the timer, with no attempt in flight", || {
        clock.pending_delays().contains(delay_ms)
            && rt.gauges().backend_in_flight.values().all(|n| *n == 0)
    }).await?;
    clock.advance(*delay_ms);
}

delay_ms: &u64, pending_delays() returns something contains(&u64) can search — idiomatic if it returns Vec<u64> or similar. Logic correctly guards against advancing the clock while a host-seam async call is in flight, fixing the race in the old wait_sleeper + advance_ms pattern.

Bundle fixture re-generation

lodging-emb.bundle.json and support-emb.bundle.json changed (dispatch/end timings shifted by a few ms). The replay command outputs the stored judgment (timing-independent), not the raw run-record timings, so the unchanged CLI replay goldens remain valid.

Minor: scripted on_cancel:"unconfirmed" path passes charge:"unknown" as a string to SeamFailure. Not exercised by any current native case, so this is dead code with a potentially wrong argument shape.

{"head": "297fd90f32e425a2bc3ff0144c97d2ebef7d6aa1", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/js/run.mjs", "line": null, "summary": "scripted() throws 'unknown answer' for any non-null, non-object, non-'gate' string in an answer list (e.g. 'finished'), silently failing future cases that use such answers"}, {"path": "tools/rustev-conformance/js/run.mjs", "line": null, "summary": "advance_timer driver step uses .includes(arg.delay_ms) where arg.delay_ms is a JS number; if the native engine.clockDelays() returns BigInt values, strict equality silently never matches and the until-loop exhausts its limit, reporting a misleading 'waited forever' error"}]}

Subject: ba225e8...297fd90, diff digest 6d1ed0c530b9c839d2addd00aef388479dd1ac2902977cc3586cf54b3d114df6, 1 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Reviewing the key changes: new AdvanceTimer driver step, runtime.cancel split into two cases, "native" surface added everywhere, and descriptor fixtures added for run cases.

Finding: clock.pending_delays() called but not implemented in diff

tools/rustev-conformance/src/runtime.rs at the new AdvanceTimer arm (line ~476) calls clock.pending_delays():

Step::AdvanceTimer { delay_ms } => {
    until("the timer, with no attempt in flight", || {
        clock.pending_delays().contains(delay_ms)   // ← new method
            && rt.gauges().backend_in_flight.values().all(|n| *n == 0)
    })
    .await?;
    clock.advance(*delay_ms);
}

crates/rustev-runtime/src/clock.rs is listed in REPO CONTEXT but is not in the changed paths, so it is unchanged from the base. The spec note in specs/027-node-and-wasm-bindings/spec.md explicitly describes this as new ("the manual clock now reports its pending delays, an additive accessor on spec 003's ManualClock"), confirming this method does not pre-exist. Without a pending_delays() implementation on ManualClock, the conformance crate will fail to compile.

Everything else is internally consistent: the cancel/cancel-stop case split correctly threads through manifest.json, case files, expected golden files, and the mirrors fields; the advance_timer JSON serialization format matches the enum variant naming; the descriptor SHA256s in the run case fixtures match the new fixture file contents; and the surface lists are uniform across individual case files and the manifest.

{"head": "935813f396240d9b27db56437816aabb71c96fff", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/src/runtime.rs", "line": 476, "summary": "AdvanceTimer calls clock.pending_delays() which the spec describes as a new accessor on ManualClock, but crates/rustev-runtime/src/clock.rs is absent from the changed paths, so the method is not implemented and the crate will not compile."}]}

Subject: ba225e8...935813f, diff digest 04d049de8dbb672665746474e308059b77b482ed8a87f4ca7a233410d33af28c, 1 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff across all changed paths.

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

The condition change from !pure to !(pure || is_run) is a standard De Morgan expansion: the continue guard previously skipped non-pure commands; now it proceeds for both pure and run commands. Correct. The surfaces change ("native" added for all, "wasm" kept only for pure) is internally consistent with every updated case file.

tools/rustev-conformance/src/runtime.rs

The new AdvanceTimer step waits until clock.pending_delays().contains(delay_ms) and no attempt is in flight, then advances. This is a refinement over the old WaitSleeper + AdvanceMs pair that was racy against async host seams (deadline timer could satisfy WaitSleeper before the retry delay was pending). The new approach is correct for deterministic retry sequencing.

tools/rustev-conformance/tests/runtime.rs

The runtime.cancel / runtime.cancel-stop split is logically sound: the ignore cancel case (no answer from host seam → possibly_continuing / not_observed) is portable to the native runner; the stop/charge case requires synchronous Rust seam semantics and stays rust-api only. The assertion ran >= 6 is correct (6 cases now). The cost.liability check of 15 (3 requests × 5 max_units) in the mirrors block matches the new golden.

Cross-file SHA-256 consistency

All SHA-256 values cross-check cleanly:

  • runtime.cancel-stop in manifest.json, cases/runtime/runtime.cancel-stop.json, and the tests/runtime.rs generator agree on bf82b57… / 17937b3….
  • runtime.cancel new golden 70604120… matches the updated expected/runtime/runtime.cancel/d1.record.json.
  • Replay bundle SHA-256 updates in manifest and individual case files are consistent.

Fixture descriptors

New *.descriptor.json files for run cases are identical across the four actionable-run fixtures (same sha256: 98070801…) and correctly differ from the lodging-run descriptor (a3c75af9…). The inline sha256 in each case file matches.

No findings identified. The logic, cross-file consistency, golden content, and surface assignments are all correct.

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

Subject: ba225e8...e96e123, diff digest 98f9806b46614fe125ec27399f8d66c7807816a58649d3e37513489ac35751e0, 1 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing this PR carefully: it adds a "native" surface to all CLI conformance cases, splits runtime.cancel into runtime.cancel (on_cancel: ignore, ["rust-api", "native"]) and runtime.cancel-stop (on_cancel: stop+charge, ["rust-api"] only), and introduces AdvanceTimer to replace wait_sleeper + advance_ms for the retry case.

Checked items:

  1. harvest.rs logic — old !pure → new !(pure || is_run): correctly widens descriptor recording to run cases. Surfaces logic pure ? ["cli","native","wasm"] : ["cli","native"] matches the spec text ("pure commands also on WebAssembly").

  2. AdvanceTimer implementation — waits for pending_delays().contains(delay_ms) && no backend in flight, then advances by exactly that amount. The guard prevents advancing while an async host-seam answer is in transit, which is the stated purpose. Consistent with retry drive dropping wait_sleeper.

  3. runtime.cancel split — runtime.cancel now has on_cancel: "ignore", golden record shows not_observed/possibly_continuing/liability:15. runtime.cancel-stop has on_cancel: stop{charge:2}, golden record shows stopped/observed cost 6. Both golden files in expected/runtime/ match their SHA256s in the case files; the cancel-stop record content is identical to the pre-PR cancel record, and the SHA (bf82b57...) is preserved.

  4. Cross-file consistency — standalone JSON files, manifest.json, and tests/runtime.rs agree on mirrors, surfaces, SHA256s, and drive sequences for all changed cases. assert!(ran >= 6) is correct.

  5. runtime.cancel-stop surfaces rust-api-only — the comment explains correctly: host seams answer asynchronously and can never confirm a stop synchronously, so the native surface is excluded for cancel-stop.

  6. Descriptor SHA256s — the five support descriptor files all share the same content and SHA (98070801…); the lodging descriptor has distinct content and SHA (a3c75af9…). Both are consistent across case and fixture files.

No bugs, security issues, or inconsistencies found.

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

Subject: 7d37649...e87f305, diff digest 98f9806b46614fe125ec27399f8d66c7807816a58649d3e37513489ac35751e0, 1 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