12 — Implementation Prompts (gated)
title: 12 — Implementation Prompts (gated) date: 2026-05-30
12 — Implementation Prompts (run in order; each read-only or rollback-first)
P0 — Count-integrity reconcile (read-only). Run design test_counting_contract() vs live (v_registry_counts_compat JOIN meta_catalog); list every drift (CAT-ALL/023/006/CMP/MAT/007/MOL/DOT/COL/SPE); propose refresh_meta_catalog_from_pivot() as a separate Điều 32 packet. No mutation.
P1 — Backend views (BEGIN..ROLLBACK). CREATE v_living_lists, v_count_drift, test_counting_contract(), v_registries_pivot_tree, fn_node_substrate() (doc 10); smoke selects (root→groups; dot_tools→PIV-104/category; leaf→substrate); confirm zero literals/Nuxt-math; ROLLBACK. COMMIT only after approval.
P2 — PIVOT_MISSING rows (gated). Draft INSERTs for PM1–PM10 (grand-total, IU PIV-310, KG PIV-320, drift, stale, total-pivots, orphan, coverage); rehearse BEGIN..ROLLBACK; validate pivot_count/pivot_query resolve; owners GOV-COUNCIL/SIV/KG-SYS. COMMIT per Điều 32.
P3 — Directus/API. Expose v_living_lists + v_registries_pivot_tree via Directus read or thin diServer route (SELECT … WHERE parent_id=:id only; no aggregation). Add pivot_query evidence endpoint.
P4 — Nuxt render-shell. Build RegistriesPivotPage / DrillLayer (recursive) / NodeRow / SubstratePanel. Props only; no counts/arrays/depth constants; next layer from next_pivot_code/drilldown_query_ref; reuse registries/pivot primitives.
P5 — Tests + parity. Run T1–T11; gate deploy on T1/T3/T5/T6/T7 + parity T2.
P6 — Route convergence. Deploy /knowledge/registries-pivot; after parity redirect /knowledge/registries (and /knowledge/pivot or keep as reference tab — ratify). Rollback = remove route + redirects.