KB-3F1A

02 — SB-10 Auxiliary Tables Build Results (candidate_scan_run + governance_candidate_object COMMITTED+INERT, 2026-06-02)

4 min read Revision 1
one-roof-governancephase1test-modesb-10-auxcandidate-scan-rungovernance-candidate-objectcommittedinertno-checked-forever2026-06-02

02 — SB-10 Auxiliary Tables — Build Results (COMMITTED)

sql/sb10_aux_ddl.sql, sql/sb10_aux_rehearsal.sql, sql/sb10_aux_commit.sql, sql/sb10_aux_rollback.sql. Provenance: impl-index doc 40 §40.0 (grain: candidate_scan_run = "one row per scan run; links cursor SB-13 + snapshot SB-12"; candidate_object_state/governance_candidate_object = per-object materialization), §40.5 (candidate_key), §40.6 (4 materialization criteria + "same columns + candidate_key, link back to group_key"); doc 34 §2/§4/§5/§10 (run_id, dirty set, three scan modes, heartbeat); doc 60 (rehearsal: object PK (candidate_key, ruleset_version)); doc 59 + built gov_worker_cursor (worker/source soft refs); live schema (keystone 24 cols verified).

2.1 Objects committed

  • candidate_scan_run (17 cols) — run ledger. run_id text PK; scan_mode CHECK ∈ {event_driven,incremental,periodic_full} (doc 34 §5); worker_name/source_name soft refs to SB-13 cursor (no FK — cursor PK is composite and rows optional); source_snapshot_ref int → evolution_snapshots(id); ruleset_version text → governance_ruleset(ruleset_version); status CHECK ∈ {running,completed,failed,throttled}; started_at/finished_at; counters groups_scanned/objects_materialized/candidates_upserted/dirty_processed bigint; heartbeat_ref (soft); error_text; metadata jsonb; created_at. Indexes: ix_csr_status/started/mode.
  • governance_candidate_object (26 cols) — selective per-object materialization. Mirrors governance_candidate_state column-for-column (24 cols) + candidate_key text NN (doc 40 §40.5 form COALESCE(canonical_address, collection_name||':'||entity_code)) + materialization_reason text NN CHECK ∈ {indep_authoritative,open_finding,exception,high_risk_write} (doc 40 §40.6 four criteria). PK (candidate_key, ruleset_version) (doc 60). Composite back-FK (group_key, ruleset_version) → governance_candidate_state(group_key, ruleset_version); plus source_snapshot_ref → evolution_snapshots(id), ruleset_version → governance_ruleset(ruleset_version). Indexes: ix_gco_group/dirty(partial)/stale_after/verdict/reason.

2.2 Anti-pattern compliance

  • No checked-forever boolean: information_schema query for {is_governed,checked,is_checked,governed,checked_forever} on governance_candidate_object0 rows (verdict is the same decaying triple as the keystone).
  • Keystone decoupling preserved: governance_candidate_state.last_run_id stays a soft text ref; no reverse FK was added to the keystone (it remains exactly as accepted).

2.3 Rehearsal (BEGIN..ROLLBACK) — PASS

Transcript highlights (sql/sb10_aux_rehearsal.sql + isolated-savepoint negatives):

  • PRE: both tables NULL.
  • In-tx: both CREATE TABLE + indexes; both visible. Positive run-ledger insert OK; positive object insert OK (valid composite FK to a seeded temp parent group, rolled back).
  • Negatives (savepoint-isolated, all rejected as designed): orphan (group_key,ruleset_version)FK violation fk_gco_group; duplicate PK → unique violation pk_gov_candidate_object; bad scan_modeCHECK violation; bad statusCHECK violation; bad materialization_reasonCHECK violation.
  • No-checked-forever: 0 rows.
  • POST (entry==exit): both tables NULL again; idle_in_transaction=0.

2.4 Commit + verify

sql/sb10_aux_commit.sql ran BEGIN … CREATE … verify … COMMIT. In-tx verify: present, csr_rows=0, gco_rows=0, checked_cols=0. Independent query_pg post-commit: candidate_scan_run present (17 cols, 0 rows); governance_candidate_object present (26 cols, 0 rows, 0 checked-forever cols); keystone still 0 rows. No out-of-scope mutation (counts in doc 04).

2.5 Verdict

SB-10 aux = BUILT + VERIFIED + INERT. Both tables empty, trigger-less, fail-closed by construction (no scanner writes them; mission forbids any run). Reversible via sql/sb10_aux_rollback.sql.

Back to Knowledge Hub knowledge/dev/reports/architecture/one-roof-phase1-test-mode-deferred-substrate-completion-2026-06-02/02-sb10-aux-build-results.md