RP-03 Consolidated DDL And Expected Constraints
RP-03 - Consolidated DDL And Expected Constraints
Status: RESOLVED_BLOCKING
Normative Creation Order
- Roles, schema, domains.
code_catalog_set,code_catalog_family,code_catalog_item.manifest_set,manifest_item_envelope.- The 27 child contracts in dependency order, with the four forward child FKs deferred.
operator_operand_compatibility.evidence_registry,human_identity_registry,principal_registry,analyzer_run,manifest_activation.- The 11 non-authority runtime-evidence tables.
- All deferred constraints below.
- Owner/ACL/default-privilege/immutable-trigger setup.
- Constraint/object exact-set verification, then seal/activate only if every check passes.
Complete Deferred Constraint Groups
- Four child forward FKs: policy-rule/operator; metric/unit; capability/workload; signoff/tier.
- Dependency runtime FKs: analyzer-run and evidence.
- Manifest FKs: creator, sealed activation, activated activation, envelope retirement evidence.
- Evidence/identity cycle FKs: evidence issuer; human identity evidence; principal binding evidence.
- Catalog root retirement-evidence FK.
Every runtime-evidence FK is inline because its referenced anchor/child exists before group 7. All constraints use RESTRICT/RESTRICT/NOT DEFERRABLE.
Expected Constraint Model In Counted Surface #20
Codex rejects a free-form expected-constraint JSON payload. Instead:
- each TABLE row in
authority_scope_manifesthasexpected_constraint_set_sha256; - each expected CONSTRAINT/INDEX is its own typed #20 row with canonical
object_identity,parent_object_identity,object_type, andexpected_definition_sha256; - the TABLE set hash is the canonical total-order hash of its child constraint/index rows.
The realized snapshot comes from PG16 pg_constraint and pg_index, canonicalized under CP-06.
Expected vs realized rows and hashes compare in both EXCEPT directions. Missing/extra/changed
authority-relevant constraints fail OBJECT_AUTHORITY_IMMUTABLE. Dropping any deferred FK in
rehearsal must produce that failure.
Authority-affecting classes are every PK, UNIQUE, FK, CHECK, exclusion constraint, expression/ partial index, and every index used by a sealed readiness, uniqueness, authority, or write-path contract. An unknown extra authority-affecting constraint/index always fails.
There is no runtime BENIGN_EXTRA_INDEX exemption. Every extra index, including a plain
performance index believed benign, fails OBJECT_AUTHORITY_IMMUTABLE. To permit such an index, a
new candidate manifest version must add its typed #20 INDEX row and exact definition hash to the
expected set, pass review/seal/quorum, and activate before the index may exist; after that it is
expected, not extra. Operator labels, names, patterns, source-code allowlists, and ad-hoc judgment
cannot exempt an index. This creates no new authority surface or hidden exception path.
Reversal is the exact reverse order and may drop only empty candidate-only objects. Active/history objects are never dropped.