KB-85C7

SuperBundle — 02 IU KG Backfill + Vocab Result (LIVE)

7 min read Revision 1
kgiu-relationprovenancebackfillvocabdieu39live2026-05-28

02 — IU KG Relationship Backfill + Vocab (Branch B)

Verdict: PASS — LIVE backfill committed + durable; vocab expansion = implementation-ready DDL + authority pack.

A. Live state inspected

  • iu_relation = 60 rows, all relation_type='contains', 0 triggers, 9 constraints incl. iu_relation_type_chk CHECK (relation_type IN ('contains','derived_from','supersedes','replaced_by','merged_from','split_from')) and relation_status_chk IN ('active','superseded','retired','cancelled').
  • 5 enrichment columns present (prior superbundle ALTER): provenance jsonb, confidence numeric, evidence jsonb, assertion_mode text, valid_time tstzrange — all nullable, all 60 NULL at entry.
  • universal_edges = 2199 (USES 1486 / BELONGS_TO 431 / CONTAINS 282), integer-keyed (CAT-130), excludes IU; already has confidence(2199 filled), valid_time, provenance(0 filled).
  • v_kg_edges_all (security_invoker view) = 2259 = UNION of iu_relation(60) + universal_edges(2199). Projects edge_source/edge_id/source_ref/source_collection/target_ref/target_collection/edge_type(=upper(relation_type))/edge_subtype/status/confidence/valid_time(COALESCE(valid_time, tstzrange(valid_from,valid_to)))/provenance/metadata/created_by/created_at. Does NOT project assertion_mode or evidence → see doc 04 patch.

B. LIVE backfill (committed) — Đ39 provenance-or-quarantine

UPDATE iu_relation
SET provenance = jsonb_build_object(
      'method','structural_derivation',
      'basis','pre-existing iu_relation row, relation_type=contains',
      'backfilled_by','foundation-factory-gateway-superbundle-2026-05-28',
      'authority','Dieu39 provenance-or-quarantine backfill (additive, reversible)',
      'channel','workflow_admin','note','structural containment edges from iu tree; no inference'),
    confidence     = 1.0,
    assertion_mode = 'asserted',
    valid_time     = COALESCE(valid_time, tstzrange(valid_from, valid_to, '[)'))
WHERE relation_type = 'contains' AND provenance IS NULL;   -- 60 rows
  • Method: dress-rehearse BEGIN..ROLLBACK (in-tx 60/60, post-rollback 60/0) → COMMIT → fresh-connection verify: total 60, has_prov 60, has_conf 60, has_am 60, has_vt 60, min=max confidence=1.0.
  • View now: iu_relation edges 60/60 provenance+confidence; universal_edges 2199 still 0 provenance (left untouched intentionally — see C).
  • Rollback: UPDATE iu_relation SET provenance=NULL,confidence=NULL,assertion_mode=NULL,valid_time=NULL WHERE relation_type='contains' AND provenance->>'backfilled_by'='foundation-factory-gateway-superbundle-2026-05-28';

Rationale for values: containment edges are curated structural facts (from iu tree), so confidence=1.0 and assertion_mode='asserted' are correct; provenance records method+basis+authority; valid_time anchored to existing valid_from..valid_to so the temporal record is complete (Đ39 valid_time requirement satisfied).

C. universal_edges NOT backfilled (deliberate, with reason)

2199 rows, integer-keyed, CAT-130, likely Directus/auto-managed (is_auto_managed, _dot_origin). A 2199-row write on a non-IU collection is a heavier, separate governance decision and risks colliding with auto-management. Provenance there is a separate macro (doc 10 Prompt 2). No hidden SoT created.

D. Vocab expansion — implementation-ready DDL + AUTHORITY PACK (NOT applied)

The KG semantic vocab (8 atom-rules: IDENTITY/BELONGS_TO/CONTAINS/DEPENDS_ON/USED_BY/TRANSITIVE/PEERS/SIMILAR) is not a table — for iu_relation it lives in the iu_relation_type_chk CHECK (currently 6 structural values). Requested relation families and their mapping:

Requested family Inverse Status vs live CHECK
contains / belongs_to belongs_to contains ✓ present; belongs_to NEW
uses / used_by used_by NEW (exists in universal_edges as USES)
depends_on / dependency_of dependency_of NEW
references / referenced_by referenced_by NEW
triggers / triggered_by triggered_by NEW
produced_by / produces produces NEW
supersedes / superseded_by superseded_by supersedes ✓; superseded_byreplaced_by
conflicts_with (symmetric) self NEW

Why authority-gated, not applied now: expanding the CHECK changes the relation ontology — a deliberate governed decision that should be tied to which real edges will populate each new type (no orphan vocab). Expanding an allow-list CHECK is itself additive/reversible, so it is safe mechanically; the gating is governance, not safety.

Ready DDL (apply under Đ38/Đ39 authority):

ALTER TABLE iu_relation DROP CONSTRAINT iu_relation_type_chk;
ALTER TABLE iu_relation ADD CONSTRAINT iu_relation_type_chk CHECK (relation_type IN (
  'contains','belongs_to','derived_from','supersedes','replaced_by','superseded_by',
  'merged_from','split_from','uses','used_by','depends_on','dependency_of',
  'references','referenced_by','triggers','triggered_by','produces','produced_by','conflicts_with'));

Rollback: restore the original 6-value CHECK. No row migration needed (existing rows all contains, still valid).

E. DOT commands needed for future enrichment (define, defer build)

  • dot_iu_kg_assert_edge(source,target,relation_type,provenance,confidence,assertion_mode,valid_time) — gateway-guarded inserter enforcing provenance-or-quarantine.
  • dot_iu_kg_backfill_provenance(scope) — idempotent provenance backfill (this bundle did the manual equivalent for contains).
  • dot_iu_kg_project_verify() — assert v_kg_edges_all count == iu_relation + universal_edges and no SoT duplication. These become catalog rows (category=write/read) in the KG-enrichment macro; not created here to keep this bundle to one live mutation.

F. No hidden second SoT / vector off

  • iu_relation remains the only IU-native edge SoT; universal_edges remains the integer-keyed SoT; v_kg_edges_all is a read-only projection (no writes, no copy). Count identity holds: 60+2199=2259.
  • iu_core.vector_sync_enabled=false untouched (never-flip). No Qdrant write.

G. Advance vs prior state

Prior superbundle created the columns + view (zero data). This bundle is the first to populate KG provenance — 60 edges move from quarantine-eligible to provenance-bearing, and the view now serves enriched IU edges. Vocab + universal_edges backfill + DOT inserters are now spec-complete and queued.

Back to Knowledge Hub knowledge/dev/reports/architecture/foundation-factory-gateway-superbundle-cr-kg-pilot-recon-4mothers-design-2026-05-28/02-iu-kg-backfill-vocab-result.md