Skip to content

impl(061): increment 1, host run records and case measures - #484

Merged
bartekus merged 1 commit into
mainfrom
impl/061-host-repeats
Nov 4, 2026
Merged

bartekus merged 1 commit into
mainfrom
impl/061-host-repeats

Conversation

@bartekus

@bartekus bartekus commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Spec 061 (host-scored repeat sets, A-77), increment 1 of 5: host run records and case measures, as a library module not yet reachable from the CLI.

Stacked on spec/061-host-scored-repeat-sets (#481) until the ratified text (A-77) is on that branch and #481 merges; until then this PR also shows the ratification commit.

  • crates/rustev-eval/src/host_run.rs: rustev.host-run/1 and its field rules (3.1, host-run), the per-run binding checks of 3.2.2 (host-binding, then spec 041 3.7.5's scorer-undeclared, scores-duplicate, scores-mismatch), and rustev.host-cases/1 with the host/ and score measures of 3.3.
  • crates/rustev-eval/src/report.rs: check_scores now calls scores_refusal, which returns the refusal code, so the host path applies the same 041 checks. No behavior change.
  • Spec 061: the planned increments, the increment 1 record paragraph and an extends edge on tools/rustev-release/ (031, additive). archive-policy.json lists src/host_run.rs.
  • Tests: crates/rustev-eval/tests/host_run.rs over the synthetic fixture tests/host_support/mod.rs.

Archive size: rustev-eval packages to 742,153 unpacked bytes, under the 786,432 bound #480 sets (above the 720,896 bound on this base, which #480 replaces).

@bartekus bartekus added the statecraft:stacked-ci Run the full CI matrix on a stacked pull request label Nov 3, 2026
@bartekus
bartekus force-pushed the impl/061-host-repeats branch from 6a23b55 to f1dfc03 Compare November 3, 2026 21:07
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff across the seven changed paths.

crates/rustev-eval/src/host_run.rs

  • HostRun::check(): the case-count, case-id, duplicate-case, subgroup, latency, cost, and scores-cardinality rules all look correct. The BTreeSet duplicate check for scores is sound (all ContentDigest entries are unique before the BTreeSet comparison).
  • bind(): the ownership-transfer pattern for named: BTreeSet<&ContentDigest> is valid; BTreeSet::remove accepts a borrow of ContentDigest through the &ContentDigest: Borrow<ContentDigest> blanket impl.
  • measure(): the next counter that maps the flat record.cases iterator onto the views-only-answered cases vec advances only inside the HostOutcome::Answered branch of the && short-circuit, so it stays aligned with views.cases.
  • scored iterator: same short-circuit pattern with answered.next().expect("bound")—safe because bind() already verified the counts match.
  • out.iter_mut().zip(new.cases): out has record.cases.len() entries; new.cases from the metric functions is scoped to the same scope vec (also record.cases.len()), so the zip is correctly aligned.
  • SnapshotId::parse(digest.as_str()).expect(…) in view_case is a panic path, but it rests on the invariant that a ContentDigest string is a valid snapshot id—a reasonable design assumption given they share the same digest encoding.

crates/rustev-eval/src/report.rs

  • The refactor of check_scores into scores_refusal (returning &'static str) and a thin wrapper is clean; the reference change d.views != *digest is correct.

crates/rustev-eval/tests/host_run.rs and tests/host_support/mod.rs

  • ViewEntry construction in views() evaluates proposal_view.subject().unwrap() before the move into the struct—correct Rust evaluation order.
  • Cost arithmetic in the fixture (2_500_000 × (i+1) units × 1000 for cost_per_1000) matches the num: 15.0 assertion for c6.
  • The with_views helper correctly rebuilds scores and record after editing, so each test isolates exactly one failure path.

specs/061-host-scored-repeat-sets/spec.md

  • Status promotion from draft to approved, implementation record added, extends edges added. The extends edge over crates/rustev-cli/ is claimed now but no CLI files are changed in this increment; the spec text explicitly notes this comes in increment 2, consistent with spec-first ownership.

tools/rustev-release/archive-policy.json

  • src/host_run.rs inserted in correct alphabetical position between holdout.rs and judge.rs.

No concrete bugs, security defects, or inconsistencies found.

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

Subject: d4eb644...f1dfc03, diff digest 3d9ba0d62bd6bfeb4f9cae08774df3f8fcfc12541fbbf0da1b572a4d262a6e57, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception November 3, 2026 21:13 — with GitHub Actions Inactive
@bartekus
bartekus force-pushed the spec/061-host-scored-repeat-sets branch from d4eb644 to 1e868c9 Compare November 4, 2026 00:29
@bartekus
bartekus force-pushed the impl/061-host-repeats branch from f1dfc03 to 8bab679 Compare November 4, 2026 10:28
@bartekus
bartekus changed the base branch from spec/061-host-scored-repeat-sets to main November 4, 2026 10:39
@bartekus bartekus closed this Nov 4, 2026
@bartekus bartekus reopened this Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing each changed file systematically.

crates/rustev-eval/src/host_run.rs

  • case_id_ok, unit_ok validators match their stated character sets and length bounds.
  • HostRun::check: case-count vs dataset.cases, duplicate scores digests via BTreeSet, MAX_SCORES guard, case-id uniqueness ignoring ASCII case, subgroup uniqueness, latency bound (> 1 << 53), cost sign, cost/unit consistency — all consistent with §3.1 as described in the implementation record.
  • bind: the two-way digest reconciliation (every named digest must have a document, every supplied document must be named) is correct. The v.case_view.id != c.case arm of the views check is a belt-and-suspenders guard against an internally inconsistent views document; it cannot silently accept a mismatched case.
  • measure: the next counter and the answered iterator both advance only on HostOutcome::Answered, keeping views indexing aligned with the answered-case slice. The expect("bound") after bind(config, run)? is sound. The SnapshotId::parse(digest.as_str()).expect(…) is safe because ContentDigest is a subset of that format and the comment names this expectation explicitly.
  • MAX_LATENCY_US = 1 << 53 with a strict > MAX_LATENCY_US check: values up to and including 2^53 µs are accepted — consistent with the spec wording "above 2^53" and confirmed by the boundary tests.
  • Cost overflow is handled with checked_mul(1000) → CaseMeasure::Unknown.

crates/rustev-eval/src/report.rs

The refactoring of check_scores into scores_refusal is mechanically correct: check_scores computes the digest and delegates; scores_refusal replaces EvalError returns with &'static str returns, and d.views != digest becomes d.views != *digest (a deref, not a semantic change). The pub(crate) visibility is appropriate for intra-crate use from host_run.

crates/rustev-eval/tests/host_run.rs and tests/host_support/mod.rs

Test coverage is thorough: every §3.1 field rule, every §3.2.2 binding refusal, boundary cases for latency/cost, the assertions and derivations in the measures. The a_scores_file_over_other_views_is_scores_mismatch test correctly rebuilds the record after mutating the scores document so only the views-digest check fails.

tools/rustev-release/archive-policy.json

src/host_run.rs inserted in correct alphabetical position between holdout.rs and judge.rs.

specs/061-host-scored-repeat-sets/spec.md

The extends edge added for tools/rustev-release/ is consistent with the archive-policy.json change. The implementation record accurately describes what was done in increment 1.

No defects found.

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

Subject: 19b9e92...8bab679, diff digest 1ef73a26771de008363fd84bbf3bf0d4723f567a4668a51736c91cf7836a5fcf, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus added this pull request to the merge queue Nov 4, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 4, 2026
@bartekus
bartekus added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit 3f47066 Nov 4, 2026
73 of 76 checks passed
@bartekus
bartekus deleted the impl/061-host-repeats branch November 4, 2026 21:19
bartekus added a commit that referenced this pull request Nov 5, 2026
Spec 061 (host-scored repeat sets, A-77), increment 2: host repeat
reports in the library. The CLI import (`rustev eval repeat import`)
follows as increment 3; the plan in the spec record is revised
accordingly.

Stacked on #484 (increment 1), which this depends on.

- `crates/rustev-eval/src/host_repeat.rs`:
`rustev.host-repeat-report/1`, `import` (3.2.3 cross-run checks:
`mixed-runs`, `duplicate-run`; `top-k-not-observed`; 3.4 statistics, 3.5
labels; 3.8 held-out unknown) and `reassemble` (3.3.4, `reconcile`).
- `crates/rustev-eval/src/repeat.rs`: spec 029's per-cohort loop moved,
unchanged in behavior, into `cohort_reports`, which both Rustev and host
sets call. Every existing 029 eval test passes unchanged.
- Spec 061 record paragraph; `archive-policy.json` lists
`src/host_repeat.rs`.
- Tests: `crates/rustev-eval/tests/host_repeat.rs`, including the
acceptance item that a host set's statistics equal 029's functions over
the same measures, bit for bit.

Archive size: `rustev-eval` stays under the 786,432 bound of #480.
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