KB-19CA

10 — Operator Apply Packet + Live Apply Report

4 min read Revision 1
registries-pivotoperatorapply-packetrollback2026-06-03

10 — Operator Apply Packet + Live Apply Report

Part A — Live applied this macro (DONE)

A1. v_registries_pivot_node_contract — applied + verified live. Reverse: DROP VIEW IF EXISTS v_registries_pivot_node_contract; Base table untouched: pd_hash=1e31696f3cb47d244c578bd9390ca56d (37 rows, 0 children) before AND after.

Part B — Operator step 1: commit the parent graph (rehearsed-clean)

Channel: ssh contabo "docker exec -i -e PGCLIENTENCODING=UTF8 postgres psql -U workflow_admin -d directus -v ON_ERROR_STOP=1" Run off-peak (fires a full refresh_pivot_results() + refresh_meta_catalog_from_pivot(), ~0.6s).

BEGIN;
UPDATE pivot_definitions SET parent_code = v.parent
FROM (VALUES
 ('PIV-101','PIV-001'),('PIV-102','PIV-001'),('PIV-106','PIV-001'),
 ('PIV-201','PIV-101'),('PIV-202','PIV-101'),('PIV-203','PIV-101'),
 ('PIV-204','PIV-101'),('PIV-205','PIV-101'),('PIV-206','PIV-101'),
 ('PIV-104','PIV-007'),('PIV-105','PIV-009'),('PIV-103','PIV-016'),
 ('MTX-L2-ATOM','MTX-L1-OVERVIEW')
) AS v(child,parent)
WHERE pivot_definitions.code = v.child;
-- verify before commit:
SELECT count(*) FILTER (WHERE parent_code IS NULL) roots,   -- expect 24
       count(parent_code) children,                         -- expect 13
       count(DISTINCT parent_code) parents                  -- expect 6
FROM pivot_definitions;
SELECT count(*) dangling FROM pivot_definitions c           -- expect 0
WHERE c.parent_code IS NOT NULL AND NOT EXISTS (SELECT 1 FROM pivot_definitions p WHERE p.code=c.parent_code);
COMMIT;   -- or ROLLBACK if any check fails

Rollback (after commit, if needed):

UPDATE pivot_definitions SET parent_code = NULL
WHERE code IN ('PIV-101','PIV-102','PIV-106','PIV-201','PIV-202','PIV-203',
               'PIV-204','PIV-205','PIV-206','PIV-104','PIV-105','PIV-103','MTX-L2-ATOM');

Part C — Operator step 2 (owner-gated, HELD): aggregate pivots

Each needs (a) pivot-engine support for view-backed counts and (b) ratified definitions. Proposed (do NOT run until both gated):

PIV-301 orphan     ← v_birth_orphan (59)
PIV-302 phantom    ← v_birth_phantom (289)
PIV-303 drift      ← v_count_drift (3 rows; net surplus 21,182)
PIV-311 IU         ← information_unit (219)
PIV-312 KG edges   ← v_kg_edges_all (2,259)
PIV-313 sys issues ← system_issues WHERE status='open' (207,940)
PIV-304 unmanaged  ← CANDIDATE (needs law definition; do not fake)
PIV-500 grand total← cross-table anchor (needs engine extension)

Births fire fn_birth_registry_auto; beware the birth_registry UNIQUE(entity_code) composite defect (Track B) — birth these in a rehearsed BEGIN..ROLLBACK first.

Part D — DOT-category drill filter (owner decision)

Align v_pivot_dot_by_category (published-only=16) with PIV-007 (all=309): either drop the status='published' filter or add a status sub-axis so child Σ reconciles to parent. Surface as a drift flag meanwhile.

Forbidden (unchanged): no composition cleanup, no dot-pivot-update, no birth-gate change, no Nuxt count math, no hardcoded depth, no hidden PIVOT_MISSING.

Back to Knowledge Hub knowledge/dev/reports/architecture/registries-pivot-dynamic-layer-graph-count-contract-finalize-2026-06-03/10-operator-apply-packet-or-live-apply-report.md