Skip to content

[implementation] data: R01 - writer of a superseding reassessment for a live revision (ADR-0074 A2.3) #519

Closed

Description

@NeoNix-Lab

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

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)

  1. New writer in quant_platform.data next to quality_lifecycle.py (data plane; no import of access). It targets the current live revision (the single non-superseded row of the key), locking in the same order as the lifecycle application (dataset row FOR UPDATE, then the key's topology), and refuses a superseded, foreign (other dataset or key) or writing revision.
  2. 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 unchanged certification_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_sha256 and the evidence categories of the superseded report; it sets status, the coverage category status and, for fail, a violation legacy_publication_incomplete_day that names the archive identity; it carries metrics.supersedes_assessment_signature = the semantic signature of the current leaf, and the producing commit as code_ref.
  3. Idempotent: the same semantic signature adds no second leaf. Honest: the report says the partition is incomplete for its day, not corrupt.
  4. The application of the lifecycle runs through the existing seam in its own short transaction; nothing here widens its meaning.
  5. Restore: a pass that supersedes the fail returns the revision to valid through 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

  1. On a real PostgreSQL: a valid revision with a pass assessment becomes invalid after the writer and the lifecycle application, and returns to valid after a superseding pass; the supersession link is the exact signature of the previous leaf; the bound evidence is the previous report's, unchanged.
  2. 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.
  3. A VALID_ONLY read (and the other lifecycle policies) excludes the retired revision; its bytes, manifests and earlier reports are byte-identical.
  4. 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.
  5. Ordinary record_quality_report still refuses a non-closed partition (existing tests unchanged).
  6. 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

  1. github-actions commented on Oct 25, 2026

    @github-actions

    Automatically closed by PR #530 merged into implement/fid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions