Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(control-api): preserve context spec.displayName on mcp-server uninstall allowlist prune (R4-B5)
Diego Zacariasd7883d180559
diff --git a/control-api/package-lock.json b/control-api/package-lock.jsonindex dc1df7cd9..f72bfaab7 100644--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-api",- "version": "0.1.443",+ "version": "0.1.444","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.443",+ "version": "0.1.444","dependencies": {"@clerum/image-policy": "file:../packages/image-policy","@clerum/llm-providers": "file:../packages/llm-providers",diff --git a/control-api/package.json b/control-api/package.jsonindex df2fba24e..cad177848 100644--- a/control-api/package.json+++ b/control-api/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-api",- "version": "0.1.443",+ "version": "0.1.444","description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets","main": "dist/main.js","engines": {diff --git a/control-api/src/routes/admin/registry.ts b/control-api/src/routes/admin/registry.tsindex 2d937d6ca..eebcbf747 100644--- a/control-api/src/routes/admin/registry.ts+++ b/control-api/src/routes/admin/registry.ts@@ -1642,7 +1642,11 @@ export function createAdminRegistryRouter(gateway?: K8sGateway): Router {try {const ctxList = (await gateway.listResource('contexts', namespace)) as Array<{metadata?: { name?: string }- spec?: { contextId?: string; description?: string; mcpServers?: string[] }+ spec?: Record<string, unknown> & {+ contextId?: string+ description?: string+ mcpServers?: string[]+ }}>for (const ctx of ctxList) {const name = ctx.metadata?.name@@ -1653,8 +1657,8 @@ export function createAdminRegistryRouter(gateway?: K8sGateway): Router {name,{spec: {+ ...ctx.spec,contextId: ctx.spec?.contextId ?? name,- description: ctx.spec?.description,mcpServers: servers.filter(s => s !== resourceName),} as Record<string, unknown>,},diff --git a/control-api/test/routes.registryInstall.test.ts b/control-api/test/routes.registryInstall.test.tsindex 008ff53b2..ea3d49886 100644--- a/control-api/test/routes.registryInstall.test.ts+++ b/control-api/test/routes.registryInstall.test.ts@@ -2845,6 +2845,38 @@ describe('DELETE /admin/registry/uninstall/:serverName', () => {await request(app).delete('/admin/registry/uninstall/INVALID').expect(400)})++ it('uninstalling an McpServer preserves spec.displayName on referencing contexts (R4-B5)', async () => {+ const gw = new MockGateway('mcp-server')+ await gw.createResource('mcpservers', {+ metadata: { name: 'srv-target' },+ spec: { image: 'test:1.0' },+ })+ // Context references the server being uninstalled AND carries displayName —+ // the additive field the allowlist-pruning rebuild must not drop.+ await gw.createResource('contexts', {+ metadata: { name: 'ctx-keep' },+ spec: {+ contextId: 'ctx-keep',+ mcpServers: ['srv-target', 'srv-other'],+ displayName: 'Keep Me',+ },+ })+ // Suppress makeApp's default installed-srv/ctx1 seed so the store holds only+ // the fixtures this assertion cares about.+ ;(gw as unknown as { _seeded?: boolean })._seeded = true+ const { app } = makeApp(gw)++ await request(app).delete('/admin/registry/uninstall/srv-target').expect(200)++ // Observable result (T4): re-read the persisted context. displayName survived+ // and only the uninstalled server left the allowlist.+ const ctx = (await gw.getResource('contexts', 'ctx-keep', 'mcp-server')) as {+ spec: { displayName?: string; mcpServers?: string[] }+ }+ expect(ctx.spec.displayName).toBe('Keep Me')+ expect(ctx.spec.mcpServers).toEqual(['srv-other'])+ })})// ── Upgrade flow (§9.4) ─────────────────────────────────────────────────────