Skip to content

test(067): live conformance cases and their Rust runner (increment 3, part 1) - #557

Merged
bartekus merged 1 commit into
mainfrom
impl/067-inc3
Nov 8, 2026
Merged

bartekus merged 1 commit into
mainfrom
impl/067-inc3

Conversation

@bartekus

@bartekus bartekus commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Spec 067 increment 3, part 1: the live conformance cases of 3.8.2 and their Rust runner, in tools/rustev-conformance (067's extends edge, 027 additive). Builds on #549 (the suite depends on rustev-live) and #548 (the input resolution in rustev_surface::live).

  • Case kind. live beside runtime in the manifest (Case.live), cases under cases/live/, one shared set of inputs under fixtures/live/ (plus the journal-cap case's pre-existing journal, the run-cap live configuration and the resume dataset), expected bytes under expected/live/<id>/. Generated and blessed by tests/live.rs as tests/runtime.rs does for runtime cases (RUSTEV_BLESS=1); aggregate() reads cases/live/.
  • Case data. The files rustev eval live and liveRun read, liveRun's camel-case options as paths (3.2.1), the runtime cases' BackendScripts (cost model and bound declared per backend, 3.3.1), drive steps (wait_gated, release_all, abort) and sequential runs on one journal and output directory (for resume, 3.7.2).
  • Rust runner (src/live.rs): resolves the inputs through rustev_surface::live over a real filesystem Host, rustev_live::run::prepare, a temporary testing journal, execute on a Runtime with the Rust scripted backends, a ManualClock and a rule authorizer deciding as the CLI's and the binding's (3.5.1, references <LiveConfigId>#<rule index>). Each case pins every file under out, the journal and each run's status and exit code, without normalization.
  • The six cases of 3.8.2: live.full (evaluated_live), live.probe-only (probed), live.probe-failure (probe_failed, 15, no dataset case sent), live.run-cap and live.journal-cap (spend_capped, 14), live.resume (interrupted, 16, after an abort with an item in flight, then evaluated_live on resume with the completed item not re-sent and the interrupted one incomparable). Each names the crates/rustev-live/tests/run.rs test it mirrors, and tests/live.rs checks the blessed outputs against what that test asserts.
  • Surfaces are rust-api only in this part, so the native runner does not meet a case it cannot run; part 2 adds the native runner over engine.liveRun (after increment 2b) and the native surface. No acceptance item is claimed yet: 3.8.2 needs both runners.

Every existing case, golden and expected file is unchanged; cases/manifest.json gains the six cases (cases/ is review-excluded and checked by tests/manifest.rs). tests/cli.rs accepts a .jsonl golden (the journal) line by line.

Spec

067 3.8.2, 3.7.2 (resume), I-3. The implementation record paragraph is held for the spec 067 closure pull request (increment 4), which writes every 067 record paragraph at once, so 067's derived shards do not collide in the queue.

Spec-Drift-Waiver: test tooling under 067's approved extends edge on tools/rustev-conformance/ (027, additive) for 3.8.2; no spec claim changes here; 067's record and closure land in its increment 4 pull request (coordinated per-spec record policy for 0.6.0, owner preapproval of 2026-11-07).

Checks

cargo test -p rustev-conformance --locked (full suite, 20 tests), cargo clippy --workspace --all-targets --locked -- -D warnings, cargo fmt --all --check and make gate pass. No live or paid call (R-1): scripted backends only.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

AI review (findings)

Reviewing the diff. It introduces new live-case conformance test infrastructure (src/live.rs, tests/live.rs) plus golden fixtures and expected outputs. No governance, authority, or ratification documents are touched, so the review focuses on correctness and security.

Scan results:

  1. src/live.rs, run() function (~line 182): path.parent().unwrap() is called without an error path:

    let path = dir.0.join(crate::contained(name)?);
    std::fs::create_dir_all(path.parent().unwrap()).map_err(err)?;

    In practice dir.0 is always an absolute path (from std::env::temp_dir()) and crate::contained() returns a relative path, so the join always has a parent and parent() is never None. No reachable input causes a panic, making this hypothetical. Worth using .ok_or_else(...) for correctness-by-construction but not a live defect.

  2. Drive polling in execute() – The poll_fn correctly polls driver first, then running, using the shared cx so both register wakers. The Step::Abort path synchronously raises the cancel flag and immediately completes the driver, after which running notices the flag on its next poll. The ordering is sound.

  3. Journal shared across runs (resume case) – Both runs in live.resume open the same journal.jsonl path. The second SpendJournal::open appends to the existing file; the final read captures the cumulative state. The expected golden (21 lines) is consistent with this.

  4. collect() without symlink guard – Recursive read_dir can follow symlinks. The output directory is freshly created under tempdir, so no symlink attack surface exists in practice.

  5. aggregate() now references "live" directory – If cases/live/ is absent when the_manifest_live_cases_pass_through_the_runner runs (e.g. before live_cases blessed it), manifest() would error. The repo context is truncated so I cannot confirm cases/live/ is committed; this is not reportable as a confirmed absence.

No security defects, no governance/ratification changes, no authority changes found.

{"head": "b66292ae294b3bcd01c947efc37f3b8eb37b9a4f", "verdict": "findings", "findings": [{"path": "tools/rustev-conformance/src/live.rs", "line": 182, "severity": "low", "category": "correctness", "summary": "path.parent().unwrap() panics on None; safe in practice because dir.0 is always absolute, but no input is named on which it would actually fail."}]}

Subject: e8f6653...b66292a, diff digest cd48c4bcad5be1e8fc202a471bf4783ecfc20a169d3420469adaf8d552d967fd, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception November 7, 2026 22:12 — with GitHub Actions Inactive
@bartekus

bartekus commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Review note: the one finding (src/live.rs:182, path.parent().unwrap()) is unreachable, as the review itself states: dir.0 is an absolute temporary directory and contained() refuses empty, absolute and .. names, so the joined path always has a parent. Low-severity robustness only; it is replaced by an ok_or in part 2, which edits this runner anyway, rather than costing a review round here.

@bartekus
bartekus added this pull request to the merge queue Nov 7, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 7, 2026
… part 1)

A live case kind in the conformance suite: the files eval live and
liveRun read, liveRun's camel-case options, the runtime cases' scripted
backend scripts and drive steps, and sequential runs on one journal and
output directory. The Rust runner resolves the inputs through
rustev_surface::live over a real filesystem and runs rustev_live::run on
a runtime with scripted backends, a manual clock and the configuration's
rule authorizer; each case pins every file under out, the journal and
each run's status and code. The six cases of spec 067 3.8.2 (full run,
probe-only, probe failure, spend_capped by the run cap and by the
journal cap, resume after a mid-run abort) each mirror a rustev-live
test and are checked against what it asserts. Surfaces are rust-api for
now; the native runner over engine.liveRun follows increment 2b.
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff: a new live-reexecution conformance harness (src/live.rs), corresponding test (tests/live.rs), test fixtures and expected outputs, and small additions to src/lib.rs and tests/cli.rs.

src/live.rs

Files::join concatenates without sanitisation:

fn join(&self, dir: &str, name: &str) -> String {
    format!("{dir}/{name}")
}

Every other Host method routes through self.path() → crate::contained(), so the returned string is re-validated before it reaches the filesystem. No exploitable traversal, but the implementation differs from every other method in the trait.

The resolve function contains a bare .unwrap() in a Result<_, String> path:

split: serde_json::to_value(o.split)
    .map_err(err)?
    .as_str()
    .unwrap()   // panics instead of returning Err
    .into(),

The guard at the top of resolve rejects Split::FinalTest, and the remaining variants of Split are string enums, so this cannot panic with valid inputs. It is still incorrect to unwrap where the function contract calls for ?.

tests/live.rs

WaitGated spins until gated() == count exactly:

while b.gated() != count {
    tokio::task::yield_now().await;
}

With max_concurrency: 1 throughout all test cases, the gated count always increments by exactly one per step, so the equality check can never skip over the target value. No issue in the present fixture set.

The poll_fn interleaving of driver and running futures passes the same cx to both. Standard Tokio practice; waker aliasing is acceptable here and poses no correctness risk in the new_current_thread runtime used by run().

The 20-second tokio::time::timeout watchdog in run() provides a backstop for any latent liveness issue.

tests/cli.rs — JSONL golden files skip the plan-id/normalization checks and validate only that every line is valid JSON. This is consistent with journal files having no plan-id and no normalization.

Expected fixtures — the journal sequence numbers, digest values, checkpoint states, spend accounting, and exit codes are internally self-consistent across all six scenarios (full, probe-only, probe-failure, run-cap, journal-cap, resume).

No concrete defect with an input that demonstrates misbehaviour was found.

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

Subject: 35ab7e5...ec59624, diff digest 8909c088a94d712600eef1f35ed1865fe2b3cfd5c212a4c93b0f1dd8147cafbe, 1 call(s). An AI comment is not an approval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant