KB-38BD rev 2

07 — Violation Audit (VERIFIED v2)

5 min read Revision 2
architectureviolation-auditdieu26dieu28counting-integrityduplicate-sot2026-05-30verified-v2

07 — Violation Audit (VERIFIED v2)

v2 ERRATA: v1 listed a "PIV-104 over-counts information_unit 219→309" finding — false; live PIV-104 is a dot_tools-by-category pivot. Also corrected the stored-count surfaces. Below = verified only. Severity: 🔴 must-fix · 🟡 should-fix · 🟢 minor.

🔴 V1 — meta_catalog stores numbers (Đ26 MT5)

meta_catalog holds counts in 6 columns; 164/169 rows have record_count, 161 have actual_count (+ orphan_count, baseline_count, active_count, species_count). Đ26 MT5: "meta_catalog = list of lists; does NOT contain numbers." Numbers should live in pivot_results and be read via pivot_count(). Verified.

🔴 V2 — Two meta_catalog rows count the same table and disagree

CAT-006 (DOT Tools, registry_collection=dot_tools, record_count 309, actual_count 163) vs CAT-DOT (Tổng DOT Tools, entity_type=dot_total, composition_level='meta', record_count 307, orphan 140). Live dot_tools=309; fresh PIV-007=309. → CAT-006.record_count is right; CAT-DOT(307) is stale; CAT-006.actual_count(163) is also wrong. Reconcile to one canonical CAT + the PIV-007 pivot. Verified.

🔴 V3 — record_count ≠ actual_count within meta_catalog (self-inconsistent)

7/169 rows disagree between their own two count columns, incl: CAT-006 (309 vs 163), CAT-007 Pages/Routes (record 37 vs actual 52, source ui_pages). Two stored numbers for the same list, neither tied to a pivot. Verified.

🔴 V4 — Counting path bypasses pivot (stored-number drift is the root)

The pivot path is CORRECT and FRESH (PIV-007=309 at 13:27 today) but the registries page and v_registry_counts surface the STORED record_count/actual_count, which drift. Đ26 MT8: numbers should flow pivot→Directus→display. The fix direction exists (refresh_meta_catalog_from_pivot()) but competes with the stored/trigger path. Verified.

🟡 V5 — Competing count maintainers

trg_auto_sync_registry_counts (ENABLED, on meta_catalog) + refresh_registry_count(s)() + refresh_meta_catalog_from_pivot() all can write meta_catalog numbers. Multiple maintainers → the CAT-006/CAT-DOT and record/actual splits. Pick ONE owner (recommend the pivot path). Verified.

🟡 V6 — Hardcoded phantom rows in registries.vue (Đ28) — code-level evidence

KB report s146-m3-codex-nuxt-investigation quotes verbatim hardcoded rows in the page source: code:'CAT-SPE', 'CAT-ORP', 'CAT-PHA', 'CAT-UNM', 'CAT-017' at index.vue:308–322, and orphan figure 21825 derived in-page from /api/registry/health totals.totalGap. → the registries page injects summary rows + computes a gap in Nuxt, violating render-shell (Đ28). Limitation: Nuxt source outside read_file allowlist; this is report-sourced (s146-m3), not re-read live — but it is verbatim code evidence, not behavioural inference. Confirmed via report.

🟡 V7 — pivot freshness uneven / no visible computed-at

3/126 pivot_results rows have needs_refresh=true; oldest refreshed 2026-05-11. The registries page shows "đếm realtime bằng PG trigger" with no computed-at timestamp (verified: none visible). Staleness is hidden. Verified.

🟡 V8 — Stale literals in UI vs live

Registries page shows birth "964,573" (CAT-023) while live birth_registry≈959,372; CAT-007 shows 37 while actual 52. Stored vs live divergence surfaced to users. Verified.

🟢 V9 — Dirty composition_level values

entity_species.composition_level contains non-canonical values 'meta' and '1' alongside atom/molecule/compound. No canonical 6-layer reference table to constrain them (see doc 06). Verified.

🟢 V10 — meta_catalog navigability gaps

Only 18/169 rows have ui_page. Lists are not consistently linkable to a surface. Verified.

🟢 V11 — Two-ish count entry points

pivot_count(p_code) (canonical) vs pivot_query(p_code) vs the refresh_registry_count* writers — consolidate read path to pivot_count. Verified.

Retracted from v1 (not violations / not verified)

  • "PIV-104 over-counts information_unit" — false; PIV-104 source_object=dot_tools, groups by category.
  • "collection_registry.record_count 168/168 / table_registry.row_count 21/21" — those columns don't exist; counts are stored in meta_catalog only.
  • "pivot_results uniformly stale 2026-05-29 17:02" — false; newest is 13:27 today.

Not violations (healthy, verified)

  • Pivot engine complete + canonical (pivot_count/pivot_matrix/pivot_query/refresh_*).
  • /knowledge/pivot render-shell architecture.
  • entity_species catalog + birth ledger.
Back to Knowledge Hub knowledge/dev/reports/architecture/registries-pivot-foundation-reuse-audit-rebuild-blueprint-2026-05-30/07-violation-audit.md