Skip to content

refactor(063): move the repeatability renderings into rustev-surface (increment 5, part 1) - #522

Merged
bartekus merged 2 commits into
mainfrom
impl/063-inc5
Nov 6, 2026
Merged

bartekus merged 2 commits into
mainfrom
impl/063-inc5

Conversation

@bartekus

@bartekus bartekus commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Spec 063 increment 5, part 1 (3.9.3, 3.9.4): the repeatability renderings move from rustev-cli into rustev-surface behind Host. Part 2 (stacked) adds the memory host's listing and the Host::list tests.

  • Moved: crates/rustev-cli/src/repeat.rs (the renderings) to crates/rustev-surface/src/repeat.rs, and crates/rustev-cli/src/host_sets.rs (061's import and host sets) to crates/rustev-surface/src/repeat/host_sets.rs. Changed lines are the I/O seam only: join becomes Host::join, std::fs::read_dir becomes Host::list plus Host::entry_kind, Path::exists becomes entry_kind, the staged publication becomes Host::write_all_in, and Parsed gives way to argument structs (EvalArgs, BaselineArgs, CompareArgs, SelectArgs, ImportArgs) with now_ms as an argument. An empty bundles is live-source-unavailable.
  • Host gains list(dir, max) (immediate names in byte order, at most max), entry_kind (without following links) and write_all_in (a set with its new directories, all or none). Defaults refuse listing and inspection; write_all_in defaults to preflight plus write_all.
  • The CLI keeps its usage rules, the live path, and publish_outputs with its rollback tests; the filesystem host's write_all_in is publish_outputs. Single-file outputs (baseline record, gate select) still use write_all as before; the staged sets (eval, candidates, eval diff, import) use write_all_in as before. The dependency file caps now live once in rustev_surface::host.
  • No binding change (integrations/** untouched). CLI goldens and the repeat-* conformance expected bytes are unchanged, without re-blessing.
  • Archive policy: rustev-surface lists the two new files and rustev-cli drops src/host_sets.rs. cargo package -p rustev-surface gives 181,899 bytes unpacked (bound 262,144 on current main) and 46,568 bytes archived (bound 131,072), so this does not wait on spec(021): run the archive check in pull-request CI with doubled bounds (A-81) #516.
  • Spec 063: the implementation record gains increment 5. No normative edit.

The reviewed diff is large because --no-renames shows the moved files as whole additions; git diff -M origin/main...HEAD shows host_sets.rs as a rename, and diff of the old CLI repeat.rs against the new surface file shows only the seam changes above.

Checks run locally: cargo build --workspace --locked; cargo test -p rustev-surface -p rustev-cli -p rustev-conformance -p rustev-release --locked (full crate tests); cargo clippy --workspace --all-targets --locked -- -D warnings; cargo fmt --all --check; make boundaries; make gate.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

AI review (findings)

Review

What the change does

This PR extracts the file-orchestration logic for eval repeat commands from crates/rustev-cli/src/repeat.rs and host_sets.rs into the new crates/rustev-surface/src/repeat.rs and src/repeat/host_sets.rs behind the Host trait. The Host trait gains three new default methods (list, entry_kind, write_all_in); the CLI's Reads struct overrides all three. The CLI wrappers become thin argument-collection + delegation shims. The spec and archive policy are updated accordingly.

Analysis

list implementation (io.rs+): The BTreeSet-with-pop-last approach correctly returns at most max lex-smallest entries. dependency_files calls it with max+1 to detect the over-limit condition, which works correctly. directories calls it with usize::MAX to get everything. No issue.

entry_kind / TOCTOU: The new two-step (list names, then entry_kind per name) is equivalent to the old single-pass read_dir iteration; both have the same TOCTOU window. No regression.

write_all_in default: Preflights each dir via ensure_absent, then delegates to write_all. Correct for virtual hosts. The filesystem override uses publish_outputs with hard-link atomicity and rollback, as before.

select passing run: "": bound_baseline reads only p.baseline and p.baseline_eval; it never touches p.run. The empty-string sentinel is harmless and mirrors the original code.

Double preflight in import: The two-stage preflight (known fixed names first, full list after building the write set) is intentional defense-in-depth; publish_outputs itself is atomic via hard links.

Scorer-ID filename safety: declared_name is re-validated before using the id in a filename; this is defence-in-depth and correct.

Missing lower-bound on --run in CLI wrapper:

// crates/rustev-cli/src/repeat.rs – CLI import wrapper
pub fn import(p: &Parsed) -> Result<Res, Usage> {
    if p.many("run").len() > 64 {          // only checks upper bound
        return usage("--run is given 1 to 64 times");
    }
    Ok(rustev_surface::repeat::import(...))
}

The spec (and the surface layer) require 1–64 runs. The CLI wrapper only refuses > 64; len() == 0 passes this check and reaches the surface layer, which correctly refuses it via Done::invalid rather than a Usage-level error. The validation does occur, but the error type is inconsistent with what the adjacent > 64 path produces, and the CLI comment ("1 to 64 times") advertises both bounds without enforcing the lower one here.

No other concrete defects found.

{"head": "befff33bd8b7ed84b853b35e664b462200e41fe5", "verdict": "findings", "findings": [{"path": "crates/rustev-cli/src/repeat.rs", "line": null, "severity": "low", "category": "correctness", "summary": "The CLI-level import wrapper only checks the upper bound (> 64) on --run count; zero runs bypass the usage-level guard and reach the surface layer, which rejects them with Done::invalid rather than the Usage error produced for the > 64 case, contradicting the '1 to 64 times' message."}]}

Subject: 49fac12...befff33, diff digest e0f45b9dbf64f98c43164d2d81091efe250b2a771cb55dee9ad8a335f525457f, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception November 6, 2026 01:23 — with GitHub Actions Inactive
@bartekus

bartekus commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Review note: the finding on crates/rustev-cli/src/repeat.rs (import wrapper checks only > 64 runs) is a false positive. --run is a required flag of eval repeat import (crates/rustev-cli/src/args.rs, required: &["repeat-config", "config", "run", "out"]), so the parser refuses zero runs as a usage error before the wrapper runs. The wrapper is byte-for-byte the check the CLI had before the move (p.many("run").len() > 64 in the old host_sets::import). The surface-level 1..=64 check only guards hosts that call rustev_surface::repeat::import directly; the CLI never reaches it with zero runs. No behavior change, so no code change.

@bartekus
bartekus added this pull request to the merge queue Nov 6, 2026
@bartekus
bartekus removed this pull request from the merge queue due to a manual request Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing this PR, which moves repeat-command file orchestration from crates/rustev-cli/src/repeat.rs and host_sets.rs into crates/rustev-surface/src/repeat.rs and src/repeat/host_sets.rs behind the Host abstraction.

Key areas examined:

crates/rustev-cli/src/io.rs — Reads::list implementation

The function inserts entries into a BTreeSet and calls pop_last() when len > max, keeping the max lexicographically smallest names. When directories calls list(dir, usize::MAX), no truncation ever occurs and all entries are returned then sorted — matching the original behaviour. When dependency_files calls list(dir, max.saturating_add(1)), it receives at most max+1 entries, which allows the caller's own overflow check (files.len() > max) to fire correctly. The semantics are correct.

crates/rustev-surface/src/repeat.rs — argument validation in evaluate

New checks (empty bundles → live-source-unavailable; lineage without ledger_out) protect callers that bypass the CLI's args.rs usage rules. These are additive and consistent with the spec text in increment 5.

crates/rustev-surface/src/repeat/host_sets.rs — import scorer-id validation

The check rustev_eval::measures::declared_name(&doc.scorer.id) before using the id in a filename (run-{r}.scores-{id}.json) correctly guards against malformed or traversal-attempting ids, consistent with the comment that import already validated this.

host_sets::select — silent discard of directories errors

Err(_) => return None silently drops errors from the candidates directory. The intent is that the Rustev path (repeat::select) then runs and reports the same error from its own directories call. This is intentional and documented inline.

select with run: ""

Both repeat.rs and host_sets.rs call bound_baseline with run: "". bound_baseline reads only baseline and baseline_eval, never run, so this is safe — same pattern as the original CLI code.

write_all_in default impl

The default implementation is not atomic (preflights dirs then calls write_all). The CLI overrides it with the atomic publish_outputs. Virtual hosts that need atomicity must also override it; the trait doc says so. This is by design.

archive-policy.json

Removes src/host_sets.rs (deleted file) from CLI's list and adds src/repeat.rs and src/repeat/host_sets.rs to surface's list, matching the actual file changes. ✓

Spec 063 increment 5

The prose accurately describes what moved, the new Host methods, their defaults, and the unchanged CLI goldens. No lifecycle or ratification concern: spec 063 is in draft and the increment note is factual description, not a ratification claim.

No concrete defects found.

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

Subject: 773d72f...e64b726, diff digest 8420a6f32000f3d7bce8026ce2fc621e2cb57f476b9aabdf05112d0126ce185f, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus added this pull request to the merge queue Nov 6, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 6, 2026
@bartekus bartekus added the statecraft:stacked-ci Run the full CI matrix on a stacked pull request label Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

AI review (findings)

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

crates/rustev-cli/src/io.rs — Reads::list

The implementation silently truncates by calling pop_last() on the BTreeSet when names.len() > max. When dependency_files calls list(dir, max.saturating_add(1)) to detect overflow, the truncation correctly allows up to max+1 entries through, so overflow detection works. However, directories calls list(dir, usize::MAX), causing the filesystem host to read all directory entries into memory before the ≤64-candidate cap is enforced. The old code returned early from the read_dir iterator after finding the 65th candidate, costing at most 65 DirEntry type checks. The new code always enumerates the full directory through list and then makes one entry_kind syscall per entry—a performance regression for adversarially large candidate directories, but not a correctness defect.

crates/rustev-surface/src/repeat.rs — dependency_files

list() returns names in BTreeSet (sorted) order, so the final files.sort() call is redundant. Harmless, low severity.

crates/rustev-surface/src/repeat/host_sets.rs — import

The function preflights repeat-config.json, config.json, and repeat.json early (before computing anything), then preflights the entire written list (which includes those same three paths) in a second loop before calling s.publish. The double preflight of three paths is redundant and inconsistent with the single-pass pattern used by all other commands. Not a data-loss risk, but the preflight semantics of the first pass are weaker than stated—repeat.json is added to written only at the end, so the first check ensures the final output slot is free before computing content, while the second loop enforces the full no-clobber rule. The inconsistency is harmless but could mislead a future editor into removing the second loop.

Mutation seeds (crates/rustev-cli/mutation/seeds.py)

Seeds referencing U + "repeat.rs" target patterns now in crates/rustev-surface/src/repeat.rs. Spot-checked: s.publish(&files)?, const NOT_REPRODUCIBLE: u8 = 13;, set.verify(&s)?;, Source::Captured, selection.exit_code(), set.record(s, &b.name, b.recorded_at_ms)? != b, and the ensure_absent block in Session::absent all appear in the moved file. Seeds referencing S + "repeat.rs" (rollback_outputs, validate patterns) remain in the CLI file. No broken seeds found.

Spec 063 / archive-policy

Increment 5 description matches the diff: two new surface source files, host_sets.rs removed from CLI, archive-policy updated accordingly. No contradiction found.

{"head": "165f1df45c5024bf34e5dee61a7026e1c9b1ae72", "verdict": "findings", "findings": [{"path": "crates/rustev-surface/src/repeat.rs", "line": 282, "severity": "low", "category": "correctness", "summary": "directories() calls list(dir, usize::MAX) so the filesystem host reads every directory entry before the 64-candidate cap fires, whereas the old code returned early after the 65th candidate; the redundant files.sort() in dependency_files (entries already arrive sorted from BTreeSet) is a minor redundancy."}, {"path": "crates/rustev-surface/src/repeat/host_sets.rs", "line": 213, "severity": "low", "category": "correctness", "summary": "import() preflights repeat-config.json, config.json, and repeat.json twice—once before computing their bytes and again in the comprehensive preflight loop—inconsistent with every other command's single-pass preflight."}]}

Subject: 7fbca56...165f1df, diff digest 253052ae6adca2b3f03196f0ee77fff21771f8ef3e3a55d5189fd4b1e48ac29b, 1 call(s). An AI comment is not an approval.

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

bartekus commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Review note for head 165f1df. Both findings are low severity and carried over from the code before the move. No code change.

  1. directories() lists the whole directory with list(dir, usize::MAX) before the 64-candidate cap applies. The review itself calls this "not a correctness defect". The old loop also read every entry when the extra entries were files, because it skips non-directories without counting them. Only directories count toward the cap, so list cannot be capped at 65 without missing candidates that sort after many files. Output and refusals are unchanged: more than 64 candidate directories is still invalid_input, "more than 64 candidates". The redundant files.sort() in dependency_files is the pre-move line, kept so the move stays line-for-line.
  2. import() checks its three fixed outputs early and then the whole output set again. That is the pre-move code in crates/rustev-cli/src/host_sets.rs (spec 061, 3.2): the first check refuses an occupied output before any input is read, and the second covers every file of the set before publication. Both checks are intended.

What changed on this head: the dependency caps are public consts at their 0.4.0 paths again (cargo-semver-checks), seven spec 029 mutation seeds now target crates/rustev-surface/src/repeat.rs, and a new test diff_publishes_its_documents_as_one_staged_set detects the staged-publication seed. Locally on the rebased head: cargo test and clippy on rustev-surface and rustev-cli, and seeds.sh repeat029 at 11/11 detected. Before the rebase, spec-spine verify passed for 006 (41/41 seeds), 029, 061, 043 and 041.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff: this PR moves the repeat/host-sets orchestration from crates/rustev-cli/src/repeat.rs and host_sets.rs into crates/rustev-surface/src/repeat.rs and src/repeat/host_sets.rs, parameterised over the new Host methods (list, entry_kind, write_all_in), and wires the CLI through the surface.

list truncation (io.rs:142–159) — BTreeSet::pop_last() on overfill keeps the lexicographically smallest max entries. directories passes usize::MAX (no truncation); dependency_files passes max.saturating_add(1) and then counts files.len() > max, so the error is still raised when there are more than max entries. Functionally correct.

select passes run: "" — both bound_baseline overloads (surface repeat.rs and host_sets.rs) read only p.baseline and p.baseline_eval; p.run is never accessed in those call paths. No issue.

import double-preflight of repeat.json — the initial three-name check and the later full-loop check both include repeat.json. Harmless redundancy, same pattern as the original.

StagedOnly test host — only overrides write_all_in to route through Memory::write_all, asserts dirs.is_empty() (correct for diff). list/entry_kind default-refuse, but diff never calls those. Test correctly verifies staged publication.

Archive policy — src/repeat.rs and src/repeat/host_sets.rs added to rustev-surface; src/host_sets.rs removed from rustev-cli. Consistent with the deletion and spec 063 increment 5.

Mutation seeds — updated targets (U + "repeat.rs", CLI_AND_SURFACE) match the new code locations and APIs (s.publish(&files)?, self.reads.ensure_absent).

No concrete defects found.

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

Subject: df67bc5...dc7a3c2, diff digest 187ab7831f7f2918d1246f43dced4b27d71c32178bcec395ccc1620601e585a7, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus added this pull request to the merge queue Nov 6, 2026
@bartekus
bartekus removed this pull request from the merge queue due to a manual request Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff carefully against governance rules, the existing test infrastructure, and the code's own invariants.

Summary of change

The PR moves repeat-command orchestration from crates/rustev-cli/src/repeat.rs and the deleted host_sets.rs into crates/rustev-surface/src/repeat.rs and src/repeat/host_sets.rs, adds three new Host trait methods (list, entry_kind, write_all_in), and wires the filesystem implementation in io.rs. The spec, seeds, and archive policy are updated to match.

Checks performed

list in io.rs (truncation logic): dependency_files calls list(dir, max.saturating_add(1)). With max=64 this passes 65; list retains at most 65 entries (the lexicographically smallest), which correctly lets dependency_files trigger files.len() > 64 on the 65th entry. For directories, usize::MAX is passed so truncation never fires and the 64-candidate guard in the loop applies. No off-by-one.

Symlink handling: entry_kind uses symlink_metadata (lstat); directories refuses Symlink; dependency_files refuses any entry that is not File. Both match the old file_type().is_symlink() / is_file() checks exactly.

Staged publication: s.publish → write_all_in(&[]) → publish_outputs(files, &[], hard_link). The new test diff_publishes_its_documents_as_one_staged_set enforces that diff calls write_all_in rather than write_all, matching the seed mutation s.publish(&files)? → s.write(&files)? and the spec 029 no-clobber requirement.

Host-dispatch pattern: host_sets::select swallows directories errors to fall through to the Rustev path — intentional per the existing dispatch design; the Rustev path then reports the error.

run: "" sentinel in select and host_sets::select: bound_baseline does not use the run field when called from select, so the empty string is harmless.

import double-preflight: The early check of three output paths fails fast before expensive reads; the full preflight runs before publish. The actual write uses hard_link which is atomic and fails if the target exists regardless, so correctness is not affected.

Archive policy / seeds / spec: src/repeat.rs and src/repeat/host_sets.rs added to rustev-surface; src/host_sets.rs removed from rustev-cli. Seeds that targeted paths or patterns still in the CLI (rollback_outputs, purpose, dirs > 64, p.has("ledger")) correctly retain S + "repeat.rs" / CLI; seeds for moved code now correctly use U + "repeat.rs" / CLI_AND_SURFACE.

No concrete bugs, security problems, or rule violations found.

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

Subject: a9eeb9f...ecff2bf, diff digest ad4cbd4822fccd6e124b669fb822521a12cde38d26a8ca8a508acae06160c87b, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus added this pull request to the merge queue Nov 6, 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 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

AI review (findings)

Reviewing the diff: a large refactor moving spec 029/061 repeat orchestration from crates/rustev-cli into crates/rustev-surface behind the Host trait, with the CLI keeping argument parsing, hard-link publication, and rollback.

crates/rustev-cli/src/io.rs — list truncation semantics

The implementation silently drops the lexicographically largest names when names.len() > max:

names.insert(name);
if names.len() > max {
    names.pop_last();
}

For the two callers this is correct: directories passes usize::MAX (no pruning ever fires), and dependency_files passes max.saturating_add(1) specifically to receive one extra sentinel entry for overflow detection. Both call patterns work. The behavior is non-obvious but not a bug for existing callers.

crates/rustev-cli/src/repeat.rs::import — lower-bound not enforced at CLI level

if p.many("run").len() > 64 {
    return usage("--run is given 1 to 64 times");
}

The CLI guard checks only the upper bound. With zero --run arguments the guard passes; the library's !(1..=64) check then fires, returning Done::invalid(command, "run", "...") rather than a Usage error. The error message is the same string, but the error type differs (command error vs. usage error), changing the output format for the 0-runs case.

crates/rustev-surface/src/repeat.rs and host_sets.rs — run: "" sentinel

Both select implementations pass run: "" to bound_baseline, which does not read p.run. This works today but is brittle; if bound_baseline is later extended to use run, the silent empty-string path would produce a confusing error. Low risk, but worth documenting.

Everything else — the routing logic (provenance dispatch in select/reproducibility/baseline), the write_all_in default and filesystem override, the entry_kind/list filesystem implementations, the scorer-ID path-safety check, the double-preflight in import, the archive-policy update, and the spec-063 increment description all appear consistent with the stated intent and governance rules.

{"head": "5522a0fad4eaa589e0b658c8e8efa7190fb27ab3", "verdict": "findings", "findings": [{"path": "crates/rustev-cli/src/repeat.rs", "line": null, "severity": "low", "category": "correctness", "summary": "The CLI-level import guard only checks the upper bound (> 64 runs) and not the lower bound (0 runs); zero --run arguments passes the CLI guard but then hits the library's !(1..=64) check, producing a Done::invalid error rather than the Usage error the guard was intended to emit."}]}

Subject: 96b480c...5522a0f, diff digest 9ff224148b6a927738697d5388c905483443fcefea69bb4ba40ae298a95e9ab7, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception November 6, 2026 19:09 — with GitHub Actions Inactive
@bartekus

bartekus commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Review note: the finding on crates/rustev-cli/src/repeat.rs (import guard, zero --run) cannot occur: crates/rustev-cli/src/args.rs declares required: &["repeat-config", "config", "run", "out"] for eval repeat import, so the parser refuses a missing --run with a usage error before import runs, and the guard only needs the upper bound. The behavior is unchanged from main (host_sets.rs, moved here), and the CLI goldens are byte-identical.

@bartekus
bartekus added this pull request to the merge queue Nov 6, 2026
@bartekus
bartekus removed this pull request from the merge queue due to a manual request Nov 6, 2026
…(increment 5, part 1)

The seven repeat renderings (eval and candidates with a repeat
configuration, baseline record, reproducibility, diff, gate select and
061's import) move from crates/rustev-cli/src/repeat.rs and host_sets.rs
into crates/rustev-surface/src/repeat.rs and src/repeat/host_sets.rs,
with file I/O replaced by Host (spec 063 3.9.3, 3.9.4). Host gains list,
entry_kind and write_all_in; the defaults refuse. The CLI keeps its usage
rules, the live path and the hard-link publication and rollback, now its
filesystem host's write_all_in, and calls the moved functions.

CLI goldens and the repeat-* conformance bytes are unchanged without
re-blessing. The archive lists follow the moved files; rustev-surface
packages at 181,899 bytes unpacked (bound 262,144). Part 2 adds the
memory host's listing and the Host::list tests.
…at seeds (increment 5, part 1)

rustev_cli::io::{MAX_RULES_FILES, MAX_DESCRIPTOR_FILES,
MAX_CALIBRATION_FILES} are public consts again (cargo-semver-checks does
not see a re-exported const), with their values taken from
rustev_surface::host, so one definition stays the source of truth.

Seven spec 029 seeds in crates/rustev-cli/mutation/seeds.py (run by the
acceptance of specs 006 and 029) anchored in code that moved to
crates/rustev-surface/src/repeat.rs; they now mutate it there and run
the CLI and surface tests. The seed for `eval diff` bypassing staged
publication survived once its anchor moved, because its old unit tests
exercised the publication helper rather than the command: the CLI's
tests/repeat.rs gains a test that runs `eval diff` on a host that
accepts only staged sets and compares the outputs with the diff goldens.
No seed is weakened or removed; no spec changes.
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

AI review (findings)

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

crates/rustev-cli/src/repeat.rs — import lower-bound check missing

The CLI wrapper validates p.many("run").len() > 64 but not < 1. Zero --run arguments pass the guard and reach rustev_surface::repeat::import, which checks !(1..=64).contains(&dirs.len()) and returns Err(Done::invalid(...)) — a runtime error, not a Usage error. The error message "–run is given 1 to 64 times" implies 1 is the minimum; the original host_sets.rs (deleted, 512 lines) almost certainly checked both bounds. This is a regression in error class: the user gets a non-zero exit with an error body instead of the help text a Usage return triggers.

crates/rustev-cli/src/io.rs — list silently truncates to max

The implementation keeps the max lexicographically smallest names and silently drops the rest:

names.insert(name);
if names.len() > max {
    names.pop_last();
}

The callers that matter are directories (passes usize::MAX, so no truncation) and dependency_files (passes max_files + 1). For dependency_files the truncation is benign — when more than max_files files exist the caller still gets max_files + 1 entries and fires its own error. However, the host-trait contract says "at most max" without documenting silent truncation; a future caller that relies on seeing every entry up to its limit (e.g., to enforce a strict cap with a different error) would silently miss entries. This is low severity today because every current caller is designed around this behaviour.

crates/rustev-surface/src/repeat.rs and host_sets.rs — run: "" sentinel passed to bound_baseline

Both select and host_sets::select construct a CompareArgs { run: "", … } and pass it to bound_baseline. The field is currently unused in bound_baseline, so this is harmless, but the sentinel is fragile — a future change to bound_baseline that reads run would silently operate on an empty string rather than fail to compile.

No authority or ratification changes found. The spec 063 increment note is a data edit to a draft spec, not a lifecycle promotion. The archive-policy entries match the file movements.

{"head": "ac181cf92b9db4aac82c36e6edf83fd78af41d47", "verdict": "findings", "findings": [{"path": "crates/rustev-cli/src/repeat.rs", "line": null, "severity": "low", "category": "correctness", "summary": "The import CLI wrapper checks only `> 64` for --run count, missing the lower bound; zero --run arguments bypass the usage error and reach the surface, which returns a runtime invalid error instead of a usage error with help text."}, {"path": "crates/rustev-cli/src/io.rs", "line": null, "severity": "low", "category": "correctness", "summary": "The list implementation silently keeps only the max lexicographically smallest names and drops the rest, which is undocumented in the host trait and could mislead a future caller that expects to see every entry up to its limit."}]}

Subject: e9fe4c4...ac181cf, diff digest 704b674192a8bb2a2741ac8ce3ac0f8db4a6f3dcbf2a6b199b61f77c2de2468c, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception November 6, 2026 20:04 — with GitHub Actions Inactive
@bartekus

bartekus commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Review note on ac181cf (both findings low):

  1. crates/rustev-cli/src/repeat.rs, zero --run: unchanged from the note above. crates/rustev-cli/src/args.rs declares "run" required for eval repeat import, so the parser refuses a missing --run with a usage error before import runs; only the upper bound needs the wrapper.
  2. crates/rustev-cli/src/io.rs, list keeps the max smallest names: that is the documented contract. Host::list in crates/rustev-surface/src/host.rs says "Immediate entry names in byte order, at most max", the callers pass their limit plus one to detect overflow, and tests/host_list.rs checks the same truncation on the memory and filesystem hosts.

@bartekus
bartekus added this pull request to the merge queue Nov 6, 2026
Merged via the queue into main with commit 6051926 Nov 6, 2026
46 of 47 checks passed
@bartekus
bartekus deleted the impl/063-inc5 branch November 6, 2026 20:58

This branch was previously deployed

1 inactive deployment
statecraft-review-exception — ac181cf9 Deployed Nov 6, 2026 by bartekus via review-exception #3618
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

statecraft:stacked-ci Run the full CI matrix on a stacked pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant