Skip to content

impl(027): increment 4, the conformance suite and its CLI cases - #129

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

bartekus merged 1 commit into
mainfrom
impl/027-conformance

Conversation

@bartekus

@bartekus bartekus commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Spec 027, increment 4 (first change): the shared conformance suite, its manifest, and the Rust runner over every CLI golden. Stacked on #128.

  • tools/rustev-conformance (publish = false; excluded from the release set as repository tooling): cases/manifest.json (rustev.conformance-manifest/1) with 29 cases, one per CLI golden, each listing argv, exit code, inputs (repo path, name, SHA-256) and outputs (stdout or a written file, the golden by repo path and SHA-256, normalizations). CLI goldens are referenced in place, never copied.
  • Cases are harvested from the CLI tests that pin the goldens (RUSTEV_HARVEST=1; make conformance-harvest): inputs as they were before the invocation, under fixtures/<case>/.
  • Normalizations are the goldens' own (receipt, timing), in one file shared by the CLI tests and the runners.
  • make conformance (no Node toolchain) runs every case through rustev_cli::execute in a fresh directory and compares outputs and exit codes; tests also check full golden coverage, digests, that plan_id is compared as bytes, and that a differing output or exit code is reported.
  • Runtime cases as data, eval/gate on the packaged tasks, and the bindings' surfaces follow in later changes.

