KB-2F69

11 — No-Hardcode Acceptance Tests (pivot-backed, Truth Check, coverage)

4 min read Revision 1
designregistries-pivotno-hardcodetestspivot-backeddieu28dieu31truth-checkcoverage-scanner2026-05-31

title: 11 — No-Hardcode Acceptance Tests date: 2026-05-31

11 — No-Hardcode Acceptance Tests

Enforces: no frontend hardcode or disguised hardcode; every count pivot-backed or PIVOT_MISSING; labels/layers/pins/thresholds are PG data. Reuses live system_issues types hardcode_violation / hc_finding_sql|builtin|function (Đ28) + Đ28 Test-4 + §VIII coverage scanner + Đ31 contracts.

Principle

The surface is a reflection of PG. Nuxt holds no numbers, thresholds, label arrays, layer depths, or pin state. Anything baked into web/ is a violation.

Test catalogue (design — to run as governed checks)

id asserts fail ⇒
T-COUNT-1 every displayed count = a pivot_count/pivot_query result, or rendered PIVOT_MISSING hardcode_violation
T-COUNT-2 no client arithmetic on counts (no reduce(Σ), no Math.abs(gap)) — health.get.ts totalGap/orphan_count=21,823 is the canonical anti-example hardcode_violation (Đ28)
T-COUNT-3 the accounting invariant is computed over the leaf set, never a blind SUM over all meta_catalog rows (doc 05) false-clean / count_integrity_failed
T-COUNT-4 (Đ28 Test-4 Truth Check) 100% of rendered cells == PG, 0 wrong parity fail
T-LABEL-1 every label_ref resolves to a live taxonomy/label_rules row hardcode_violation
T-LABEL-2 max_ungrouped_threshold read from PG per species; literal 50 in web/ is a violation hardcode_violation
T-LABEL-3 no literal label/category arrays in web/ (grep CAT-PHA/CAT-ORP/CAT-UNM/CAT-SPE, phantom/unmapped lists) hardcode_violation
T-DRILL-1 every node with children_count>1 resolves a next_pivot_code or final_substrate_ref structural dead-end
T-DRILL-2 no Nuxt depth/level branching (level === N, fixed layer arrays) — depth is data hardcode_violation
T-PIN-1 pin_state derives from registry_pin (PG); no localStorage/in-memory pin arrays hardcode_violation
T-SELF-1 every NEW registry (registry_pin, label dims) is itself in meta_catalog + has a pivot thiếu_mã_định_danh
T-COVERAGE-1 (Đ28 §VIII) every registries-pivot route maps to a registered active template; 0 outside registry coverage<100%
T-CONTRACT-1 (Đ31) the count-integrity check is registered as a Đ31 self-verification contract with a watchdog contract missing

PIVOT_MISSING ledger (cells that must be pivots, never Nuxt math)

PIV-500 grand-total · PIV-30x orphan/phantom/drift · PIV-31x label-by-facet · PIV-32x pin · IU 219 / KG 2,259 totals. Until each exists the cell renders PIVOT_MISSING + next_action=propose_pivot.

Anti-pattern of record (to retire — Đ28 violation)

web/server/api/registry/health.get.ts: totalGap = collections.reduce((s,c)=>s+Math.abs(c.gap),0)orphan_count = 21,823 injected into index.vue; CAT-PHA=7/CAT-UNM=122 computed in the API. Disguised hardcode (frontend math masquerading as a count) — exactly what T-COUNT-2/T-LABEL-3 catch. The converged surface replaces these with pivot reads + PIVOT_MISSING.

How tests run (design)

  • CI/static: grep-class checks for literal arrays, reduce/Math.abs on counts, hardcoded thresholds, level-branching → write hardcode_violation to system_issues.
  • Runtime parity: Đ28 Test-4 compares rendered cells to PG (sampled) → Truth Check.
  • Coverage: DOT-template-coverage scan → 0 routes/components outside the Đ28 registry.
  • Self-verification: fn_count_integrity_check() registered under Đ31 with a watchdog cadence. None executed this session (design-only).