Skip to content

impl(023): increment 1, the qualification procedure and its refusals - #149

Merged
bartekus merged 1 commit into
mainfrom
impl/023-qualification-procedure
Oct 21, 2026
Merged

bartekus merged 1 commit into
mainfrom
impl/023-qualification-procedure

Conversation

@bartekus

@bartekus bartekus commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Spec 023 increment 1: the qualification procedure and its refusals, built and proven on synthetic fixtures without an admitted dataset. Spec 023 stays implementation: pending: no dataset is admitted, no qualification exists, and nothing here makes or implies a quality, calibration or usefulness claim.

  • crates/rustev-eval/src/dataset.rs: rustev.dataset-admission/1 (AdmissionRecord, identified by its digest) with every statement of 3.1 and 3.2, and admit, the only way to make an Admitted. It refuses a synthetic manifest (I-1), a record for another manifest, any empty statement, real-user-derived data without a privacy decision, a model labeler that is a system under test or of its family, another adapter, a source label mapped twice, missing labels that do not reconcile with the manifest, split counts or slice sizes the manifest does not hold, and exposed cases outside the final test.
  • crates/rustev-eval/src/report.rs: rustev.qualification/1 (QualificationRecord).
    • freeze (3.3): admitted data only; the frozen version 2 evaluator configuration with the admitted rules digest and adapter; an independent candidate; an exact baseline or the reason the task allows none; positive final-test target and slice minimums; frozen calibrations qualified by spec 004's fit::qualify against the final test; replacements that supply what they supersede on a new final test (3.3.3).
    • measure (3.4): spec 004 reports by role on the frozen dataset, split, configuration and bindings, ConfigChanged otherwise; coverage, exclusions, acceptance, abstention and labeled-proposal rows (numerator and denominator) before error among accepted and probability figures (R-1); slices below their minimum and exposed cases unknown.
    • regression: each frozen gate through spec 004's evaluate_gate.
    • scope_claim (3.5): the claim sentence composed from the freeze and the admission, with the admission's limits; another population, another freeze's measurement, missing call dates and unknown figures are rejected.
  • crates/rustev-eval/tests/qualification.rs: one test per section 5 row plus the positive path, admission completeness, exposure, report refusals, freeze preconditions and regression (12 tests). Synthetic fixtures only, no real data, no network; every report is built by hand.
  • crates/rustev-eval/mutation/seeds.py: category qualification refusals, one seeded defect per refusal; 8 of 8 detected.
  • Spec 023: verify:cli block and implementation record, including the limits below. Derived shards regenerated.

What remains (blocked on owner-supplied inputs): an admitted dataset per task (6.1), its admission and qualification records, the live or retained candidate runs, and the owner's review of each record (acceptance item 2).

Owner decisions:

  1. Exposed cases (3.2.1) and slices (3.4.4): a spec 004 report cannot leave cases out and its detail records outcome keys, not correctness. Count figures are recomputed per slice and without exposed cases; error among accepted and probability figures are spec 004's whole-split values, so they are unknown when any final-test case is exposed, and per-slice error among accepted is always unknown. Computing them needs a spec 004 amendment (a case exclusion list, or per-subgroup metrics).
  2. Regression-gate split conflict: spec 004 gates require an identical dataset, split and configuration, while 3.3.3 requires a new final-test split for a new qualification. A regression gate against a previous qualification (3.4.5) is therefore unknown unless both share the dataset; regression reports that unknown rather than a pass.
  3. Intervals (6.3) wait for the spec 004 amendment of Tracking: make Rustev a complete embeddable decision library (Node and WebAssembly bindings, service, evidence model, model backends, observability, evaluation) #76 child E2; every claim states point estimates as a limit.
  4. Placement: the code lives in the existing dataset.rs and report.rs rather than a new file, because a new source file would change spec 021's reviewed archive list (tools/rustev-release/archive-policy.json). Moving it to its own module is mechanical once that list may change.

Local verification (macOS arm64): make gate, make code (build, test, clippy -D warnings, fmt, boundaries), .bin/spec-spine verify 023 (3 commands: the qualification tests, clippy for rustev-eval, seeds 8/8 detected), bash scripts/check-authored-content.sh.

Rebased onto main after #145 merged (derived shards regenerated, unchanged).

Review round 2: no findings.

Rebased onto main after #143 and #144 merged (derived shards regenerated, unchanged).

