KB-211D

05 — Dynamic Drill-Down Contract Rehearsal (Branch E)

5 min read Revision 1
registries-pivotdrilldownbranch-edata-contractparent-codesubstratepivot-queryvariable-depth2026-05-31

title: 05 — Dynamic Drill-Down Contract Rehearsal (Branch E) date: 2026-05-31 verdict: contract is GENERATABLE from live substrate for pivot-anchored nodes; BLOCKED for the rest by parent_code-NULL + PIVOT_MISSING

05 — Dynamic Drill-Down Contract Rehearsal (Branch E)

Goal: prove the doc-03 node contract can be produced from live PG, that count>1 ⇒ child layer and count=1 ⇒ final substrate, with no hardcoded depth.

A. The child-layer mechanism EXISTS (live-proven)

  • pivot_query('PIV-104') returns rows grouped by group_values.category → PIV-104 = dot_tools grouped by category. This is the child layer of PIV-007 (dot_tools total). So "expand a node into its child groups" already works via pivot_query on a grouping pivot.
  • The 37 pivots are organized by registry_group: cấu_trúc, công_cụ, cross-table (PIV-101–106 = by-dimension), l2-drill (PIV-201–206 = meta_catalog by composition_level atom→building), giám_sát, quy_trình, matrix_l1/l2, default, test. Drill is implied by this naming convention, not by an explicit edge.

B. The blocker: the drill graph is not wired

parent_code is NULL on all 37 (v_registries_pivot_tree = 0 children / 37 roots, doc 04). So next_layer_exists() / child_grouping_dimension() cannot resolve from data — they would fall back to the naming convention (a disguised hardcode). EXTEND parent_code is the gate for a clean backend-resolved drill. Proposable edges (from live source_object+group_spec):

child pivot grouped by proposed parent_code
PIV-104 (dot_tools ⋅ category) category PIV-007
PIV-201..206 (meta_catalog ⋅ composition_level) composition_level PIV-500 (grand total, PIVOT_MISSING)
PIV-101/102/106 (meta_catalog cross-table) dimension PIV-001 / PIV-500
PIV-103 (entity_species) species tree PIV-016

C. count=1 ⇒ final substrate (live-proven via fn)

fn_registries_pivot_node_substrate(code) resolves a node to its substrate:

  • ('CAT-023')source_object=birth_registry, source_location=Directus:birth_registry, model A, record 980,378, has_pivot=t.
  • ('CAT-006')source_object=dot/bin/ (File), model B, record 309, has_pivot=f (mapping gap, doc 04). At a singular leaf, substrate = the real table + PK/code + registry entry + (where bound) IU/KG (v_kg_edges_all 2,259 edges, iu_relation 60) + governing DOTs (dot_tools/dot_iu_command_catalog) + events (event_outbox) + governance owner. These are joinable today.

D. Node-contract field generatability (doc-03 §A/B/C) from live substrate

field source today status
node_code, layer, composition_level, species meta_catalog / pivot_definitions
total pivot_count(code) where anchored; else PIVOT_MISSING (most leaves)
plus / minus (Δ vs baseline) meta_catalog.baseline_count exists; no period pivot PIVOT_MISSING
orphan_count meta_catalog.orphan_count ✅ (on rollup rows)
phantom_count derive GREATEST(record−actual,0)model-dependent, unreliable (doc 08); no column EXTEND + LAW_DEFINITION_GAP
drift_status / count_integrity_status v_count_integrity (doc 04) ✅ (rehearsed)
has_children / children_count / next_layer_kind / next_pivot_code needs parent_code BLOCKED until EXTEND
child_grouping_dimension pivot_definitions.group_spec / species_collection_map.discriminator_field / taxonomy_matrix ✅ data exists, wiring missing
drilldown_query_ref the child pivot_query code ✅ once parent_code set
final_substrate_ref fn_registries_pivot_node_substrate
child-summary §C (child_orphan/phantom/drift/missing_*) pivots over child set mostly PIVOT_MISSING
registry_ref/table_ref/iu_ref/kg_ref/dot_ref/governance_owner collection_registry/table_registry/information_unit/v_kg_edges_all/dot_*/governance_registry ✅ joinable; governance_owner heuristic (primary_collection NULL — prior finding)
label_ref/grouping_required/classification_* doc 06 ✅ except threshold (gap)
pin_state registry_pin (NEW) propose-only
preview_url/detail_url/last_refreshed_at/evidence_refs route + pivot_results.refreshed_at

E. Verdict

  • Generatable now for the ~13–25 pivot-anchored nodes + all substrate (leaf) resolutions + drift/integrity columns.
  • Blocked for full backend-resolved drill until: (1) parent_code populated (+ pivot_code map), (2) PIV-500 + PIV-30x/31x created so child-summary counts are pivot-backed not PIVOT_MISSING.
  • No hardcoded depth is required by the design; depth terminates on value≤1 ∨ no resolving dimension ∨ substrate reached. The mechanism is sound; the data wiring is the work.
Back to Knowledge Hub knowledge/dev/reports/architecture/registries-pivot-p0-p1-count-integrity-view-rehearsal-2026-05-31/05-dynamic-drilldown-contract.md