KB-40A7

12 — GPT MCP-Readable Checkpoint

4 min read Revision 1
architecturerpcheckpointmcp-readable2026-06-06

— 12 GPT MCP-READABLE CHECKPOINT (mirror of the canonical checkpoint)

MACRO: RP_PRODUCTION_API_OPERATOR_FIX — 2026-06-06. STATUS: PARTIAL. MODE: EXECUTION (delegated). LIVE MUTATION: DB YES (10 additive birth-neutral views), PROD NO.

LIVE TRUTH (vps.incomexsaigoncorp.vn, ~04:47 UTC): page / = 200; APIs 12 HEALTHY / 4 PARAM(400 by design) / 2 SERVER_ERROR(500) / 1 ROUTE_MISSING(404); plus refresh-counts GET 404 = POST-only.

3 REAL BREAKS + ROOT CAUSE + FIX:

  • /api/registry/pivot-query 500 = jsonb group_spec _neq -> Directus 11.5 400. FIX: drop jsonb filter, filter cross in JS. PROVEN LIVE 200/12-of-37. Patch patches/pivot-query.get.mjs (node --check ok). Existing route -> express hotfix eligible.
  • /api/registry/matrix 500 = 897,347 entity_labels via Directus REST limit=-1 in 512MB container, 15s fetch timeout -> 500 @ 28s. FIX: rpQuery over v_rp_entity_label_facet_counts (226,052 rows). Patch patches/matrix.get.mjs (node --check ok). Existing route -> express hotfix eligible.
  • /api/registries/index 404 = client/server drift (/knowledge/registries calls it; not mounted in s174). FIX: add handler (candidate patches/registries-index.get.ts) or repoint page. NEW route -> REBUILD required.

PIVOT_MISSING=14 = v_registries_pivot_node_contract.count_status='PIVOT_MISSING' (39 nodes=25 backed+14). Classes: 9 BY_DESIGN_TABLE_NO_SCALAR (PIV-101..106,201,202,203 have results, render as tables), 3 DATA_EMPTY_LEVEL (PIV-204/205/206 Material/Product/Building no entities), 2 RETIRE_PHANTOM (PIV-020 _uncategorized, MTX-TEST). Guard PASS_ALL_EXPLAINED. (Leaf-grain 138 from v_count_integrity also reported, not hidden.)

TOPOLOGY: nuxt incomex-nuxt image nuxt-ssr-local:s174 mem_limit 512m; bind-mount /opt/incomex/deploys/nuxt-output -> /app/.output (existing-route hotfix needs no rebuild; new route does); nginx proxies /api/registry|registries|registries-pivot + / to nuxt:3000; compose /opt/incomex/docker/docker-compose.yml; RP_PG_* env + rpQuery(sql) pg helper (exported rpQuery as m); Directus admin token NUXT_DIRECTUS_SERVICE_TOKEN.

DB: 10 views applied one tx RC=0, birth_registry 1,210,816 before==after. Views: v_rp_production_api_truth_status_v2, _failure_inventory, _ui_no_false_green_guard (BLOCKED, real_breaks=3), _route_mapping_status, v_rp_entity_label_facet_counts, v_rp_pivot_missing_inventory_v2, _resolution_plan (9/3/2), _no_false_green_guard (PASS), v_rp_production_api_smoke_expectation, v_rp_production_api_router_v2 (RED_ACTION_READY, self-flips GREEN on deploy). Rollback 99_rollback.sql.

SMOKE: rp-production-smoke.sh — ran vs current prod -> FAIL 3 breaks, exit 1 (proves detection). PASS expected post-deploy.

STAGED (VPS /opt/incomex/docs/mcp-writes/rp-production-api-fix-2026-06-06/): 01_apply.sql, 99_rollback.sql, rp-production-smoke.sh, rp-apply-hotfix.sh (express, auto-rollback), patches/{pivot-query.get.mjs, matrix.get.mjs, registries-index.get.ts}. Local: /Users/nmhuyen/{rp-production-smoke.sh, rp-apply-hotfix.sh}.

GOTCHAS: pg_schema MCP broken (use information_schema); write_file blocks .sh (write local + ssh push); KB no fenced code (WAF); DDL via ssh contabo -> docker exec -i postgres psql; nitro rpQuery export letter m is build-specific; nuxt container has no curl (use node); .output bind-mount = host-editable.

BLOCKER: operator restart/rebuild of incomex-nuxt (all-users SSR action; not self-authorized). Zero engineering blocker. NEXT: RP_PRODUCTION_DEPLOY_AND_POSTFIX_SMOKE.

Back to Knowledge Hub knowledge/dev/reports/architecture/rp-production-api-operator-fix-ui-truth-smoke-2026-06-06/12-gpt-mcp-readable-checkpoint.md