KB-7C87

F-4 Seam Commit 02 — Seam Commit DDL & Rollback

3 min read Revision 1
one-roofphase1f4ddlrollbackf2-1-cast

02 — Seam Commit DDL & Rollback

Commit script (sql/f4_seam_commit.sql)

Single transaction, ON_ERROR_STOP, self-guarding via a DO-block assertion that aborts the whole transaction (no commit) if the in-transaction ceilings deviate.

Seam A — v_governance_object_inventory

CREATE OR REPLACE VIEW v_governance_object_inventory AS
  SELECT 'collection'::text       AS object_type,
         cr.collection_name::text AS object_ref,                 -- F2-1 cast (load-bearing)
         (cr.governance_role IN ('governed','locked')) AS requires_owner,
         (cr.coverage_status = 'BIRTH_REQUIRED')        AS born
  FROM collection_registry cr
  WHERE cr.governance_role = 'governed' AND cr.coverage_status = 'BIRTH_REQUIRED';

Seam B — v_governance_object_containment

CREATE OR REPLACE VIEW v_governance_object_containment AS
  SELECT 'collection'::text       AS object_type,
         cr.collection_name::text AS object_ref,                 -- F2-1 cast
         'group'::text            AS parent_type,
         cr."group"::text         AS parent_ref                  -- F2-1 cast
  FROM collection_registry cr
  WHERE cr.governance_role = 'governed' AND cr.coverage_status = 'BIRTH_REQUIRED'
    AND cr."group" IS NOT NULL AND cr."group" <> '';

In-transaction ceiling guard

DO $$
DECLARE a int; b int;
BEGIN
  SELECT count(*) INTO a FROM v_governance_object_inventory;
  SELECT count(*) INTO b FROM v_governance_object_containment;
  RAISE NOTICE 'F-4 in-txn: seamA=% seamB=% gap_ceiling=%', a, b, a*6;
  IF a <> 35 THEN RAISE EXCEPTION 'ABORT: Seam A ceiling breach got % expected 35', a; END IF;
  IF b <> 35 THEN RAISE EXCEPTION 'ABORT: Seam B edge breach got % expected 35', b; END IF;
  IF a*6 > 210 THEN RAISE EXCEPTION 'ABORT: gap ceiling % exceeds 210', a*6; END IF;
END $$;
COMMIT;

Why safe to persist

Read-only projections over collection_registry; add visibility not data; no INSTEAD OF triggers / no rules beyond _RETURN (verified post-commit: view_triggers=0, extra_rules=0); reversible in one statement per seam.

Rollback script (sql/f4_seam_rollback.sql) — staged pre-commit

CREATE OR REPLACE VIEW … WHERE false per seam; matches canonical inert DDL in the deferred-substrate-completion package. Lossless, instantaneous.

Back to Knowledge Hub knowledge/dev/reports/architecture/one-roof-phase1-coverage-dry-run-f4-seam-commit-test-mode-2026-06-02/02-seam-commit-ddl-and-rollback.md