Repository navigation
Description
Parent
SCOPE.md Part D (DG-R), atom R01, registered by governance issue #518; design gate #515 (ADR-0074 Amendment 2, PR #516, A2.3). Branch from implement/fid; the pull request targets implement/fid, never main. Hand-off notes: HANDOFF_516_astra.md (not versioned).
Authority
ADR-0074 Amendment 2 A2.2 to A2.3 (accepted); ADR-0030 (A16, general quality lifecycle: reassessment creates new, target-bound evidence; fail -> invalid); ADR-0033 and ADR-0044 unchanged. AGENTS.md governance boundary: no governance file is touched.
Start gate
- PR ADR-0074 Amendment 2 (proposed): retire, then import, damaged legacy BTCUSDT live days #516 is merged with its acceptance record (A2.9).
- Governance issue [governance] DG-R: register ADR-0074 Amendment 2 (R01, R02) and reconcile O01 with ADR-0075 Amendment 1 #518 is merged:
R01is inSCOPE.mdPart D as authorized. implement/fidcontainsmain.
Problem
The lifecycle application (QualityLifecycleCatalog.apply_partition_lifecycle) accepts valid as a source state and maps a current fail assessment to invalid, but nothing can write that assessment for a revision that is not closed: CatalogPublicationWriter.record_quality_report refuses every other state (data/publication_catalog.py), and the repair path writes reports only for candidates inside its own cutover (data/repair.py, _insert_quality_report). A legacy live day whose only live revision is valid and incomplete therefore cannot be retired from reads by any accepted mechanism.
Objective
A writer of a superseding reassessment report for the current live revision of one natural partition, plus the application of the existing lifecycle seam, so that a valid revision becomes invalid (and back to valid by a superseding pass) without deleting or rewriting anything.
Design (ADR-0074 A2.3; no semantic decision beyond it)
- New writer in
quant_platform.datanext toquality_lifecycle.py(data plane; no import ofaccess). It targets the current live revision (the single non-superseded row of the key), locking in the same order as the lifecycle application (dataset rowFOR UPDATE, then the key's topology), and refuses a superseded, foreign (other dataset or key) orwritingrevision. - The new report is filed under the same check suite and certification profile as the assessment it supersedes and must pass
current_partition_report(quality_lifecycle.py): it copies unchangedcertification_profile,natural_partition_identity,dataset_manifest_sha256,partition_manifest_sha256,physical_artifact_hash,canonical_content_hash_v1,coverage_manifest_id/ids,coverage_assertion_id/ids,coverage_manifest_sha256and theevidencecategories of the superseded report; it setsstatus, the coverage category status and, forfail, a violationlegacy_publication_incomplete_daythat names the archive identity; it carriesmetrics.supersedes_assessment_signature= the semantic signature of the current leaf, and the producing commit ascode_ref. - Idempotent: the same semantic signature adds no second leaf. Honest: the report says the partition is incomplete for its day, not corrupt.
- The application of the lifecycle runs through the existing seam in its own short transaction; nothing here widens its meaning.
- Restore: a
passthat supersedes thefailreturns the revision tovalidthrough the same seam.
Mutation boundary
src/quant_platform/data/ (the new writer and, only if needed, a re-export), its unit and PostgreSQL tests, the CI job for the PostgreSQL test. Nothing else.
Forbidden: any change to trade-v1, the ordering key, TradeKeyV1, a dataset identity, the J02 wire, schemas or migrations, record_quality_report's refusal of non-closed revisions (ordinary S13 keeps it), A10 repair, S13/S14 behaviour, governance files, ADRs, retention and cleanup code.
Acceptance criteria
- On a real PostgreSQL: a
validrevision with apassassessment becomesinvalidafter the writer and the lifecycle application, and returns tovalidafter a supersedingpass; the supersession link is the exact signature of the previous leaf; the bound evidence is the previous report's, unchanged. - Idempotence (the same call twice adds no leaf and no state change); refusal of a superseded revision, of a revision that is not the live one of its key, of a foreign dataset or key, of
writing, and of a report whose bound evidence does not match the target. - A
VALID_ONLYread (and the other lifecycle policies) excludes the retired revision; its bytes, manifests and earlier reports are byte-identical. - A concurrent S13 publication on the same dataset waits for the writer's short transaction and then proceeds; the writer holds no lock beyond its transaction.
- Ordinary
record_quality_reportstill refuses a non-closedpartition (existing tests unchanged). - Mutation checks: each rule above has a test that fails when the rule is weakened (supersession link, evidence copy, status mapping, live-revision check, state check, idempotence, lock order).
Verification
python tools/run_tests.py; the new PostgreSQL integration against a disposable database (own CI job and database); python tools/check_markdown_links.py; git diff --check; python tools/workflow.py preflight --base implement/fid.
Out of scope
The importer variant, the plan and the rebuild (R02); the 31 days; A10 repair and any atomic replacement (ADR-0074 A2.8); deletion or retention; any production run.
To verify first, and report if it fails
Who reacts to the state invalid: operations/retention.py, the publication-eligibility tables (S14), admitted inputs (K12), any WHERE state in src/ and tools/. If something treats invalid as a deletion candidate or breaks a read, stop and report: retention is the maintainer's code.
Atomicity check
One responsibility (writing the reassessment that the existing lifecycle seam consumes); justified by SCOPE.md Part D R01; no implicit dependency (R02 comes after); no semantic decision beyond ADR-0074 A2.3; observable criteria; reviewable without unrelated changes.
Activity
github-actions commentedon Oct 25, 2026
Automatically closed by PR #530 merged into
implement/fid.