KB-79A3

06 — Count Drift Reconciliation (3 drift rows + 5 unmeasured, classified)

5 min read Revision 1
registries-pivotdriftreconciliationsource-modelno-mutation2026-05-31

title: 06 — Count Drift Reconciliation date: 2026-05-31 mutation: none (classification only)

06 — Count Drift Reconciliation

Leaf-scoped, live 2026-05-31. net_gap +132, fully explained by 3 drift rows (drift closure proven). 5 leaf rows are unmeasured. No rows mutated.

Classification vocabulary

stale_record_count · stale_actual_count · missing_pivot · missing_leaf_rule · orphan_candidate · phantom_candidate · source_model_requires_definition. Fix-type ∈ {data refresh, pivot creation, law decision, row retirement, registry backfill}.

The 3 drift rows

CAT-006 — DOT Tools (model B, File:dot/bin/)

  • record 309 · actual 163 · pivot_count 309 (PIV-007) · surplus record_over_actual +146
  • classification: phantom_candidate (model_b_phantom_candidate) + source_model_requires_definition
  • reading: 309 registered DOT rows, 163 files on disk → 146 registry rows with no backing file. (≈ CAT-DOT rollup orphan 140.) The pivot counts the table (309), not the files (163).
  • proposed fix: law decision (RG4/P6 — define model-B phantom = "registry row whose file is absent") THEN row retirement / re-onboarding of the 146; reconcile CAT-006 ↔ CAT-DOT to one canonical CAT + PIV-007. NOT a blind delete.

CAT-007 — Pages/Routes (model B, File:web/pages/)

  • record 37 · actual 52 · pivot (PIV-008 source ui_pages) · surplus actual_over_record −15
  • classification: orphan_candidate (model_b_unregistered_candidate)
  • reading: 52 page files on disk, only 37 registered → 15 UNREGISTERED pages (Đ23 §4.2).
  • proposed fix: registry backfill — onboard the 15 pages (birth → register), then record=actual.

CAT-023 — Sổ khai sinh / birth_registry (model A, Directus)

  • record 985,472 · actual 985,471 · pivot_count 985,472 (PIV-019) · surplus record_over_actual +1
  • classification: model_a_surplus_rechecklive-write race (1 row inserted between the record snapshot and the actual scan). NOT phantom.
  • reading: this row carried the old +36,652 stale gap (record 980,378 vs stale actual 943,726); the 01:33 scan refreshed actual to 985,471. Residual +1 is noise.
  • proposed fix: none / data refresh — accept ±small as race tolerance; or align record to the pivot at scan time. Do not treat as integrity failure.

The 5 unmeasured leaf rows (record & actual both NULL)

code name source_model classification fix
CAT-1006 APR action types pg_table missing_pivot / never_scanned pivot creation OR scan onboarding
CAT-1007 APR request types pg_table missing_pivot pivot creation
CAT-1008 APR approvals ledger pg_table missing_pivot pivot creation
CAT-1009 Admin fallback log pg_table missing_pivot pivot creation
CAT-1010 Law version verification log pg_table missing_pivot pivot creation
These render unverified / PIVOT_MISSING — correct, not hidden. Fix = add a pivot (or scan) so a count exists.

Rollup rows (NOT in leaf set — context only)

  • CAT-COL / CAT-DOT / CAT-SPE (composition_level='meta'): actual_count NULL, carry the 161 orphans (20/140/1). These are rollups; they must keep actual_count NULL or be measured by a dedicated rollup pivot — never summed into the leaf invariant.
  • CAT-ALL (entity_type='all', in atom): record 1,719,958 vs actual 2,003,754 (+283,796 internal disagreement). This is the grand-total row whose semantics PIV-500 must define; it is excluded from the leaf set by design.

Hidden-drift watch (record==actual but BOTH may be stale)

Where a row shows record==actual, that is "balanced" only if both equal the live pivot. Two historically-flagged candidates to re-check against live pivots at P5: entity_labels (live count 722,803) and system_issues (live ~180k). A row is only truly balanced when record == actual == pivot_count. Today 21/160 have a pivot to check against; the other 139 are balanced-by-scan only.

Reconciliation order (gated)

  1. P5: create PIV-500/30x/31x; map leaves to pivots; the 5 unmeasured get counts; hidden-drift checked.
  2. RG4/P6: phantom law → resolves CAT-006's 146.
  3. P-onboarding: backfill CAT-007's 15 unregistered pages.
  4. CAT-023 ±1 accepted as race. No row is mutated before its gate.
Back to Knowledge Hub knowledge/dev/reports/architecture/registries-pivot-ratification-commit-ready-gateway-2026-05-31/06-count-drift-reconciliation.md