Second change (runtime cases as data, 3.12.4), folded in: five cases under cases/runtime/ mirroring admission.rs, budget.rs, retry.rs, time.rs and cancel.rs (each names its test). A case declares plan/descriptor/calibration fixtures (built from spec 002's builders), runtime bounds, a scripted backend per registration (per-task answer sequences, cost, remote end, cancel answer, release answers), requests, and manual-clock driver steps. rustev_conformance::runtime interprets it with Rust seams; results and record bytes are committed under expected/runtime/ and compared without normalization, and the test checks each expected record against what the mirrored test asserts. The manifest is now the aggregate of cases/cli/ and cases/runtime/ (drift-checked).

Review round 1 (3 findings): (1) sha2 is a normal dependency of rustev-cli, so its tests can use it; the harness says so. (2) Fixed: the files an invocation wrote are read as soon as it ends, so a file the test writes later is never taken for an output. (3) Fixed: a normalization that does not apply is reported as such, not as a difference; test added.

Review round 2 (5 findings): fixed: the harvest probes no normalization and then each one normalize::NAMES lists (one list beside apply); the scripted answer clamps the attempt number to the script; the coverage count counts JSON goldens only. Answered: the first golden a test pins names its case, and a reordering that renames it is reported by the manifest drift check (the harness says so); the refusal fixture with a repeated name key is refused by the bounded parser (duplicate keys are a category 1 refusal), which the case's golden shows and the runner reproduces.

Review round 3 (5 findings): (1) fixed: the harvest snapshots the whole scratch directory before the invocation and takes as written only files new or changed against it. (2) fixed: a directory entry error panics instead of being skipped. (3) fixed: the CLI call changes the working directory under a process-wide lock through a guard that restores it on drop, panic included. (4) fixed: an output file that cannot be read is reported with its error; only a missing file is "no output". (5) The #[path] inclusion of spec 002's shared builders is the repository's existing pattern (the CLI's tests include them the same way): source inclusion needs no crate edge and the builders' dependencies are this crate's dev-dependencies; the module is renamed builders so it no longer shadows core, and the code says so. A re-harvest leaves every case unchanged except two replay bundles whose recorded run timing is wall-clock; the committed ones stay. Restacked on #128.

Review round 4 (7 findings): (1) fixed: a case file that exists but does not parse fails the harvest instead of being replaced. (2) Every committed digest is 64 hex characters (all 322 checked), including actionable.plan.json's. (3) The duplicate name in refusal-01/cat-01.definition.json is the point of that case: it is category 1's parse refusal, and its golden reads bounds: duplicate key "name" at byte 761; the bounded parser refuses duplicate keys rather than taking the last. (4, 5) fixed: a case's paths and input names must be relative paths of normal components (contained), so nothing is read or written outside its directory; tested. (6) fixed: a release answer that gates again is a script error, failed like a missing answer, so a gate never waits forever. (7) fixed: receipt normalization replaces only a receipt the output has.

Review round 5 (4 findings): (1) Repeated: the duplicate name in refusal-01/cat-01.definition.json is the case: the bounded parser refuses duplicate keys (its golden reads bounds: duplicate key "name"); serde_json's last-wins never runs. (2) fixed: a missing case directory or unreadable entry fails aggregation naming it. (3) fixed: the working-directory guard reports a failed restore while a panic unwinds instead of panicking twice. (4) fixed: each run's scratch directory is unique (process id and time) and created fresh.

Review round 6 (2 findings): (1) Repeated a fourth time, so a test now pins it: the_duplicate_key_case_is_the_parsers_refusal_of_it checks that refusal-01's definition carries the top-level name twice (x, then support-routing) and that its golden is the bounded parser's refusal (duplicate key \"name\"); serde_json's last-wins never applies, because the bounded scan refuses duplicates first. (2) fixed: an output's stream-or-file error names which rule it broke (an unknown stream, both set, or neither).

Review round 7 (3 findings): (1) fixed: the harvest tries every combination of the known normalizations, fewest first, so a golden needing receipt and timing together is found. (2) Repeated a fifth time, and the test added last round answers it: the bounded parser refuses the duplicate before serde_json would see it, and the case's golden is that refusal (duplicate key \"name\"), pinned by the_duplicate_key_case_is_the_parsers_refusal_of_it. (3) fixed: on a divergence the scratch directory is kept and its path printed.

Review round 8 (3 findings): (1) Repeated a sixth time; unchanged answer: the fixture's duplicate name is the case, and the_duplicate_key_case_is_the_parsers_refusal_of_it pins that its golden is the bounded parser's refusal. (2) fixed: an output's file must be a contained relative path too, like an input name. (3) fixed: the runtime runner's scratch directory is unique per case and run and is kept, with its path printed, when a case diverges.

Review round 9 (3 findings, none a defect; the code now says why): (1) Repeated a seventh time: the duplicate name is the case under test, pinned by the_duplicate_key_case_is_the_parsers_refusal_of_it. (2) runtime.deadline sets no request deadline on purpose: the support plan's own deadline_ms (2000) applies, and the case passes with deadline_expired true; the field's documentation says so. (3) An ignoring backend's never-ending future is the behavior under test: the runtime polls a cancelled attempt once (spec 003, 3.7.3), records not_observed and ends the decision without it; runtime.cancel passes on both runners. A comment at that arm says so.

Split (the AI review was cancelled at its 15-minute limit twice): this PR is now increment 4's first change, the suite, its Rust runner and the 29 CLI cases; the runtime cases (src/runtime.rs, tests/runtime.rs, cases/runtime, fixtures/runtime, expected/runtime and their dependencies) move to a second PR stacked on this one, and #130 is restacked on that.

Review round 10 (6 findings): (1, 6, and a defect they pointed at) fixed: the harvest no longer probes combinations of normalizations; each output gets exactly the normalizations its shape calls for (normalize::applicable: receipt when it has a top-level receipt, timing when it has timing). Probing let a run fast enough to time every step at 0 match with no normalization, or with a no-op one, and record a case that later runs would fail. A full re-harvest records every case exactly as committed. Normalizing also sets only fields an output has, never adding a timing key. (2) By design: an --out that already exists is an input; the no-clobber cases need it there for the CLI to refuse it, and the code says so. (3) The shared normalize_timing is the one the CLI goldens now pass with; a difference would fail those tests, not pass silently. (4) fixed: a case file left from an earlier harvest must record the same inputs this harvest copied, or the harvest fails and says to rebuild. (5) fixed: the comment no longer says "both" directories.

Review round 11 (4 findings): (1) Repeated: the shared normalize_timing is in this PR (tools/rustev-conformance/src/normalize.rs) and is what the CLI's timing-normalized goldens pass with; a difference fails those tests by name. (2) fixed: the command words before the first flag are never probed as paths. (3) fixed in what it guards: normalize.rs states it may use only what both crates depend on, and both crates compile it, so a stray import fails a build at once. (4) Not so: both record goldens are covered as the written outputs of the lodging.run and support.run cases, and the coverage test passes. A full re-harvest still records every case as committed.

Review round 12 (1 finding, repeated, and wrong): the coverage set holds every golden any output pins, and each run case pins two (its printed output and its record), so all 31 goldens are covered by 29 cases; the test passes in CI. It now also asserts by name that both record goldens are covered.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

Reviewing the diff for harvest.rs, mod.rs, the new Cargo.toml, the spec update, and the committed fixture/manifest files.

Finding 1 — missing dev-dependency for sha2 in rustev-cli

crates/rustev-cli/tests/common/harvest.rs imports sha2::{Digest, Sha256} at line 13 and calls Sha256::digest in the hex() helper. crates/rustev-cli/Cargo.toml is not modified by this PR, so sha2 is not listed as a dev-dependency there. The Cargo.lock diff adds sha2 only under the new rustev-conformance package entry; if sha2 was not already independently listed in rustev-cli/Cargo.toml (dev-deps), this test code will fail to compile. The absence of a new [[package]] name = "sha2" block in the lock diff suggests sha2 was already in the workspace, but it still needs an explicit entry in rustev-cli's Cargo.toml to be usable from its test binary.

Finding 2 — locate() scans the scratch directory at golden-call time, not immediately after the CLI run

In harvest.rs, the locate() function (called from golden()) performs its directory scan of seen.dir long after the CLI process has exited:

let mut written = BTreeMap::new();
files(&seen.dir, &seen.dir, &mut written);
for (name, bytes) in written {
    if seen.inputs.contains_key(&name) { continue; }
    // compare bytes against golden
}

Any file written by test code between harvest::after() and the cli_golden() call (e.g., a file the test reads or creates for verification) that is not in seen.inputs and coincidentally matches the golden bytes after normalization would be incorrectly attributed as a CLI output. The content-match guard makes false positives unlikely in practice, but the invariant is fragile when tests do post-invocation file operations before calling cli_golden.

{"head": "340d33a72c16e02dac0139799a6eb541fc1967dd", "verdict": "findings", "findings": [{"path": "crates/rustev-cli/tests/common/harvest.rs", "line": 13, "summary": "`sha2` is imported and used but `crates/rustev-cli/Cargo.toml` is not modified to add it as a dev-dependency, which will cause a compilation failure if it was not already listed there."}, {"path": "crates/rustev-cli/tests/common/harvest.rs", "line": 99, "summary": "`locate()` scans the scratch directory at golden-registration time rather than immediately after the CLI invocation, so any file written by test code between `harvest::after()` and `cli_golden()` could be falsely attributed as a CLI output."}]}

Group 2 of 2

Reviewing the group 2 files: fixture definitions, rules, calibrations, the lib.rs implementation, normalize.rs, and the conformance test.

Intentional defects in refusal fixtures (not bugs):

  • refusal-11/cat-11.definition.json: second step (count_where) has "id":"failed_30d", duplicating the first step's ID. This is the deliberate defect that exercises the duplicate-step-ID refusal path.
  • refusal-10/cat-10.definition.json: "calibration":"none" paired with "requires":"calibrated_probability" is the defect for refusal-10.
  • refusal-09/cat-09.definition.json: adds a fallback on explicit_deadline that the other cases don't have; that's the tested defect.
  • refusal-08/cat-08.definition.json: on_unresolved is missing an entry for step:frustration (present in -09/-10/-11); that's the defect.
  • refusal-12/cat-12.execution.json: references "no_such_step" which does not exist in the definition; that's the defect.

All of the above look intentional and consistent with the naming convention.

Real finding — src/lib.rs:

In compare():

let normalized = produced
    .as_deref()
    .and_then(|b| normalize::apply(&o.normalize, b));
if normalized.as_deref() != Some(&golden[..]) {
    v.push(format!("{}: {} differs", case.id, o.golden));
}

When produced is Some(bytes) but normalize::apply returns None — either because the output bytes are not valid JSON when normalization is requested, or because an unrecognised normalisation name appears in o.normalize — normalized becomes None. The comparison None != Some(&golden[..]) is always true, so the failure is reported as "<case>: <golden> differs". This is incorrect: the output may be byte-for-byte correct, but the infrastructure silently failed to apply normalisation. The root cause (bad JSON or unknown normalisation name) is invisible to the caller. A failing case would look like a content mismatch instead of a framework error.

The same pattern applies when a file output is absent (std::fs::read(...).ok() swallows the I/O error and returns None), though there the "differs" wording is at least plausible.

{"head": "340d33a72c16e02dac0139799a6eb541fc1967dd", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/src/lib.rs", "line": 120, "summary": "When normalize::apply returns None (unknown normalization name or non-JSON output), the failure is silently reported as 'differs' instead of a normalization error, masking the true root cause and potentially hiding a correct output."}]}

Subject: 721be94...340d33a, diff digest 851243860e65e462ff4196a69d6b868dedc3b7eaaf540f5f7c8bb852c379ef21, 2 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 20, 2026 14:49 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/027-conformance branch from 340d33a to 492eb63 Compare October 20, 2026 14:57
@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 3

Reviewing this PR, which adds a conformance suite (rustev-conformance) with a harvest mechanism to generate CLI test cases from existing golden tests.

harvest.rs locate() hardcodes normalizations

In crates/rustev-cli/tests/common/harvest.rs lines ~113-130, locate() only tries two normalization variants for stdout ([] and ["receipt"]) and two for files ([] and ["timing"]). If a future golden uses any other normalization, locate() returns None and golden() panics with a misleading "is no output of" message even though the underlying test passed fine. This is a latent correctness trap for anyone adding a new normalization to the conformance suite.

Case ID derived from first golden name only

In harvest.rs line ~154, the case ID is set from the first golden's name (name.trim_end_matches(".json")). For multi-output cases like lodging.run, the record golden (lodging.record.json) joins the case only because the stdout golden (lodging.run.json) is pinned first. If test ordering ever changes (e.g., a test pins the record golden before the stdout golden), the case ID would be derived from lodging.record instead, producing a misnamed case. The two goldens are in separate cli_golden() calls with no enforced ordering guarantee.

No issues found with: SHA-256 encoding (all hashes are valid 64-hex-char), fixture deduplication across cases (intentional), BTreeMap ordering in input arrays, the command field extraction for current CLI surface, the spec change removing planned: true from the conformance directory, or Cargo.toml dependency layout.

{"head": "492eb631532a31e6bdc672f8672d81432f8af5fd", "verdict": "findings", "findings": [{"path": "crates/rustev-cli/tests/common/harvest.rs", "line": 113, "summary": "locate() only tries hardcoded normalization variants [\"receipt\"] and [\"timing\"]; any golden using a different normalization causes a misleading panic in harvest mode even though the underlying test passes."}]}

Group 2 of 3

Reviewing the conformance fixture files in this group, I focused on internal consistency, schema correctness, and structural integrity of the fixture data.

Finding: duplicate JSON key in refusal-01 fixture

tools/rustev-conformance/fixtures/cli/refusal-01/cat-01.definition.json (line 1): The root JSON object contains two "name" keys — "name":"x" at the very start of the object, and "name":"support-routing" later at the same level. In Rust's serde_json (default behaviour), duplicate object keys are silently resolved to the last value, so the parsed definition would have name = "support-routing". If the intent is to test rejection of a single-character definition name "x", the test would silently parse as a valid name and never produce the expected refusal. All other refusal fixtures (02–12) have a single, unambiguous defect; this is the only one with a duplicate key.

Everything else reviewed:

  • Refusal 02–12: each carries exactly one intentional structural defect (wrong op version, cyclic step graph, invalid binding expression, missing unresolved handler, duplicate step id, non-existent step in execution policy, etc.) — all consistent with their intent.
  • Refusal 16/17: definition/2 actionability fixtures look structurally correct as distinct error cases.
  • Lodging and support run/show/replay bundles: snapshot IDs, plan IDs, and digest cross-references are internally consistent. Supply sequence numbers and request counts are consistent with the cost accounting (observed: 20 = 10 requests × 2 units).
  • Runtime fixtures (support.plan.json, budget.plan.json, retry.plan.json): calibration IDs correctly track the synthetic-linear-head artifact rather than the CLI-fixture synthetic-rules-support artifact.
{"head": "492eb631532a31e6bdc672f8672d81432f8af5fd", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/fixtures/cli/refusal-01/cat-01.definition.json", "line": 1, "summary": "Root JSON object contains duplicate key \"name\" (first value \"x\", second value \"support-routing\"); serde_json resolves this to the last value, so the parsed definition is indistinguishable from a valid one and likely will not trigger the expected compile refusal."}]}

Group 3 of 3

Reviewing the three source files and two test files in this group.

tools/rustev-conformance/src/lib.rs

compare() (line ~162) reads a file output with .ok(), silently converting any I/O error into None, which then reports "no output" instead of the underlying failure:

(None, Some(f)) => std::fs::read(dir.join(f)).ok(),

A missing file and an unreadable file produce the same opaque diagnostic. This makes test failures harder to diagnose in CI.

tools/rustev-conformance/tests/cli.rs

every_cli_case_produces_its_expected_bytes (lines 33-38) calls std::env::set_current_dir, which modifies the process-global working directory:

std::env::set_current_dir(&dir).unwrap();
let exit = rustev_cli::execute(&case.argv, ...);
std::env::set_current_dir(&start).unwrap();

Cargo runs test functions within a binary in parallel by default. The comment at the top of the file explains why cases run sequentially inside one test, but it does not protect against concurrent test functions in other files (manifest.rs, runtime.rs) that happen to run while the directory is temporarily changed. Those tests use absolute paths via root() so the practical impact is low today, but any future test that touches a relative path will race non-deterministically.

tools/rustev-conformance/src/runtime.rs, tests/runtime.rs, tools/rustev-release/release-set.json

No issues found. The scripted backend correctly guards against index underflow (n.max(1) at the call site), the until busy-loop is bounded and used only in tests, the release_all / cancellation race is safe because the executor is single-threaded (new_current_thread), and the release-set.json exclusion entry is correct.

{"head": "492eb631532a31e6bdc672f8672d81432f8af5fd", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/src/lib.rs", "line": 162, "summary": "File-read errors are silently swallowed via `.ok()`, reporting a generic 'no output' message instead of the actual I/O failure and making test diagnostics harder."},{"path": "tools/rustev-conformance/tests/cli.rs", "line": 33, "summary": "`std::env::set_current_dir` is a process-wide side effect; Cargo runs test functions in parallel by default, so any concurrent test that relies on the working directory would race non-deterministically with the repeated directory changes in this function."}]}

Subject: b0e556a...492eb63, diff digest 0e04f4aa7468416ad2ab68d1477b78bb7a69e76a1fef61d4f1d01c7c20f0788e, 3 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 20, 2026 15:09 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/027-conformance branch from 492eb63 to 973f512 Compare October 20, 2026 15:09
@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 3

Reviewing the harvest infrastructure, conformance case fixtures, and supporting changes.

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

The locate() function (lines ~122–144) hardcodes exactly two normalization families to probe: [] and ["receipt"] for stdout, [] and ["timing"] for written files. If a future golden requires any other normalization, locate() returns None and golden() panics with "golden … is no output of …". This is an intentional design constraint but undocumented; any extension requires updating this function.

The before() input scanner (lines ~80–98) collects every positional arg that resolves to an existing path in the scratch directory. If --record-out some.record.json names a file that already exists in the scratch dir from an earlier sibling invocation, it would be recorded as a pre-existing input rather than as a written output—silently misclassifying it. In practice the Scratch impl uses a fresh temp dir per test, so this is benign under current usage but fragile.

The after() "written" computation reads every file in the directory and filters by inputs.get(name) != Some(bytes). Any file present before the invocation but not captured as an input (e.g., a leftover from an earlier step in the same test) would appear in written, and locate() might match a golden against it. Same caveat about fresh temp dirs applies.

None of these rise to actual bugs in the current usage pattern.

tools/rustev-conformance/Cargo.toml

No [dev-dependencies] section and no test = false/bench = false. The crate is repository-only (publish = false), so this is acceptable, but it means sha2, serde, etc. are unconditional runtime deps rather than dev-only. Not a bug, just heavier than necessary.

Fixture/case JSON consistency

Spot-checked SHA-256 values are all 64 hex characters. The case argv arrays, command strings (truncated at first -- arg), inputs, and outputs are consistent between individual cases/cli/*.json files and the aggregate manifest.json. The lodging.run and support.run cases each carry two outputs (stdout with receipt normalization + written record with timing normalization), which matches the harvester's output format.

No security issues, correctness bugs, or material inconsistencies found in group 1.

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

Group 2 of 3

Reviewing the fixtures in group 2. All files are new (no prior baseline), so I'm checking internal consistency and cross-file coherence.

Refusal test cases (refusal-01 through refusal-17): Each definition fixture is deliberately malformed to exercise a distinct rejection path:

  • refusal-01: "name":"x" instead of valid definition name
  • refusal-02: count_where with "version":2 (unknown version)
  • refusal-03: count_where fed "list":"input:ticket.message" (wrong type)
  • refusal-04: steps a and b reference each other (cycle)
  • refusal-05: "binding":{"backend":"nope"} (invalid binding)
  • refusal-06: uncalibrated_threshold:"not_declared" on a mass_at_least check
  • refusal-07: max_semantic_requests:2 (below required 3)
  • refusal-08: missing as_unmet handler for frustration in on_unresolved
  • refusal-09: fallback requires label output but step requires distribution
  • refusal-10: "calibration":"none" with "requires":"calibrated_probability"
  • refusal-11: duplicate step id "failed_30d" (both window_filter and count_where share that id)
  • refusal-12: execution policy references "step":"no_such_step"
  • refusal-16/17: definition/2 with actionability on_fail edge cases

All these appear intentional and internally consistent with their named purpose.

Normal fixtures (lodging., support.):

  • lodging.run/lodging.plan.json and lodging.show/lodging.plan.json are byte-for-byte identical — correct, both need the same plan.
  • support.run/support.plan.json and support.show/support.plan.json are identical — correct.
  • All support.rules.json copies across refusal-01 through refusal-12 and support.* are identical — expected (rules backend is shared; only definition changes per case).
  • topic.calibration.json files across CLI fixtures use sha256:dddddddd... synthetic artifact and dataset digests — acceptable for conformance fixtures; consistent across all copies.
  • runtime/topic.calibration.json correctly uses sha256:aaaaaaa... to match the synthetic-linear-head artifact rather than the synthetic-rules-support artifact used in CLI fixtures.
  • lodging-emb.bundle.json supply sequence numbers (0–9) are non-contiguous for supports_preference c-1 items (sequences 8–9 come after 3–7), matching the requests ordering where c-1 results arrived late — consistent with the run's requests array.
  • support-emb.bundle.json supply sequences (topic=0, explicit_deadline=1, frustration=2) differ from request dispatch order (topic, frustration, explicit_deadline) — consistent with parallel dispatch and out-of-order completion.
  • runtime/support.snapshot.json ends with a trailing newline while CLI support.run/support.snapshot.json does not — minor style inconsistency, no functional impact.

No bugs, security issues, or meaningful inconsistencies found.

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

Group 3 of 3

Looking at the three source files and three test files in this review group.

tools/rustev-conformance/src/lib.rs

The compare() function applies normalize::apply to the produced bytes but reads the golden bytes raw. This is correct by design (goldens are already stored in normalised compact-JSON form), but the _ wildcard arm in the (stream, file) match emits a message saying "an output names one stream or one file" even when stream == Some("stderr"), which is a misleading error for an otherwise-valid case that just uses an unsupported stream name.

tools/rustev-conformance/src/runtime.rs

No correctness bugs found. The answer() indexing l[n.min(l.len()) - 1] is safe because the call site always passes n.max(1) and the match guard asserts !l.is_empty(). The OnCancel::Ignore branch returning std::future::pending().await is intentional; the 30-second timeout in run() bounds it.

tools/rustev-conformance/tests/cli.rs

Two issues:

  1. set_current_dir races with parallel tests (line 38-40). Rust's test harness runs test functions on multiple threads by default. std::env::set_current_dir changes the working directory for the entire process, not just the calling thread. If every_case_pins_its_inputs_and_compares_its_plan_id or tests from manifest.rs / runtime.rs run concurrently with every_cli_case_produces_its_expected_bytes, they could observe a mid-case CWD (e.g. a temp sub-directory) rather than the repo root, corrupting any path construction that is not absolute. The fix is #[serial] (via serial_test) or spawning a subprocess instead of mutating process-global state.

  2. Golden-count check does not filter by extension (line 50). std::fs::read_dir(...).count() counts every directory entry — files of any extension, subdirectories, .gitkeep, etc. Adding any non-JSON artefact to crates/rustev-cli/tests/golden/ would silently skew goldens and break the assert_eq!(covered.len(), goldens, ...) assertion. The intent is clearly to count .json files only; the filter |e| e.path().extension().is_some_and(|x| x == "json") (already used in aggregate()) should be applied here too.

tools/rustev-conformance/tests/runtime.rs and tools/rustev-release/release-set.json — no issues.

{"head": "973f512634321e34b430fb892964d99562380812", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/tests/cli.rs", "line": 38, "summary": "set_current_dir is process-global and races with other test threads running in parallel, which can cause flaky failures in any concurrent test that resolves a relative path."}, {"path": "tools/rustev-conformance/tests/cli.rs", "line": 50, "summary": "read_dir(...).count() counts all directory entries regardless of extension, so any non-JSON file or subdirectory added to the golden directory would skew the coverage assertion."}]}

Subject: 224c026...973f512, diff digest 0e04f4aa7468416ad2ab68d1477b78bb7a69e76a1fef61d4f1d01c7c20f0788e, 3 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 3

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

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

The locate() function (lines 153-164) hardcodes two exhaustive normalization lists to try when matching a golden to an invocation's output:

for names in [&[][..], &["receipt"][..]] { ... }   // stdout
for names in [&[][..], &["timing"][..]] {  ... }   // written files

If any future golden requires a normalization other than "receipt" (for stdout) or "timing" (for files), the harvest will reach the None return and the golden() caller will panic:

.unwrap_or_else(|| panic!("golden {name} is no output of {:?}", seen.args))

This is an implicit closed-world assumption: adding a third normalization kind anywhere in the CLI tests silently breaks conformance-harvest with an unhelpful panic message rather than a compile-time or schema error.

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

The case id for an invocation is set from the first golden() call's name parameter via get_or_insert_with. For invocations with two goldens (e.g., lodging.run has stdout lodging.run.json and record lodging.record.json), the case id depends silently on call order. If a future test reorders those cli_golden calls, the case files would be regenerated with wrong ids and fixture paths, with no compile error or clear failure — the drift check in conformance-harvest step 3 would catch it eventually, but only after the incorrect files were written.

Everything else looks correct: SHA-256 values are 64 hex characters throughout, the before() heuristic is guarded by p.exists(), the ../../../../ path to normalize.rs resolves correctly, the manifest case count (29 CLI + 5 runtime = 34) is consistent with the spec, runtime expected records match the described behaviour, and publish = false is set.

{"head": "d3ddd6f7fecfdeea65153a9d152b0add688dfcdf", "verdict": "findings", "findings": [{"path": "crates/rustev-cli/tests/common/harvest.rs", "line": 153, "summary": "locate() hardcodes only [\"receipt\"] and [\"timing\"] as normalizations to probe; any future golden using a different normalization will cause harvest::golden() to panic with a misleading message rather than a compile or schema error."}, {"path": "crates/rustev-cli/tests/common/harvest.rs", "line": 170, "summary": "Case ID for a multi-golden invocation is silently determined by whichever golden() call arrives first; reordering cli_golden calls in a test would regenerate case files with wrong IDs and fixture paths, with no static enforcement of the required ordering."}]}

Group 2 of 3

Looking at this group of new conformance fixture files, I checked internal consistency of IDs and digests, intentional flaw design in refusal cases, and cross-fixture coherence.

Refusal case flaws (intentional by design):

  • cat-02: "version":2 on count_where (unknown version)
  • cat-03: "list":"input:ticket.message" fed to count_where (type mismatch)
  • cat-04: steps a and b reference each other (cycle)
  • cat-05: "binding":{"backend":"nope"} (invalid binding)
  • cat-06: uncalibrated_threshold:"not_declared" on mass_at_least without a declared reason
  • cat-07: "max_semantic_requests":2 but 3 semantic steps
  • cat-08: frustration missing from on_unresolved
  • cat-09: fallback "requires":"label" on a step that "requires":"distribution"
  • cat-10: "calibration":"none" on a step that "requires":"calibrated_probability"
  • cat-11: step id "failed_30d" appears twice (second should be "failed_payments_30d")
  • cat-12: execution references "no_such_step"
    All look correctly designed.

Genuine concern — refusal-01:

refusal-01/cat-01.definition.json opens with {"name":"x","inputs":[... and then the same top-level object contains "name":"support-routing" later. With Rust's default serde_json (last-value-wins semantics for duplicate keys), the parsed definition ends up with name = "support-routing" — indistinguishable from a valid definition — so the conformance test would receive a success response instead of a refusal, causing the test to be permanently wrong. If a strict duplicate-key parser is in use this is fine, but that dependency is not visible from the fixture alone.

Everything else checks out:

  • Snapshot, plan, and calibration IDs are consistent within the lodging and support bundles
  • Runtime fixtures (aaaa… artifact) and CLI fixtures (dd21… artifact) use separate calibration IDs and backends appropriately
  • Replay bundle attempt-IDs all match their corresponding request entries
  • Refusal-16 and refusal-17 correctly omit support.rules.json and topic.calibration.json since they carry no semantic steps ("max_semantic_requests":0)
{"head": "d3ddd6f7fecfdeea65153a9d152b0add688dfcdf", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/fixtures/cli/refusal-01/cat-01.definition.json", "line": 1, "summary": "The top-level JSON object contains two 'name' keys ('x' then 'support-routing'); with serde_json's default last-value semantics the definition parses as name='support-routing' (identical to a valid definition), so this conformance case would receive a success instead of a refusal and never exercise the intended rejection path."}]}

Group 3 of 3

Looking at the three source files and two test files in this group:

src/runtime.rs — Scripted::answer, line ~210

Some(l) if !l.is_empty() => l[n.min(l.len()) - 1].clone(),

When n == 0 this is 0usize - 1, which panics (subtraction overflow in debug, wraps in release). The only call site guards it with .max(1), but nothing in answer's signature enforces that precondition. If answer is ever called with n = 0 (e.g. a future caller or a case where the attempt-id suffix doesn't parse), the test binary crashes rather than producing a useful error.

tests/cli.rs — golden coverage check, line ~47

let goldens =
    std::fs::read_dir(rustev_conformance::root().join("crates/rustev-cli/tests/golden"))
        .unwrap()
        .count();

ReadDir::count() includes every directory entry — subdirectories, .gitkeep files, anything. The covered set correctly filters for paths starting with "crates/rustev-cli/tests/golden/", so the assert_eq! will spuriously fail (or silently under-count coverage) the moment any non-.json file lands in that directory. The count should use .filter to select only .json entries, consistent with how aggregate() filters in src/lib.rs.

Everything else looks correct: the SHA-256 pinning, the normalize::apply returning None for unknown names, the compare logic for stream vs. file outputs, the manual-clock runtime harness, the until busy-poll bound, and the release-set.json addition.

{"head": "d3ddd6f7fecfdeea65153a9d152b0add688dfcdf", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/src/runtime.rs", "line": 210, "summary": "Scripted::answer computes n.min(l.len()) - 1 which panics on underflow when n == 0; the only call site guards with .max(1) but the function itself does not enforce this precondition."}, {"path": "tools/rustev-conformance/tests/cli.rs", "line": 47, "summary": "read_dir(...).count() counts all directory entries including non-JSON files, making the golden-coverage assertion fragile and inconsistent with the filter applied when building the covered set."}]}

Subject: edcb709...d3ddd6f, diff digest 0e04f4aa7468416ad2ab68d1477b78bb7a69e76a1fef61d4f1d01c7c20f0788e, 3 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 20, 2026 15:38 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/027-conformance branch 2 times, most recently from 4970460 to ff4477d Compare October 20, 2026 15:43
@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 3

Reviewing group 1 of the PR, which adds tools/rustev-conformance, the harvest harness, and the case/fixture JSON data.

crates/rustev-cli/tests/common/harvest.rs — after() over-captures written files

after() collects every file in the scratch directory whose content differs from inputs:

s.written = all
    .into_iter()
    .filter(|(name, bytes)| s.inputs.get(name) != Some(bytes))
    .collect();

Any file already present in the scratch directory before the invocation whose name was not passed as a CLI argument — and therefore not captured by before() — satisfies inputs.get(name) == None, so None != Some(bytes) is always true. Such files are silently treated as if the CLI wrote them. In practice, Scratch directories start clean, so this does not bite the existing tests, but the logic is wrong: new files are identified by absence from inputs, not by absence from a pre-invocation snapshot.

crates/rustev-cli/tests/common/harvest.rs — files() silently swallows DirEntry errors

let mut entries: Vec<_> = std::fs::read_dir(path).unwrap().flatten().collect();

Iterator::flatten on a ReadDir iterator drops every Err variant silently. If a directory entry cannot be read (permission error, stale symlink, etc.) the file is quietly omitted, making it invisible to both inputs and written without any diagnostic. Using .collect::<Result<Vec<_>,_>>() followed by an explicit unwrap/expect would surface these errors.

tools/rustev-conformance/Cargo.toml — [dev-dependencies] absent; rustev-cli in [dependencies]

The crate lists rustev-cli as a regular (library) dependency, which is intentional only if the library surface (src/lib.rs, src/runtime.rs) itself uses it directly. Because the runner calls rustev_cli::execute, this is defensible, but it means every downstream user of rustev-conformance as a library pulls in the full CLI. If the runner is only used from tests, moving rustev-cli (and potentially sha2, tokio) to [dev-dependencies] would be cleaner and avoid inflating downstream compile graphs.

No security issues, no digest inconsistencies between individual case files and the manifest (spot-checked several), and no structural problems in the Makefile targets.

{"head": "ff4477da4bb97bf6cd43cb1dd910436495d619f2", "verdict": "findings", "findings": [{"path": "crates/rustev-cli/tests/common/harvest.rs", "line": 97, "summary": "after() treats every pre-existing scratch-directory file absent from inputs as a CLI-written output, because absence from the inputs map always satisfies the != predicate, making the written-file detection logically incorrect."}, {"path": "crates/rustev-cli/tests/common/harvest.rs", "line": 53, "summary": "files() uses .flatten() on the ReadDir iterator, silently discarding any DirEntry errors and potentially omitting files from both the inputs and written maps without any diagnostic."}]}

Group 2 of 3

This group is all new conformance fixture files — JSON test data for the rustev-conformance tool. I reviewed each fixture family for internal consistency, intentionality of mutations in refusal cases, and cross-fixture coherence.

Refusal fixtures (01–12, 16–17): Each contains exactly one deliberate defect that should trigger a compile/validation refusal. All are intentional:

  • refusal-01: "name":"x" (bad definition name)
  • refusal-02: count_where version:2 (unsupported op version)
  • refusal-03: count_where applied to a text input instead of a list
  • refusal-04: cyclic step dependency (a→b→a)
  • refusal-05: invalid "binding":{"backend":"nope"}
  • refusal-06: "uncalibrated_threshold":"not_declared" used without a calibration
  • refusal-07: max_semantic_requests:2 but three semantic steps
  • refusal-08: frustration step missing from on_unresolved
  • refusal-09: fallback set on a step that requires distribution
  • refusal-10: requires:"calibrated_probability" with "calibration":"none"
  • refusal-11: duplicate step id "failed_30d" (second step should be "failed_payments_30d")
  • refusal-12: execution policy references "no_such_step"
  • refusal-16/17: definition/2 actionability variants (no rules/calibration files needed — correct)

Non-refusal fixtures: lodging and support run/show/replay/check bundles are internally consistent. Plan digests, snapshot digests, and supply entries match their embedded retention.bytes structures. The out-of-order sequence numbers in lodging-emb.bundle.json supplies (c-1 preference evaluations appear at sequences 8–9 despite being dispatched last) correctly reflect concurrent async execution order shown in dispatched_ms.

Runtime fixtures: The two descriptor files sharing artifact sha256:aaa…aaa with different backend_id values (synthetic-linear-head vs synthetic-linear-head-replica) is intentional for equivalence/fallback testing.

No unintentional bugs found.

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

Group 3 of 3

Reviewing the three source files, three test files, and the release-set update.


tools/rustev-conformance/tests/cli.rs — set_current_dir without a process-level lock (lines 32–35)

std::env::set_current_dir(&dir).unwrap();
let exit = rustev_cli::execute(&case.argv, &rustev_cli::Context::default());
std::env::set_current_dir(&start).unwrap();

set_current_dir is a process-global mutation. Rust's test harness runs tests in parallel by default. If any other test in the same binary (present or future) touches CWD-relative paths while this loop is mid-flight, the result is a non-deterministic failure. Additionally, if rustev_cli::execute panics, the set_current_dir(&start) restore is skipped, leaving every remaining case in the loop running from the wrong directory. A process-level Mutex (or #[serial] attribute) is missing.


tools/rustev-conformance/src/lib.rs — IO errors silently collapsed in compare() (line 146)

(None, Some(f)) => std::fs::read(dir.join(f)).ok(),

.ok() discards the io::Error, so a genuine failure (permission denied, path component missing, etc.) is reported only as "{}: no output for {}" — indistinguishable from a missing output file. Using map_err and surfacing the error message into v would make failures actionable.


tools/rustev-conformance/src/runtime.rs — answer() index arithmetic comment mismatch (line 258)

Some(l) if !l.is_empty() => l[n.clamp(1, l.len()) - 1].clone(),

The comment says "Attempts count from 1; a 0 reads as the first," but the caller already calls s.answer(&task, n.max(1)), making n always ≥ 1 before entering clamp. The n.max(1) guard on the call site and the comment's "a 0" case are therefore dead. Not a bug, but the comment is misleading about which layer actually protects against 0.


tools/rustev-conformance/tests/runtime.rs — cross-crate #[path] import (line 4)

#[path = "../../../crates/rustev-core/tests/common/mod.rs"]
mod core;

Shadowing the built-in core crate with a local mod core works but is fragile: any rename or restructuring of rustev-core's internal test helpers silently breaks this file without a Cargo dependency edge to signal the breakage. The module name also shadows ::core in all subsequent code in this file.


{"head": "ff4477da4bb97bf6cd43cb1dd910436495d619f2", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/tests/cli.rs", "line": 32, "summary": "`set_current_dir` mutates process-global CWD without a lock; concurrent test threads can race on it, and a panic in `execute` skips the restore, corrupting CWD for subsequent loop iterations."}, {"path": "tools/rustev-conformance/src/lib.rs", "line": 146, "summary": "`std::fs::read(...).ok()` silently swallows IO errors, reporting a permission-denied or path-error as an uninformative 'no output' message instead of the underlying cause."}, {"path": "tools/rustev-conformance/tests/runtime.rs", "line": 4, "summary": "`#[path]` import of `rustev-core`'s internal test helpers crosses crate boundaries without a Cargo edge, and shadows the built-in `core` crate name throughout the file."}]}

Subject: 541973e...ff4477d, diff digest 0bea81b42f416c9d0f9245a1b9c16d185c3a33fc2b480a885c953550d96f49a8, 3 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 3

Reviewing the changed files in group 1: the new harvest.rs, changes to common/mod.rs, the spec update, the new Cargo.toml, and all the case/fixture JSON files.


harvest.rs — silent JSON parse error discards existing case data

At the point where an existing case file is read back before appending a second output (line ~197):

let mut case: Json = std::fs::read(&path)
    .ok()
    .and_then(|b| serde_json::from_slice(&b).ok())   // error silently dropped
    .unwrap_or_else(|| { json!({ "id": id, ... }) });

If serde_json::from_slice fails (e.g. the file was partially written by a prior crash, or manually edited and left invalid), the error is silently discarded via .ok(), and a fresh case object is constructed from the current invocation only. Any outputs already recorded for the same case are then overwritten and lost on the subsequent fs::write. This should expect() or at least surface the error; a silently recreated case could drift from what the manifest check expects, making conformance-harvest appear to succeed while producing a subtly wrong manifest.


before() — every non-flag arg value is probed as a file path

In the loop at ~line 78:

for a in args {
    let p = dir.join(a);
    if !a.is_empty() && !a.starts_with('-') && p.exists() {
        files(dir, &p, &mut inputs);
    }
}

Values like "lodging-1" (the --decision-id value), "1790164800000" (timestamp), or "needs.record.json" (the --record-out value) are all probed as paths. Most don't exist yet, so they're silently skipped — correct in practice. But if a scratch directory happens to contain a file whose name collides with a CLI argument value, that file is silently captured as an input fixture. The existing invocations are fine; the risk is latent for future cases.


JSON fixture files — one SHA-256 looks anomalously short

In tools/rustev-conformance/cases/cli/actionable.run-needs.json, the SHA-256 for actionable.plan.json:

"sha256": "84ae4058639f7be842f15950e19e72a2cfa8758721420cc2ec3314906e884a98"

This is 63 hex characters; a SHA-256 digest is always 64. The same truncated hash appears across all six fixture directories that share that plan (actionable.run-needs, actionable.run-propose, actionable.run-refused, actionable.run-unresolved, actionable.show, and the manifest). If the conformance runner checks byte-exact digest length before comparing, or if a future runner is strict about the 32-byte encoding, these cases will fail verification.


{
  "head": "88a7b2278fba48e498818dde3e4b188f0edf83ab",
  "verdict": "findings",
  "findings": [
    {
      "path": "crates/rustev-cli/tests/common/harvest.rs",
      "line": 197,
      "summary": "serde_json::from_slice error is silently swallowed via .ok(), so a malformed existing case file is quietly replaced with a fresh object, discarding all previously harvested outputs for that case."
    },
    {
      "path": "tools/rustev-conformance/cases/cli/actionable.run-needs.json",
      "line": 26,
      "summary": "The SHA-256 digest for actionable.plan.json is 63 hex characters instead of the required 64, and the same truncated hash is repeated across all six case files and the manifest that reference this fixture."
    }
  ]
}

Group 2 of 3

Reviewing the fixture files in this group. The content is predominantly intentionally invalid test data (refusal-01 through refusal-12, 16, 17) and reference bundles whose embedded digests and numerical values I've spot-checked for internal consistency.

Numerical/logical cross-checks (lodging bundle)

Suitability logits, softmax expectations, shortlist ordering, and weighted ranking scores in lodging-emb.bundle.json all check out against the rules defined in lodging.run/lodging.rules.json. Frustration, topic, and deadline logits in support-emb.bundle.json also agree with support.run/support.rules.json and the urgency-adjustment logic.

Intentional refusal fixtures (as expected)

Each refusal case introduces one targeted defect (unknown op version in refusal-02, wrong input type in refusal-03, circular dependency in refusal-04, bad binding in refusal-05, uncalibrated threshold without declaration in refusal-06, budget too low in refusal-07, missing as_unmet handler in refusal-08, incompatible fallback in refusal-09, calibration/requires mismatch in refusal-10, duplicate step ID in refusal-11, execution referencing a non-existent step in refusal-12). These are intentional.

Genuine finding

refusal-01/cat-01.definition.json contains a duplicate "name" key at the top-level JSON object: "name":"x" appears as the very first key, and "name":"support-routing" appears again later in the same object in the normal field position. The JSON specification treats duplicate object keys as undefined behavior; in particular, serde_json (Rust's standard JSON library) resolves duplicate struct fields to the last occurrence, so the compiled definition would have name = "support-routing", silently discarding "x". If the fixture is intended to test refusal of a definition whose name is "x" (e.g., too short, or mismatched), the test is likely a no-op with the current parser and the fixture would not trigger the intended refusal path.

{
  "head": "88a7b2278fba48e498818dde3e4b188f0edf83ab",
  "verdict": "findings",
  "findings": [
    {
      "path": "tools/rustev-conformance/fixtures/cli/refusal-01/cat-01.definition.json",
      "line": 1,
      "summary": "Duplicate top-level JSON key 'name' ('x' then 'support-routing'): serde_json last-wins semantics will silently use 'support-routing', likely neutralising the intended refusal condition."
    }
  ]
}

Group 3 of 3

Reading through the three source files and the release-set entry.

tools/rustev-conformance/src/lib.rs

pinned() resolves the manifest-supplied path string directly against the repo root with no sanitization:

std::fs::read(root().join(path))

A case file whose "path" field contains ../../etc/passwd (or similar) would escape the repository tree. The manifest is generated from committed case files, so an attacker who can land a PR with a crafted case file gains an arbitrary read on the CI runner.

tools/rustev-conformance/tests/cli.rs

The same pattern appears for the input name field:

let p = dir.join(&i.name);
std::fs::create_dir_all(p.parent().unwrap()).unwrap();
std::fs::write(p, bytes).unwrap();

i.name is manifest-controlled. A value like ../../foo would write outside the per-case temp directory. Combined with the pinned-bytes write, this is an arbitrary-write primitive in CI.

tools/rustev-conformance/src/runtime.rs

In Handle::infer, after the Gate arm resolves a release channel, the released Answer is placed into answer and matched again:

let (result, charge) = match answer {
    Answer::Output { output, charge } => ...,
    Answer::Fail { .. } => ...,
    Answer::Gate => std::future::pending().await,   // ← reachable
};

If on_release maps any task to Answer::Gate (the enum variant is accepted by the deserializer and there is no validation guard), this arm is reached and the spawned task hangs until the 30-second wall-clock timeout kills it — silently turning a configuration mistake into a 30-second stall reported as a timeout error rather than a clear message.

tools/rustev-conformance/src/normalize.rs

normalize_receipt unconditionally inserts the key:

pub fn normalize_receipt(out: &mut Json) {
    out["receipt"] = "<normalized>".into();
}

serde_json's index-assign on a missing key inserts it. An output that legitimately has no receipt field would silently gain one after normalization, potentially causing a false match against a golden that also has it normalized away. A missing-receipt case should be a normalization error, not a silent insertion.

tools/rustev-release/release-set.json

Entry is correctly structured and consistent with the other exclusion entries. No issue.

{"head": "88a7b2278fba48e498818dde3e4b188f0edf83ab", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/src/lib.rs", "line": 119, "summary": "pinned() joins a manifest-supplied path string directly to the repo root without sanitization, enabling path traversal to read arbitrary files on the CI runner."}, {"path": "tools/rustev-conformance/tests/cli.rs", "line": 34, "summary": "Input files are written via dir.join(&i.name) where i.name is manifest-controlled, enabling path traversal to write arbitrary files outside the per-case temp directory."}, {"path": "tools/rustev-conformance/src/runtime.rs", "line": 339, "summary": "The inner match on the resolved answer includes an Answer::Gate arm that calls pending().await, which is reachable when on_release maps a task to Gate and silently hangs the task for 30 seconds."}, {"path": "tools/rustev-conformance/src/normalize.rs", "line": 26, "summary": "normalize_receipt inserts the receipt key via serde_json index-assign even when absent, potentially causing a false match for outputs that legitimately have no receipt field."}]}

Subject: e5ada90...88a7b22, diff digest 2198a867e57cd86fb7c02f74766e340d888b948ab1bfeb90b72b289eabc06da5, 3 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception October 20, 2026 17:31 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 3

Reviewing the group-1 files: Cargo.lock, Makefile, the new harvest.rs, changes to mod.rs, the spec update, the new Cargo.toml, and all the new CLI case and fixture JSON files.

Cargo.lock / Cargo.toml — Clean. rustev-conformance is added as an unpublished workspace member with the expected dependencies. sha2 does not appear as a newly added entry in the lock file, confirming it was already a transitive dependency of the workspace before this PR; the comment in harvest.rs (line 16) is consistent with that.

Makefile — The three-step conformance-harvest recipe (delete → harvest → bless → verify) is ordered correctly. Using --locked on each cargo invocation is appropriate. No issue.

harvest.rs — before / after / locate / golden

  • before snapshots present (the full directory before the run) and inputs (files named by non-flag args that already exist). Correct.
  • after re-scans the directory and computes written as files that are new or changed relative to present. Correct; this correctly captures --record-out files.
  • locate only probes the empty normalization set and each single-element set. This matches the observed case files (which use at most one normalization at a time) and is consistent with the spec prose, so it is not a bug.
  • golden — case ID comes from name.trim_end_matches(".json"), which matches all case file names in the PR.
  • LAST is thread_local!; test threads are isolated. No data-race concern.
  • command extraction (take_while(!starts_with('-'))) yields "run", "plan check", "replay" as expected.

mod.rs

  • #[path = "harvest.rs"] resolves correctly relative to common/.
  • #[path = "../../../../tools/rustev-conformance/src/normalize.rs"]: four levels up from crates/rustev-cli/tests/common/ reaches the repo root; the path is correct and intentional per the spec ("one file the CLI tests and the runners share").
  • normalize_timing is delegated to normalize::normalize_timing. The old inline implementation is removed without leaving dead code.
  • harvest::golden is called after the existing golden(name, bytes) call, so the original bless behavior is preserved.

Case and fixture JSON files

  • All SHA-256 values are 64 hex characters (spot-checked: 84ae…4a98, 7a2d…a5e, c3e0…ed8, etc.).
  • lodging.run.json correctly includes two outputs (stdout with "normalize":["receipt"] and the record file with "normalize":["timing"]).
  • lodging.compile.json deliberately only verifies stdout; the written plan is not a pinned golden. This is consistent with the CLI test design (and lodging.show/lodging.run use their own pre-built fixture plans).
  • refusal-16.json and refusal-17.json have no --rules/--calibration flags in argv, matching those test cases.
  • Runtime cases (runtime.admission, etc.) in the manifest correctly omit "argv" and "exit" (they use "command": "decide" and the "runtime" block instead).
  • manifest.json case order is alphabetical; the five runtime cases are correctly interleaved between the lodging and support groups.

spec.md — Removing planned: true from the tools/rustev-conformance/ entry is correct since the crate now exists. The new Increment 4 prose accurately describes what the code does.

No bugs, security problems, or inconsistencies found.

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

Group 2 of 3

Reviewing all the new fixture files in group 2. These are conformance test fixtures for CLI and runtime test cases.

Finding: Duplicate JSON key in refusal-01 definition

tools/rustev-conformance/fixtures/cli/refusal-01/cat-01.definition.json line 1 contains a duplicate top-level "name" key: the object begins with "name":"x" and then later contains the legitimate "name":"support-routing" field. Every other refusal fixture (02–17) and every valid fixture omits this leading "name":"x".

With Rust's serde_json (default behavior: last value wins for duplicate keys), this causes the "name":"x" to be silently overwritten by "name":"support-routing", making the definition appear structurally valid. If refusal-01 is intended to exercise a specific semantic defect (as all other refusal cases do), the duplicate key neither adds that defect nor is reliably detected by the parser — the conformance case would produce a valid plan rather than the expected refusal output.

All other changed files look correct: the intentional defects in refusal-02 through refusal-17 are each clearly scoped (wrong op version, wrong list type, cyclic deps, bad binding, out-of-range request limit, missing on_unresolved entry, invalid fallback, missing calibration, duplicate step id, unknown step in execution policy, non-future-window actionability check). The lodging and support fixture data, bundle files, descriptor files, and runtime fixtures are internally consistent.

{"head": "c05f2728e73f7d2fc20c1d3d0f46f66a8843df5c", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/fixtures/cli/refusal-01/cat-01.definition.json", "line": 1, "summary": "Duplicate top-level JSON key 'name': object opens with \"name\":\"x\" and later also contains \"name\":\"support-routing\"; serde_json's last-value-wins semantics silently ignores the first, making the definition appear valid and likely preventing the intended refusal from firing."}]}

Group 3 of 3

Reviewing the three source files, three test files, and the release-set addition.

tools/rustev-conformance/src/lib.rs

contained correctly rejects all traversal forms (.., absolute, ., empty). The sort in aggregate compares Option<&str>, putting None before any Some; non-string IDs would silently sort first, but in practice every ID is a string.

In compare, the match (&o.stream, &o.file) wildcard arm catches three distinct situations with one message:

  • (Some(s), None) where s != "stdout" — unrecognised stream name
  • (Some(_), Some(_)) — both set
  • (None, None) — neither set

All three print "an output names one stream or one file", which is the rule rather than the violation. When a case file misnames a stream (e.g. "stderr"), the diagnostic does not identify the unknown name, making it harder to debug a bad conformance case. This is a minor diagnostic quality issue.

tools/rustev-conformance/src/normalize.rs

apply serialises back as compact JSON + newline; both the harvest path and the compare path go through the same function, so field ordering is consistent. No issues.

tools/rustev-conformance/src/runtime.rs

Scripted::answer: n.clamp(1, l.len()) - 1 with the "Attempts count from 1; a 0 reads as the first" comment — both n=0 and n=1 index element 0 (i.e. the first answer is used for any attempt ≤ 1). This matches the comment and is intentional.

OnCancel::Ignore => std::future::pending().await hangs only if the runtime raises its cancel signal, which the admission/deadline cases avoid (gate is released, or deadline abandons the future externally). Fine.

The release_all filter !matches!(a, Answer::Gate) prevents a gate-on-release cycle from hanging indefinitely. Correct.

tools/rustev-conformance/tests/cli.rs

Cwd serialises all set_current_dir calls through a per-binary static mutex and restores on drop, including panic unwind — sound approach for a process-wide resource.

The golden-coverage assertion counts distinct repository paths in manifest outputs against the number of .json files in the golden directory; run cases output both stdout and the record file as separate outputs, so lodging.record.json / support.record.json are covered through the run cases rather than dedicated case files. The count will be consistent.

tools/rustev-conformance/tests/runtime.rs

create_dir_all is inside the for c loop (declared alongside dir), so removal at the end of each iteration is safe — the directory is re-created on the next iteration. No bug.

Temp-dir name for the_manifest_runtime_cases_pass_through_the_runner uses only process::id() with no timestamp nonce. Two test binaries have different PIDs, so they won't conflict. Within one binary this test runs once. No issue.

The blip variable is referenced twice inside json!([blip, blip, …]); serde_json's json! macro serialises each element via &$elem (a borrow), so this compiles and the two elements are independent copies.

tools/rustev-release/release-set.json

Clean exclusion entry; mirrors the existing rustev-boundaries pattern.


{"head": "c05f2728e73f7d2fc20c1d3d0f46f66a8843df5c", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/src/lib.rs", "line": 169, "summary": "The wildcard arm in `compare` emits 'an output names one stream or one file' for an unrecognised stream name (e.g. 'stderr'), the both-set case, and the neither-set case, giving no indication of which violation occurred and making a misconfigured case file hard to diagnose."}]}

Subject: b3ae816...c05f272, diff digest 542a819572a8c46836a731cfce29ad91319432f39d66f559de08629b5d5084a6, 3 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception October 20, 2026 20:42 — with GitHub Actions Inactive
@bartekus
bartekus force-pushed the impl/027-conformance branch from c05f272 to 836600a Compare October 20, 2026 20:44
@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 3

Reviewing the files in this group: the new harvest.rs module, the updated mod.rs, the spec amendment, the new Cargo.toml, and all the generated case/fixture/manifest JSON.

harvest.rs — locate() only probes single normalizations

crates/rustev-cli/tests/common/harvest.rs line ~127:

let probes: Vec<Vec<&str>> = std::iter::once(vec![])
    .chain(super::normalize::NAMES.iter().map(|n| vec![*n]))
    .collect();

probes contains [], ["receipt"], ["timing"], … but never any two-element combination. If a golden is ever produced by applying two normalizations in sequence (e.g. both "receipt" and "timing"), locate() returns None and the unwrap_or_else on line ~152 panics with "golden X is no output of …". The current golden set uses only single normalizations, so this is latent rather than immediately broken, but it is a real design gap — the probe set is not closed under the compositions normalize::apply can express.

Everything else checks out

  • root() path arithmetic (CARGO_MANIFEST_DIR + ../..) correctly resolves to the workspace root for crates/rustev-cli/.
  • before()/after()/golden() use a thread-local LAST so parallel test threads can't interfere.
  • The written computation (all vs present) correctly identifies files the invocation created or changed, so stdout and record-file outputs are located reliably.
  • command extraction (take_while(!starts_with('-'))) produces the right strings for every case in the diff.
  • SHA-256 values in all case files are 64-hex-character strings (verified spot-checks).
  • The normalize_timing refactor delegates to normalize::normalize_timing; the path import ../../../../tools/rustev-conformance/src/normalize.rs resolves correctly from crates/rustev-cli/tests/common/.
  • Manifest case count (29 CLI + 5 runtime = 34) matches the golden-file count in the repo context and the spec text.
  • conformance-harvest intentionally deletes only cases/cli and fixtures/cli, leaving hand-authored runtime/ files intact.
{"head": "836600a81e363bc6dbfa3f8e67d74e0eda9dc4e0", "verdict": "findings", "findings": [{"path": "crates/rustev-cli/tests/common/harvest.rs", "line": 127, "summary": "locate() builds probes with only single normalizations; any golden requiring two normalizations applied together (e.g. [\"receipt\", \"timing\"]) will never match and will panic during harvest."}]}

Group 2 of 3

Reviewing the fixture files in this group for internal consistency, data correctness, and structural issues.

refusal-01/cat-01.definition.json — The top-level JSON object has two "name" keys at the same level: "name":"x" appears first, then "name":"support-routing" later in the same object. JSON does not define behavior for duplicate keys. With serde_json (Rust default), the last value wins, so the effective name is "support-routing" — the "name":"x" is silently discarded. If this refusal case is intended to test rejection of a definition named "x", the fixture does not achieve it; the parser sees a valid "support-routing" definition and the intended invalid condition is never exercised.

All other fixture files look internally consistent:

  • Snapshot timestamps, IDs, and provenance values are consistent within and across the lodging and support bundles.
  • Step IDs and their cross-references (e.g., step:failed_30d, step:eligible) are coherent within each definition.
  • refusal-11's duplicate "id":"failed_30d" (two steps with the same ID) and refusal-12's reference to "step":"no_such_step" are clearly intentional defects for those test cases.
  • Runtime descriptors, calibration artifacts, and plan calibration IDs are mutually consistent within their fixture group.
  • Synthetic dataset hash (sha256:ddd...) and artifact hashes (sha256:aaa..., sha256:bbb..., etc.) are consistently applied.
{"head": "836600a81e363bc6dbfa3f8e67d74e0eda9dc4e0", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/fixtures/cli/refusal-01/cat-01.definition.json", "line": 1, "summary": "Top-level JSON object contains duplicate 'name' keys ('x' and 'support-routing' at the same level); serde_json silently discards the first, so the parser sees a valid 'support-routing' definition and the intended invalid condition for this refusal case is never exercised."}]}

Group 3 of 3

tools/rustev-conformance/src/lib.rs

The aggregate() sorts by a["id"].as_str().cmp(...) which compares Option<&str>. A case file missing the "id" key yields None, sorting before all valid entries rather than producing an immediate error. Parsing via manifest() would catch it eventually, but aggregate() itself emits no diagnostic for malformed files.

The path-safety in contained looks correct: the Normal-only component check rejects .., ., and absolute prefixes, and the manifest test covers the relevant edge cases including "./a".

tools/rustev-conformance/src/normalize.rs

normalize_timing uses serde_json's IndexMut to write into record["timing"]["elapsed_ms"], etc. When the "timing" key is absent, IndexMut silently creates it (converting Null to an empty object). If a non-timing output is given the "timing" normalization by mistake, the function injects spurious "timing": { "elapsed_ms": 0, "queued_ms": 0 } and subsequent comparison against a golden that lacks that key will differ — which is the right outcome — but the error message will say "differs" with no indication that a structural mismatch was the cause.

tools/rustev-conformance/src/runtime.rs

OnCancel::Ignore falls through to std::future::pending().await, which suspends the attempt indefinitely. A case that combines a Gate answer with on_cancel: ignore and a subsequent Cancel step (but no ReleaseAll) would hang until the 30-second tokio::time::timeout fires and reports "never finished". This is a latent trap in the case-authoring API rather than a runtime bug, but there is no guard or diagnostic to catch it at case-parse time.

The until spin-loop (100 000 yield_now iterations) is a common single-threaded-runtime idiom and should be sufficient in practice.

tools/rustev-conformance/tests/cli.rs

The temp directory is removed before the failure assertion is evaluated (line ~60):

let _ = std::fs::remove_dir_all(&base);
assert!(failures.is_empty(), "{failures:#?}");

If failures is non-empty, every actual output file the CLI produced is already gone by the time the test reports a failure, making the discrepancy unreproducible from the filesystem. The fix is to assert first, then clean up (or use a scopeguard/Drop wrapper so cleanup is deferred until after the assert).

tools/rustev-conformance/tests/manifest.rs and tests/runtime.rs — no issues found.

tools/rustev-release/release-set.json — the new rustev-conformance exclusion entry is consistent with the existing tooling-crate exclusions.

{"head": "836600a81e363bc6dbfa3f8e67d74e0eda9dc4e0", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/tests/cli.rs", "line": 60, "summary": "Temp directory is removed before the failure assertion fires, destroying actual CLI output files when a case diverges and making the failure unreproducible from the filesystem."}]}

Subject: b3ae816...836600a, diff digest 35fc7d8c1eab89f087a37abd5d18027a4a878b093c55c0684475f033340c187d, 3 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception October 20, 2026 20:58 — with GitHub Actions Inactive
@bartekus
bartekus force-pushed the impl/027-conformance branch from 836600a to c7999ec Compare October 20, 2026 21:01
@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 3

Reviewing the changed files in group 1.

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

The harvest logic is well-structured for a developer tool. A few observations:

  1. Input-detection heuristic (before, lines ~76-101): Any argument that doesn't start with - and whose corresponding path exists under dir is treated as an input file. This works correctly for the CLI's argument patterns (flag values like --plan lodging.plan.json are picked up; numeric values like 1790164800000 don't exist as files). The heuristic could silently miss a file if an argument value matches an existing unrelated path, but this is low-probability in test scratch directories.

  2. TOCTOU in golden (lines ~153-220): The read-modify-write on the case JSON file has a race if multiple tests run in harvest mode and share a case name. However, conformance-harvest is run sequentially from make and Cargo test parallelism operates on separate cases; in practice this is harmless.

  3. Case-naming ordering dependency (lines ~163-166): The first golden a test pins names the case (get_or_insert_with). Callers must pin the "primary" output first. This is documented in the comment but is a silent failure mode if someone reorders golden pins.

  4. hex function (lines ~45-49): format!("{x:02x}") where x: &u8 — Rust's format machinery auto-derefs so LowerHex on u8 applies. This is correct.

  5. Sha256::digest iterator yields &u8, and the result is 32 bytes × 2 hex chars = 64-character string. Spot-checking the hashes in the case files (e.g., 84ae4058...884a98 — 64 chars) confirms consistency.

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

The cross-crate #[path] inclusion of ../../../../tools/rustev-conformance/src/normalize.rs is unconventional but valid at the Rust level. The relative path resolves to <repo-root>/tools/rustev-conformance/src/normalize.rs from crates/rustev-cli/tests/common/. No dependency cycle exists in Cargo since rustev-cli doesn't depend on rustev-conformance.

tools/rustev-conformance/Cargo.toml

rustev-cli is in [dependencies] (not [dev-dependencies]), which is correct since the Rust runner calls rustev_cli::execute in its library code. publish = false is set as required by the spec.

Makefile

The conformance-harvest target's rm -rf tools/rustev-conformance/cases/cli tools/rustev-conformance/fixtures/cli deliberately spares the runtime cases and expected/ tree. Sequence (delete → harvest → bless → verify) is correct.

Case JSON files

SHA-256 hashes are 64-character hex strings throughout. Identical fixture files shared across cases (e.g., the actionable plan) correctly show identical hashes. The lodging.run and support.run cases correctly include two outputs (stdout with receipt normalization, file with timing normalization). The manifest is the aggregate of all individual case files.

Spec update

Removing planned: true from tools/rustev-conformance/ is correct now that the directory exists.

No bugs or security issues found.

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

Group 2 of 3

Reviewing the fixture files in group 2. These are conformance test data files — most are intentional "bad" fixtures for refusal test cases. Let me verify internal consistency.

Verified correct (intentional defects in refusal fixtures):

  • refusal-02: count_where version:2 (unknown op version)
  • refusal-03: count_where applied to input:ticket.message (wrong type, not a list)
  • refusal-04: circular step dependency (step:a ↔ step:b)
  • refusal-05: invalid binding:{"backend":"nope"} instead of "auto"
  • refusal-06: uncalibrated_threshold:"not_declared" on a mass_at_least that requires a declared reason
  • refusal-07: max_semantic_requests:2 for 3 semantic steps
  • refusal-08: missing as_unmet entry for step:frustration in on_unresolved
  • refusal-09: fallback:{"kind":{"reason":"labels only","requires":"label"}} incompatible with requires:"distribution"
  • refusal-10: calibration:"none" but step requires:"calibrated_probability"
  • refusal-11: two steps with id:"failed_30d" (duplicate step ID; second should be failed_payments_30d)
  • refusal-12: execution config references step:"no_such_step" that doesn't exist in the definition

Verified numerically consistent: lodging-emb bundle — suitability logits, ranking scores, shortlist ordering, eligibility filter, and FX conversion all check out against the rules in lodging.rules.json.

Finding: refusal-01/cat-01.definition.json has a duplicate top-level "name" key in the JSON object — the object opens with {"name":"x","inputs":[...],...,"name":"support-routing",...}. The key "name" appears twice at the root level. Under serde_json defaults the last value wins, making the effective name "support-routing" — identical to a valid definition. If the intended defect for refusal-01 is something other than this duplicate key (and the duplicate key silently resolves to the correct value), the test case may not be exercising its intended refusal scenario.

{"head": "c7999ec2db7e14a4b86edbc50fce9d6e7e41e92a", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/fixtures/cli/refusal-01/cat-01.definition.json", "line": 1, "summary": "Duplicate top-level JSON key 'name' ('x' then 'support-routing') — serde_json silently keeps the last value, making the definition identical to a valid one and potentially nullifying whatever refusal this fixture is meant to exercise."}]}

Group 3 of 3

Two issues found across the reviewed files.

1. Output file path not validated in compare() (lib.rs)

contained() is used to validate input names before joining with a directory, but output file values bypass this check:

(None, Some(f)) => match std::fs::read(dir.join(f)) {

A case output with "file": "../../etc/secret" would read outside dir. Case files are pinned by SHA-256, so exploitation requires repository compromise, but the defense-in-depth is inconsistent with how inputs are handled. contained(f)? should gate this arm the same way it gates input names.

2. Temp directory deleted before assertion fires (tests/runtime.rs)

In the_manifest_runtime_cases_pass_through_the_runner:

let v = compare(c, 0, b"", &dir);
let _ = std::fs::remove_dir_all(&dir);   // ← deleted here
assert!(v.is_empty(), "{v:#?}");         // ← already gone on failure

The CLI test (tests/cli.rs) deliberately keeps the temp directory on failure so the differing outputs can be inspected. This test does the opposite: the directory is unconditionally removed before the assertion, so any produced files that differ from the golden are already deleted when the assertion message is printed. The let _ also silently ignores removal failure, meaning stale files from a prior iteration (all cases share the same rustev-conformance-rt-{pid} path) could persist into the next case's compare call, though the outputs dict overwrite makes a false positive unlikely.

{"head": "c7999ec2db7e14a4b86edbc50fce9d6e7e41e92a", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/src/lib.rs", "line": 163, "summary": "Output `file` values are joined with `dir` without `contained()` validation, unlike input names, allowing path traversal outside the temp directory."}, {"path": "tools/rustev-conformance/tests/runtime.rs", "line": 415, "summary": "The temp directory is removed before the assertion fires, so produced outputs that differ from the golden are deleted before they can be inspected, unlike the CLI test which preserves them on failure."}]}

Subject: b3ae816...c7999ec, diff digest 027afdc93a65ba28a6db3c75258a5167c718546be19ac36d003191585e4bef20, 3 call(s). An AI comment is not an approval.

@bartekus
bartekus requested a deployment to statecraft-review-exception October 20, 2026 21:12 — with GitHub Actions Waiting
@bartekus
bartekus force-pushed the impl/027-conformance branch from c7999ec to 116fbd7 Compare October 20, 2026 21:17
@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 3

Reviewing the diff carefully across the harvest infrastructure, case files, and supporting changes.

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

The before function detects input files with:

if !a.is_empty() && !a.starts_with('-') && p.exists() {

This correctly skips flags, non-path tokens (subcommands like "plan", timestamps like "1790164800000", IDs like "lodging-1"), and output files that don't exist yet (e.g., lodging.plan.json for compile, lodging.record.json for run). Verified against every case's argv.

The locate function enumerates all 2^|NAMES| normalization combinations sorted by length. With NAMES = ["receipt", "timing"] (as implied by the spec), that's 4 probes -- fine.

The command extraction take_while(!starts_with('-')) correctly produces "run", "plan check", "replay" for all present argv shapes.

The multi-golden case (e.g., lodging.run pinning stdout + lodging.record.json) reads the existing case JSON and appends only if the golden isn't already present -- correct.

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

The normalize_timing function is refactored from an inline implementation to a delegation to normalize::normalize_timing. The original body zeroed elapsed_ms, queued_ms, dispatched_ms, and ended_ms. Whether the shared normalize::normalize_timing is equivalent can't be confirmed here since tools/rustev-conformance/src/normalize.rs is in a different review group -- this is a cross-file dependency worth verifying.

Case files / manifest

SHA-256 values in individual case files match the manifest exactly (spot-checked actionable.run-needs, lodging.run, runtime.admission). All SHA-256 strings are 64 hex characters. Inputs in each case correctly reflect only the pre-existing files the argv names.

Makefile

The rm -rf in conformance-harvest is scoped to two subdirectories (cases/cli, fixtures/cli) and is intentional cleanup before re-harvest.

No bugs, security issues, or inconsistencies found in the files assigned to this group.

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

Group 2 of 3

Reviewing the fixture files for correctness and internal consistency.

Finding: duplicate "name" key in refusal-01/cat-01.definition.json

The file begins {"name":"x","inputs":[...],... but the object also contains a canonical "name":"support-routing" field later at the same nesting level (as seen in every other definition file). This creates two top-level "name" keys in the same JSON object. With standard serde_json behaviour (last value wins), the "name":"x" entry is silently overwritten by "name":"support-routing", making the mutation a no-op. If the intention was to test rejection of an invalid definition name, the test fixture is ineffective: the parser will see name = "support-routing" and the definition appears structurally valid. All other refusal fixtures (refusal-02 through refusal-17) start cleanly with {"inputs":[...] — only refusal-01 has this leading extra key.

Other refusal mutations verified as intentional:

  • refusal-02: count_where uses "version":2 (unsupported op version)
  • refusal-03: count_where list points at "input:ticket.message" (wrong type)
  • refusal-04: steps a and b form a mutual dependency cycle
  • refusal-05: frustration step has "binding":{"backend":"nope"} (invalid binding)
  • refusal-06: mass_at_least uses "uncalibrated_threshold":"not_declared" for an uncalibrated step without a declared reason
  • refusal-07: "max_semantic_requests":2 with 3 semantic steps (on_excess":"refuse")
  • refusal-08: missing as_unmet entry for step:frustration in on_unresolved
  • refusal-09: explicit_deadline fallback provides a label for a step that requires: distribution
  • refusal-10: topic step has "calibration":"none" but "requires":"calibrated_probability"
  • refusal-11: second step reuses "id":"failed_30d" (duplicate step ID, policy references non-existent failed_payments_30d)
  • refusal-12: execution config references "step":"no_such_step"

All other fixture data (digests cross-referencing within bundles, calibration artifact hashes matching between plan and calibration files, snapshot contents matching plan inputs) appears internally consistent.

{"head": "116fbd7148012f9debc16eea5d72552053103a25", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/fixtures/cli/refusal-01/cat-01.definition.json", "line": 1, "summary": "Top-level JSON object has two 'name' keys ('name':'x' and 'name':'support-routing'); serde_json last-value-wins semantics silently discard the 'name':'x' mutation, rendering this refusal fixture ineffective."}]}

Group 3 of 3

Looking at the three source files, three test files, and the release-set update.


tools/rustev-conformance/src/lib.rs

  • aggregate sort (line ~104): a["id"].as_str() returns None when a case file has no id key; None sorts before all Some(...) values, so malformed files cluster at the top nondeterministically. The committed manifest check would still catch the divergence, but the stale error message could mislead. Minor.
  • pinned / contained security path: contained correctly rejects .., leading /, and ./ components. Path traversal outside the repo root is not possible.

tools/rustev-conformance/src/runtime.rs

  • OnCancel::Ignore hangs (line ~319): std::future::pending().await inside the gate handler means any task using on_cancel: "ignore" that receives a cancel signal will hang indefinitely. The 30-second tokio::time::timeout in the result-collection loop saves it from hanging forever, but the test will fail with "never finished" rather than producing the expected output if the runtime does not forcibly cancel the attempt by another path. This is only safe if the runtime guarantees no cancel signal is raised while an "ignore" backend is gated.

tools/rustev-conformance/tests/runtime.rs

  • runtime.deadline case has no deadline_ms (line ~327 of the test, inside cases()): The request is constructed with request("d1", None), setting deadline_ms: None. The mirrors function for this case then asserts r.timing.deadline_expired == true, AttemptEnd::Deadline, and Unresolved::DeadlineExceeded. If the runtime only schedules a deadline timer when deadline_ms is explicitly supplied, advancing the clock by 2000 ms will not expire the deadline; the three tasks will stay gated behind the "ignore" backend, and the decision will time out after 30 s with "d1 never finished". This is the most consequential finding: the data-driven case appears to be missing the deadline_ms field that the mirrored test (time.rs::an_attempt_in_flight_at_the_deadline_is_abandoned_honestly) presumably supplies.

tools/rustev-conformance/tests/cli.rs

  • Cwd mutex and panic-safe restore look correct.
  • Golden-coverage check (covered.len() == goldens) counts unique referenced goldens, so two cases sharing a golden file would still satisfy the assertion even if a third golden were uncovered — a minor gap in the invariant.

tools/rustev-conformance/tests/manifest.rs / tools/rustev-release/release-set.json

No issues found.


{"head": "116fbd7148012f9debc16eea5d72552053103a25", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/tests/runtime.rs", "line": null, "summary": "The runtime.deadline case passes `deadline_ms: None` to the decision request but the mirrors assertion expects `deadline_expired = true` and `DeadlineExceeded`; if the runtime only arms a deadline timer when `deadline_ms` is explicitly set, the gated attempts (with on_cancel=ignore) will never be abandoned and the test will time out after 30 s."}, {"path": "tools/rustev-conformance/src/runtime.rs", "line": 319, "summary": "`OnCancel::Ignore` drops into `std::future::pending().await` when the cancel signal fires, hanging the task until the 30-second result-collection timeout kills it rather than producing usable output, so any case that raises a cancel against an ignore-backend will report 'never finished' instead of the expected run record."}]}

Subject: b3ae816...116fbd7, diff digest 438e6f301634f5a8117dd159c4eeba6c88be8f6806bec9f34b15ef85c6e7b8ab, 3 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 20, 2026 21:29 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/027-conformance branch from 116fbd7 to a7f99df Compare October 20, 2026 21:34
@bartekus
bartekus force-pushed the impl/027-conformance branch 2 times, most recently from b22983d to ed80241 Compare October 20, 2026 23:07
Base automatically changed from impl/027-surface to main October 20, 2026 23:11
@bartekus
bartekus force-pushed the impl/027-conformance branch from ed80241 to f6e9940 Compare October 20, 2026 23:12
@bartekus
bartekus enabled auto-merge (squash) October 20, 2026 23:13
@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

Reviewing the harvest machinery, conformance scaffolding, and case data.

harvest.rs – locate enumerates all 2^n subsets of normalization names

crates/rustev-cli/tests/common/harvest.rs line ~130:

let mut probes: Vec<Vec<&str>> = (0..1usize << names.len())
    .map(|m| {
        (0..names.len())
            .filter(|i| m & (1 << i) != 0)
            .map(|i| names[i])
            .collect()
    })
    .collect();

With NAMES.len() == 2 today this is 4 probes (harmless), but every new normalization doubles the work. The powerset approach is also O(n × 2^n) in norm calls per invocation. The right data structure is a linear scan over named normalizations applied individually, not over their power set — subset combinations are never needed for the goldens that exist.

harvest.rs – before may capture an --out destination as an input

crates/rustev-cli/tests/common/harvest.rs line ~87:

if !a.is_empty() && !a.starts_with('-') && p.exists() {
    files(dir, &p, &mut inputs);
}

Any non-flag argument that resolves to an existing file is treated as an input. For plan compile --definition ... --out existing-plan.json --rules ..., if existing-plan.json is already present (re-run scenario without scratch), it would be captured as an input and appear in the case's inputs array with its pre-run digest, making the fixture diverge from the actual invocation input set. The --out flag value should be excluded, e.g. by tracking which args immediately follow known output flags.

mod.rs – normalize_timing silently delegates to code not visible in this group

crates/rustev-cli/tests/common/mod.rs line ~295:

pub fn normalize_timing(record: &mut Json) {
    normalize::normalize_timing(record)
}

The implementation is now in tools/rustev-conformance/src/normalize.rs (group 2). If that implementation differs from the deleted inline code (zeroing elapsed_ms, queued_ms, dispatched_ms, ended_ms), every existing CLI golden that exercises normalize_timing would silently mismatch. The behavioral equivalence is unverifiable from this group alone and there is no compile-time check.

harvest.rs golden – fixture files overwritten but case inputs not refreshed on second call

crates/rustev-cli/tests/common/harvest.rs lines ~185–220: When a case file already exists (second golden for the same invocation), fixture files are always re-written from seen.inputs, but the case JSON's inputs array is kept from the on-disk file. This is safe only while make conformance-harvest always starts with rm -rf. If the rm is skipped, fixture content and case inputs SHA-256 values can diverge without error.

{"head": "f6e99404a4b3ca9e08891c11c2834e606178c78e", "verdict": "findings", "findings": [{"path": "crates/rustev-cli/tests/common/harvest.rs", "line": 130, "summary": "locate builds 2^n normalization probes; exponential growth embedded in harvest path as each new normalization name doubles probe count."}, {"path": "crates/rustev-cli/tests/common/harvest.rs", "line": 87, "summary": "before captures any non-flag arg matching an existing file as an input, so an --out destination that already exists is erroneously included in the case inputs array."}, {"path": "crates/rustev-cli/tests/common/mod.rs", "line": 295, "summary": "normalize_timing now delegates to normalize::normalize_timing in group 2; if that implementation differs from the deleted inline code, existing CLI golden tests silently mismatch."}, {"path": "crates/rustev-cli/tests/common/harvest.rs", "line": 185, "summary": "golden re-writes fixture files on every call but does not refresh the case JSON inputs array when the file already exists, so fixture content and case SHA-256 values can diverge if conformance-harvest is run without the leading rm -rf."}]}

Group 2 of 2

Reviewing the changed files in this group.

tools/rustev-conformance/src/lib.rs — misleading comment in aggregate()

aggregate() has:

// Both directories exist whenever the suite does; a missing one is
// an error naming it, never a silently smaller manifest.
for dir in ["cli"] {

The comment says "both directories" but the slice contains only one entry. If a second surface directory is later added here, the comment is already wrong and may cause confusion about the invariant.

tools/rustev-conformance/src/normalize.rs — normalize_timing silently inserts fields

pub fn normalize_timing(record: &mut Json) {
    record["timing"]["elapsed_ms"] = 0.into();
    record["timing"]["queued_ms"] = 0.into();

serde_json::IndexMut on a missing key in an Object inserts Null, and chained ["elapsed_ms"] on that Null then promotes it to a new Object. If an output does not naturally have a "timing" field, normalize_timing silently inserts {"timing":{"elapsed_ms":0,"queued_ms":0}} into it. The normalized output would then not match the golden, producing only a "differs" failure with no indication that normalization introduced spurious keys. This is a silent correctness trap for anyone who mistakenly declares "timing" for a non-run output in a case file.

Refusal fixture internal consistency (fixtures look intentionally mutated)

  • refusal-03/cat-03.definition.json: failed_payments_30d uses count_where over input:ticket.message (a text input) — deliberate type mismatch.
  • refusal-04/cat-04.definition.json: steps a and b form a mutual reference cycle — deliberate cycle detection case.
  • refusal-11/cat-11.definition.json: two steps share "id":"failed_30d" — deliberate duplicate ID.
  • refusal-12/cat-12.execution.json: references "step":"no_such_step" — deliberate unknown step.

These are all intentional defects for refusal cases. No issue.

tools/rustev-conformance/tests/cli.rs — Cwd process-global mutation

The LOCK is a static local to the cli.rs binary, protecting the process-level set_current_dir. Any other test in the same test binary that calls set_current_dir outside this lock could race with the conformance runner. Given the narrow scope of this binary this is unlikely to be triggered, but it is an implicit assumption.

{"head": "f6e99404a4b3ca9e08891c11c2834e606178c78e", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/src/lib.rs", "line": 111, "summary": "Comment claims 'Both directories exist' but the loop iterates only ['cli'], making the invariant statement factually wrong and likely to mislead when a second surface directory is added."}, {"path": "tools/rustev-conformance/src/normalize.rs", "line": 19, "summary": "normalize_timing uses serde_json IndexMut which silently inserts a 'timing' key (with zeroed sub-fields) when the output JSON does not already have one, causing a misleading 'differs' failure if mistakenly applied to a non-run output."}]}

Subject: 1473a77...f6e9940, diff digest 8c9f5b654d45154882b757da77ce568379a7593dbb552acd17dbee8c0b13846e, 2 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 20, 2026 23:21 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/027-conformance branch from f6e9940 to bb605b5 Compare October 20, 2026 23:27
@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

Review

crates/rustev-cli/tests/common/mod.rs — normalize_timing delegation

The diff removes the inline normalize_timing body and replaces it with a call to normalize::normalize_timing(record) (line 295):

// was:
record["timing"]["elapsed_ms"] = 0.into();
record["timing"]["queued_ms"]  = 0.into();
for r in record["requests"].as_array_mut()... {
    for a in r["attempts"].as_array_mut()... {
        a["dispatched_ms"] = 0.into();
        a["ended_ms"]      = 0.into();
    }
}

// now:
normalize::normalize_timing(record)

normalize.rs is not in this review group. If the new implementation differs — zeroing more fields, fewer fields, or using different JSON paths — every timing-normalized golden comparison (lodging.record.json, support.record.json) will produce a spurious mismatch without any obvious error message. This is the most load-bearing behavioral change in the diff.

crates/rustev-cli/tests/common/harvest.rs — before() input scanner

for a in args {
    let p = dir.join(a);
    if !a.is_empty() && !a.starts_with('-') && p.exists() {
        files(dir, &p, &mut inputs);
    }
}

Every non-flag token is probed against dir. For current invocations (plan, check, run, replay, compile, show) the names don't collide with fixture files so p.exists() is false and they're silently skipped. However if any future test puts a file literally named run or compile in its scratch directory, it would be silently included as a conformance input with a wrong digest, producing a case file that can never pass the runner's digest check. The robustness here depends entirely on the test author knowing not to create such files.

tools/rustev-conformance/Cargo.toml — cross-crate #[path] boundary

#[path = "../../../../tools/rustev-conformance/src/normalize.rs"]
pub mod normalize;

normalize.rs is compiled into rustev-cli's test binary as well as into rustev-conformance. Any use statement added to normalize.rs that references a crate only present in rustev-conformance's dependency graph (not rustev-cli's) will silently break rustev-cli's tests at the next cargo test -p rustev-cli. There is no [dev-dependencies] guard preventing this drift.


{"head": "bb605b56064e7566adc01a7728f3eb217feff0ea", "verdict": "findings", "findings": [{"path": "crates/rustev-cli/tests/common/mod.rs", "line": 295, "summary": "normalize_timing is now delegated to normalize::normalize_timing() whose implementation is not in this diff group; if it zeros different fields than the removed inline code the timing-normalized goldens (lodging.record.json, support.record.json) will fail without a clear diagnostic."}, {"path": "crates/rustev-cli/tests/common/harvest.rs", "line": 97, "summary": "before() probes every non-flag argument token as a filesystem path; command words like 'run' and 'compile' are safe only because no fixture file with those names exists in the scratch dir — a future test that creates such a file would silently add it as a conformance input with a wrong digest."}, {"path": "crates/rustev-cli/tests/common/mod.rs", "line": 73, "summary": "The #[path] cross-crate include of normalize.rs means any future import added to normalize.rs that resolves only in rustev-conformance's dependency graph will silently break rustev-cli's test compilation with no guard to catch the drift."}]}

Group 2 of 2

Reviewing the changed files in group 2 of 2.

tools/rustev-conformance/src/lib.rs and tests/cli.rs — missing coverage for two existing goldens

The test every_cli_case_produces_its_expected_bytes (cli.rs ~71) asserts that every .json file in crates/rustev-cli/tests/golden/ is referenced by at least one conformance case output:

assert_eq!(covered.len(), goldens, "every CLI golden is covered");

The REPO CONTEXT shows two golden files that have no corresponding conformance case in this PR:

  • crates/rustev-cli/tests/golden/lodging.record.json
  • crates/rustev-cli/tests/golden/support.record.json

The changed-path list includes lodging.check, lodging.compile, lodging.replay, lodging.run, and lodging.show (same pattern for support), but no lodging.record or support.record case files. The test cites spec 3.12.4 as its own authority for this invariant, so the PR violates its stated spec and the test will fail in CI.

tools/rustev-conformance/src/normalize.rs — consistency gap between empty and non-empty names

apply() returns bytes.to_vec() unchanged when names is empty, but serializes back through serde_json (compact + \n) when non-empty. If a case uses no normalizations, the golden is compared as raw bytes; if it uses any normalization, numeric keys may be reordered and whitespace canonicalized. This creates a latent inconsistency: a golden stored with non-canonical key order would pass with empty normalize but fail if a single normalization was ever added. Not a bug today (goldens are already compact single-line), but worth noting structurally.

tools/rustev-conformance/tests/manifest.rs — "./a" rejection relies on platform-specific Path parsing

contained("./a") is rejected because CurDir ≠ Normal(_). This is correct on Linux. No issue for the declared target platform, but the function has no comment explaining why CurDir is forbidden while the test quietly relies on it. Minor documentation gap only.

The fixture files for refusal cases (duplicate step IDs in refusal-11, circular deps in refusal-04, type mismatch in refusal-03, no calibration + requires calibrated_probability in refusal-10) all appear intentionally malformed to exercise refusal paths — not bugs in the fixtures.

{"head": "bb605b56064e7566adc01a7728f3eb217feff0ea", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/tests/cli.rs", "line": 71, "summary": "The golden-coverage assertion will fail in CI because `crates/rustev-cli/tests/golden/lodging.record.json` and `support.record.json` exist in the base repo but no conformance cases for `lodging.record` or `support.record` are added by this PR, violating the suite's own spec 3.12.4 requirement."}]}

Subject: 1473a77...bb605b5, diff digest f2f966e4fedbd96ec35c6bfef61c546411d0bc2123bb05599a3c3ba580a3b9a7, 2 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 20, 2026 23:37 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/027-conformance branch from bb605b5 to 7eed80e Compare October 20, 2026 23:40
@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

Reviewing the harvest infrastructure and conformance case files in group 1.

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

The before() input-capture heuristic (lines 82-89) checks every non-flag argument as a potential path after first_flag. This is intentional for the --out no-clobber cases. In practice it is safe because test scratch directories are fresh, but argument values like "needs" (from --decision-id needs) or "1790164800000" (from --evaluation-time) would also be probed as paths; a coincidental filename match would silently add a spurious entry to inputs, causing the next conformance-harvest run's assert_eq! to fire. Low risk in practice but a latent fragility in the harvest tool.

The thread-local LAST pattern and the before/after/golden call sequence are sound; Rust test threads are independent so there is no cross-test bleed.

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

The #[path = "../../../../tools/rustev-conformance/src/normalize.rs"] attribute is four levels up from crates/rustev-cli/tests/common/, which lands at the repo root and then into tools/…. The arithmetic is correct.

Case JSON files and manifest.json

All 29 cases are present (5 actionable, 6 lodging, 14 refusal, 6 support – with lodging.record.json and support.record.json correctly modelled as file outputs of lodging.run and support.run, not as separate cases). SHA-256 field lengths look consistent at 64 hex chars. The lodging cases correctly omit --calibration (no calibrated_probability step); the support cases include it. The refusal-16 and refusal-17 cases correctly list only the definition file as input (no rules or calibration needed for standalone format validation). The manifest.json schema entry is "rustev.conformance-manifest/1", consistent with the spec description.

tools/rustev-conformance/Cargo.toml

publish = false is set, correctly excluding this from the release set. All declared dependencies (rustev-cli, serde, serde_json, sha2) are required.

Makefile

The conformance-harvest target begins with rm -rf …/cases/cli …/fixtures/cli, which is destructive but intentional and documented. The three-step sequence (remove → harvest → bless → verify) matches the spec description.

specs/027-node-and-wasm-bindings/spec.md

The planned: true removal for tools/rustev-conformance/ is consistent with the directory now existing. The increment-4 description accurately describes what is implemented in this PR.

No bugs or security problems found that would affect runtime correctness.

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

Group 2 of 2

Looking at the diff, I'll review the new rustev-conformance crate's source code, test files, and fixture consistency.

Fixture defects (refusal-03 through refusal-12) are intentional — each cat-NN.definition.json encodes a deliberate error to exercise a specific refusal path (wrong list type in refusal-03, circular step dependency in refusal-04, bad binding in refusal-05, undeclared uncalibrated threshold in refusal-06, semantic request limit exceeded in refusal-07, missing on_unresolved entry in refusal-08, invalid fallback kind in refusal-09, missing calibration on a calibrated_probability step in refusal-10, duplicate step id "failed_30d" in refusal-11, execution referencing a nonexistent step in refusal-12). All look consistent with their intended semantics.

Real bug — coverage assertion will fail: tests/cli.rs asserts that every JSON file under crates/rustev-cli/tests/golden/ is pinned as an output in at least one conformance case:

assert_eq!(covered.len(), goldens, "every CLI golden is covered");

The REPO CONTEXT shows two golden files that have no corresponding conformance case anywhere in this PR's changed paths:

  • crates/rustev-cli/tests/golden/lodging.record.json
  • crates/rustev-cli/tests/golden/support.record.json

Neither a lodging.record nor support.record case file appears in the SUBJECT's changed paths, so these goldens are uncovered. With 31 JSON goldens in that directory but only 29 covered, assert_eq!(29, 31, …) will fail. (The companion bound assert!(ran >= 29) is satisfied but hides nothing.)

Minor — src/lib.rs aggregate sort on missing id: The manifest aggregation sorts JSON values by a["id"].as_str(), which yields None for any case file missing an id field. Rust's stable sort puts all Nones first in an implementation-defined but stable way, so the aggregated manifest would be non-deterministic across file-system orderings for malformed inputs. Not a runtime hazard because serde with deny_unknown_fields requires id, but the sort should defensively panic or error on a missing field rather than silently misorder.

src/normalize.rs: correct; normalizations are applied symmetrically during golden harvest and comparison, and the applicable() function is driven by field presence rather than normalization name matching, preventing silent misses.

{"head": "7eed80e52193493cc8d950a34d992beea87c5eee", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/tests/cli.rs", "line": 65, "summary": "assert_eq!(covered.len(), goldens) will fail: crates/rustev-cli/tests/golden/lodging.record.json and support.record.json are not referenced as outputs in any conformance case in this PR, so covered.len() (29) != goldens (31)."}]}

Subject: 1473a77...7eed80e, diff digest 6e66e8d05f57c6853bf5c6c108477f617371dae774681c7a0da783556a6e4fad, 2 call(s). An AI comment is not an approval.

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

Copy link
Copy Markdown

AI review (no-findings)

Group 1 of 2

Reviewing the diff carefully across the new harvest infrastructure, conformance case files, and supporting changes.

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

  • hex() correctly formats each SHA-256 byte as {x:02x}, giving the expected 64-character output. All digests in the case files are 64 hex chars. ✓
  • before() correctly skips flag names (start with -) and probes only flag values as paths; values that don't exist as files (e.g. 1790164800000, tenant-a) are silently ignored. ✓
  • Thread-local LAST is appropriate: each test thread gets isolated state; before() always replaces LAST before the next invocation. ✓
  • after() captures written = all_current - present_before immediately after the CLI exits, before any test-side writes, so record files are attributed correctly. ✓
  • locate() tries stdout before written files. If the stdout's normalized form accidentally equalled a written-file golden, the wrong type would be recorded; in practice the shapes differ (judgment JSON vs. record JSON), so this is safe in the current fixture set.
  • The assert_eq!(case["inputs"], json!(inputs), …) guard prevents silent overwrite of stale case files. ✓

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

  • #[path = "../../../../tools/rustev-conformance/src/normalize.rs"] resolves correctly relative to crates/rustev-cli/tests/common/mod.rs. ✓
  • cli_golden now chains golden() and harvest::golden() correctly: the old in-process golden comparison still runs, then harvest records the case. ✓
  • Deletion of inline normalize_timing in favour of normalize::normalize_timing is a correct extraction; the old body is now owned by the shared normalize.rs.

Case files and manifest

  • SHA-256 digests are consistently 64 hex characters across all case and manifest entries. ✓
  • All 29 case IDs match the spec's claimed count and the referenced goldens are all present in the REPO CONTEXT. ✓
  • actionable.plan.json fixture (same content, same digest 84ae4058…) is correctly duplicated per-case directory rather than shared. ✓
  • lodging.compile correctly omits lodging.plan.json from inputs (it doesn't exist before the invocation) and from outputs (no golden is pinned for it). ✓
  • lodging.run and support.run correctly record two outputs (stdout + record file). ✓

Makefile

  • conformance-harvest clears old case/fixture directories with rm -rf before regeneration, which is the intended workflow. No accidental data loss risk beyond what's git-tracked. ✓

tools/rustev-conformance/Cargo.toml

  • rustev-cli listed as a normal (not dev) dependency, needed for the Rust runner to call rustev_cli::execute. publish = false correctly excludes it from the release set. ✓

No bugs, security issues, or inconsistencies found.

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

Group 2 of 2

Reviewing the conformance fixture files and library code in group 2.

Fixture files (refusal-03 through refusal-17, support. fixtures)*

Each refusal fixture has a single intentional defect that distinguishes it from the valid support routing definition:

  • refusal-03: failed_payments_30d step uses "list":"input:ticket.message" (a text field) instead of "list":"step:failed_30d" — type mismatch, intentional.
  • refusal-04: Steps a and b form a cycle (a refs step:b, b refs step:a) — circular dependency, intentional.
  • refusal-05: frustration step has "binding":{"backend":"nope"} — unresolvable backend binding, intentional.
  • refusal-06: mass_at_least for explicit_deadline uses "uncalibrated_threshold":"not_declared" instead of a declared reason — intentional.
  • refusal-07: max_semantic_requests:2 while the definition requires 3 — budget exceeded, intentional.
  • refusal-08: on_unresolved omits the frustration entry — intentional missing handler.
  • refusal-09: explicit_deadline fallback has "requires":"label" while step requires:"distribution" — mismatch, intentional.
  • refusal-10: topic step has "calibration":"none" while requires:"calibrated_probability" — calibration missing, intentional.
  • refusal-11: Second step has id "failed_30d" (duplicate; should be "failed_payments_30d") — duplicate id, intentional.
  • refusal-12: Execution config references "step":"no_such_step" — invalid step reference, intentional.
  • refusal-16/17: Definition v2 actionability cases with provenance-specific failure handlers — intentional.

All support.* fixture files (check, compile, replay, run, show) match the canonical valid definition.

src/lib.rs

  • contained: correctly rejects empty paths, absolute paths, ../ traversal, and ./-prefixed paths by requiring all components to be Component::Normal. Safe.
  • pinned: verifies SHA-256 before returning bytes. Safe.
  • compare: uses contained before joining to dir for file outputs. Safe.
  • aggregate: reads only from cases/cli/, not cases/ itself, so manifest.json at cases/ is not included. Correct.

src/normalize.rs

  • normalize_timing: zeroes timing fields and attempt timestamps at their correct structural locations. No issue.
  • normalize_receipt: replaces top-level receipt value. No issue.
  • apply: when names non-empty, re-serialises as compact JSON + newline — goldens must be in the same format, which is enforced by the harvest tooling.

tests/cli.rs

  • Cwd correctly holds a process-wide Mutex and restores the directory in Drop, with panic-safe handling. Correct.
  • Golden coverage check: asserts covered.len() == goldens. This would fail if two cases shared a golden (dedup), but each golden is pinned by exactly one case. The explicit checks for lodging.record.json and support.record.json (which are outputs of run cases, not standalone cases) are correctly handled.
  • ran >= 29 matches the 29 introduced case files exactly.

tests/manifest.rs

  • a_case_path_stays_inside_its_directory: tests the right bad cases including ./a. Correct.

No bugs, security problems, or inconsistencies found.

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

Subject: 1473a77...7c9d25b, diff digest 506c66683bcba78ec930fd0c2657240b421b974c28619c24fc2677968d17b0f6, 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