@github-actions

Copy link
Copy Markdown

AI review (findings)

Reviewing the diff across all five changed paths for bugs, security issues, and inconsistencies.

dataset.rs — admit()

The logic is well-structured. The slice-validation condition !names.insert(&slice.name) || size == 0 || size != slice.cases collapses "subgroup absent" and "count mismatch" into a single Slice error; that is intentional and matches the spec. The exposed-case loop correctly checks both membership and uniqueness. The manifest.id().ok() idiom silently maps a canonicalization failure to WrongDataset, but there is no information-loss security concern since the caller cannot distinguish the error anyway.

report.rs — freeze() / measure() / scope_claim()

The three-way consistency check (manifest id == admission dataset == freeze record dataset) is applied redundantly in admitted_for, then re-checked in each top-level function: a correct and conservative defense. The calibration qualification chain (fit::qualify → split guard → id-set comparison) looks sound. The cohort = final_test.difference(&exposed) set is computed and threaded correctly through count_rows and then through the slice membership filter.

Concrete defect — misleading doc comment on Figure

/// One figure. A ratio carries its numerator and denominator; a value is a
/// spec 004 measurement with its count. Unknown is never a figure.
pub enum Figure {
    Ratio { numerator: u64, denominator: u64 },
    Value { value: f64, n: u64 },
    Unknown { reason: String },   // ← contradicts the doc
}

"Unknown is never a figure" directly contradicts the existence of the Unknown variant in the same enum. The intended meaning is that scope_claim refuses to compose a claim from an Unknown figure, not that the variant is absent or unreachable. A future reader following the doc comment would be wrong to treat Unknown arms as dead code, and a future refactor (e.g., exhaustiveness audit) could silently drop the arm that surfaces blocked measurements.

Mutation seeds

All eight seeds target distinct guard conditions, each paired with a test that observes the specific error variant. The seed descriptions correctly identify which spec row and function they exercise.

test qualification.rs

The evaluated() builder is careful to recompute the detail digest after each mutation in the measurement-refusal tests (where the report is mutated before the detail, the detail references the old digest, and measure catches the mismatch). The OUTCOMES array is consistent with the manifest's split and label assignments.

Spec update

The verification block now names concrete cargo test and mutation commands. The implementation record correctly states implementation: pending because no dataset has been admitted.

{"head": "90a254a2b9b655ed7c9b7dce85ce7f44eec50996", "verdict": "findings", "findings": [{"path": "crates/rustev-eval/src/report.rs", "line": null, "summary": "The doc comment on `Figure` says \"Unknown is never a figure\" but `Unknown` is a variant of the same enum, directly contradicting the comment and risking removal of the arm by a future maintainer who trusts the documentation."}]}

Subject: 1204bc8...90a254a, diff digest c3f2de5aaf07c4618eac59055f96f3ebde33e750f989ecac82d19a485f622e9b, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 21, 2026 18:44 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/023-qualification-procedure branch from 90a254a to 26b0200 Compare October 21, 2026 18:52
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

I reviewed the five changed files carefully: the new AdmissionRecord/admit() implementation in dataset.rs, the QualificationRecord/freeze()/measure()/regression()/scope_claim() block in report.rs, the new test file, the eight mutation seeds, and the spec update.

dataset.rs — admit() validation is complete and ordered correctly: schema, structure, provenance (synthetic guard), manifest-id match, source-specific blanks, license, privacy decision, labeling, systems-under-test with independence check, adapter, label mapping deduplication, missing-label reconciliation, split counts, population slices (all-splits count against declared whole-manifest size), and exposure. No path allows bypassing independence via short-circuit ordering.

report.rs — freeze() chains: admitted dataset == frozen record, frozen config == supplied config, rules digest bound, analysis subset of declared metrics, label independence, declares-system guard (ordered after related_labeler — the test explicitly covers the resulting behavior, which is a deliberate design choice), calibration qualification via fit::qualify + split check, slice-minimum completeness, supersedes symmetry. measure() correctly builds cohort = final_test \ exposed, gates value rows (blocked) on any exposure while count rows run against the already-reduced cohort, marks below-minimum slices unknown, and checks role set exactly. scope_claim() verifies frozen record matches admission and measurement matches freeze before composing the sentence.

