KB-3348
Supertrack H — RP-07 Retirement-Evidence FK Review
2 min read Revision 1
fix7architecturet1-reviewrp07retirement-evidence-fksupertrack-h
08 — Supertrack H: RP-07 retirement-evidence FK review
Verdict: RP07_VERIFIED.
Codex delivered (doc 05) the normative deferred constraint:
ALTER TABLE qt001_cp.code_catalog_item
ADD CONSTRAINT fk_code_catalog_item__retired_evidence
FOREIGN KEY(retired_reason_evidence_id) REFERENCES qt001_cp.evidence_registry(evidence_id)
ON UPDATE RESTRICT ON DELETE RESTRICT NOT DEFERRABLE;
Checklist
| Criterion | Result | Basis |
|---|---|---|
code_catalog_item.retired_reason_evidence_id FK → evidence_registry.evidence_id |
✅ | exact ALTER above |
| NULL allowed for active items | ✅ | existing structural CHECK: active item ⇒ NULL retirement evidence |
| non-NULL must exist | ✅ | retired item ⇒ non-NULL; FK guarantees the evidence row exists |
| deferred ALTER order included | ✅ | RP-03 consolidated order, deferred group 5 ("Catalog root retirement-evidence FK") |
| expected-constraint catalog includes it | ✅ | "included in the consolidated deferred order and sealed expected-constraint set" → covered by #20 both-EXCEPT |
| fake evidence UUID fails | ✅ | rejects at PG FK level |
| rollback included | ✅ | deferred constraint added in candidate phase; RP-03 reversal (exact reverse order) drops it; root table data untouched |
Coherence
This closes the "retire-with-fake-evidence" root-integrity bypass: the FK-authority ROOT
(code_catalog_item) can no longer be marked retired without a real evidence_registry row.
Combined with RP-03's both-EXCEPT constraint verification, a dropped retirement FK is itself caught
as a missing authority-relevant constraint → OBJECT_AUTHORITY_IMMUTABLE FAIL.
Conclusion
RP-07 fully resolved. No proposal.