BLOCKER E - Rollback Source Artifact Fix (evidence_registry)
06 - BLOCKER E: Rollback Source Artifact Fix (sealed evidence_registry body)
Codex recheck finding
source_sha256 (and the #27 rollback_stub_source_sha256) is proof of a body, not the body or a
restore mechanism. It cannot restore a function/procedure definition unless the full source artifact
is present and sealed. Every body-changing action (STUB_FAIL_CLOSED) must bind a content-addressed,
read-back-verified source artifact and the exact authorized restore operation. (Codex recheck CHECK_C
issue 2 / CHECK_E.)
Ground truth - the approved evidence_registry already stores content-addressed artifacts
From the approved DDL (codex-fix7-spec-artifact-correction-.../09 CP-08):
CREATE TABLE qt001_cp.evidence_registry (
evidence_id uuid PRIMARY KEY,
evidence_kind_id uuid NOT NULL REFERENCES qt001_cp.code_catalog_item(item_id),
storage_class_item_id uuid NOT NULL REFERENCES qt001_cp.storage_class_manifest(item_id),
artifact_uri qt001_cp.nonempty_text NOT NULL, -- KB doc id / object-store URI of the BODY
artifact_sha256 qt001_cp.sha256 NOT NULL, -- content hash
artifact_size_bytes qt001_cp.nonnegative_bigint NOT NULL,
issuer_principal_id uuid NOT NULL,
control_epoch ..., issued_at ..., last_readback_at timestamptz NOT NULL,
valid_until timestamptz NOT NULL, revoked_at timestamptz NULL,
supersedes_evidence_id uuid NULL ...,
UNIQUE(storage_class_item_id,artifact_uri,artifact_sha256), CHECK(valid_until>issued_at));
artifact_uri is exactly Codex's "source artifact path or KB document ID"; artifact_sha256 is the
content hash; last_readback_at proves read-back verification.
The fix - STUB body restore = sealed evidence_registry artifact (docs 02, 04, 05, 06)
For every STUB_FAIL_CLOSED member, the blueprint binds, in addition to the #27 hash:
- source artifact reference =
evidence_registry.artifact_uri(KB doc ID / object-store URI) of the prior legacy body AND of the fail-closed stub; - source artifact sha256 =
evidence_registry.artifact_sha256, which MUST equal the pinned #27old_source_sha256/rollback_stub_source_sha256; - object identity / owner / language / argument signature = from the #20 row (
object_identity= regprocedure incl. argument types;expected_owner_role;object_type); - read-back verification =
last_readback_atset; the artifact content is fetched and its sha256 recomputed.
Authorized restore operation: fetch the artifact_uri body → verify its sha256 ==
artifact_sha256 == the pinned #27 hash → operator CREATE OR REPLACE of the legacy object (a
separate, authorized operator function-replacement of a legacy object - different object class from
the never-overwritten gateway, Codex CR-E3) → verify the live pg_get_functiondef sha256 == the
pinned #27 hash. The final authority that the restore succeeded is PG-native (the post-restore
live hash match), with the KB/object-store artifact as the source material.
Fallback rule: if the prior body is not available as a sealed, read-back-verified
evidence_registry artifact, the body change is not allowed - the object is dispositioned
REVOKE_ONLY + owner isolation instead of STUB_FAIL_CLOSED. A body change with no restorable source
is forbidden.
Self-check
PASS only if every body-changing action has a real, sealed, read-back-verified source artifact and an
authorized restore that verifies the restored hash. PASS - STUB bodies are content-addressed
evidence_registry artifacts (URI + sha256 == #27 hash), restored by an authorized operator
replacement verified against the pinned hash; no-artifact ⇒ no body change.