KB-273E

Gate-Resolution SQL — Post-Commit Verification (read-only, run if seed committed)

3 min read Revision 1
one-roofphase1sqlpost-commit-verificationread-only2026-06-02

-- ============================================================================ -- POST-COMMIT VERIFICATION (read-only). Run ONLY if the seed was committed -- under an opened gate. query_pg-safe (single SELECT each). -- ============================================================================

-- 1. Exactly 30 seed rows present, all matching the planned key pattern. SELECT count() AS seed_rows, count() FILTER (WHERE object_type='group') AS as_group, count() FILTER (WHERE owner_kind='accountable') AS as_accountable, count() FILTER (WHERE is_inherited_anchor) AS as_anchor, count(DISTINCT object_ref) AS distinct_groups, -- expect 5 count(DISTINCT scope) AS distinct_scopes -- expect 6 FROM governance_object_ownership WHERE created_by='F6_OWNERSHIP_SEED_COMMIT';

-- 2. Effective-owner coverage closes all 210 object x scope cells. SELECT count(*) AS gap_rows FROM v_object_owner_gap; -- expect 0

-- 3. No ownership conflict introduced. SELECT count(*) AS conflict_rows FROM v_object_owner_conflict; -- expect 0

-- 4. Scanner read path: coverage = 100% (covered = inventoryscopes = 210). SELECT (SELECT count() FROM v_governance_object_inventory)

  • (SELECT count() FROM governance_responsibility_scope WHERE status='active') AS cells_total, -- 210 ( (SELECT count() FROM v_governance_object_inventory)
    • (SELECT count(*) FROM governance_responsibility_scope WHERE status='active')
    • (SELECT count(*) FROM v_object_owner_gap) ) AS cells_covered; -- 210

-- 5. Side-effect boundary: governance emit still 0. SELECT count(*) AS gov_emit FROM event_outbox WHERE event_domain='governance'; -- expect 0

-- 6. Nothing else moved. SELECT (SELECT count() FROM system_issues) AS system_issues, -- unchanged vs preflight (SELECT count() FROM governance_ruleset) AS ruleset, -- 0 (SELECT count() FROM governance_candidate_object) AS candidate, -- 0 (SELECT count() FROM candidate_scan_run) AS scan_run, -- 0 (SELECT count() FROM gov_worker_cursor) AS worker_cursor, -- 0 (SELECT count() FROM os_proposal_approvals) AS ospa, -- unchanged (SELECT count() FROM apr_approvals) AS apr_approvals, -- unchanged unless Path A vote added (SELECT count() FROM dot_tools) AS dot_tools; -- 309

-- 7. No idle-in-transaction left behind. SELECT count(*) AS idle_in_txn FROM pg_stat_activity WHERE state='idle in transaction';

Back to Knowledge Hub knowledge/dev/reports/architecture/one-roof-phase1-coverage-gate-resolution-and-ownership-seed-decision-2026-06-02/sql/post_commit_verification.sql