tests/qualification.rs — Each section 5 row has a dedicated test; positive path exercises the round-trip identity checks. Fixture arithmetic (10 cases, 6 final-test, 1 missing label, 4 long/2 short) is internally consistent. evaluated() reconciles its own EvalDetail before returning, so detail.reconcile() in measure() is satisfied.

mutation/seeds.py — Eight seeds added to REQUIRED; each targets the exact guard it is meant to kill and the patterns are unique within dataset.rs/report.rs.

specs/023 — Verification block is a first-item acceptance record only; implementation status stays pending; limits table is accurate against the code. No spec principle (VI–XIII) is contradicted.

No concrete defect found.

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

Subject: df053f6...26b0200, diff digest 07863d6ec078c93d3b438203d5250ff8bc12710b48ad6d9e9ef0837ad88c9973, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus force-pushed the impl/023-qualification-procedure branch from 26b0200 to 55d9d25 Compare October 21, 2026 19:47
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

I'll review the changed files carefully against the governance documents and for code defects.

crates/rustev-eval/src/dataset.rs

The admit() function's logic looks consistent:

  • Synthetic provenance refuses correctly (DatasetProvenance::Synthetic); Real passes for the test fixture as documented.
  • The LabelsNotIndependent check iterates systems_under_test and for each system checks all model producers via m.related(s); ModelRef::related is symmetric and checks both identity and family.
  • The slice count uses all manifest cases (not just final-test) against SliceSize.cases, described as "whole-manifest size" — consistent with how measurement uses only final-test members.
  • MissingLabels declared = unmapped.saturating_add(unlabeled) vs. manifest's Label::Missing count. Correct.
  • Training-data exposure required only for Public source; for Commissioned it is not checked. This is intentional given the nature of commissioned data.
  • PrivacyDecisionMissing uses is_none_or(blank) — requires a non-blank string when derived_from_real_user_data is true. Correct.

crates/rustev-eval/src/report.rs

  • admitted_for checks manifest.id() == admitted.dataset(). Content-addressed IDs mean a different manifest (same bytes) can't pass.
  • freeze() chain: admitted → record matches admitted → config v2 with bound rules matching admission's task_mapping.rules → analysis metrics are prefixes of declared config metrics → candidate model independence → calibrations qualified by fit::qualify against FinalTest split, and additionally fit on Calibration split.
  • measure() checks roles exactly (sorted set), detail bound to report, config internal consistency before frozen-config match (ConfigChanged is distinct from corrupt report), cases = every final-test case exactly once, and binding per role.
  • Cohort final_test.difference(&exposed) correctly excludes exposed cases from headline and slice figures; exposed cases get separate count_rows output.
  • scope_claim builds the claim sentence from freeze/admission data (not free-form), validates population against a.population.id (not request.population), and checks measurement is of this specific freeze before proceeding.
  • regression correctly returns unknown when old.id() != want or task doesn't match; the task check is redundant (ID is a content hash), but harmless. Notes that cross-dataset regression is always unknown is documented.

crates/rustev-eval/tests/qualification.rs

The test fixture uses DatasetProvenance::Real with synthetic content to exercise code paths that would be skipped for Synthetic. The comment in the file and spec are clear this is intentional. All 8 mutation seeds have corresponding test coverage.

specs/023-real-data-quality-qualification/spec.md

The verification block's verify:cli commands match what was implemented. The implementation record accurately describes the code, the known limitations (per-slice error always unknown, cross-dataset regression always unknown), and correctly marks implementation: pending (no real dataset admitted yet). The spec's status/implementation frontmatter is not shown changed in the diff — if the spec was already approved/pending, this remains consistent.

No concrete defects found.

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

Subject: 2d6a1f2...55d9d25, diff digest 07863d6ec078c93d3b438203d5250ff8bc12710b48ad6d9e9ef0837ad88c9973, 1 call(s). An AI comment is not an approval.

Spec 023 increment 1: what can be built and proven without an admitted
dataset. Implementation stays pending; no dataset is admitted and no
quality, calibration or usefulness claim is made.

- `rustev-eval/src/dataset.rs`: `rustev.dataset-admission/1` with every
  statement of 3.1 and 3.2, and `admit`, which refuses synthetic
  manifests (I-1), incomplete records, real-user-derived data without a
  privacy decision, labels from a system under test or its family,
  missing labels that do not reconcile, and split, slice or exposure
  statements the manifest does not hold.
