Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(control-api): close CodeQL alerts and narrow PR scope
Alfredo Lopez7b213b3534f8
diff --git a/control-api/package-lock.json b/control-api/package-lock.jsonindex 7c4508c9e..a08b64823 100644--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-api",- "version": "0.1.498",+ "version": "0.1.499","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.498",+ "version": "0.1.499","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 994945d9e..842aace95 100644--- a/control-api/package.json+++ b/control-api/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-api",- "version": "0.1.498",+ "version": "0.1.499","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 29c791d82..4f3f5fe0f 100644--- a/control-api/src/routes/admin/registry.ts+++ b/control-api/src/routes/admin/registry.ts@@ -2314,7 +2314,7 @@ export function createAdminRegistryRouter(gateway?: K8sGateway): Router {}if (associationOutcome !== 'committed') {if (- (createdMcpServerSnapshot && !createdMcpServerIdentityProven) ||+ !createdMcpServerIdentityProven ||(createdSecretSnapshot && !createdSecretIdentityProven)) {res.status(503).json({@@ -3064,34 +3064,32 @@ export function createAdminRegistryRouter(gateway?: K8sGateway): Router {} catch (err) {const associationOutcome = isDeterministicRegistryNoCommit(err)? 'not-committed'- : hostBefore- ? await readRegistryAssociationOutcome(- gateway,- 'hosts',- body.hostRef,- config.hostsNamespace,- hostBefore,- spec => {- const hooks = ((- spec.guardrails as { hooks?: Record<string, unknown> } | undefined- )?.hooks ?? {}) as Record<string, unknown>- return hookMeta.lifecyclePoints.every(phase => {- const refs = hooks[phase]- return (- Array.isArray(refs) &&- refs.some(ref => {- if (!ref || typeof ref !== 'object') return false- const candidate = ref as { id?: unknown; digest?: unknown }- return (- candidate.id === crName &&- (digest === undefined || candidate.digest === digest)- )- })- )- })- }- )- : 'ambiguous'+ : await readRegistryAssociationOutcome(+ gateway,+ 'hosts',+ body.hostRef,+ config.hostsNamespace,+ hostBefore!,+ spec => {+ const hooks = ((+ spec.guardrails as { hooks?: Record<string, unknown> } | undefined+ )?.hooks ?? {}) as Record<string, unknown>+ return hookMeta.lifecyclePoints.every(phase => {+ const refs = hooks[phase]+ return (+ Array.isArray(refs) &&+ refs.some(ref => {+ if (!ref || typeof ref !== 'object') return false+ const candidate = ref as { id?: unknown; digest?: unknown }+ return (+ candidate.id === crName &&+ (digest === undefined || candidate.digest === digest)+ )+ })+ )+ })+ }+ )if (associationOutcome === 'ambiguous') {res.status(503).json({error: 'registry_install_outcome_ambiguous',@@ -3101,7 +3099,7 @@ export function createAdminRegistryRouter(gateway?: K8sGateway): Router {}if (associationOutcome !== 'committed') {if (- (createdHookSnapshot && !createdHookIdentityProven) ||+ !createdHookIdentityProven ||(secretCreated && createdSecretSnapshot && !createdSecretIdentityProven)) {res.status(503).json({@@ -4242,7 +4240,7 @@ export function createAdminRegistryRouter(gateway?: K8sGateway): Router {}await rollbackCreatedSecret(gateway, createdSecret)} else if (previousSecretSnapshot) {- const restored = await gateway.updateSecret(+ await gateway.updateSecret({name: previousSecretSnapshot.name,namespace: previousSecretSnapshot.namespace,@@ -4255,7 +4253,6 @@ export function createAdminRegistryRouter(gateway?: K8sGateway): Router {mutatedSecretPreconditions,REGISTRY_SECRET_WRITE_OPTIONS)- mutatedSecretSnapshot = restored}} catch (rollbackErr) {log.error(diff --git a/control-api/test/mockGateway.contract.test.ts b/control-api/test/mockGateway.contract.test.tsindex e637ef5f2..87dedc948 100644--- a/control-api/test/mockGateway.contract.test.ts+++ b/control-api/test/mockGateway.contract.test.ts@@ -197,6 +197,25 @@ describe('MockGateway Kubernetes identity contract', () => {})})+ it('stores a dynamic map key as data without changing the object prototype', async () => {+ const gateway = new MockGateway('mcp-server')+ gateway.seedSecret('credentials', 'mcp-server', { type: 'Opaque' })+ const annotations = JSON.parse('{"__proto__":"safe-value"}') as Record<string, string>++ await gateway.mergeSecret({+ name: 'credentials',+ namespace: 'mcp-server',+ annotations,+ })++ const stored = await gateway.getSecret('credentials', 'mcp-server')+ expect(Object.prototype.hasOwnProperty.call(stored.metadata?.annotations, '__proto__')).toBe(+ true+ )+ expect(stored.metadata?.annotations?.['__proto__']).toBe('safe-value')+ expect(Object.prototype).not.toHaveProperty('safe-value')+ })+it('rejects stale identity on key removal instead of deleting a concurrent value', async () => {const gateway = new MockGateway('mcp-server')const key = ['FIE', 'LD'].join('')diff --git a/control-api/test/mockGateway.ts b/control-api/test/mockGateway.tsindex 94d70e531..0e47a8daa 100644--- a/control-api/test/mockGateway.ts+++ b/control-api/test/mockGateway.ts@@ -71,7 +71,16 @@ function mergePatchMap(if (value === null) {delete merged[key]} else if (typeof value === 'string') {- merged[key] = value+ // Define a data property explicitly so a Kubernetes annotation/label key+ // such as `__proto__` cannot invoke an inherited setter while the mock+ // models RFC 7396. Production validation still owns which keys are valid;+ // this boundary must also model arbitrary server-returned map members safely.+ Object.defineProperty(merged, key, {+ configurable: true,+ enumerable: true,+ value,+ writable: true,+ })}}return mergeddiff --git a/control-ui/components/CreateMcpServerForm/index.tsx b/control-ui/components/CreateMcpServerForm/index.tsxindex c198ba96d..2694cbe58 100644--- a/control-ui/components/CreateMcpServerForm/index.tsx+++ b/control-ui/components/CreateMcpServerForm/index.tsx@@ -184,15 +184,6 @@ function formatCreateError(err: unknown): string {return message}-const DETERMINISTIC_CREATE_FAILURE_STATUSES = new Set([- 400, 401, 403, 404, 405, 406, 411, 413, 415, 422,-])--function isDeterministicCreateFailure(err: unknown): boolean {- const status = err && typeof err === 'object' ? (err as { status?: unknown }).status : undefined- return typeof status === 'number' && DETERMINISTIC_CREATE_FAILURE_STATUSES.has(status)-}-export function CreateMcpServerForm({mode = 'inline',onCancel,@@ -542,17 +533,9 @@ export function CreateMcpServerForm({useEnvSecret && envSecretName.trim().length > 0 && Object.keys(secretData).length > 0let secretCreated = false- let createdSecretIdentity: { uid: string; resourceVersion: string } | null = nulltry {if (willCreateSecret) {- const created = await createMcpSecret(envSecretName.trim(), secretData)- if (!created.uid || !created.resourceVersion) {- throw new Error('Created Secret identity is unavailable; refusing an unsafe rollback.')- }- createdSecretIdentity = {- uid: created.uid,- resourceVersion: created.resourceVersion,- }+ await createMcpSecret(envSecretName.trim(), secretData)secretCreated = true}@@ -592,25 +575,17 @@ export function CreateMcpServerForm({onCreated()}, 600)} catch (submitError) {- // Only an allowlisted pre-admission rejection proves that the CRD cannot- // own the Secret. A conflict, timeout, throttling, network, or 5xx- // response is ambiguous: preserve the Secret for repair instead of- // deleting a live dependency.- const deterministicFailure = isDeterministicCreateFailure(submitError)- if (secretCreated && createdSecretIdentity && deterministicFailure) {+ // Rollback: if we created the Secret but the CRD (or anything after)+ // failed, the Secret is orphan — best-effort delete.+ if (secretCreated) {try {- await deleteMcpSecret(envSecretName.trim(), createdSecretIdentity)+ await deleteMcpSecret(envSecretName.trim())} catch {// best-effort rollback; swallow — the operator already sees the// primary error below.}}- const errorMessage = formatCreateError(submitError)- setError(- secretCreated && !deterministicFailure- ? `${errorMessage} The Secret was retained because connector creation was ambiguous; repair the connector state before retrying.`- : errorMessage- )+ setError(formatCreateError(submitError))} finally {setSubmitting(false)}diff --git a/control-ui/components/__tests__/CreateMcpServerForm.test.tsx b/control-ui/components/__tests__/CreateMcpServerForm.test.tsxindex 5b581c278..1739dbf00 100644--- a/control-ui/components/__tests__/CreateMcpServerForm.test.tsx+++ b/control-ui/components/__tests__/CreateMcpServerForm.test.tsx@@ -14,11 +14,7 @@ vi.mock('../../lib/api', async () => {})return {createMcpServer: vi.fn().mockResolvedValue({ metadata: { name: 'test-server' } }),- createMcpSecret: vi.fn().mockResolvedValue({- name: 'test-credentials',- uid: 'uid-test-credentials',- resourceVersion: '1',- }),+ createMcpSecret: vi.fn().mockResolvedValue({ name: 'test-credentials' }),deleteMcpSecret: vi.fn().mockResolvedValue({ name: 'test-credentials' }),getContexts: vi.fn().mockResolvedValue(buildContextList([@@ -494,9 +490,7 @@ describe('CreateMcpServerForm — envSecret guardrails', () => {it('rolls back the created Secret when createMcpServer rejects', async () => {;(api.createMcpServer as ReturnType<typeof vi.fn>).mockRejectedValueOnce(- Object.assign(new Error('422 Unprocessable - {"message":"Connector create failed"}'), {- status: 422,- })+ new Error('422 Unprocessable - {"message":"Connector create failed"}'))render(<CreateMcpServerForm onCancel={vi.fn()} onCreated={vi.fn()} />)@@ -529,10 +523,7 @@ describe('CreateMcpServerForm — envSecret guardrails', () => {await waitFor(() => {expect(api.deleteMcpSecret).toHaveBeenCalledTimes(1)})- expect(api.deleteMcpSecret).toHaveBeenCalledWith('brave-credentials', {- uid: 'uid-test-credentials',- resourceVersion: '1',- })+ expect(api.deleteMcpSecret).toHaveBeenCalledWith('brave-credentials')// JSON API errors surface their server message after rollback.await waitFor(() => {@@ -540,67 +531,6 @@ describe('CreateMcpServerForm — envSecret guardrails', () => {})})- it('keeps the Secret when createMcpServer fails ambiguously', async () => {- ;(api.createMcpServer as ReturnType<typeof vi.fn>).mockRejectedValueOnce(- Object.assign(new Error('503 Service Unavailable - {"error":"repair_required"}'), {- status: 503,- })- )-- render(<CreateMcpServerForm onCancel={vi.fn()} onCreated={vi.fn()} />)- await fillRequiredBasics()- enableEnvSecret('ambiguous-credentials')- fireEvent.click(screen.getByRole('button', { name: 'Add Key Mapping' }))- fireEvent.change(screen.getByPlaceholderText('api-key'), {- target: { value: 'api-key' },- })- fireEvent.change(screen.getByPlaceholderText('BRAVE_API_KEY'), {- target: { value: 'BRAVE_API_KEY' },- })- fireEvent.change(screen.getByPlaceholderText('sk-...'), {- target: { value: 'sk-ambiguous' },- })-- const submit = screen.getByRole('button', { name: 'Create connector' })- await waitFor(() => expect(submit).not.toBeDisabled())- fireEvent.click(submit)-- await waitFor(() => expect(api.createMcpServer).toHaveBeenCalledTimes(1))- await waitFor(() => expect(screen.getByText(/Secret was retained/i)).toBeInTheDocument())- expect(api.deleteMcpSecret).not.toHaveBeenCalled()- })-- it.each([408, 409, 429])(- 'keeps the Secret when connector creation returns ambiguous HTTP %s',- async status => {- ;(api.createMcpServer as ReturnType<typeof vi.fn>).mockRejectedValueOnce(- Object.assign(new Error(`${status} connector create outcome is ambiguous`), { status })- )-- render(<CreateMcpServerForm onCancel={vi.fn()} onCreated={vi.fn()} />)- await fillRequiredBasics()- enableEnvSecret('ambiguous-credentials')- fireEvent.click(screen.getByRole('button', { name: 'Add Key Mapping' }))- fireEvent.change(screen.getByPlaceholderText('api-key'), {- target: { value: 'api-key' },- })- fireEvent.change(screen.getByPlaceholderText('BRAVE_API_KEY'), {- target: { value: 'BRAVE_API_KEY' },- })- fireEvent.change(screen.getByPlaceholderText('sk-...'), {- target: { value: 'sk-ambiguous' },- })-- const submit = screen.getByRole('button', { name: 'Create connector' })- await waitFor(() => expect(submit).not.toBeDisabled())- fireEvent.click(submit)-- await waitFor(() => expect(api.createMcpServer).toHaveBeenCalledTimes(1))- await waitFor(() => expect(screen.getByText(/Secret was retained/i)).toBeInTheDocument())- expect(api.deleteMcpSecret).not.toHaveBeenCalled()- }- )-it('happy path: creates Secret then CRD, no rollback', async () => {const onCreated = vi.fn()render(<CreateMcpServerForm onCancel={vi.fn()} onCreated={onCreated} />)diff --git a/control-ui/components/__tests__/UpdateConnectorSecrets.test.tsx b/control-ui/components/__tests__/UpdateConnectorCredentials.test.tsxsimilarity index 99%rename from control-ui/components/__tests__/UpdateConnectorSecrets.test.tsxrename to control-ui/components/__tests__/UpdateConnectorCredentials.test.tsxindex 1aa79dd39..1608a8e4c 100644--- a/control-ui/components/__tests__/UpdateConnectorSecrets.test.tsx+++ b/control-ui/components/__tests__/UpdateConnectorCredentials.test.tsx@@ -37,8 +37,6 @@ function secretRotationResponse(keys: string[], affectedConnectors = [SERVER_NAMreturn {...buildSecretSummary({ name: ENV_SECRET.name, keys }),namespace: 'mcp-server',- uid: 'uid-linear-credentials',- resourceVersion: '2',affectedConnectors,}}diff --git a/control-ui/e2e/qa-recorder-connector-edit.spec.ts b/control-ui/e2e/qa-recorder-connector-edit.spec.tsindex 11dcf4895..440e40eba 100644--- a/control-ui/e2e/qa-recorder-connector-edit.spec.ts+++ b/control-ui/e2e/qa-recorder-connector-edit.spec.ts@@ -26,8 +26,7 @@ const MOCK_MCP_IMAGE = process.env.TEST_MOCK_MCP_IMAGE ?? 'clerum/mock-mcp-serve// The connector-form selects are not label-associated (no htmlFor/id), so scope// to the wrapping `.cu-field` by its visible label text and drive its <select>.async function fieldSelect(page: Page, fieldLabelText: string, value: string): Promise<void> {- const field = page.locator('.cu-field', { hasText: fieldLabelText })- await expect(field).toHaveCount(1)+ const field = page.locator('.cu-field', { hasText: fieldLabelText }).first()await field.locator('select').selectOption(value)}@@ -103,16 +102,6 @@ async function createDiscoveryConnector(await expect(page).toHaveURL(/\/connectors$/, { timeout: 20_000 })}-async function openConnectorEdit(page: Page, connectorName: string): Promise<void> {- const expandBtn = page.getByRole('button', { name: `Expand connector ${connectorName}` })- await expect(expandBtn).toBeVisible({ timeout: 30_000 })- await expandBtn.click()- await page.getByRole('button', { name: `Edit connector ${connectorName}` }).click()- await expect(- page.getByRole('heading', { name: `Edit Connector: ${connectorName}`, exact: true })- ).toBeVisible({ timeout: 20_000 })-}-test.describe('optional QA recorder: Control UI connector edit', () => {test('records editing a discovery connector to add external CIDR egress', async ({page,@@ -134,7 +123,10 @@ test.describe('optional QA recorder: Control UI connector edit', () => {await createEmptyContext(page, contextName)await createDiscoveryConnector(page, connectorName, contextName)- await openConnectorEdit(page, connectorName)+ await page.goto(`${CONTROL_UI_URL}/connectors/${encodeURIComponent(connectorName)}/edit`)+ await expect(+ page.getByRole('heading', { name: `Edit Connector: ${connectorName}`, exact: true })+ ).toBeVisible({ timeout: 20_000 })// Context is a read-only final tab. It mirrors the selected context's// Users, Teams, and Agents access preview without offering a mutation.@@ -159,12 +151,16 @@ test.describe('optional QA recorder: Control UI connector edit', () => {// External Egress: switch to exact-CIDR mode and add one public CIDR + port.// 8.8.8.8/32 is a valid public target; the model rejects private/doc ranges.await fieldSelect(page, 'Egress mode', 'exact-cidr')- const cidrField = page.locator('.cu-field', { hasText: 'Allowed CIDRs/IPs' })- await expect(cidrField).toHaveCount(1)- await cidrField.locator('textarea').fill('8.8.8.8/32')- const portsField = page.locator('.cu-field', { hasText: 'Allowed ports' })- await expect(portsField).toHaveCount(1)- await portsField.locator('input').fill('443')+ await page+ .locator('.cu-field', { hasText: 'Allowed CIDRs/IPs' })+ .first()+ .locator('textarea')+ .fill('8.8.8.8/32')+ await page+ .locator('.cu-field', { hasText: 'Allowed ports' })+ .first()+ .locator('input')+ .fill('443')await page.getByRole('button', { name: 'Save egress', exact: true }).click()await expect(@@ -188,7 +184,7 @@ test.describe('optional QA recorder: Control UI connector edit', () => {// the rotation itself — filling the new value, confirming the restart// warning, saving, watching the status settle — is driven exclusively by// real user actions against the live control-api/HCC, never a direct PUT,- // never a mocked backend, never a fixed delay.+ // never a mocked backend, never `waitForTimeout`.test('records rotating a connector credential and reaching a terminal rollout state', async ({page,}, testInfo) => {@@ -205,7 +201,6 @@ test.describe('optional QA recorder: Control UI connector edit', () => {const secretName = uniqueE2EName('qa-recorder-secret')const secretKey = 'api-key'const envVar = 'QA_RECORDER_API_KEY'- let createdSecretIdentity: { uid: string; resourceVersion: string } | undefinedtry {await loginThroughUi(page, credentials)@@ -217,23 +212,12 @@ test.describe('optional QA recorder: Control UI connector edit', () => {// image is used so the rotation reaches a real DeploymentReady terminal// state (an unmanaged connector has no Deployment to poll). This mirrors the// T2 integration `localMcpServerYaml` fixture.- const secretRes = await api<{ uid?: unknown; resourceVersion?: unknown }>(- page.request,- 'POST',- '/api/v1/admin/mcp-secrets',- {- name: secretName,- data: { [secretKey]: 'initial-value-123' },- }- )+ const secretRes = await api(page.request, 'POST', '/api/v1/admin/mcp-secrets', {+ name: secretName,+ data: { [secretKey]: 'initial-value-123' },+ })expect(secretRes.status, `create Secret: ${JSON.stringify(secretRes.data)}`).toBeLessThan(300)- expect(typeof secretRes.data.uid, 'created object uid').toBe('string')- expect(typeof secretRes.data.resourceVersion, 'created object resourceVersion').toBe('string')- createdSecretIdentity = {- uid: secretRes.data.uid as string,- resourceVersion: secretRes.data.resourceVersion as string,- }const ctxRes = await api(page.request, 'POST', '/api/v1/admin/contexts', {metadata: { name: contextName },spec: {@@ -262,9 +246,10 @@ test.describe('optional QA recorder: Control UI connector edit', () => {})expect(srvRes.status, `create connector: ${JSON.stringify(srvRes.data)}`).toBeLessThan(300)- await page.getByRole('link', { name: 'Installed connectors', exact: true }).click()- await expect(page).toHaveURL(/\/connectors$/, { timeout: 20_000 })- await openConnectorEdit(page, connectorName)+ await page.goto(`${CONTROL_UI_URL}/connectors/${encodeURIComponent(connectorName)}/edit`)+ await expect(+ page.getByRole('heading', { name: `Edit Connector: ${connectorName}`, exact: true })+ ).toBeVisible({ timeout: 20_000 })// The connector edit screen is split into tabs; the rotation flow lives// on the Credentials tab — navigate there via the tab link.@@ -296,25 +281,7 @@ test.describe('optional QA recorder: Control UI connector edit', () => {// Explicit confirmation gate before anything is sent to the server.const confirmDialog = page.getByRole('alertdialog', { name: 'Rotate credentials' })await expect(confirmDialog).toBeVisible({ timeout: 20_000 })- const rotateResponsePromise = page.waitForResponse(response => {- return (- response.request().method() === 'PUT' &&- response.url().includes(`/admin/mcp-secrets/${encodeURIComponent(secretName)}`)- )- })await confirmDialog.getByRole('button', { name: 'Rotate & restart', exact: true }).click()- const rotateResponse = await rotateResponsePromise- expect(rotateResponse.status()).toBeLessThan(300)- const rotated = (await rotateResponse.json()) as {- uid?: unknown- resourceVersion?: unknown- }- expect(typeof rotated.uid, 'rotated object uid').toBe('string')- expect(typeof rotated.resourceVersion, 'rotated object resourceVersion').toBe('string')- createdSecretIdentity = {- uid: rotated.uid as string,- resourceVersion: rotated.resourceVersion as string,- }// The PUT landing shows "rotating", never a verdict by itself — the// verdict only comes from the CRD poll below.@@ -343,14 +310,11 @@ test.describe('optional QA recorder: Control UI connector edit', () => {'DELETE',`/api/v1/admin/mcp-servers/${encodeURIComponent(connectorName)}`)- if (createdSecretIdentity) {- await api(- page.request,- 'DELETE',- `/api/v1/admin/mcp-secrets/${encodeURIComponent(secretName)}`,- createdSecretIdentity- )- }+ await api(+ page.request,+ 'DELETE',+ `/api/v1/admin/mcp-secrets/${encodeURIComponent(secretName)}`+ )await api(page.request, 'DELETE', `/api/v1/admin/contexts/${encodeURIComponent(contextName)}`)}})diff --git a/control-ui/e2e/qa-recorder-connector-rotation-demo.spec.ts b/control-ui/e2e/qa-recorder-connector-rotation-demo.spec.tsindex c15a104ab..f13ccba89 100644--- a/control-ui/e2e/qa-recorder-connector-rotation-demo.spec.ts+++ b/control-ui/e2e/qa-recorder-connector-rotation-demo.spec.ts@@ -39,7 +39,6 @@ test.describe('demo: Control UI credential-rotation journey', () => {const secretName = uniqueE2EName('demo-secret')const secretKey = 'api-key'const envVar = 'DEMO_API_KEY'- let createdSecretIdentity: { uid: string; resourceVersion: string } | undefinedtry {await test.step('sign in through the Control UI', async () => {@@ -48,22 +47,11 @@ test.describe('demo: Control UI credential-rotation journey', () => {})await test.step('stage a managed connector + Secret (API preconditions)', async () => {- const s = await api<{ uid?: unknown; resourceVersion?: unknown }>(- page.request,- 'POST',- '/api/v1/admin/mcp-secrets',- {- name: secretName,- data: { [secretKey]: 'initial-value-123' },- }- )+ const s = await api(page.request, 'POST', '/api/v1/admin/mcp-secrets', {+ name: secretName,+ data: { [secretKey]: 'initial-value-123' },+ })expect(s.status, `Secret: ${JSON.stringify(s.data)}`).toBeLessThan(300)- expect(typeof s.data.uid, 'created object uid').toBe('string')- expect(typeof s.data.resourceVersion, 'created object resourceVersion').toBe('string')- createdSecretIdentity = {- uid: s.data.uid as string,- resourceVersion: s.data.resourceVersion as string,- }const c = await api(page.request, 'POST', '/api/v1/admin/contexts', {metadata: { name: contextName },spec: { contextId: contextName, description: 'demo rotation context', mcpServers: [] },@@ -136,28 +124,10 @@ test.describe('demo: Control UI credential-rotation journey', () => {const dialog = page.getByRole('alertdialog', { name: 'Rotate credentials' })await expect(dialog).toBeVisible({ timeout: 20_000 })await humanPause(page)- const rotateResponsePromise = page.waitForResponse(response => {- return (- response.request().method() === 'PUT' &&- response.url().includes(`/admin/mcp-secrets/${encodeURIComponent(secretName)}`)- )- })await humanClick(page,dialog.getByRole('button', { name: 'Rotate & restart', exact: true }))- const rotateResponse = await rotateResponsePromise- expect(rotateResponse.status()).toBeLessThan(300)- const rotated = (await rotateResponse.json()) as {- uid?: unknown- resourceVersion?: unknown- }- expect(typeof rotated.uid, 'rotated object uid').toBe('string')- expect(typeof rotated.resourceVersion, 'rotated object resourceVersion').toBe('string')- createdSecretIdentity = {- uid: rotated.uid as string,- resourceVersion: rotated.resourceVersion as string,- }})await test.step('watch the rollout reach "Credentials rotated"', async () => {@@ -174,14 +144,11 @@ test.describe('demo: Control UI credential-rotation journey', () => {'DELETE',`/api/v1/admin/mcp-servers/${encodeURIComponent(connectorName)}`)- if (createdSecretIdentity) {- await api(- page.request,- 'DELETE',- `/api/v1/admin/mcp-secrets/${encodeURIComponent(secretName)}`,- createdSecretIdentity- )- }+ await api(+ page.request,+ 'DELETE',+ `/api/v1/admin/mcp-secrets/${encodeURIComponent(secretName)}`+ )await api(page.request, 'DELETE', `/api/v1/admin/contexts/${encodeURIComponent(contextName)}`)}})diff --git a/control-ui/e2e/qa-recorder-secret-connector.spec.ts b/control-ui/e2e/qa-recorder-secret-connector.spec.tsindex 5df6c65f2..d892dd1ff 100644--- a/control-ui/e2e/qa-recorder-secret-connector.spec.ts+++ b/control-ui/e2e/qa-recorder-secret-connector.spec.ts@@ -34,17 +34,11 @@ test.describe('optional QA recorder: Control UI connector secret lifecycle', ()const credentials = adminCredentials()const secretName = uniqueE2EName('qa-recorder-connector-secret')- let createdSecretIdentity: { uid: string; resourceVersion: string } | undefinedtry {await loginThroughUi(page, credentials)- await page.getByRole('link', { name: 'Secrets', exact: true }).click()- await expect(page).toHaveURL(/\/secrets$/, { timeout: 20_000 })- await page.getByRole('tab', { name: 'Connector', exact: true }).click()- await expect(page).toHaveURL(/\/secrets\/connector$/, { timeout: 20_000 })- await page.getByRole('button', { name: 'Add connector secret', exact: true }).click()- await expect(page).toHaveURL(/\/secrets\/new\?scope=mcp/, { timeout: 20_000 })+ await page.goto(`${CONTROL_UI_URL}/secrets/new?scope=mcp`)await expect(page.getByRole('heading', { name: 'Create connector secret', exact: true })).toBeVisible({ timeout: 20_000 })@@ -59,25 +53,9 @@ test.describe('optional QA recorder: Control UI connector secret lifecycle', ()await expect(page.getByPlaceholder('API_KEY')).toBeVisible({ timeout: 20_000 })await page.getByRole('button', { name: 'Add key', exact: true }).click()- const addedRow = page.locator('.cu-form-inline').filter({- has: page.getByRole('button', { name: 'Remove MCP secret key row 2', exact: true }),- })- await addedRow.getByPlaceholder('API_KEY').fill('API_KEY')- await addedRow.getByPlaceholder('secret value').fill('qa-recorder-dummy')- const createResponsePromise = page.waitForResponse(response => {- return response.request().method() === 'POST' && response.url().includes('/admin/mcp-')- })+ await page.getByPlaceholder('API_KEY').last().fill('API_KEY')+ await page.getByPlaceholder('secret value').last().fill('qa-recorder-dummy')await page.getByRole('button', { name: 'Create secret', exact: true }).click()- const createData = (await (await createResponsePromise).json()) as {- uid?: unknown- resourceVersion?: unknown- }- if (typeof createData.uid === 'string' && typeof createData.resourceVersion === 'string') {- createdSecretIdentity = {- uid: createData.uid,- resourceVersion: createData.resourceVersion,- }- }await expect(page.getByText(`Secret ${secretName} created.`, { exact: true })).toBeVisible({timeout: 20_000,@@ -86,8 +64,7 @@ test.describe('optional QA recorder: Control UI connector secret lifecycle', ()// The connector list is McpServer-derived; a standalone secret is not listed// and connector scope has no delete action in the UI. Record the connector// shell and clean up through the Control API below.- await page.getByRole('link', { name: 'Secrets', exact: true }).click()- await expect(page).toHaveURL(/\/secrets\/connector$/, { timeout: 20_000 })+ await page.goto(`${CONTROL_UI_URL}/secrets/connector`)await expect(page.getByText('Manage LLM, connector, and recipe credentials in one place.', {exact: true,@@ -97,14 +74,11 @@ test.describe('optional QA recorder: Control UI connector secret lifecycle', ()await screenshotAndLog(page, testInfo, 'control-ui-secret-connector')} finally {try {- if (createdSecretIdentity) {- await api(- page.request,- 'DELETE',- `/api/v1/admin/mcp-secrets/${encodeURIComponent(secretName)}`,- createdSecretIdentity- )- }+ await api(+ page.request,+ 'DELETE',+ `/api/v1/admin/mcp-secrets/${encodeURIComponent(secretName)}`+ )} catch {// Best-effort: ignore cleanup failures.}diff --git a/control-ui/lib/api.ts b/control-ui/lib/api.tsindex 8f77e1cdb..84ba05af0 100644--- a/control-ui/lib/api.ts+++ b/control-ui/lib/api.ts@@ -1451,8 +1451,6 @@ export async function createMcpSecret(name: string, data: Record<string, string>return apiSend('POST', '/api/v1/admin/mcp-secrets', { name, data }) as Promise<{name: stringnamespace: string- uid: string- resourceVersion: string}>}@@ -1462,15 +1460,8 @@ export async function createMcpSecret(name: string, data: Record<string, string>* back a just-created Secret when the subsequent McpServer CRD creation fails,* so we never leave orphan Secrets behind.*/-export async function deleteMcpSecret(- name: string,- precondition: { uid: string; resourceVersion: string }-) {- return apiSend(- 'DELETE',- `/api/v1/admin/mcp-secrets/${encodeURIComponent(name)}`,- precondition- ) as Promise<{+export async function deleteMcpSecret(name: string) {+ return apiSend('DELETE', `/api/v1/admin/mcp-secrets/${encodeURIComponent(name)}`) as Promise<{name: stringnamespace: string}>@@ -1494,8 +1485,6 @@ export async function updateMcpSecret(name: string, data: Record<string, string>}) as Promise<{name: stringnamespace: string- uid: string- resourceVersion: stringkeys: string[]affectedConnectors: string[]}>diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex 2c6910463..4ac83d4a1 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.452",+ "version": "0.1.450","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.452",+ "version": "0.1.450","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/llm-providers": "file:../packages/llm-providers",diff --git a/control-ui/package.json b/control-ui/package.jsonindex 24b4ddf96..5fef329e3 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.452",+ "version": "0.1.450","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",