KB-7AB3

04 — Tree and Node Contract After Commit

3 min read Revision 1
registries-pivottreenode-contracthierarchy2026-06-03

04 — Tree and Node Contract After Commit

The tree is now hierarchical (live)

v_registries_pivot_node_contract.has_children flipped from 0 → 6 parents, with no view or UI change — the data-driven, no-hardcode-depth contract working exactly as designed.

parent node has_children child_pivot_codes child_layer_kind
PIV-001 (Danh mục Total, 169) true {PIV-101, PIV-102, PIV-106} cross-table
PIV-007 (DOT Tools Total, 309) true {PIV-104} cross-table
PIV-009 (Collections Total, 168) true {PIV-105} cross-table
PIV-016 (Loài Total, 42) true {PIV-103} cross-table
PIV-101 (Danh mục theo Lớp) true {PIV-201, PIV-202, PIV-203, PIV-204, PIV-205, PIV-206} l2-drill
MTX-L1-OVERVIEW (Ma trận L1, 1,131,998) true {MTX-L2-ATOM} matrix

Parent vs leaf rendering (verified live)

node is_root has_children count_value final_substrate_ref
PIV-001 true true 169 NULL (parent — no leaf substrate)
PIV-007 true true 309 NULL
PIV-015 true false 107 trigger_registry (leaf terminus)
PIV-019 true false 1,131,998 birth_registry (leaf terminus)
PIV-104 false false NULL (group pivot) dot_tools
PIV-201 false false NULL (group pivot) meta_catalog

The contract correctly distinguishes:

  • parentshas_children=true, final_substrate_ref=NULL, child_layer_kind set, child_pivot_codes[] populated;
  • leaf totalshas_children=false, final_substrate_ref=<source table> (the L3/L4 "DB về chính nó" terminus);
  • group pivots (PIV-101..106, 201..206, 103/104/105) → count_value=NULL + count_status=PIVOT_MISSING for the aggregate row (their counts live in child group rows — honest, not an error).

Layer examples (live)

  • L1 (top totals): PIV-019 birth_registry 1,131,998; PIV-007 DOT 309; PIV-207 approvals 211; PIV-001 catalog 169; PIV-009 collections 168; PIV-016 species 42; etc.
  • L2 (DOT drill, PIV-104 under PIV-007): category pivot=8, null=4, Vòng đời thực thể=2, Giám sát hệ thống=2 → Σ=16. (⚠ published-only filter; Σ16 ≠ parent 309 — see doc 06 drift flag.)
  • L3 (substrate terminus): final_substrate_ref resolves each leaf to its source table (e.g. PIV-015 → trigger_registry, PIV-019 → birth_registry).

No naming-convention dependency

Hierarchy is resolved from parent_code (data edges), not from registry_group strings. §13 satisfied.

Back to Knowledge Hub knowledge/dev/reports/architecture/registries-pivot-parent-graph-commit-and-aggregate-pivots-2026-06-03/04-tree-and-node-contract-after-commit.md