- `rustev-eval/src/report.rs`: `rustev.qualification/1` and `freeze`
  (3.3: admitted data only, the frozen v2 configuration with the admitted
  rules digest, independent candidate, slice minimums, calibrations
  qualified off the final test, replacements on a new final test);
  `measure` (3.4: reports by role on the frozen dataset, split,
  configuration and bindings, `ConfigChanged` otherwise; coverage and
  abstention rows before accuracy; slices below their minimum and exposed
  cases unknown); `regression` through spec 004 gates; `scope_claim`
  (3.5: the sentence composed from the freeze and admission, another
  population rejected).
- `tests/qualification.rs`: one test per section 5 row on synthetic
  fixtures, no real data, no network; 8 seeded defects, all detected.
- Code sits in existing files so spec 021's reviewed archive list is
  untouched.
- Spec 023: verification block and implementation record, with the
  limits found (spec 004 reports cannot exclude exposed cases or give
  per-slice error; cross-qualification regression gates are unknown).
@bartekus
bartekus force-pushed the impl/023-qualification-procedure branch from 55d9d25 to 2a4243e Compare October 21, 2026 23:11
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

I reviewed the five changed files carefully against the governance context and diff.

crates/rustev-eval/src/dataset.rs — The admit function is logically sound. The checks run in a defensible order: schema, check_structure, synthetic provenance, manifest identity, completeness, privacy decision, labeling independence, adapter match, duplicate label mapping, missing-label reconciliation, split counts, slice sizes, exposure, and owner review. The Admitted witness type is only constructable via admit, which enforces all the checks ran. The ModelRef::related method (family == other.family || identity == other.identity) correctly catches same-family siblings as well as exact duplicates.

crates/rustev-eval/src/report.rs — The freeze, measure, and scope_claim functions are coherent. admitted_for correctly guards both freeze and measure from using an admission for a different manifest. The ConfigChanged error is correctly distinguished from a generic NotAdmitted or Report error; the mutation seeds confirm coverage. The cohort exclusion final_test.difference(&exposed).copied().collect() is correct, and the blocked flag gates only spec 004 aggregate values (not the recomputed count rows) when exposed cases exist — consistent with the "Limits found" note in the implementation record. The binding_ok checks are role-specific; the rules-baseline only verifies containment (not exclusivity), which may be lenient, but this pattern is shared with the candidate role and I see no contradicting spec text in the diff.

crates/rustev-eval/tests/qualification.rs — The synthetic manifest is marked real solely to exercise the procedure, with a prominent comment to that effect. Each section-5 row has a dedicated negative test; the positive path, completeness, exposure, report refusals, freeze preconditions, and regression are also exercised. The evaluated helper calls detail.reconcile().unwrap(), so hand-built reports satisfy spec 004's own internal consistency invariant before being passed to measure.

crates/rustev-eval/mutation/seeds.py — All eight seeds under the "qualification refusals" category target the actual code paths in dataset.rs and report.rs and are detectable by the corresponding tests. The verify block invokes seeds.sh "spec 023", and every seed description contains "spec 023", so the filter is consistent.

specs/023-real-data-quality-qualification/spec.md — The body-only update (verification section and implementation record) does not touch frontmatter, so no derived shard should be staled. The implementation record accurately documents what was and was not built (e.g., second acceptance item blocked on an owner-supplied dataset, intervals deferred, per-slice error blocked on a spec 004 amendment). The status is correctly left as pending.

No concrete defects found.

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

