KB-2B9E

03 — SB-2 Recursive Inheritance + Gap + Double-Owner Views Build Results (COMMITTED+INERT over seams; fixture rehearsal PASS, 2026-06-02)

5 min read Revision 1
one-roof-governancephase1test-modesb-2-viewsrecursive-inheritancev-object-effective-ownerv-object-owner-gapv-object-owner-conflictinert-seamscommitted2026-06-02

03 — SB-2 Recursive / Gap / Double-Owner Views — Build Results (COMMITTED)

sql/sb2_views_ddl.sql, sql/sb2_views_rehearsal.sql, sql/sb2_views_commit.sql, sql/sb2_views_rollback.sql. Provenance: impl-index doc 17 §4 (uniqueness/conflict/gap), §5 (owner-link inheritance, nearest-ancestor, anti-hiding, Δtotal=0), §8 (gap = inventory LEFT JOIN effective-owner); doc 78 R4 (recursive-CTE resolution D1–D3, gap D4/D7, conflict D6, anti-masquerade D5); doc 19 §3 (literal table/view sketch).

3.1 Objects committed (5 views)

  1. v_object_effective_ownerCREATE OR REPLACE from the direct v1 to the recursive owner-link inheritance form. First 5 columns identical (object_type, object_ref, scope, owner_gov_code, owner_kind); appends source_anchor_type, source_anchor_ref, resolution, depth (strictly additive ⇒ CREATE OR REPLACE-safe). Recursive CTE: direct owner wins at depth 0 (any accountable); inheritance climbs containment only through is_inherited_anchor=true ancestors (anti-hiding M-DEF-7); 64-depth cycle guard; DISTINCT ON (object,scope) … ORDER BY depth = nearest-ancestor.
  2. v_object_owner_gap — governed-object inventory (birth-gated) × profile-mandatory active scopes LEFT JOIN effective accountable owner; owner IS NULL ⇒ gap. Excludes unborn objects (born=true, M-DEF-4).
  3. v_object_owner_conflict — double-owner detector: GROUP BY (object_type,object_ref,scope) HAVING count(*)>1 over active accountable rows. Reads only the committed store (no seam). Catches legacy/out-of-band doubles; the partial unique index prevents new ones.
  4. v_governance_object_containment (test-mode seam) — the single documented containment integration point. Inert/typed/empty in test mode (SELECT NULL::text… WHERE false).
  5. v_governance_object_inventory (test-mode seam) — the single documented governed-object-inventory integration point. Inert/typed/empty in test mode.

3.2 Why two inert seams (decoupling decision)

A correct recursive inheritance view needs a containment source, and the gap view needs a governed-object inventory — neither is part of the committed governance substrate (doc 17 §5/§8 name meta_catalog + per-class registries + pivot_definitions.parent_code / information_unit container refs; doc 78 used a rolled-back fixture). Wiring those production catalogs is a coverage/coupling decision (ratified follow-up), not pure engineering, and a non-empty inventory would make the substrate begin to see gaps — i.e. cross from inert→active. To keep the mission's inert mandate and avoid a hidden island, the two seams are committed empty/typed: the inheritance and gap views are structurally complete and queryable, currently return 0 rows, and "light up" only when the seams are CREATE OR REPLACEd onto ratified real sources (additive, no migration). This is the honest realization of "recursive inheritance / gap views, inert."

3.3 Rehearsal (BEGIN..ROLLBACK) — PASS (functional, fixture mirrors doc 78 R4)

With a rolled-back containment+inventory fixture and seeded ownership rows (anchors + direct override + an exception), every demonstration matched the design:

# Demonstration Expected Live result
D1 direct resolution registries-pivot/policy GOV-COUNCIL / direct / 0
D2 inherited os_agency/policy GOV-COUNCIL / inherited / 1
D3 direct overrides inherited os_agency_item/policy GOV-DOT / direct / 0
D5b exception does NOT inherit exc-descendant/policy GOV-COUNCIL / inherited / 2 ✅ (not GOV-MOUT)
D5c exception never resolves as owner 0
D4 missing-owner lonely-pivot/policy in gap present
D7 gap respects inheritance os_agency/policy 0 (covered)
D6 conflict view on real store 0 (unique index)
D6b detector predicate catches an out-of-band double 1 group
governance_relations 8 (untouched)
  • POST (entry==exit): all new views NULL; v_object_effective_owner back to 5 cols (DDL is transactional ⇒ CREATE OR REPLACE auto-restored on ROLLBACK); relations 8; ownership 0; idle_in_transaction=0.

3.4 Commit + verify

sql/sb2_views_commit.sql ran BEGIN … 5×CREATE … verify … COMMIT. In-tx + independent query_pg: all 5 views present, queryable, 0 rows; v_object_effective_owner now 9 cols (recursive); governance_relations=8; ownership=0; scopes=6. No governance_relations ALTER, no trigger added, no out-of-scope mutation (doc 04).

3.5 Verdict

SB-2 recursive/gap/conflict views = BUILT + VERIFIED + INERT. The recursive inheritance + gap + double-owner semantics are proven live (rehearsal), the committed views return 0 rows on the empty substrate, and the real-source wiring is a clean ratified follow-up. Reversible via sql/sb2_views_rollback.sql (restores the exact original 5-col direct view).

Back to Knowledge Hub knowledge/dev/reports/architecture/one-roof-phase1-test-mode-deferred-substrate-completion-2026-06-02/03-sb2-recursive-gap-views-build-results.md