KB-4888

12 — No-Hardcode & Pivot-Only Evidence (Đ26/Đ28)

4 min read Revision 1
registries-pivotno-hardcodepivot-onlydieu26dieu28evidenceci-lint2026-05-31

title: 12 — No-Hardcode & Pivot-Only Evidence (Đ26/Đ28) date: 2026-05-31

12 — No-Hardcode & Pivot-Only Evidence

A. This macro's own artifacts — no hardcode

artifact evidence
display_policy ceiling resolved from PG via COALESCE(dp.max_ungrouped, default)no literal 50 in app; the only 50 is the PG CHECK (<=50) and the seed row value
leaf set keys on composition_level/entity_type predicates — no hardcoded CAT list
pivot-backing scalar EXISTS on registry_collection = source_object — data-driven
drift classification source_model-aware CASE — no hardcoded code list
drilldown tree from parent_code (UPDATE existing col) — no frontend hierarchy
label groups GROUP BY label_code (PIV-311) — 23 groups discovered, not enumerated
pins PG registry_pin rows — no localStorage, no hardcoded pin list
preview data.json generated from live read snapshot, every number tagged source/PROPOSED/LEGACY

B. Legacy violations located (the cleanup target — grepped live)

server/api/registry/health.get.ts:123  totalGap = collections.reduce((s,c)=>s+Math.abs(c.gap),0)   ← Σ|gap|
server/api/registry/health.get.ts:117  collections.sort((a,b)=>Math.abs(b.gap)-Math.abs(a.gap))
server/api/registry/health.get.ts:~106 status: gap===0?'KHOP':gap>0?'ORPHAN':'PHANTOM'             ← JS classify, source-model-blind
server/api/registry/raw-counts.get.ts:58  total_records = entries.reduce((s,e)=>s+(e.record_count||0),0)
pages/knowledge/registries/index.vue:266-320  hardcoded virtual rows CAT-ORP/CAT-PHA/CAT-UNM/CAT-017
pages/knowledge/registries/index.vue:271  orphan_count: hd.totalGap                                 ← Σ|gap| as orphan
pages/knowledge/registries/index.vue:162  orphan_count: levelDetails.reduce((s,d)=>s+d.orphan_count,0)
pages/knowledge/registries/index.vue:595/598  v-if row.code === 'CAT-017' / 'CAT-SPE'               ← template hardcode

GOOD reference (NOT a violation): server/api/registry/pivot-query.get.ts — reads pivot_definitions/pivot_results via Directus, no count math, no VIEW_MAP.

C. The disagreeing totals (why pivot-only matters)

Six different "totals" are live today, all from non-pivot math: PIV-500 leaf Σrecord 2,007,288 (proposed truth) · leaf Σactual 2,001,909 · /api/registry/counts 1,726,581 · CAT-ALL.record 1,725,206 · CAT-ALL.actual 2,003,754 · /api/registry/health Σ|gap| 991,501. One pivot (PIV-500) replaces all of them.

D. CI no-hardcode gate (specified, doc 09/10)

A build-fail grep gate for the converged surface:

FAIL if grep -E "reduce\([^)]*\+[^)]*(gap|record_count)" web/{pages,server}
FAIL if grep -E "Math\.abs\([^)]*gap" web/{pages,server}
FAIL if grep -E "code:\s*'CAT-[A-Z0-9]+'" web/pages/knowledge/registries-pivot
FAIL if grep -E "localStorage.*pin" web/{pages,components}

Expected: legacy surface FAILS (8 hits); converged surface must be 0 before RG9 cutover.

E. Pivot-only proof points (engine-real, Macro 1 + this run)

  • PIV-500 view-backed grouped-sum returns a genuine SUM (2,007,261), not count(*).
  • PIV-311 native grouped-count = 23 groups Σ726,864.
  • v_count_integrity invariant closes (Σ drift == net_gap) — no SQL double-count.

Verdict

No-hardcode evidence COMPLETE: this macro's artifacts are clean; legacy violations are located with file:line; the CI gate is specified; pivot-only is engine-proven.

Back to Knowledge Hub knowledge/dev/reports/architecture/registries-pivot-macro2-3-combined-ui-api-legacy-acceptance-2026-05-31/12-no-hardcode-evidence.md