docs(master-controls): list all 4 seeded mapping tables + sentinel caveat
CI / detect-changes (push) Successful in 18s
CI / branch-name (push) Has been skipped
CI / guardrail-integrity (push) Has been skipped
CI / secret-scan (push) Has been skipped
CI / dep-audit (push) Has been skipped
CI / sbom-scan (push) Has been skipped
CI / build-sha-integrity (push) Successful in 7s
CI / validate-canonical-controls (push) Successful in 15s
CI / loc-budget (push) Successful in 17s
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / nodejs-build (push) Successful in 2m27s
CI / test-go (push) Has been skipped
CI / iace-gt-coverage (push) Has been skipped
CI / test-python-backend (push) Has been skipped
CI / test-python-document-crawler (push) Has been skipped
CI / test-python-dsms-gateway (push) Has been skipped

The guard probes mc_use_case_mappings as the existence sentinel, but the route
also queries mc_verification, mc_regulations and mc_use_case_sync_state. Document
that they are seeded together and that a half-seeded DB (sentinel present, a
sibling missing) still 500s on the sibling's queries.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-06-10 16:10:34 +02:00
parent 3e2bd91209
commit a064933c1f
@@ -15,10 +15,13 @@ const pool = new Pool({ connectionString: dbUrl })
let metaCache: { at: number; data: unknown } | null = null
const META_TTL_MS = 120_000
// The use-case mapping tables (mc_use_case_mappings/mc_verification/mc_regulations)
// are seeded per-environment and may not exist yet on a fresh/unseeded DB. Guard
// every mapping query so the route degrades to empty filters instead of a 500.
// Cached with a short TTL so it picks up the tables once that DB gets seeded.
// The use-case mapping tables (mc_use_case_mappings, mc_verification,
// mc_regulations, mc_use_case_sync_state) are seeded together per-environment
// and may not exist yet on a fresh/unseeded DB. We probe mc_use_case_mappings as
// the existence sentinel and guard every mapping query so the route degrades to
// empty filters instead of a 500. Short TTL so it picks up the tables once seeded.
// NB: the sentinel assumes the siblings are seeded together — a half-seeded DB
// (mappings present but e.g. mc_regulations missing) would still 500 on those.
let mappingTablesCache: { at: number; present: boolean } | null = null
async function hasMappingTables(): Promise<boolean> {
if (mappingTablesCache && Date.now() - mappingTablesCache.at < 300_000) {