MET-WP7-PREREQ-02: durable CloudFront unresolved-DOI quarantine - #933
Merged
ja573 merged 2 commits intoSep 21, 2026
Merged
Conversation
Add migration 20260921_v1.9.0 creating metric_identifier_quarantine: one row per REJECTED / UNKNOWN_DOI provenance row, with locale-independent nonblank checks, an ordered-period check, four non-cascading foreign keys, no DOI-format check and no request identity. Its downgrade locks the table and refuses while any row exists. The canonical coordinator retains the source it already locks and, only for driver_key exactly "cloudfront" and an observation carrying none of the five excluded optional fields, writes one quarantine row in the same transaction as the unchanged rejection, import error and invalid counter. updateMetricSourceCheckpoint locks checkpoint, import, source account and source in that order and, for CloudFront COMPLETED_WITH_ERRORS imports, derives rejection and quarantine evidence from provenance: contradictions fail closed as INTERNAL_STATE_INCONSISTENCY with no write; consistent but ineligible imports keep the ordinary release; a quarantine-only import with exact one-day COMPLETE coverage records its period-manifest cursor entry without advancing last_successful_period_end. Refs #930
Add the implementation report for the durable CloudFront unresolved-DOI quarantine: bindings, preflight, write-budget compliance, decisions, migration effects, validation, CI and remaining gates. Refs #930
ja573
marked this pull request as ready for review
September 21, 2026 15:02
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MET-WP7-PREREQ-02 — durable CloudFront unresolved-DOI quarantine
Implements the approved and frozen specification in #930, under CTO implementation authorization #930 comment
5759028300.Risk: CRITICAL. Status: DRAFT. It needs an independent exact-head CRITICAL source review and a separate CTO merge authorization. Do not merge.
feature/metrics @ 15b6efd089dee25d988cbb316c082be1780bf56f(tree53411810ad68014598a32376f6e4e929465002e8)feature/metrics--wp7-prereq-02-doi-quarantinethoth-api/migrations/20260921_v1.9.0(additive; guarded down)What changes
Migration. Creates only
metric_identifier_quarantine:REJECTED/UNKNOWN_DOIprovenance row (UNIQUErecord_provenance_id);period_end > period_start;down.sqllocks the table and refuses while any row exists.Coordinator.
RequestScoperetains the source it already locksFOR SHARE. A quarantine row is written only when the lockeddriver_keyis exactlycloudfrontand the observation carries none ofpublication_isbn,publication_type,institution_ror,source_record_idorsource_row_number. It is written in the same transaction as the unchanged rejected provenance, sanitized import error and invalid counter.REJECTED/UNKNOWN_DOI, with no record, revision or delta.Checkpoint update. Locks are taken in the order checkpoint
FOR UPDATE, then import, source account and source, eachFOR SHARE. For CloudFrontCOMPLETED_WITH_ERRORSimports only, the three-way partition is derived from provenance and quarantine rows:INTERNAL_STATE_INCONSISTENCY, with no write or release;COMPLETEcoverage: records or replaces the cursor entry and releases, whilelast_successful_period_endstays unadvanced.Docs. Contract register §3.4 (the narrow exception only),
CHANGELOG.md, and the implementation report.No GraphQL operation, field, input or enum changes: the regenerated SDL is byte-identical to the base,
6a61ba36…f74d6f. No role, policy, entitlement,thoth-errors, Cargo, workflow or Sphinx change.Local validation (commit
12a2a48e, clean tree, disposable Postgres 17 UTF8/C + Redis)cargo fmt --all -- --checkcargo test -p thoth-api --features backendcargo test --workspacecargo check --workspacecargo clippy --all --all-targets --all-features -- -D warningscargo build(forced SDL regeneration)git diff --check 15b6efd0...HEADMigration CLI (
thoth migrate/--revert, disposable DB):pg_dumpschema identical to the base binary's;rollback refused … holds 1 row(s), and the schema and row are unchanged.Mutation checks: six targeted regressions (coverage gate, A1 field, inconsistency, cursor flag, lock order, driver key) were all caught.
Production migration execution: NONE. Provider access: NONE.
Refs #930 (programme #766). Downstream thoth-pub/thoth-sphinx#18 is unchanged and remains on HOLD.