Subject: 00a4b7c...2a4243e, diff digest 1f28443260f30e00a3c0a9f36a3793b9a23ecd158ca57842ec9ce78e1f19791b, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus merged commit 4552b3e into main Oct 21, 2026
26 checks passed
@bartekus
bartekus deleted the impl/023-qualification-procedure branch October 21, 2026 23:41
bartekus added a commit that referenced this pull request Oct 22, 2026
…c 001 3.5 confirmation rule (#147)

Spec 010, increment 1: the three section 3.4 binding records and the
`rustev-rahi` evidence sink. Only `rustev-rahi` is implemented, because
only its record passes every row (3.4.8). Nothing here authorizes a
release, publication, deployment, live service call, spend or real-user
data.

## Changes

- `specs/010-integrations/spec.md`: the binding records for
`rustev-aicortex` (refuses on item 1: its git-revision dependency fails
the workspace supply-chain check of `tools/rustev-release`),
`rustev-rahi` (passes) and `rustev-serve` (refuses on item 2, Sigstore
row unverified). `implementation: in-progress`; the Verification block
and the implementation record for increment 1. The `cargo tree | grep`
verify loop captures `cargo tree` output first and fails when `cargo
tree` fails.
- `integrations/rustev-rahi/`: `RahiEvidenceSink` over `rahi-store
=0.7.1` receipts, the `rustev` migration set, `stage_erasure`, and a
closed `Delivery` outcome (accepted, duplicate, conflict, rejected,
unavailable, acceptance unknown). Receipts are
`rahi:<durability>:<external_id>:<digest>` and
`rahi:duplicate:<external_id>:<digest>`, so the external record identity
(3.6.2) reaches the run record through the `EvidenceSink` seam. A
`Changed` head without an accepted digest (Rahi reports `""`) and a
recorded collision are a conflict with `stored: None`, never `sha256:`
or a placeholder string. Tests: every item 5 row against a scripted
store, and accepted, duplicate, conflict, erased and refused deliveries
against a single-voter Rahi 0.7.1 store on loopback, each opened through
the bounded port-retrying `open_with`.
- `specs/001-boundaries-and-authority/spec.md` 3.5 and
`tools/rustev-boundaries/`: amendment R-45. A transitive violation found
in the workspace-wide `cargo metadata` resolution stands only when the
crate's own `cargo tree -p <crate> -e normal,build --locked` resolution
(every target, or `wasm32-unknown-unknown` for the WebAssembly binding)
also lists a forbidden package. The check prints how many paths it
dismissed, and fails closed: when that graph cannot be read, the
violation stands. Declared-edge rules are unchanged. Why: Rahi's graph
switches on `crypto-common`'s optional `rand_core` edge, and the
unconfirmed checker reported 7 paths ending `rand_core -> getrandom [->
js-sys]` for the pure crates and bindings that their own builds do not
hold.
- `docs/decisions/00-founding-decisions.md`: R-44 and A-45 (binding
records), R-45 (the 001 3.5 amendment). `docs/backlog.md` RUSTEV-015
state. `Makefile`: 010 joins `VERIFIED_SPECS`.
`tools/rustev-release/release-set.json`: `rustev-rahi` is excluded from
the release family. `Cargo.lock`: Rahi 0.7.1's graph added, no existing
entry changed.

## Owner acts

1. **R-44 / A-45: confirmed.** The owner confirmed the three written
binding records as this PR states them on 2026-10-21; the decision
record, spec 010 and the backlog say so.
2. **R-45: approved.** The owner approved the spec 001 3.5 amendment on
2026-10-21; R-45, A-45 and 001's decision history say so.

Not in this PR: any `rustev-aicortex` code. The owner chose to narrow
spec 021's source check to the release closure; that amendment and the
adapter follow in a separate PR after this one merges, so the
`rustev-aicortex` record here still refuses on item 1.

## Recorded, no code change

- With `AcceptanceUnknown` the store's own error (for example `Io`) does
not reach the run record, and the delivery holds its slot for the full
delivery timeout. That follows from spec 003 3.9.4's seam, which reports
uncertainty only by timing out; the `rustev-rahi` record item 5 now
states the evidence loss.

## Review history

Earlier rounds on this branch: round 1 (0 findings), round 2 (0), round
3 (1 finding, fixed: `Delivery::Unavailable` after a refused transaction
is documented, recorded and tested), round 4 (0). The owner-side review
(issue comment 6325417338) items 1 to 6 and both notes are addressed
above. Round 5 on `467b33a` (2 findings, both fixed): R-45 was
implemented while recorded as awaiting approval (the owner has since
approved it, and the records say so); `Delivery::Conflict` carried the
placeholder `another digest` where the record says no digest is
reported, so `stored` is now `Option<String>` and the seam detail names
no digest. Round 6 on `cc9afd4`: no findings. The branch is rebased onto
`main` at `4552b3e` (#149, no conflict; derived shards unchanged by
`make refresh`) and squashed to one commit.
bartekus added a commit that referenced this pull request Oct 22, 2026
)

Marks 023 implementation complete against the acceptance text amended by
#174 (D-023-1, A-46), now merged. Delivered: every unit of section 2
(#149, #173), the section 5 refusals as tests, and declared verification
passing. No quality claim is made; 3.5 refuses one until a dataset is
admitted.
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