KB-4DD7

01 — Master Design v0.1 Consistency Check vs Live (Branch A)

5 min read Revision 1
registries-pivotconsistency-checkbranch-alive-verifiedpivot-definitionsparent-codephantom-count2026-05-31

title: 01 — Master Design v0.1 Consistency Check vs Live (Branch A) date: 2026-05-31 verdict: ALL design claims CONFIRMED against live; 0 critical corrections → no errata doc required

01 — Master Design Consistency Check (Branch A)

Each row: design claim (docs 00–13) → live fact (read-only) → verdict → impact.

# Design claim Live fact (2026-05-31) Verdict Impact
1 pivot_definitions = 37 (35 active) 37 total / 35 active confirmed engine REUSE stands
2 parent_code NULL on all 37 → drill unwired parent_code_set = 0; v_registries_pivot_tree rehearsal = 0 nodes with children, 37 roots confirmed drill graph is flat; EXTEND parent_code is a hard prerequisite (doc 05)
3 v_registry_counts = pivot-backed snapshot it is a BASE TABLE (169 rows), not a view; v_registry_counts_compat/v_pivot_by_level/v_kg_edges_all are the views confirmed (sharpened) reconcile naming: the table is a snapshot; live truth = pivot
4 meta_catalog has accounting cols, no phantom_count cols present: record/actual/orphan/baseline_count, composition_level(text), entity_type, layer, source_model, source_location, code/name/code_column. No phantom_count. Also no source_table/source_collection confirmed phantom_count = EXTEND; meta↔pivot link is via source_location string only (mapping gap, doc 05)
5 entity_species 42 with parent_id+depth tree cols parent_id, depth, composition_level, species_code, code present confirmed species sub-tree available for drill
6 species_collection_map 164 with discriminator cols discriminator_field/value/operator/config, species_code, collection_name, is_primary confirmed grouping-dimension source (doc 06)
7 label_rules 38 / taxonomy_facets 10 / entity_labels 718,744 available 38 / 10 / 718,744; label_rules has skip_wide_warning+facet_id+condition jsonb; facets have max_labels_per_entity+cardinality confirmed label machinery REUSE; no ungrouped-display threshold column (doc 06)
8 orphan scanners live fn_refresh_orphan_col/_dot/_species (+trg), check_registry_coverage, fn_birth_onboarding_full_scan(_hc) all present confirmed scanner REUSE
9 system_issues 179,074 / event_outbox 170,498 / event_type_registry 40 available confirmed; live issue types incl. orphan halves, collection_onboarding_gap, kb_pg_sync_drift, hardcode_violation, apr_phantom_applied; 40 event types confirmed notification spine REUSE (doc 08)
10 pin/ghim artifact absent (REGISTRY_MISSING) %pin%/%favorit%/%watch%/%bookmark%/%ghim%0 tables confirmed registry_pin is genuinely NEW (doc 07)
11 no count_integrity / phantom function pg_proc search → none confirmed v_count_integrity/fn_count_integrity_check() are NEW (doc 04)
12 phantom = LAW_DEFINITION_GAP no phantom law; only apr_phantom_applied (1) + frontend gap-math confirmed + sharpened the proposed record>actual def is itself unreliable (doc 08)

New facts discovered (not contradicting design, but sharpening it)

  • A source_object LEFT JOIN re-introduces double-count. Several leaf tables map to >1 pivot (e.g. meta_catalog→PIV-001/101/102/106/201–206), so a naive meta_catalog ⋈ pivot_definitions ON source_object fans 160 leaves → 172 rows. The integrity/coverage views must use scalar EXISTS/LATERAL LIMIT 1, never a row-multiplying join (proven in doc 04).
  • source_location is not a clean pivot key. Model-A rows store Directus:<table> (joinable), but model-B rows store File:dot/bin/ / File:web/pages/ (not joinable to pivot_definitions.source_object='dot_tools'). So a split_part(source_location,':',2) join misses real pivots (e.g. CAT-006↔PIV-007). A proper meta_catalog.pivot_code mapping column is needed (new EXTEND, beyond doc-02's parent_code EXTEND).
  • Four disagreeing "system totals" exist live (doc 09): /api/registry/counts=1,688,702; CAT-ALL.record=1,682,270; CAT-ALL.actual=1,919,748; leaf Σrecord=1,954,686. Confirms PIV-500 (one canonical grand total) is mandatory.

Conclusion

Design v0.1 is internally consistent with live reality; no critical correction → no errata doc written. Two additive sharpenings (meta↔pivot mapping column; scalar-not-join coverage) are folded into docs 04/05/11 as implementation notes, not design reversals.

Back to Knowledge Hub knowledge/dev/reports/architecture/registries-pivot-p0-p1-count-integrity-view-rehearsal-2026-05-31/01-master-design-consistency-check.md