RP Classification Cleanup — 01 State Recovery + Live Preflight
01 — State Recovery + Hard Gate 0 Live Preflight
All values below read live from production directus on 2026-06-03 (channel: query_pg read-only for diagnosis; ssh … psql for snapshots). No mutation occurred during preflight.
1. Current RP state (LIVE)
| Object | Count |
|---|---|
pivot_definitions |
37 |
pivot_results |
126 |
triggers on pivot_definitions |
3 enabled — trg_pivot_def_refresh, fn_birth_registry_auto, fn_matrix_config_changed |
triggers on pivot_results |
1 enabled — fn_birth_registry_auto |
RP classification fields are mixed/free-text:
registry_group(11 distinct):default(7),cross-table(6),l2-drill(6),quy_trình(5),công_cụ(4),cấu_trúc(3),giám_sát(2),dữ_liệu(1),matrix_l1(1),matrix_l2(1),test(1)composition_level(7 distinct):atom(14),molecule(11),compound(6),matrix(3),building(1),material(1),product(1)species(18 distinct incl null):catalog(10),governance_infra(4), NULL(4),collection(2),dot_tool(2),species(2), + 12 singletons
2. Current L1 governance state (LIVE — governed home for RP classification)
| Object | Count | Notes |
|---|---|---|
taxonomy_facets |
10 | FAC-01..09 + FAC-PROV |
taxonomy |
58 | label codes incl LBL-101..105 |
entity_species |
42 | canonical composition_level = {atom 21, molecule 11, compound 8, meta 1} (+1 stray "1" on SPE-NVS) |
label_rules |
38 | app-owned |
entity_labels |
824,230 | organic growth |
Mapping target vocabulary — FAC-02 "Vai trò hệ thống?" (cardinality=single, all active):
- LBL-101 Cấu trúc · LBL-102 Nội dung · LBL-103 Quy tắc · LBL-104 Công cụ · LBL-105 Giám sát
Join key confirmed: pivot_definitions.species = entity_species.species_code. 18/18 distinct non-null species match → 0 orphans.
3. Current L2 gate state (CLOSED — unchanged)
| Counter | Value | Meaning |
|---|---|---|
os_proposal_approvals |
0 | rollout NO-GO |
governance_object_ownership |
0 | no ownership seeded |
v_object_owner_gap |
210 | real, not closed |
axis_registry / topic_taxonomy_map |
ABSENT | L2 substrate not deployed in prod |
event_outbox WHERE event_domain='governance' |
0 | no gov emit |
⇒ Production = inert governance skeleton at L2, with L1 classification LIVE. This is the two-layer model: L1 (Đ24/Đ29 classification) live; L2 (object-ownership/axis/topic) gated.
4. Mapping-view status (at preflight)
to_regclass('public.v_rp_classification_governance_map') = NULL (not applied). → Applied later this macro (see doc 02).
5. DOT cleanup path discovered
dot_tools has a pivot domain with 8 published tools — the lawful cleanup channel:
DOT-113 dot-pivot-declare,DOT-114 dot-pivot-health,DOT-307 dot-pivot-virtual-create,DOT-308 dot-cron-pivot-setupDOT-312 dot-matrix-declare(create),DOT-313 dot-matrix-update(update),DOT-314 dot-matrix-retire(delete),DOT-315 dot-matrix-health
Plus classification.species (3 tools) and classification.label (5 tools) on the L1 side. Full path in doc 04.
6. idle transactions / write-path risk
idle in transaction= 0 (safe to apply DDL).- Write-path risk: any manual UPDATE to
pivot_definitionsfires 3 triggers (refresh + birth_registry auto-write + matrix config change). A read-only VIEW fires none of these → safe. This is exactly why Đ26 mandates DOT-mediated pivot mutation.
7. Allowed / forbidden scope (this macro)
Allowed: read-only diagnosis; ONE persistent read-only mapping view (preflight-proven safe/reversible/no-island); produce DOT packet; produce read contracts & plans. Forbidden: L2 rollout, ospa/ownership writes, manual pivot UPDATE, DOT execution, event/system_issues emit, UI/Directus/Qdrant/Nuxt mutation, law/version change, governance island, any gap=0 claim.
8. Reconciliation vs prior package
The predecessor RP-attach package rehearsed the view read-only (37 rows, species clean=31/missing=4/ambiguous=2/orphan=0). This macro's live re-rehearsal reproduced those numbers exactly and added the composition breakdown (match=21/mismatch=3/drill_overload=9/no_ref=4). entity_labels grew 820,187→824,230 (organic). All other counters identical. Baseline confirmed → apply authorized.