Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(control-api): assert fail-closed grant-gate logging in grantGate test (R1-B3)
Diego Zacariasb49cc4e7d5f7
diff --git a/control-api/package-lock.json b/control-api/package-lock.jsonindex ef2da0e91..b912e773f 100644--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-api",- "version": "0.1.508",+ "version": "0.1.509","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.508",+ "version": "0.1.509","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/image-policy": "file:../packages/image-policy",diff --git a/control-api/package.json b/control-api/package.jsonindex 1d80aea3f..3b32a33e1 100644--- a/control-api/package.json+++ b/control-api/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-api",- "version": "0.1.508",+ "version": "0.1.509","description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets","main": "dist/main.js","engines": {diff --git a/control-api/test/services.access.mcpInvocable.grantGate.test.ts b/control-api/test/services.access.mcpInvocable.grantGate.test.tsindex 4f8f2d586..b6abe3dba 100644--- a/control-api/test/services.access.mcpInvocable.grantGate.test.ts+++ b/control-api/test/services.access.mcpInvocable.grantGate.test.ts@@ -19,8 +19,10 @@ vi.mock('../src/oauth/store.js', async importActual => {})// The resolver logs the fail-closed exclusion through the pino child logger-// (`rootLogger.child({ module: 'mcp-connectors' })`), not console.*. Capture the-// child's `.error` so the fail-closed-logging assertion survives the migration.+// (`rootLogger.child({ module: 'mcpInvocable' })` — see mcpInvocable.ts:41,286),+// not console.*. Capture the child's `.error` so the fail-closed-logging+// assertion is real (the mock's child ignores its bindings, so every module+// child shares this one `error` spy).const loggerMock = vi.hoisted(() => {const error = vi.fn()const noop = vi.fn()@@ -262,9 +264,15 @@ describe('resolveInvocableMcpServersForContexts — fail-closed + non-oauth', ()const out = await resolveInvocableMcpServersForContexts(g, NS, ['ctx-1'], CALLER, DB)// Observable outcome (T4): 'broken' excluded (fail-closed on its DB error),- // 'plain' (none) + 'good' survive. Sorted. The exclusion is also logged- // loudly via the module's pino logger (silent in tests) — an implementation- // detail we no longer assert on directly.+ // 'plain' (none) + 'good' survive. Sorted.expect(names(out)).toEqual(['good', 'plain'])+ // Fail-closed exclusions must be LOUD: the DB error on 'broken' is logged+ // via the module's pino child `log.error` (mcpInvocable.ts:286). Assert it+ // fires with the offending server + err, so a silent-swallow regression+ // (dropping the log.error) turns this test red.+ expect(loggerMock.error).toHaveBeenCalledWith(+ expect.objectContaining({ mcpServerName: 'broken', err: expect.any(Error) }),+ expect.stringContaining('grant-presence check failed')+ )})})