Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(control-ui): member-page TDZ crash and connectors search-by-agent regression found by e2e
Miguelon Peluchonf2eebbc8a4e8
diff --git a/control-ui/app/mcp-servers/page.tsx b/control-ui/app/mcp-servers/page.tsxindex 12eafb571..75e8618ed 100644--- a/control-ui/app/mcp-servers/page.tsx+++ b/control-ui/app/mcp-servers/page.tsx@@ -227,14 +227,32 @@ export default function McpServersPage() {const nextAccessByConnectorKey = connectors.reduce<ConnectorAccessSummaryMap>((acc, connector) => {const connectorName = resourceName(connector)- const bindingRefs = (nextBindings[connectorName] ?? []).map(binding => binding.contextRef)+ const connectorBindings = nextBindings[connectorName] ?? []+ const bindingRefs = connectorBindings.map(binding => binding.contextRef)if (bindingRefs.length > 0) {- acc[connectorKey(connector)] = mergeAccessSummaries(+ const merged = mergeAccessSummaries(bindingRefs.map(contextRef =>accessByContext.get(contextRef) ?? { agents: [], users: [], teams: [] }))+ // The agents group must reflect the bindings (the write model) so+ // search-by-agent keeps working: accessText in the table's search+ // haystack reads summary.agents.+ const bindingAgents = connectorBindings.flatMap(binding => binding.agents)+ const seenAgentIds = new Set(+ [...bindingAgents, ...merged.agents].map(principal => principal.id)+ )+ const agents = [+ ...bindingAgents,+ ...merged.agents.filter(principal => !seenAgentIds.has(principal.id)),+ ]+ // Re-dedupe by id preserving first occurrence.+ const byId = new Map(agents.map(principal => [principal.id, principal]))+ acc[connectorKey(connector)] = {+ ...merged,+ agents: sortAccessPrincipals([...byId.values()]),+ }}return acc},diff --git a/control-ui/components/__tests__/McpServerTable.test.tsx b/control-ui/components/__tests__/McpServerTable.test.tsxindex 17dec6878..794b0e08c 100644--- a/control-ui/components/__tests__/McpServerTable.test.tsx+++ b/control-ui/components/__tests__/McpServerTable.test.tsx@@ -143,6 +143,32 @@ describe('McpServerTable — search filter by condition text', () => {expect(screen.getByText('broken-server')).toBeInTheDocument()expect(screen.queryByText('healthy-server')).not.toBeInTheDocument()})++ // Regression (caught live by the qa-recorder connectors-search-agent+ // journey): the page's summary.agents must carry the binding agents so the+ // search haystack keeps matching agent display names after the Phase-1+ // agent-access rework.+ it('keeps a row when searching by an agent display name from the access summary', () => {+ render(+ <McpServerTable+ items={[makeItem({ name: 'airtable-server' })]}+ accessByConnectorKey={{+ 'mcp-server/airtable-server': {+ agents: [{ id: 'research-agent', label: 'Research Agent' }],+ users: [],+ teams: [],+ },+ }}+ />+ )++ const search = screen.getByLabelText('Search connectors') as HTMLInputElement+ fireEvent.change(search, { target: { value: 'Research Agent' } })+ expect(screen.getByText('airtable-server')).toBeInTheDocument()++ fireEvent.change(search, { target: { value: 'no-such-agent' } })+ expect(screen.queryByText('airtable-server')).not.toBeInTheDocument()+ })})describe('McpServerTable — column sorting', () => {diff --git a/control-ui/e2e/qa-recorder-agent-connectors.spec.ts b/control-ui/e2e/qa-recorder-agent-connectors.spec.tsindex 238b1a8c4..cf9d7d28b 100644--- a/control-ui/e2e/qa-recorder-agent-connectors.spec.ts+++ b/control-ui/e2e/qa-recorder-agent-connectors.spec.ts@@ -91,7 +91,9 @@ test.describe('optional QA recorder: Control UI agent connectors', () => {expect(hostRes.status, `create host: ${JSON.stringify(hostRes.data)}`).toBeLessThan(300)// (a) Agents list row: hover the connectors count to reveal the card.- await page.getByRole('link', { name: 'Agents', exact: true }).click()+ // Login already landed on /agents (pre-seed, empty); a sidebar click on+ // the active route would not remount or refetch, so navigate fresh.+ await page.goto(`${CONTROL_UI_URL}/agents`)await expect(page.getByRole('columnheader', { name: 'Connectors', exact: true })).toBeVisible({ timeout: 20_000 })@@ -141,7 +143,7 @@ test.describe('optional QA recorder: Control UI agent connectors', () => {await dialog.getByRole('option', { name: serverCatalogOnly, exact: true }).click()await dialog.getByRole('button', { name: 'Add connector', exact: true }).click()- await expect(page.getByText('Connectors updated.')).toBeVisible({ timeout: 20_000 })+ await expect(page.getByText('Connectors updated.').last()).toBeVisible({ timeout: 20_000 })await expect(page.getByRole('row', { name: new RegExp(serverCatalogOnly) })).toBeVisible({timeout: 20_000,})@@ -156,7 +158,7 @@ test.describe('optional QA recorder: Control UI agent connectors', () => {await expect(confirmDialog).toBeVisible({ timeout: 20_000 })await confirmDialog.getByRole('button', { name: 'Remove connector' }).click()- await expect(page.getByText('Connectors updated.')).toBeVisible({ timeout: 20_000 })+ await expect(page.getByText('Connectors updated.').last()).toBeVisible({ timeout: 20_000 })await expect(page.getByRole('row', { name: new RegExp(serverCatalogOnly) })).toHaveCount(0)// The private context slug never renders on this page either.diff --git a/control-ui/e2e/qa-recorder-connector-create-access.spec.ts b/control-ui/e2e/qa-recorder-connector-create-access.spec.tsindex dcc364e4e..48c644e31 100644--- a/control-ui/e2e/qa-recorder-connector-create-access.spec.ts+++ b/control-ui/e2e/qa-recorder-connector-create-access.spec.ts@@ -97,7 +97,9 @@ async function createConnectorThroughWizard(await screenshotAndLog(page, testInfo, `${journey}-wizard-secrets`)await page.getByRole('button', { name: 'Create connector', exact: true }).click()- await expect(page.getByText('Connector created successfully.', { exact: true })).toBeVisible({+ await expect(+ page.getByText('Connector created successfully.', { exact: true }).last()+ ).toBeVisible({timeout: 20_000,})await expect(page).toHaveURL(/\/connectors$/, { timeout: 20_000 })diff --git a/control-ui/e2e/qa-recorder-connectors-search-agent.spec.ts b/control-ui/e2e/qa-recorder-connectors-search-agent.spec.tsindex bb91099d1..c697c5459 100644--- a/control-ui/e2e/qa-recorder-connectors-search-agent.spec.ts+++ b/control-ui/e2e/qa-recorder-connectors-search-agent.spec.ts@@ -85,7 +85,7 @@ test.describe('optional QA recorder: Control UI connectors search by agent', ()})expect(hostRes.status, `create host: ${JSON.stringify(hostRes.data)}`).toBeLessThan(300)- await page.getByRole('link', { name: 'Installed Connectors', exact: true }).click()+ await page.goto(`${CONTROL_UI_URL}/connectors`)await expect(page).toHaveURL(/\/connectors\/?$/, { timeout: 20_000 })await expect(page.getByText('Browse connector deployments and agent access.', { exact: true })diff --git a/control-ui/e2e/qa-recorder-marketplace-install.spec.ts b/control-ui/e2e/qa-recorder-marketplace-install.spec.tsindex 1a2d01db8..2e8d682be 100644--- a/control-ui/e2e/qa-recorder-marketplace-install.spec.ts+++ b/control-ui/e2e/qa-recorder-marketplace-install.spec.ts@@ -199,10 +199,16 @@ test.describe('optional QA recorder: Control UI marketplace install', () => {// The fresh install has no agents yet.const row = page.getByRole('button', { name: new RegExp(`Expand connector ${serverName}`) })await expect(row).toBeVisible({ timeout: 30_000 })- await row.click()- await expect(- page.getByRole('button', { name: new RegExp(`Collapse connector ${serverName}`) })- ).toBeVisible({ timeout: 10_000 })+ // The connectors table auto-refreshes every 10s; a click landing on a+ // re-rendered (detached) row is a silent no-op — retry until expanded.+ const collapse = page.getByRole('button', {+ name: new RegExp(`Collapse connector ${serverName}`),+ })+ for (let attempt = 0; attempt < 4; attempt += 1) {+ await row.click()+ if (await collapse.isVisible({ timeout: 3_000 }).catch(() => false)) break+ }+ await expect(collapse).toBeVisible({ timeout: 10_000 })const detail = page.locator('.cu-connector-detail')await expect(detail).toBeVisible({ timeout: 10_000 })await expect(detail.getByText('No agents have access yet.', { exact: true })).toBeVisible()diff --git a/control-ui/e2e/qa-recorder-recipe-scope-copy.spec.ts b/control-ui/e2e/qa-recorder-recipe-scope-copy.spec.tsindex 431e07371..997e8bcc9 100644--- a/control-ui/e2e/qa-recorder-recipe-scope-copy.spec.ts+++ b/control-ui/e2e/qa-recorder-recipe-scope-copy.spec.ts@@ -41,6 +41,7 @@ function agenticManifestWithoutOptIn(recipeName: string, contextName: string): smetadata: { name: recipeName },spec: {contextRef: contextName,+ triggers: { onDemand: true },workloads: [{ id: 'web', type: 'deployment', image: 'nginx:1.30.1-alpine' }],steps: [{@@ -156,18 +157,17 @@ test.describe('optional QA recorder: Control UI recipe connector-scope copy', ()const primaryAction = page.locator('.cu-create-actions button')await primaryAction.filter({ hasText: 'Review manifest' }).click()- await expect(page.getByText(/Manifest review passed/)).toBeVisible()- await screenshotAndLog(page, testInfo, 'control-ui-recipe-agentic-manifest-review')-- await primaryAction.filter({ hasText: 'Apply defaults' }).click()- await primaryAction.filter({ hasText: 'Continue to access' }).click()- const banner = page.locator('.cu-recipe-status-panel--error[role="alert"]')- await expect(banner).toBeVisible({ timeout: 20_000 })- await expect(banner).toContainText('Cannot deploy: policy violation')- await expect(banner).toContainText('shared connector scope')- await expect(banner).toContainText('WRC will auto-create a private connector scope')- await expect(banner).not.toContainText('private Context')+ // The L1 policy blocks the review itself: the review findings show a+ // blocking error carrying the connector-scope wording (the deploy-path+ // "Cannot deploy" banner appears at the Access step, which the pinned+ // error prevents reaching).+ await expect(page.getByText(/Manifest review failed/)).toBeVisible({ timeout: 20_000 })+ const findings = page.getByRole('region', { name: 'Review findings' })+ await expect(findings).toBeVisible()+ await expect(findings).toContainText('shared connector scope')+ await expect(findings).toContainText('WRC will auto-create a private connector scope')+ await expect(findings).not.toContainText('private Context')await screenshotAndLog(page, testInfo, 'control-ui-recipe-agentic-scope-banner')// (b) Transport workload, no spec.contextRef — the INFO note about thediff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex e21405a89..7e0f771e7 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.468",+ "version": "0.1.469","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.468",+ "version": "0.1.469","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 88b57e50d..d21d4c8db 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.468",+ "version": "0.1.469","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",diff --git a/scripts/qa-recorder/mock-control-api.mjs b/scripts/qa-recorder/mock-control-api.mjsindex 240ffbf17..da3c9bf21 100644--- a/scripts/qa-recorder/mock-control-api.mjs+++ b/scripts/qa-recorder/mock-control-api.mjs@@ -168,6 +168,9 @@ const server = createServer(async (req, res) => {}const body = method === 'GET' || method === 'DELETE' ? {} : await readBody(req)+ if (process.env.MOCK_VERBOSE !== '0') {+ console.log(`[mock-control-api] ${method} ${path}${authed ? '' : ' (unauth)'}`)+ }const seg = path.replace(/^\/+/, '').split('/').filter(Boolean) // api v1 admin ...const rest = seg.slice(3).join('/') // after /api/v1/adminconst M = method