KB-1E42

02 — Human/Council Ratification Packet (RG1 + RG2)

9 min read Revision 1
registries-pivotratificationRG1RG2councildieu20dieu32no-self-approval2026-05-31

title: 02 — Human/Council Ratification Packet (RG1 + RG2) date: 2026-05-31 gate: RG1 (design ratify) + RG2 (count-integrity accept) decision_required_from: human / council (Đ32) — NOT an agent (no self-approval)

02 — Ratification Packet (RG1 + RG2)

This packet asks a human/council to ratify the Registries-Pivot Master Design v0.1 (RG1) and accept the count-integrity model (RG2), which unlocks the committment of the read-only view/function layer (macro P1). Per Đ20 nothing is built before this gate; per Đ32 no condition may be satisfied by self-approval.

A. What is being ratified

  1. RG1 — Master Design v0.1 (knowledge/dev/design/registries-pivot-os-agency/, 14 docs): pivot-only counting (Đ26), Nuxt render-shell boundary (Đ28), leaf-scoped accounting invariant, dynamic drilldown contract, orphan/phantom/label/pin policy, one converged surface /knowledge/registries-pivot (no 3rd parallel page).
  2. RG2 — Count-integrity model: the leaf-set definition + accounting invariant + drift surfacing + source_model-aware drift classification, as committed in the read-only view layer (doc 03), proven under BEGIN..ROLLBACK (doc 04).

B. Why count-integrity "failed", and what failed means now

count_integrity_status = FAILED because the leaf set is not 100% balanced. Live 2026-05-31:

  • 152 leaf rows balanced (record_count = actual_count)
  • 3 drift rows (net_gap +132): CAT-006 +146 (model-B phantom candidate), CAT-007 −15 (model-B unregistered), CAT-023 +1 (model-A live-write race)
  • 5 unmeasured rows (CAT-1006..1010, NULL counts → unverified)

IMPORTANT for reviewers: the design docs cite net_gap +36,783. A refresh scan ran today ~01:35 and the gap collapsed to +132 (the old gap was a stale birth-registry actual_count, now refreshed). Please judge RG2 on the live +132 / 3-drift / 5-unmeasured picture. FAILED is the correct status (not zero), but the magnitude and nature changed.

C. Why the leaf-set scope is required (not optional)

meta_catalog holds 169 rows = 160 leaf catalogs + 9 rollup rows (3 composition_level='meta' rollups CAT-COL/DOT/SPE, 5 per-level *_total rows, 1 entity_type='all' grand total CAT-ALL which lives inside composition_level='atom'). A blind SUM(record_count) over all 169 rows adds the rollups on top of the rows they roll up → double-count. That is the exact Đ28 "disguised double-count", here re-entering through SQL. The leaf rule excludes the 9 rollup rows using only data columns (composition_level, entity_type) — no hardcoded CAT list. (Unscoped SUM = 3.6M+ with net_gap +200,442; leaf-scoped = the true 160-row invariant.)

D. Why pivot-only counting is mandatory (Đ26)

pivot_count() is the single counting authority. Today the system serves ≥5 disagreeing "grand totals" (live): /api/registry/counts=1,721,334; CAT-ALL.record=1,719,958; CAT-ALL.actual=2,003,754; leaf Σrecord=2,002,041; leaf Σactual=2,001,909; plus the gap-math API totalGap=986,253. Every count on the converged surface must resolve to a pivot or be flagged PIVOT_MISSING — never recomputed in the API/Nuxt. (PIV-500 grand-total is the anchor that collapses these; gated to RG3/P5.)

E. Why no-hardcode is mandatory (Hiến pháp · Đ26 §0-AU · Đ28 NT-D1/D3)

The live /knowledge/registries page and /api/registry/health inject phantom rows and compute gap = Σ|noi_chua − noi_sinh| in the client/API — business logic outside PG. Adding a list, category, species, threshold, or pin must be an INSERT into PG, not a code edit. Counts, grouping labels, thresholds and pins must all be PG-backed (doc 12 enforces this).

F. Which objects are COMMIT-READY (read-only layer, macro P1)

All six compiled and behaved under live BEGIN..ROLLBACK and rolled back clean (doc 04). They are pure read-layer over existing tables (no base-table change, no data change):

  1. v_registry_leaf_set — 160 leaf rows
  2. v_count_integrity — per-row integrity, scalar-EXISTS pivot backing (no fan-out)
  3. v_count_drift — the 3 drift exceptions
  4. v_living_lists — every registry as a list + backing pivot / PIVOT_MISSING
  5. v_registries_pivot_tree — drilldown graph (flat until parent_code wired)
  6. fn_registries_pivot_node_substrate(text) — leaf substrate resolver

