feat(valid-detection-benchmark): 11.2 persistence custody and scratch-loss suites

This commit is contained in:
Marius Ciepluch
2026-11-22 23:28:46 +01:00
parent 936835477a
commit 73c8a9d6b3
2 changed files with 1416 additions and 2 deletions
@@ -369,7 +369,7 @@
- _Requirements: 1.5, 1.6, 1.7, 2.3, 2.4, 2.5, 3.5, 3.6, 4.1, 4.2, 4.3, 4.4, 4.8, 5.1, 5.2, 5.4, 5.6, 7.6, 10.3_
- _Boundary: Population Governance Validation_
- _Depends: 2.4, 4.4, 6.5_
- [ ] 11.2 (P) Run artifact, custody, retention, and scratch-loss recovery suites
- [x] 11.2 (P) Run artifact, custody, retention, and scratch-loss recovery suites
- Exercise create-only conflicts, wrong kind/digest reads, access classes, policy mismatch, conditional create/update, concurrent writers, committed reread, version visibility, transient expiry, restart, and complete scratch loss.
- Verify the configured store through nonzero test objects before interpreting capability results and never mutate administrator-owned policy.
- Done when durable authorities and spent state recover exactly, transient versions expire as registered, and any unsupported or ambiguous storage behavior blocks admission.
@@ -447,7 +447,7 @@
- Task 8.3 (load-bearing for 8.5/11.3): core `authorize_evaluation` cannot run over the committed 8.1/8.2 products — empirically confirmed by two independent reviews: (a) 8.2 `_content_ref` builds ContentRefs over repository artifact *envelopes* while core `resolve_content`/`decode_arm_observation_set` expect raw documents, so no digest-honest resolver can bridge them; (b) `compose_plan_manifest` binds `readiness_digests=(capability_report_digest,)` while core `_validate_readiness` requires real `ReadinessResult` objects whose re-derived digests match. 8.5 must repair the manifest/ref composition in a NEW sibling module (`admission_execution.py` is sealed at 400 LLOC) or amend the core seam before replay; the interim authority is the benchmark-owned `AdmissionSpendReleaseV1` bound to the committed custody receipt.
- Hostile-decode discipline (from 8.3's three review rounds): every `json.loads` on untrusted sealed bytes must use `parse_constant` rejection plus a finite `parse_float` hook (numeric-overflow literals like `1e999` bypass `parse_constant`), and `RecursionError` must appear in every recursion-exposed except tuple. Tasks 8.5, 8.6, and 9.3 must apply this to any new decoder of untrusted bytes.
- R1 final validation (2026-11-21): the conversion from the benchmark-owned 8.3/8.4 products (`AdmissionSpendReleaseV1.released_cases` / `ExactScopeProjectionV1`) to the core V3 case graph (`ArmAdmissionCasesV3` / `AdmissionCaseReleaseV3` / `EvaluationSpendBindingV3`) that `derive_scoped_replay` requires is NOT yet committed; `run.py`'s replay-stage signature is today satisfiable only by test fixtures. Owner: tasks 11.3/11.6 (synthetic + governed end-to-end runs) must build this adapter, cross-check 8.4's parallel scoped-denominator computation against the core replay, and wire `bridge_core_authorization` into the production stage. Until then the run command is machinery, not production-complete.
- R1 final validation (2026-11-21): the pre-existing decoders behind the operator read path predate the hostile-decode discipline and lack it — `replacement_artifact_contract.py:207` (json.loads with no parse_constant/finite parse_float/RecursionError), plus `workflow_outcome._decode_canonical` (workflow_outcome.py:394) and `workflow_journal._decode_canonical` (workflow_journal.py:379); 9.3 review reproduced an unhandled RecursionError through them (closed at the run.py boundary only). Owner: task 11.1 (validation harness) or the next task owning `replacement_artifact_contract.py`; 9.3's boundary-level closure is interim.
- R1 final validation (2026-11-21, ownership updated 2026-11-22 after 11.1/11.2): the pre-existing decoders behind the operator read path predate the hostile-decode discipline and lack it — `replacement_artifact_contract.py:207` (json.loads with no parse_constant/finite parse_float/RecursionError), plus `workflow_outcome._decode_canonical` (workflow_outcome.py:394) and `workflow_journal._decode_canonical` (workflow_journal.py:379); 9.3 review reproduced an unhandled RecursionError through them (closed at the run.py boundary only). 11.2's review additionally reproduced a raw RecursionError escape from `S3ArtifactRepository.get` via 20000-deep stored JSON (artifact_repository.py:240-244 catches only ArtifactContractError; the underlying decode site is replacement_artifact_contract.py:207). 11.1/11.2 were validation-suite tasks and did not own these modules; owner is now task 11.3 (the end-to-end integration owner touching the artifact/replay surfaces) as a fold-in, else 11.7 must block on it. 9.3's boundary-level closure is interim.
- R1 final validation (2026-11-21), minor drift items: two module-local `OPERATOR_READ_POLICY_DIGEST` constants exist (`admission_replay.py` "scoped-replay-operator-read-policy" vs `run.py` "operator-command-read-policy" — caller-side only, no artifact-key coupling); `sealed_retry.py` imports the private `_reference_value` from `sealed_diagnostics` (not in `__all__`); 9.2's `score_replacement_replay` and 8.5's `derive_scoped_replay` are parallel wrappers over the same core `score_and_replay` (the admission path uses 8.5's; 9.2's seam is the 10/11+ product surface). Revisit when 11.x wires the entry points.
- Task 10.1 review: `sourcing_queue_build._request_order` sorts by (url, advisory_locator, reachability_digest, model_digest) with a stable sort, so two distinct candidates tying on all four keys get cap selection decided by input order (restart reproducibility still holds — decode is canonical-bytes-bound — but permutation-rebuild determinism does not). The next task owning that module (10.2+) should extend the sort key with the remaining content digests or refuse tied-but-distinct requests closed. Also noted: an `INSUFFICIENT_FAMILIES` refusal does not durably persist that attempt's exclusions (10.2 owns review-record exclusion durability).
- Task 10.2 review (2026-11-22): both 10.1 fold-ins landed (7-key `_request_order` discriminating old four-key ties + `InsufficientFamiliesRefusal.attempt_exclusions` durable persistence). Residual, forwarded to the next owner of `sourcing_queue_build.py`: distinct candidates differing only in non-digest fix-site scalars (path/function under identical repo/advisory/reachability/manifest/license digests) still tie on all seven keys and get cap selection by input order (round-1 reviewer reproduced divergent state digests across permutations); fix is fix-site scalars in the key or a closed refusal of residual ties. Optional hardening forwarded for the cohort modules: `project_accepted_ground_truth` call sits outside a closed-refusal wrapper (defense-in-depth only; unreachable with a consistent queue), and `decode_cohort_batch` accepts self-consistent forgeries whose `pending_entries`/`outcome.queue_entry_digest` are non-digest strings (downstream matching fails closed; a digest check would match sibling-field rigor). Real Python cohort remains PENDING external review records — the 10.2 done criterion is fixture-verified only.
File diff suppressed because it is too large Load Diff