Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(control-api): make the client_id conflict tests catch a dropped issuer
Jose Gabriel Ramirez Encinas36fdf0d445db
diff --git a/control-api/package-lock.json b/control-api/package-lock.jsonindex 01737ff3c..410d40131 100644--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-api",- "version": "0.1.708",+ "version": "0.1.709","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.708",+ "version": "0.1.709","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/grok-provider-attempt-contract": "file:../packages/grok-provider-attempt-contract",diff --git a/control-api/package.json b/control-api/package.jsonindex 977307bf8..1091a6ed3 100644--- a/control-api/package.json+++ b/control-api/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-api",- "version": "0.1.708",+ "version": "0.1.709","description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets","main": "dist/main.js","engines": {diff --git a/control-api/test/fixtures/remoteOAuthDiscovery.ts b/control-api/test/fixtures/remoteOAuthDiscovery.tsindex 5662bad53..9966223b6 100644--- a/control-api/test/fixtures/remoteOAuthDiscovery.ts+++ b/control-api/test/fixtures/remoteOAuthDiscovery.ts@@ -643,8 +643,14 @@ export function makeInMemoryDynamicClientsDb(): {}return { rows: [], rowCount: 0 }}- if (text.includes('FROM dynamic_clients') && text.includes('client_id = $3')) {+ if (+ text.includes('FROM dynamic_clients') &&+ text.includes('client_id = $3') &&+ text.includes('AND issuer = $4')+ ) {// Existence by (issuer, client_id) within a namespace (pre-registered uniqueness).+ // Matched on the issuer predicate too: a query that dropped it must not be+ // answered as if it still filtered by issuer.const [owner_kind, server_namespace, client_id, issuer] = valuesconst hit = [...rows.values()].some(row =>diff --git a/control-api/test/routes.adminRemoteMcp.test.ts b/control-api/test/routes.adminRemoteMcp.test.tsindex f77892d00..a0df75838 100644--- a/control-api/test/routes.adminRemoteMcp.test.ts+++ b/control-api/test/routes.adminRemoteMcp.test.ts@@ -2374,6 +2374,38 @@ describe('POST /admin/mcp-servers/remote — per-server callback (AS without RFCexpect(res.status).toBe(201)})+ // The conflict is keyed on the AS issuer, never on the protected resource: with the+ // two distinct, only the issuer can find the first server's client.+ it('I17 conflicts on the issuer even when the resource differs from it → 409', async () => {+ const gw = gatewayWithContext('ctx-a')+ const { db } = makeInMemoryDynamicClientsDb()+ const distinctResource: DiscoveryResult = {+ ...notionResult,+ resource: 'https://mcp.notion.com/mcp',+ }+ expect(distinctResource.resource).not.toBe(distinctResource.issuer)+ expect(+ (await installPreRegistered(gw, { db }, 'first-server', 'shared-cid', distinctResource))+ .status+ ).toBe(201)+ const res = await installPreRegistered(+ gw,+ { db },+ 'second-server',+ 'shared-cid',+ distinctResource+ )+ expect(res.status).toBe(409)+ expect(res.body).toMatchObject({ error: 'oauth_client_id_in_use', conflict: 'remote_server' })+ })++ it('I17 a different client_id at the same provider → 201', async () => {+ const gw = gatewayWithContext('ctx-a')+ const { db } = makeInMemoryDynamicClientsDb()+ expect((await installPreRegistered(gw, { db }, 'first-server', 'cid-one')).status).toBe(201)+ expect((await installPreRegistered(gw, { db }, 'second-server', 'cid-two')).status).toBe(201)+ })+it('I17 does not constrain a shared (RFC 9207) pre-registered install → 201', async () => {const gw = gatewayWithContext('ctx-a')const { db } = makeInMemoryDynamicClientsDb()