G. What remains GATED (NOT in this ask)

  • PIV-500 / PIV-30x / PIV-31x missing pivots (RG3 / P5)
  • parent_code drilldown wiring + meta_catalog.pivot_code mapping column (P-DRILL)
  • threshold registry display_policy (RG5 / P7)
  • registry_pin new table (RG5 + Đ32 / P8)
  • phantom law definition (RG4 — LAW_DEFINITION_GAP, council)
  • Directus/API exposure (P2) · static UI preview (P3) · Nuxt render-shell (P4) · legacy retirement (P4) · notification/cleanup (P9)

H. Readiness-gate status (RG1–RG8, from design doc 12 / P0-P1 doc 10)

gate condition (verbatim) state
RG1 Master Design v0.1 ratified by human/council NOT ratified — awaits this packet
RG2 Count-integrity P0 accepted (invariant+leaf-scope+drift) designed + evidenced GREEN; awaits accept
RG3 Missing pivots classified (PIV-500/30x/31x/32x) ledger complete; awaits accept
RG4 Phantom definition accepted OR deferred (LAW_DEFINITION_GAP) sharpened (unreliable def); needs council
RG5 Label/pin registry strategy accepted (registry_pin NEW; labels REUSE Đ24) designed + rehearsed; awaits accept
RG6 UI contract accepted (Đ28 render-shell) designed; awaits accept
RG7 No-hardcode test plan accepted designed; awaits accept
RG8 Rollback plan accepted (Đ30 additive-only, BEGIN..ROLLBACK first) proven (doc 04); awaits accept
None accepted. Self-approval forbidden.

I. EXACT APPROVAL WORDING (for the human/council to sign)

Copy, choose APPROVE/DEFER/REJECT per line, sign with name + role + date. An agent MUST NOT fill these in.

RATIFICATION — REGISTRIES-PIVOT RG1 + RG2 — <date>
Ratifier: <name> / <role>  (Đ32: must be human/council; not an agent)

RG1  Master Design v0.1 ratified ...................... [ APPROVE / DEFER / REJECT ]
RG2  Count-integrity model accepted (leaf-scope+invariant+drift, live +132) [ APPROVE / DEFER / REJECT ]

Unlocks macro P1 — COMMIT of the read-only view/function layer (objects 1–6, doc 03):
  v_registry_leaf_set ................................. [ APPROVE / DEFER ]
  v_count_integrity (scalar-EXISTS form) .............. [ APPROVE / DEFER ]
  v_count_drift ....................................... [ APPROVE / DEFER ]
  v_living_lists ...................................... [ APPROVE / DEFER ]
  v_registries_pivot_tree ............................. [ APPROVE / DEFER ]
  fn_registries_pivot_node_substrate(text) ........... [ APPROVE / DEFER ]

Explicitly DEFERRED to later gates (not approved here):
  missing pivots PIV-500 / PIV-30x / PIV-31x .......... [ DEFER to RG3/P5 ]
  parent_code / pivot_code drilldown mapping .......... [ DEFER to P-DRILL ]
  threshold registry (display_policy) ................. [ DEFER to RG5/P7 ]
  registry_pin (new table) ............................ [ DEFER to RG5/P8 ]
  phantom policy (law definition) ..................... [ DEFER to RG4 council ]

Condition: COMMIT off-peak only; re-run the BEGIN..ROLLBACK rehearsal immediately
before COMMIT and confirm the invariant reproduces; rollback script 999 staged.
Signature: ____________________   Date: __________

J. Rollback statement (Đ30)

Every object is additive and read-only (5 views + 1 STABLE function over existing tables). COMMIT changes no base table and no row. Reversal = 999_rollback.sql (DROP … IF EXISTS in reverse dependency order). The pre-commit rehearsal proves clean teardown (0 leftover objects, 0 idle-in-transaction). No forward-only migration; no data transformation.

K. Risk statement

risk severity mitigation
Numbers move between ratify and commit low Re-run rehearsal at commit; views compute live (no frozen numbers)
CREATE OR REPLACE VIEW column drift on re-run low First commit is fresh; 999 drops cleanly; CI diff (P10)
pivot coverage only 21/160 (PIVOT_MISSING 139) medium Honest flag, not hidden; resolved by PIV-500/30x (P5), not by faking counts
Reviewers anchor on stale +36,783 medium §B flags the collapse to +132 explicitly
Heavier-than-expected lock on commit low SET LOCAL lock_timeout=3s; off-peak; objects touch no base table DDL
Self-approval pressure (large macro) Hard rule: agent produced commit-ready pack only; this packet is the human gate
Back to Knowledge Hub knowledge/dev/reports/architecture/registries-pivot-ratification-commit-ready-gateway-2026-05-31/02-ratification-packet.md