Skip to content

R8

What to build

COMPLETE reports cannot retain failed execution counts or violate constructor/reader invariants.

Source and evidence

Repository scientific/architectural review, snapshot 86c8517, item R8. Classification: confirmed defect; high severity.

The report reconciles aggregate/trial counts but does not require zero failed executions for COMPLETE. That branch only checks retained failure records and measurement-name coverage. A report with one planned invocation, zero successful invocations, one failed invocation, old scores, and no failure records passes construction and JSON loading. Assessment then trusts its COMPLETE status and can return PASS. This is an untrusted persisted-evidence correctness defect; it does not require a candidate execution bug.

Reproduction: create the healthy isolation-fixture report; use dataclass replace to set its trial's successful_cases=0/failed_cases=1 and the matching report successful_executions=0/failed_executions=1, retaining COMPLETE status and score. Serialize and load through load_report_json() (the same reader called by the public file loader). Observed loaded_status: complete failed_executions: 1; assess(loaded, (ThresholdRule.at_least('quality', 'score', 0.5),)).passed was True.

A related constructor/reader inconsistency was confirmed: replacing elapsed_ns with -1 succeeds and serializes -1, while reading those same bytes raises ValueError. Thus frozen report construction does not currently establish all reader invariants.

Acceptance criteria

  • [ ] The reproduced zero-success/one-failure report with retained score is rejected by direct construction and JSON loading and cannot pass Assessment.
  • [ ] Negative elapsed values, invalid indices, unreconciled counts and incomplete measurement coverage reject consistently across constructor and reader.
  • [ ] Valid legacy report-v1 and report-v2 round trips remain supported; partial/failed evidence remains non-passing.
  • [ ] Adversarial tests distinguish structural consistency from authenticity of Consumer-attested inputs.
  • [ ] Preserve Consumer-owned meaning, payload-free evidence, disabled optional-import isolation, safe diagnostics and the non-relaxable Safety Floor.
  • [ ] Run the narrowest observable contract, then applicable committed Make gates. Record every command and outcome; update specifications/compatibility evidence for changed public or wire contracts. Run native Collector verification for changed Collector assets and build for packaging changes.

Design guidance

Centralize public report invariants at the immutable publication boundary and reuse them in decoding. Avoid validating status solely from retained failure records. Do not fabricate missing evidence or treat safe aggregate validation as proof of private outputs.

Keep prefactoring narrow and verifiable in this slice. Reuse established owners and structural interfaces; introduce a pattern only when it clarifies a real responsibility or variation point. Do not add consumer vocabulary or private payloads to platform code or evidence. Mocked/local results must not claim hosted, production, accelerator or release qualification.

Blocked by

None (can start immediately). Shared-area coordination is useful, but no other review fix is a genuine prerequisite for this slice.

Verification scope

Convert the described counterexample or investigation oracle into an observable test at the lowest suitable public boundary. Prefer bounded operation-count or deterministic interleaving evidence to flaky timing assertions; timing guarantees need a declared tolerance and independently owned cleanup. This ticket authorizes remediation/research, not publication or deployment.