KB-7119

09 — No-Hardcode Acceptance Rehearsal (Branch I)

5 min read Revision 1
registries-pivotno-hardcodebranch-idieu28gap-mathhealth-apilive-violationblocker2026-05-31

title: 09 — No-Hardcode Acceptance Rehearsal (Branch I) date: 2026-05-31 verdict: LIVE Đ28 violation confirmed serving in production (gap-math health API) → hard implementation blocker; tests defined

09 — No-Hardcode Acceptance Rehearsal (Branch I)

A. LIVE violation — the gap-math anti-pattern is STILL serving

GET https://vps.incomexsaigoncorp.vn/api/registry/health (HTTP 200, cachedAt 2026-05-31T01:04:29Z) returns per-collection frontend math, not pivots:

{"collection_name":"birth_registry","noi_chua":985434,"noi_sinh":0,"gap":985434,"status":"ORPHAN"}
{"collection_name":"dot_tools","noi_chua":309,"noi_sinh":592,"gap":-283,"status":"PHANTOM"}
{"collection_name":"system_issues","noi_chua":180087,"noi_sinh":180217,"gap":-130,"status":"PHANTOM"}
…
"totals":{"khop":11,"orphan":15,"phantom":10,"totalGap":986215}
  • gap = noi_chua − noi_sinh; status assigned by sign of gapbirth_registry flagged ORPHAN with 985,434 phantom-orphans (absurd: noi_sinh=0), dot_tools flagged PHANTOM with noi_sinh=592 — a fourth distinct DOT count (vs 309 table / 163 file / 307 CAT-DOT).
  • totalGap = Σ … = 986,215 — the canonical disguised-hardcode aggregate (Đ28 T-COUNT-2 anti-example).
  • /api/registry/counts returns a fifth-order discrepancy: a single grand total {"total":1688702} that matches none of CAT-ALL.record (1,682,270) / CAT-ALL.actual (1,919,748) / leaf Σrecord (1,954,686). → no canonical total_system_objects exists ⇒ PIV-500 mandatory.
  • /api/registries-pivot/health404 (the converged surface does not exist yet).
  • The compiled Nuxt SSR bundle (incomex-nuxt:/app/.output/server) contains totalGap, orphan_count || 0, orphan_count > 0 ? render logic → the frontend consumes/derives these counts.

This is a live, active Đ28 violation that mislabels the system's largest table as 985k orphans. It is a hard blocker for the converged surface and the canonical thing to WRAP→RETIRE behind pivot reads + PIVOT_MISSING.

B. Channel limitation (honest)

The Nuxt source (.vue/.ts, incl. web/server/api/registry/health.get.ts) is not on the server in readable form — only the compiled SSR output is in the image; the allowlisted read_file paths (/opt/incomex/docs|dot/specs|/var/log/nginx) do not include web/. So static source grep was done against the built bundle + the live API response (above), which is sufficient to prove the violation is deployed. Full per-file static scan requires the source repo (next macro M6 / CI).

C. Test catalogue (design — to run as governed checks; live status)

id asserts live status
T-COUNT-1 every count = pivot_count/pivot_query or PIVOT_MISSING FAIL (health API serves derived counts)
T-COUNT-2 no client arithmetic (reduce(Σ), Math.abs(gap)) FAIL (totalGap, sign-of-gap status live)
T-COUNT-3 invariant over leaf set, not blind SUM now satisfiable (doc 02/04); health API still blind
T-COUNT-4 (Đ28 Truth-Check) 100% rendered cells == PG not measurable until converged surface exists
T-LABEL-2 max_ungrouped_threshold from PG, not literal 50 GAP (no PG column — doc 06)
T-LABEL-3 no literal CAT-PHA/ORP/UNM/label arrays health API emits CAT-PHA-equivalent (status:PHANTOM)
T-DRILL-2 no Nuxt depth/level branching needs source scan (M6)
T-PIN-1 pin_state from PG, no local pin array N/A (no pin yet)
T-SELF-1 every NEW registry in meta_catalog + pivot applies to registry_pin (doc 07)
T-COVERAGE-1 every route → registered Đ28 template; 0 outside /api/registries-pivot/* not built (404)
T-CONTRACT-1 count-integrity registered as Đ31 self-verification + watchdog not yet (NEW, doc 04)

D. Tests needed (to add)

  • CI/static grep over the source repo: literal CAT-*/label arrays, reduce/Math.abs on counts, hardcoded 50/thresholds, level === N depth branching, localStorage pin arrays → write hardcode_violation/hc_finding_* to system_issues (types already exist).
  • Runtime parity (Đ28 Test-4): sample rendered cells vs PG.
  • Coverage scan: DOT-template-coverage → 0 routes/components outside the Đ28 registry.
  • Self-verification: register fn_count_integrity_check() under Đ31 with a watchdog cadence.

E. Implementation-blocker status

BLOCKER = YES for production Nuxt. The converged surface cannot ship while /api/registry/health gap-math is the count source. Retirement must be gated behind the pivot replacements being live (PIV-500/30x + v_count_integrity), so no number disappears before its pivot exists (Đ28 §retire-after-replace).

Back to Knowledge Hub knowledge/dev/reports/architecture/registries-pivot-p0-p1-count-integrity-view-rehearsal-2026-05-31/09-no-hardcode-acceptance-rehearsal.md