Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(control-ui): align credential journeys with per-key rotation
M620df78bca0e
diff --git a/control-ui/components/__tests__/EditMcpServerPageAttach.test.tsx b/control-ui/components/__tests__/EditMcpServerPageAttach.test.tsxindex a605c9d1d..1cbfdb13e 100644--- a/control-ui/components/__tests__/EditMcpServerPageAttach.test.tsx+++ b/control-ui/components/__tests__/EditMcpServerPageAttach.test.tsx@@ -158,7 +158,7 @@ describe('keyless edit credentials journey', () => {expect(screen.getByRole('heading', { name: 'Attach credentials' })).toBeInTheDocument()current.status.conditions[0].observedGeneration = 3await tick()- expect(screen.getByRole('button', { name: 'Rotate credentials' })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'Rotate api-key' })).toBeInTheDocument()expect(screen.queryByRole('heading', { name: 'Attach credentials' })).not.toBeInTheDocument()expect(api.createMcpSecret).toHaveBeenCalledOnce()expect(api.deleteMcpSecret).not.toHaveBeenCalled()@@ -169,7 +169,7 @@ describe('keyless edit credentials journey', () => {await tick(POLL_TIMEOUT_MS)fireEvent.click(screen.getByRole('button', { name: 'Refresh credentials' }))await flush()- expect(screen.getByRole('button', { name: 'Rotate credentials' })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'Rotate api-key' })).toBeInTheDocument()expect(api.createMcpSecret).toHaveBeenCalledOnce()expect(api.deleteMcpSecret).not.toHaveBeenCalled()})diff --git a/control-ui/components/__tests__/RegistryConnectorCredentialContract.test.tsx b/control-ui/components/__tests__/RegistryConnectorCredentialContract.test.tsxindex 55539cbff..f2aa650cb 100644--- a/control-ui/components/__tests__/RegistryConnectorCredentialContract.test.tsx+++ b/control-ui/components/__tests__/RegistryConnectorCredentialContract.test.tsx@@ -9,6 +9,7 @@ import {listMcpSecrets,updateMcpSecret,} from '../../lib/api'+import type { EnvSecret } from '../../lib/api'import { buildRegistryMcpServerReference } from '../../test/fixtures/mcpServer'import { ToastProvider } from '../Toast'@@ -43,7 +44,10 @@ beforeEach(() => {// contract rather than being hidden by a fixture-owned `managed: true`.expect(connector.spec?.managed).toBe(true)vi.mocked(getMcpServers).mockResolvedValue({ items: [connector] })- vi.mocked(listMcpSecrets).mockResolvedValue({ items: [] })+ const reference = connector.spec!.envSecret as EnvSecret+ vi.mocked(listMcpSecrets).mockResolvedValue({+ items: [{ name: reference.name, keys: reference.keys.map(mapping => mapping.secretKey) }],+ })vi.mocked(getMcpServer).mockResolvedValue(connector)vi.mocked(getRegistryCredentialSchema).mockResolvedValue({required: true,@@ -70,18 +74,27 @@ it('shows and rotates the registry-produced credential mapping for the attached</ToastProvider>)- expect(await screen.findByRole('button', { name: 'Rotate credentials' })).toBeInTheDocument()+ const rotate = await screen.findByRole('button', { name: 'Rotate api-key' })+ expect(rotate).toBeInTheDocument()expect(screen.getByText('Edit connector secret: linear-credentials')).toBeInTheDocument()- // The credential fields render one effect pass after the button; wait for- // the label instead of assuming it settled with the button.- expect(await screen.findByLabelText('API token')).toBeInTheDocument()- expect(screen.getAllByText('api-key').length).toBeGreaterThan(0)+ expect(+ screen.getByRole('columnheader', { name: /Environment variable.*linear/ })+ ).toBeInTheDocument()+ // Registry-produced Secret keys and their environment destinations occupy+ // separate cells. No stored value or idle value input is rendered.+ const row = rotate.closest('tr')!+ const cells = within(row).getAllByRole('cell')+ expect(cells[0]).toHaveTextContent('api-key')+ expect(cells[1]).toHaveTextContent('api-key')+ expect(row.querySelector('input')).toBeNull()- fireEvent.change(screen.getByLabelText('API token'), { target: { value: 'rotated' } })- fireEvent.click(screen.getByRole('button', { name: 'Rotate credentials' }))- const dialog = screen.getByRole('alertdialog')- expect(dialog).toHaveTextContent('restarts: linear.')- fireEvent.click(within(dialog).getByRole('button', { name: 'Rotate & restart' }))+ fireEvent.click(rotate)+ const dialog = screen.getByRole('dialog', { name: 'Rotate api-key' })+ expect(dialog).toHaveTextContent('Connectors sharing this Secret may restart: linear.')+ fireEvent.change(within(dialog).getByLabelText('New value', { exact: false }), {+ target: { value: 'rotated' },+ })+ fireEvent.click(within(dialog).getByRole('button', { name: 'Rotate', exact: true }))await waitFor(() => {expect(updateMcpSecret).toHaveBeenCalledWith('linear-credentials', { 'api-key': 'rotated' })})diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex 1a9b6c5fb..52422f78a 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.750",+ "version": "0.1.751","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.750",+ "version": "0.1.751","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/frontend-components": "file:../packages/frontend-components",diff --git a/control-ui/package.json b/control-ui/package.jsonindex 1865984d1..319c441da 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.750",+ "version": "0.1.751","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",