Skip to content

impl(029): increment 2, per-case measures - #161

Merged
bartekus merged 1 commit into
mainfrom
impl/029-repeat-sets
Oct 22, 2026
Merged

bartekus merged 1 commit into
mainfrom
impl/029-repeat-sets

Conversation

@bartekus

@bartekus bartekus commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Spec 029 increment 2: per-case measures (3.2). Library only; no CLI, no
repeat set yet, no live run, provider call or spend. implementation
stays in-progress.

  • rustev-eval/src/eval_cases.rs (new): rustev.eval-cases/1
    (REPLAY_V1, record canonical): the run report's record digest, the
    declared top-k parameter, and per case in manifest order its id, run
    record digest, detail outcome key, top-k list and measures (count,
    mean, sample, or unknown with its reason). form_of maps spec
    004's reported metric names to their per-case form; reconcile refuses
    measures that are not bound to the report, do not list the detail's
    cases and outcomes in order, name an unreported or total metric, fail to
    reproduce a case-decomposable metric bit for bit, or do not sum to the
    detail's counts (3.2.6).
  • rustev-eval/src/report.rs: evaluate_with_cases(inputs, top_k) runs
    the unchanged evaluation and records each case's term from the report's
    own functions, then reconciles. evaluate is unchanged; its report and
    detail are byte-identical with or without the measures.
  • rustev-eval/src/metrics.rs: reliability_bin (now used by
    reliability), log_loss_term and brier_term, with no change to any
    reported value.
  • rustev-eval/src/repeat_stats.rs: Contribution::Unknown, which makes
    every statistic over it unknown and every resample drawing it undefined.
  • Tests: tests/reports.rs (byte identity, reconciliation, round trip,
    candidate without latency, eleven refusal cases, lodging top-k),
    tests/metrics.rs, tests/bootstrap.rs.
  • tools/rustev-release/archive-policy.json: src/eval_cases.rs joins the
    reviewed archive list (spec 029's existing extends edge).
  • Spec 029: re-planned increments (repeat sets become increment 3), the
    increment 2 record and engineering choices.

Owner decision needed (D-029-1, recorded in spec 029's implementation
record): Brier per-case measures.
3.2.3 lists brier as a mean and
3.2.6 requires bit-for-bit reconciliation, but spec 004 adds every class
term to one running sum, so per-case sums differ in the last bit on
ordinary inputs (tests/metrics.rs has a three-case counterexample), and
spec 029 may not change how spec 004 computes a metric. Until decided,
brier has no per-case measure and its interval is unknown, never
approximated. Options: keep it so; reconcile Brier within a tolerance; or
amend spec 004 to sum per case first (changes existing Brier bits).

Local verification (macOS arm64): make gate passes with spec-spine
0.31.0; cargo clippy -p rustev-eval --all-targets -- -D warnings and
cargo test -p rustev-eval pass.

Review round 1 (1 finding, fixed): metric_cases took its case count
from the first run and indexed the others blindly. It now returns a
result and refuses (mixed-runs) runs that do not list the same case ids
in the same order, whichever comes first; tests/reports.rs covers a
shorter run in either position and a reordered one.

Review round 2: no findings. Round 2 CI (code): spec 027's
every_call_site_is_in_the_corpus refused a second math::ln call site
in metrics.rs (log_loss_term beside mean_log_loss). mean_log_loss
now adds log_loss_term's -ln(p), so there is one call site again;
sum + -ln(p) is sum - ln(p) bit for bit (IEEE 754 defines subtraction
as addition of the negation), and every existing eval test and the corpus
test pass locally.

Review round 3: no findings. Rebased onto main after #154 (no conflict).

Review round 4 (1 finding, clarified): the "another report" refusal case
built its digest by parsing the dataset id as a content digest. That
succeeds (both are sha256: digests, and the test passed), but it read as
a likely panic; it now uses an explicit all-zero digest, and the helper
trait is gone.

Review round 5: no findings. Rebased onto main after #151 (no conflict).
Review round 6: no findings. Rebased onto main after #158 (no conflict).

@github-actions

Copy link
Copy Markdown

AI review (findings)

Reviewing the PR: per-case measures (rustev.eval-cases/1) for spec 029 increment 2. Checking the new module, refactored metrics helpers, repeat-stats extension, and report plumbing.

Finding: metric_cases panics on mismatched case counts

crates/rustev-eval/src/eval_cases.rs, line 114 (let n = runs.first().map_or(0, |r| r.cases.len())):

pub fn metric_cases(metric: &str, form: Form, runs: &[&EvalCases]) -> MetricCases {
    let n = runs.first().map_or(0, |r| r.cases.len());
    let cases = (0..n)
        .map(|c| {
            runs.iter()
                .map(|r| {
                    r.cases[c]          // ← panics if r.cases.len() < n

n is taken from the first element of runs. For every subsequent run, r.cases[c] indexes blindly up to n. If any later run holds fewer cases than the first, the function panics with an out-of-bounds index instead of returning an error. If a later run holds more cases, the extra cases are silently dropped and not reflected in the MetricCases output.

Within this PR the function is only called from reconcile with &[cases] (one run), so it is safe there. But metric_cases is public and its documented contract — "all of which list the same cases in the same order" — is unenforced. The repeat-set increment (3.2.5, increment 3) will call it with multiple EvalCases built from distinct runs. A mismatched case count at that call site, which check_shape does not catch, will either panic or silently discard data depending on which run is listed first.

No other concrete defects were found. The Contribution::Unknown propagation through cluster/statistic, the reconcile bit-pattern comparison, the count-sum verification, the reliability_bin extraction, and the log_loss_term/brier_term helpers all look correct. The spec edits (renumbering, increment 2 narrative, D-029-1 open decision) are consistent with the code. The archive-policy.json addition is correct.

{"head": "9add07519179e18a759f8a2c79f03c260d0d7ed7", "verdict": "findings", "findings": [{"path": "crates/rustev-eval/src/eval_cases.rs", "line": 114, "summary": "metric_cases indexes r.cases[c] up to the first run's length without bounds-checking subsequent runs, causing a panic if any later run has fewer cases and silent data loss if it has more."}]}

Subject: fd19273...9add075, diff digest f7257883da05ce17e3a4a42b0899441aa683e894c147e3136a4c84019e1b48bf, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 22, 2026 01:21 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/029-repeat-sets branch from 9add075 to 2d8cc2b Compare October 22, 2026 01:22
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Looking at this PR, which introduces per-case measures (rustev.eval-cases/1) as increment 2 of spec 029. I'll review the key changed files.

eval_cases.rs — reconcile logic

The reconcile function runs two separate sweeps over case measures: first rejecting any metric where form_of returns None (e.g. brier, totals), then rejecting any metric absent from the report. Together they correctly enforce that only case-decomposable reported metrics appear. The bit-for-bit comparison (a.to_bits() == value.to_bits()) and the two-unknown-equals-two-unknown rule are consistent with what the spec records as an engineering choice.

metrics.rs — reliability_bin extraction

The refactor pulls exactly the fold and bin-find from reliability into reliability_bin. The original code's fall-through (continue) becomes ?; the if let Some(i) = i becomes ?. The two usages (reliability and case_measures_of) reproduce the same string comparison (top == c.label / top == l). Behavior is preserved.

repeat_stats.rs — Contribution::Unknown

check_shape accepts Unknown for any form (correct — the form is irrelevant when the contribution is absent). cluster clones the iterator to detect Unknown before consuming it, returning Cluster::Unknown. statistic similarly propagates it to Figure::Unknown. The bootstrap test confirms that unknown contributions are never dropped and make all statistics over them unknown.

report.rs — evaluate_inner and case_measures_of

coverage is inserted outside all match arms, so every case gets it (0/1). The comparable-arm-only path for case_measures_of ensures non-comparable cases carry only coverage. The run_digest and ranked variables are initialised to None and only set inside Status::Comparable, so incomparable cases correctly get run: None and top_k: None. The EvalCases.report field is set from evaluated.detail.report, the same digest that reconcile computes from run.report.record_digest() and cross-checks — any discrepancy is caught there.

Per-quantile latency: the same service value is stored under each quantile key (latency_ms/p0.5, latency_ms/p0.9, …). This is intentional — each case contributes its single elapsed time to all quantile computations.

mean_log_loss reconciliation

log_loss_term returns Err for p = 0 (infinite loss), and mean_measure(Err(...)) yields Unknown. run_stats then returns Figure::Unknown for that run. mean_log_loss in the report computes via fold in case order from 0.0; statistic for Form::Mean also accumulates from 0.0 in the same order, so their bits agree for all finite cases.

form_of pattern completeness

coverage, acceptance_coverage, labeled_proposal_coverage, error_among_accepted, candidate_outcome_change → CountRatio; mean_log_loss → Mean; reliability/{g}/{i}/confidence → Mean; reliability/{g}/{i}/accuracy → CountRatio; latency_ms/p*, queue_ms/p* → Sample. All metrics inserted by case_measures_of match a Some branch. brier correctly returns None and the spec documents the pending D-029-1 decision.

Spec update

The renumbering (increments 2→6 instead of 2→5) correctly reflects the split of the original increment 2. The D-029-1 open decision is properly framed.

Archive policy

src/eval_cases.rs is the only new source file; it's the only addition to archive-policy.json.

No concrete defects found.

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

Subject: fd19273...2d8cc2b, diff digest 0b55991a86787b91fc2332a45d92fe143c3da8cff843873c25908eeadc076584, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus enabled auto-merge (squash) October 22, 2026 01:28
@bartekus
bartekus disabled auto-merge October 22, 2026 01:30
@bartekus
bartekus force-pushed the impl/029-repeat-sets branch from 2d8cc2b to 68fbb9e Compare October 22, 2026 01:30
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

I reviewed the full diff carefully: the new eval_cases.rs module, the refactored metrics.rs helpers, the Contribution::Unknown propagation in repeat_stats.rs, the evaluate_inner / evaluate_with_cases plumbing, the accompanying tests, the spec update, and the archive-policy change.

eval_cases.rs – reconcile logic
The two-phase check (form_of first, then per-metric bit-exact reproduction, then unreported-metric sweep) is internally consistent. metric_cases is always called with &[cases] (one run), so per_run[0] is safe after check_shape. The Unknown case is correctly excluded from the count-sum check.

metrics.rs – log_loss_term extraction
sum += term where term = -ln(p) is bit-identical to the former sum -= ln(p) per IEEE 754-2008 §5.4.1. reliability_bin is a mechanical extraction of the existing inline code. brier_term is test-only and explicitly not used as a per-case measure.

repeat_stats.rs – Unknown propagation
cluster and statistic both clone their iterators to detect Unknown before consuming them. The added check_shape arm (_, Contribution::Unknown) => true is correct: Unknown is valid for any form. The bootstrap test confirming undefined-resample counting is sound.

report.rs – evaluate_inner / evaluate_with_cases
Option<Option<&TopK>> for cases_for is consistent throughout. The case-measure collection block only writes to local state (measures, run_digest, ranked, case_measures) and does not touch details or any variable that feeds the report or detail, so the byte-identity claim holds. evaluate_with_cases correctly reconciles immediately after building the document and maps the error through the pre-existing EvalError::Reconcile variant.

Spec update
The renumbering of acceptance items (old 2→new 2+3, etc.) is consistent with splitting the per-case measures increment from the repeat-sets increment. D-029-1 is correctly stated and the three options are accurately described. The engineering-choices additions match the implementation.

archive-policy.json
src/eval_cases.rs is correctly added alongside the other rustev-eval sources.

No concrete defect found.

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

Subject: fd19273...68fbb9e, diff digest 7d81e532325d58b5abddf887f5716044f5dafac646d5246c666dc951e3a0475b, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus enabled auto-merge (squash) October 22, 2026 01:39
@bartekus
bartekus disabled auto-merge October 22, 2026 01:57
@bartekus
bartekus force-pushed the impl/029-repeat-sets branch 2 times, most recently from 68fbb9e to 71b903d Compare October 22, 2026 01:57
@github-actions

Copy link
Copy Markdown

AI review (findings)

Reviewing the PR, which implements rustev.eval-cases/1 (per-case measures, spec 029 §3.2) on top of the existing evaluation pipeline. I'll trace through the new module, the restructured evaluate_inner, the extended repeat_stats, and the tests.

eval_cases.rs — reconcile: Logic is sound. Two-pass check (form gate, then report-value gate, then unreported-metric gate) is complete. Count-sum verification against detail.count correctly covers only CountRatio metrics. metric_cases correctly propagates None contributions (cases outside the denominator).

metrics.rs refactors: log_loss_term returns -ln(p) and mean_log_loss accumulates with +=; the comment is correct — IEEE 754 makes a + (-b) bit-identical with a - b. reliability_bin extraction is a clean lift-and-shift. brier_term is present but deliberately not wired as a per-case measure; the reasons are documented.

repeat_stats.rs — Contribution::Unknown: Propagation through Cluster::Unknown → Figure::unknown is correct. The Clone bounds on iterator parameters are required to pre-scan for Unknown without consuming the iterator, and are applied consistently.

report.rs — evaluate_inner: The Option<Option<&TopK>> shape is unusual but logically correct: the outer Option gates whether case-measures accumulation runs at all; the inner controls top-k extraction. The coverage measure is pushed outside case_measures_of for all cases (comparable and not), while case_measures_of is called only for Comparable — correctly placing incomparable cases outside the acceptance_coverage denominator.

Concrete defect found:

In tests/reports.rs, the ParseDigest helper:

impl ParseDigest for str {
    fn parse_digest(&self) -> rustev_contract::ids::ContentDigest {
        rustev_contract::ids::ContentDigest::parse(self).unwrap()
    }
}

is invoked as e.detail.dataset.as_str().parse_digest(). e.detail.dataset is a DatasetId — a different ID type from ContentDigest, almost certainly in a different string format (e.g., a colon-namespaced identifier vs. a hex-encoded hash). If ContentDigest::parse rejects strings not in its format — the ordinary case — unwrap() panics inside the tamper closure. The panic propagates out of tamper before reconcile is ever called, turning a deliberate reconcile-failure assertion into an unintended test panic. The test intent (set x.report to some non-matching digest and verify reconcile returns Err) is correct, but the mechanism is fragile.

{"head": "71b903d13f47d743ba5eae30b6b4e3bb3e5e4b7b", "verdict": "findings", "findings": [{"path": "crates/rustev-eval/tests/reports.rs", "line": null, "summary": "ParseDigest impl calls ContentDigest::parse(self).unwrap() on a DatasetId string, which likely panics before reaching reconcile, converting a deliberate reconcile-failure test into an unhandled panic."}]}

Subject: 70a6424...71b903d, diff digest 7d81e532325d58b5abddf887f5716044f5dafac646d5246c666dc951e3a0475b, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 22, 2026 02:04 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/029-repeat-sets branch from 71b903d to 4633a1d Compare October 22, 2026 02:05
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

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

crates/rustev-eval/src/eval_cases.rs

The metric_cases function builds cases[case][run] where None means the case is outside the metric's denominator, and Some(Contribution::Unknown) means inside the denominator but without a finite value. This distinction is maintained consistently through cluster and statistic in repeat_stats.rs.

reconcile ordering is sound: (1) schema/digest/detail-digest, (2) case ids and outcomes, (3) all measure keys have a form_of mapping, (4) each reported decomposable metric reproduces bit-for-bit, (5) count-ratio sums match detail counts, (6) no measure exists for an unreported metric. The guard in step 3 correctly rejects brier measures before the metric loop.

The bit-equality comparison a.to_bits() == value.to_bits() for the reconcile check is correct for the stated requirement.

crates/rustev-eval/src/metrics.rs

log_loss_term refactoring: the spec note is accurate — IEEE 754 negation is exact, so sum + (-ln(p)) and sum - ln(p) are bit-for-bit identical. The refactor does not change the report's output.

reliability_bin extraction from reliability is a faithful lift; the original inline logic is preserved exactly.

brier_term is correctly documented as not used for reconciliation and the test demonstrates why (per-case sums do not reproduce the running-sum accumulation).

crates/rustev-eval/src/repeat_stats.rs

The + Clone bounds on iterators are required by the pre-scan for Unknown. The early-return pattern is correct: the clone is consumed for detection, the original is consumed for accumulation. Contribution::Unknown is validated as always shape-valid (any form) and finite-value-valid (true), then propagated to Cluster::Unknown and from there to Figure::unknown.

crates/rustev-eval/src/report.rs

evaluate_inner declares measures, run_digest, and ranked fresh per loop iteration and correctly partitions writes: case_measures_of runs only inside the Status::Comparable arm (setting per-metric contributions), while coverage is inserted and pushed after the match for every case including non-comparable ones. For a non-comparable case, measures holds only coverage = Count{0,1}, which is correct.

case_measures_of latency loop inserts the same per-case sample under each quantile key — this is the intended design for Form::Sample { quantile }, where each quantile is a distinct metric that receives the same case sample, with the quantile computed across all samples later.

top_k_of correctly handles Ranking and Shortlist parameters and returns None for other kinds or absent parameters, consistent with the engineering note in the spec.

evaluate_with_cases sets cases.report = evaluated.detail.report.clone(), which reconcile checks against run.report.record_digest(). This is coherent because detail.reconcile() enforces the invariant that detail.report == report.record_digest() before returning.

specs/029-evaluation-repeatability/spec.md

The increment-2 description accurately mirrors the implementation: document layout, metrics covered, the brier open question (D-029-1) with the three named options, and the engineering choices. The renumbering of backlog items (2→3 for repeat sets) is self-consistent and correctly splits per-case measures (now satisfied) from the remaining repeat-set work.

tools/rustev-release/archive-policy.json

src/eval_cases.rs is correctly added to the rustev-eval source list.

No concrete defects found.

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

Subject: 70a6424...4633a1d, diff digest cf9d2454dbddeecb97e886bb1cb3d9f5c4e9b613c3f41d88410fae1bf92413ac, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus force-pushed the impl/029-repeat-sets branch from 4633a1d to 71a5868 Compare October 22, 2026 02:40
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the PR, which implements spec 029 increment 2: per-case measures (rustev.eval-cases/1).

crates/rustev-eval/src/eval_cases.rs

  • form_of correctly uses early return for flat names and ?-propagation inside the latency match arm; the ? desugars to a return None from form_of, giving the intended "malformed name → no form" behavior.
  • metric_cases cross-run consistency check (length + case-id order) is correct; it never truncates or pads.
  • reconcile ordering is sound: (1) every measure must have a form (no brier, no totals), (2) every reported case-decomposable metric is verified bit-for-bit, (3) no measure for a metric absent from the report. Together these are tight.

crates/rustev-eval/src/metrics.rs

  • log_loss_term refactoring: sum -= ln(p) → sum += -ln(p). IEEE 754 guarantees negation is exact, so a + (-b) == a - b bit-for-bit for all finite values. The comment is technically correct.
  • reliability_bin extraction is semantically identical to the inline code it replaces; tie-breaking (last maximum wins) is unchanged.
  • brier_term is only used in a test that demonstrates why brier cannot be reconciled per-case; it is never called in production paths. No risk.

crates/rustev-eval/src/repeat_stats.rs

  • Contribution::Unknown is accepted by check_shape for any form (correct: form doesn't matter when contribution is absent), and cluster/statistic both clone their iterators to check for Unknown before consuming. The Clone bound is explicit on the signatures.
  • Propagation is correct: a single unknown contribution makes the cluster Unknown, which makes the statistic Figure::Unknown, which makes bootstrap resamples that draw that cluster undefined — the test in bootstrap.rs verifies all three.

crates/rustev-eval/src/report.rs

  • evaluate_inner's Option<Option<&TopK>> encoding is unusual but unambiguous, and both call sites pass the right shape.
  • evaluate_with_cases uses evaluated.detail.report.clone() to set EvalCases::report. reconcile then checks all three (report digest, detail's copy, cases field) are equal — any divergence introduced by a bug in EvalDetail::reconcile would be caught.
  • case_measures_of is called only inside Status::Comparable, so incomparable cases correctly contribute None (outside denominator) for all metrics except coverage.
  • Coverage is inserted in the outer block for every case with count_measure(matches!(r.status, Status::Comparable { .. })), so incomparable cases get Count{0,1} and comparable cases get Count{1,1}. Correct.
  • Latency is guarded by inputs.candidate.is_none(), matching spec 3.11.2.
  • The as f64 cast on u64 timing values loses precision above 2^53 ms (~285 years); not a practical issue.
  • cases.unwrap_or_default() in evaluate_with_cases is always Some at that point (the inner call received Some(top_k)), so the default is dead code. Not a bug, just redundant.

specs/029-evaluation-repeatability/spec.md

  • Renumbering acceptance items 2–5 → 2–6 to carve out the newly-satisfied increment is consistent with the code.
  • D-029-1 (brier per-case) is correctly documented as an open owner decision with three explicit options; the test in metrics.rs proves the counterexample.

tools/rustev-release/archive-policy.json

  • src/eval_cases.rs inserted in alphabetical order between src/doc.rs and src/fit.rs. Correct placement.

No concrete defects found.

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

Subject: cf6665c...71a5868, diff digest 1d89f5a0f47f4ff0c3b3a4b32c8dc8dcded4475b33f684c215bf4e5d96ca0f25, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus enabled auto-merge (squash) October 22, 2026 02:45
@bartekus
bartekus disabled auto-merge October 22, 2026 02:55
@bartekus
bartekus force-pushed the impl/029-repeat-sets branch from 71a5868 to 88eca55 Compare October 22, 2026 03:22
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Looking at the PR, I'll examine the key changes: the new eval_cases.rs, the refactored metrics.rs, the repeat_stats.rs extension, and the report.rs additions.

eval_cases.rs

  • form_of correctly maps case-decomposable metrics and returns None for totals (cost_observed_units, etc.) and brier. The latency_ms/queue_ms arm strips the p prefix before parsing with Decimal::parse, returning None on failure -- safe.
  • reconcile checks are logically complete: report digest binding, case/outcome order, every measure has a known form, every case-decomposable report metric reproduces bit-for-bit, count-ratio sums match detail counts, no unreported metrics in any case. The two-phase check (form_of then "not in report") prevents brier measures from slipping through.
  • metric_cases correctly returns None (outside-denominator) for cases missing the metric key, and enforces identical case ordering across runs.

metrics.rs

  • log_loss_term returns Ok(-ln(p)). The refactored mean_log_loss adds the term: sum += -ln(p) vs. the original sum -= ln(p). IEEE 754 guarantees these are bit-for-bit equal, as noted in the comment. The spec note in the PR body also confirms this.
  • reliability_bin is a clean extraction of the inner logic with identical semantics; reliability now delegates to it without behavioral change.
  • brier_term is only used in a test to document the non-decomposability of brier; the function itself is correct.

repeat_stats.rs

  • Contribution::Unknown shape check: the first matches! arm (_, Contribution::Unknown) accepts it for any form; the second match returns true. Valid.
  • cluster clones the iterator to check for Unknown before consuming -- correct use of the Clone bound.
  • statistic propagates Cluster::Unknown to Figure::Unknown -- correct; unknown contributions poison the statistic rather than being silently dropped.

report.rs

  • evaluate_inner uses Option<Option<&TopK>> to distinguish "don't collect" from "collect without top-k" from "collect with top-k". It's unusual but unambiguous, contained in private code, and commented.
  • coverage is added for all cases (comparable: num=1/den=1; incomparable: num=0/den=1), while case_measures_of is only called for comparable cases. This matches the definition of coverage as fraction of all cases that are comparable.
  • Latency measures are gated on inputs.candidate.is_none(). A candidate evaluation that somehow produced latency_ms/* as a measured metric in the report would be refused by reconcile (computed figure would be Figure::Unknown from empty samples vs. MetricValue::Measured). This is the correct behavior.
  • evaluate_with_cases sets cases.report = evaluated.detail.report.clone() (the digest stored in the detail), and reconcile independently computes evaluated.report.record_digest() and asserts equality. Inconsistency would be caught.
  • top_k_of uses usize::try_from(top_k.k).unwrap_or(usize::MAX) -- safe fallback for 32-bit platforms.

Spec update

The acceptance schedule renumbering (items 2→2+3, former 3→4, etc.) is internally consistent. cost_per_1000/* is added to the repeat-sets item (3). The D-029-1 open decision on brier is correctly documented.

archive-policy.json

src/eval_cases.rs correctly added to the rustev-eval list.

No concrete bugs or security issues found.

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

Subject: 70b99ea...88eca55, diff digest 1d89f5a0f47f4ff0c3b3a4b32c8dc8dcded4475b33f684c215bf4e5d96ca0f25, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus enabled auto-merge (squash) October 22, 2026 03:28
@bartekus
bartekus merged commit 68f40c0 into main Oct 22, 2026
26 checks passed
@bartekus
bartekus deleted the impl/029-repeat-sets branch October 22, 2026 03:54
bartekus added a commit that referenced this pull request Oct 22, 2026
Spec 010, increment 2: the `rustev-aicortex` adapter, a non-released
integration. Follows #156 (spec 021 3.4, R-49, merged), which makes the
`rustev-aicortex` binding record's item 1 pass; rebased onto `main`
after it. Nothing here authorizes a release, publication, live service
call, spend or real-user data.

## Changes

- `integrations/rustev-aicortex/`: `AicortexContext`, a bounded read of
one claim-history page per bound subject under an explicit transaction
bound, mapped through a declared projection of 1 to 64 field bindings
into attributed snapshot entries (values, conflicts, refusals and
missing fields named; no partial history read as complete), and
`stage_observation`, an observation proposal with its Rustev lineage
staged into the host's `TxnBuilder` and never committed. Aicortex is
pinned at the record's revision
`6415b765e5267188b4ecf302a93869352e28cccc`, with Rahi `=0.6.0`, which
that revision pins. Tests: unit tests of the projection, kind mapping,
identities and refusals, and integration tests against a single-voter
Rahi 0.6.0 store with Aicortex's schema on loopback. The code is the
adapter kept on `wip/010-rustev-aicortex-adapter` (`c776546`),
unchanged.
- `specs/010-integrations/spec.md`: the `rustev-aicortex` record's item
1 passes under R-49 (its Git dependency is outside the release closure;
every release member still resolves from crates.io only), so the record
passes every row; `planned: true` is removed from its `establishes`
entry; the Verification block runs its tests, clippy and build and the
authorization-type grep; the implementation record describes increment
2.
- `tools/rustev-release/release-set.json`: `rustev-aicortex` is excluded
from the release family. `docs/backlog.md` RUSTEV-015 state.
- `tools/rustev-release/tests/manifests.rs`: #156's
`a_git_source_only_an_excluded_package_reaches_is_not_judged` asserted
exactly one violation when the resolve graph is absent, which held only
while no workspace package had a Git source. With `rustev-aicortex` its
real Aicortex packages are judged too (`code` failed on `b988788`), so
that case now asserts the added package is among the violations and
every violation is a source violation.
- `Cargo.lock`: regenerated by Cargo for the Aicortex revision and Rahi
0.6.0's graph (Rahi 0.7.1's entries stay; Cargo now names the two Rahi
versions explicitly in dependency lists).

## Limitation

The adapter pins Rahi 0.6.0 and `rustev-rahi` pins 0.7.1, so one host
cell cannot link both until Aicortex adopts Rahi 0.7.1 (record item 1).
`rustev-serve` stays unimplemented (its record refuses).

## Review history

Round 1 on `374a86b` (stacked on #156): no findings. Rebased onto `main`
at `3a238a1` after #156 merged (no conflict, derived shards unchanged).
Round 2 on `b988788`: no findings, but the `code` job failed on the
manifest test above; fixed in this head.

Round 3 on `413c222` (1 finding, rejected with evidence): it read
`serde_core` in `uuid`'s dependency list as an unrecognized crate.
`serde_core` is serde's own core crate, which `serde` 1.0.220 and later
depend on; `main` at `3a238a1` already locks it (`Cargo.lock`: `name =
"serde_core"`, `version = "1.0.229"`, crates.io, checksum
`67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48`), and
`serde` 1.0.229's entry lists it. This PR adds no `serde_core` package
entry; only the `uuid` edge is new, because Aicortex enables `uuid`'s
`serde` feature.
Round 3 rerun on `413c222` (the `code` job had a timing flake in
`rustev-remote-http`'s `runtime_batch`, untouched here; run re-run): no
findings. Rebased onto `main` at `fd19273` (#155, no conflict).
Round 4 on `2a80b7b`: no findings. Rebased onto `main` at `70a6424`
(#154, no conflict).
Round 5 on `199b201`: no findings; held for the coordinator's merge
hold. Rebased onto `main` at `cf6665c` (#151, no conflict; `Cargo.lock`
still resolves with `--locked`).
Round 6 on `0024f6c`: no findings; held for the coordinator's merge
hold. Rebased onto `main` at `70b99ea` (#158): `release-set.json` kept
both the new `rustev-otel` exclusion and this one; the manifest tests
pass locally (18 of 18).
Round 7 on `0550224`: no findings. Rebased onto `main` at `68f40c0`
(#161, no conflict).
Round 8 on `2ccb9f9` (1 finding, the same `serde_core` question as round
3): the `rustev-aicortex` record's item 1 now states the new `uuid ->
serde_core` edge and where `serde_core` comes from, so the evidence is
inside the diff.
Round 9 on `242c75f`: no findings. Rebased onto `main` at `1b0ce68`
(#159, no conflict).
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