Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
feat(control-ui): recover from a vanished Secret without a partial write
Jose Ramirez9fd51a6463b9
diff --git a/control-ui/components/UpdateConnectorCredentials/index.tsx b/control-ui/components/UpdateConnectorCredentials/index.tsxindex 167f74826..ac7dfddac 100644--- a/control-ui/components/UpdateConnectorCredentials/index.tsx+++ b/control-ui/components/UpdateConnectorCredentials/index.tsx@@ -356,8 +356,22 @@ export function UpdateConnectorCredentials({// preview for the "who else restarts" note.setRotationAffected(previewAffected ?? [])} else {- const result = await updateMcpSecret(envSecret!.name, data)- setRotationAffected(result.affectedConnectors)+ try {+ const result = await updateMcpSecret(envSecret!.name, data)+ setRotationAffected(result.affectedConnectors)+ } catch (putError) {+ // The Secret is gone (or the condition was stale). Do NOT silently+ // POST: rotate mode may hold only one of several declared keys, and a+ // partial create is exactly the failure this screen exists to remove+ // (HCC would answer SecretMissingKey). Demand every key instead.+ if ((putError as { status?: number })?.status === 404) {+ setRecreateRequired(true)+ setPhase('idle')+ setValidationError('This Secret no longer exists. Enter every key to recreate it.')+ return+ }+ throw putError+ }}setDraft({})setRotationCutoff(cutoff)diff --git a/control-ui/components/__tests__/UpdateConnectorCredentials.test.tsx b/control-ui/components/__tests__/UpdateConnectorCredentials.test.tsxindex f24f4b1b8..e479d5aa0 100644--- a/control-ui/components/__tests__/UpdateConnectorCredentials.test.tsx+++ b/control-ui/components/__tests__/UpdateConnectorCredentials.test.tsx@@ -254,6 +254,26 @@ describe('UpdateConnectorCredentials — PUT rejection', () => {})})+describe('UpdateConnectorCredentials — rotate mode against a vanished Secret', () => {+ it('switches to set mode instead of creating a partial Secret', async () => {+ mockUpdateMcpSecret.mockRejectedValue(+ Object.assign(new Error('404 - Secret "linear-credentials" not found in mcp-server'), {+ status: 404,+ })+ )+ await renderPanel(ENV_SECRET, 'rotate')++ // Only ONE key filled — valid for a rotation, fatal for a create.+ await submitRotation({ 'api-key': 'only-one' })++ expect(screen.getByText(/This Secret no longer exists\./)).toBeInTheDocument()+ // The partial data must NOT have been posted.+ expect(mockCreateMcpSecret).not.toHaveBeenCalled()+ // The form is now in set mode, demanding every key.+ expect(screen.getByRole('button', { name: 'Set credentials' })).toBeInTheDocument()+ })+})+// ─── Polling / DeploymentReady correlation — the CRD contract (Fase 3 §6) ───describe('UpdateConnectorCredentials — rollout polling', () => {it('reports success once a FRESH DeploymentReady=True is observed after the PUT', async () => {diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex d952d7760..0820fff9f 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.391",+ "version": "0.1.392","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.391",+ "version": "0.1.392","dependencies": {"@clerum/llm-providers": "file:../packages/llm-providers","@clerum/workflow-recipe-capability-policy": "file:../packages/workflow-recipe-capability-policy",diff --git a/control-ui/package.json b/control-ui/package.jsonindex 637b148e3..356164aec 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.391",+ "version": "0.1.392","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",