Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(control-ui): r1-m6 prove completion ordering invariants

Josué7c8350d15f9b
diff --git a/control-ui/components/GfsGrantPanel.tsx b/control-ui/components/GfsGrantPanel.tsx
index 55cf06cb0..457d6d161 100644
--- a/control-ui/components/GfsGrantPanel.tsx
+++ b/control-ui/components/GfsGrantPanel.tsx
@@ -462,6 +462,7 @@ export function GfsGrantPanel({
<RecordListRow
className="cu-gfs-existing-access__item"
data-testid={`gfs-access-row-${item.kind}-${item.id}`}
+ data-access-id={item.id}
key={`${item.kind}:${item.id}`}
>
<span className="cu-gfs-existing-access__identity">
diff --git a/control-ui/components/WorkflowAccessPanel/index.tsx b/control-ui/components/WorkflowAccessPanel/index.tsx
index 9790db429..808b94f40 100644
--- a/control-ui/components/WorkflowAccessPanel/index.tsx
+++ b/control-ui/components/WorkflowAccessPanel/index.tsx
@@ -682,7 +682,11 @@ function AccessUserSection({
) : (
<RecordList className="cu-workflow-access__rows">
{rows.map(user => (
- <RecordListRow className="cu-workflow-access__row" key={user.id}>
+ <RecordListRow
+ className="cu-workflow-access__row"
+ data-access-id={user.id}
+ key={user.id}
+ >
<div className="cu-workflow-access__row-main">
<span className="cu-workflow-access__row-title">{userLabel(user)}</span>
{(user.displayName || user.name) && (
@@ -779,7 +783,11 @@ function AccessTeamSection({
) : (
<RecordList className="cu-workflow-access__rows">
{rows.map(team => (
- <RecordListRow className="cu-workflow-access__row" key={team.id}>
+ <RecordListRow
+ className="cu-workflow-access__row"
+ data-access-id={team.id}
+ key={team.id}
+ >
<div className="cu-workflow-access__row-main">
<span className="cu-workflow-access__row-title">{teamLabel(team)}</span>
</div>
diff --git a/control-ui/components/__tests__/GfsGrantPanel.bulk.test.tsx b/control-ui/components/__tests__/GfsGrantPanel.bulk.test.tsx
index ba91845aa..02d28685d 100644
--- a/control-ui/components/__tests__/GfsGrantPanel.bulk.test.tsx
+++ b/control-ui/components/__tests__/GfsGrantPanel.bulk.test.tsx
@@ -200,6 +200,26 @@ describe('GfsGrantPanel bulk access', () => {
})
it('sorts access records by visible principal identity', async () => {
+ mockGetAdminUsers.mockResolvedValue({
+ items: [
+ {
+ id: '11111111-1111-1111-1111-111111111111',
+ email: '[email protected]',
+ name: 'Ada Lovelace',
+ displayName: 'Ada Lovelace',
+ picture: null,
+ activeTeamCount: 1,
+ },
+ {
+ id: '11111111-1111-1111-1111-111111111110',
+ email: '[email protected]',
+ name: 'Ada Lovelace',
+ displayName: 'Ada Lovelace',
+ picture: null,
+ activeTeamCount: 1,
+ },
+ ],
+ })
mockGetGfsGrants.mockResolvedValue({
items: [
{
@@ -218,17 +238,31 @@ describe('GfsGrantPanel bulk access', () => {
permissions: ['read'],
inherit: false,
},
+ {
+ id: '22222222-2222-2222-2222-222222222222',
+ drive: 'main',
+ resourceId: resource.resourceId,
+ subject: { type: 'user', id: '11111111-1111-1111-1111-111111111110' },
+ permissions: ['read'],
+ inherit: false,
+ },
],
})
renderPanel()
const list = await screen.findByRole('list', { name: 'Resource access' })
- await waitFor(() => expect(within(list).getByText('Ada Lovelace')).toBeTruthy())
- expect(
- within(list)
- .getAllByRole('listitem')
- .map(row => row.textContent)
- ).toEqual([expect.stringContaining('Ada Lovelace'), expect.stringContaining('Operator')])
+ await waitFor(() => expect(within(list).getAllByText('Ada Lovelace')).toHaveLength(2))
+ const rows = within(list).getAllByRole('listitem')
+ expect(rows.map(row => row.textContent)).toEqual([
+ expect.stringContaining('Ada Lovelace'),
+ expect.stringContaining('Ada Lovelace'),
+ expect.stringContaining('Operator'),
+ ])
+ expect(rows.map(row => row.getAttribute('data-access-id'))).toEqual([
+ '22222222-2222-2222-2222-222222222222',
+ '33333333-3333-3333-3333-333333333333',
+ '77777777-7777-7777-7777-777777777777',
+ ])
})
it('self-heals a row that another admin already revoked without hiding other errors', async () => {
diff --git a/control-ui/components/__tests__/RecipeStatusContent.test.tsx b/control-ui/components/__tests__/RecipeStatusContent.test.tsx
index cc5e7fcfe..0cb7882ad 100644
--- a/control-ui/components/__tests__/RecipeStatusContent.test.tsx
+++ b/control-ui/components/__tests__/RecipeStatusContent.test.tsx
@@ -725,6 +725,12 @@ describe('RecipeStatusContent — runId child resolution', () => {
sizeBytes: 42,
createdAt: '2026-05-06T00:00:00.000Z',
},
+ {
+ name: 'audit-log.txt',
+ format: 'txt',
+ sizeBytes: 84,
+ createdAt: '2026-05-06T00:01:00.000Z',
+ },
],
},
} as unknown as Awaited<ReturnType<typeof getRecipe>>)
@@ -767,7 +773,17 @@ describe('RecipeStatusContent — runId child resolution', () => {
)
expect(downloadName).toBe('ABCD1234-custom-sdk-result.json')
expect(screen.getByText('Clear All')).toBeInTheDocument()
- expect(screen.getByRole('list', { name: 'Output artifacts' })).toBeInTheDocument()
+ const artifacts = screen.getByRole('list', { name: 'Output artifacts' })
+ expect(
+ within(artifacts)
+ .getAllByRole('listitem')
+ .map(row => row.textContent)
+ ).toEqual(['JSONcustom-sdk-result.json42 B⋮', 'TXTaudit-log.txt84 B⋮'])
+ expect(
+ within(artifacts)
+ .getAllByRole('listitem')
+ .map(row => row.getAttribute('data-artifact-name'))
+ ).toEqual(['custom-sdk-result.json', 'audit-log.txt'])
expect(click).toHaveBeenCalled()
})
diff --git a/control-ui/components/__tests__/WorkflowAccessPanel.test.tsx b/control-ui/components/__tests__/WorkflowAccessPanel.test.tsx
index 557526d89..1c491a822 100644
--- a/control-ui/components/__tests__/WorkflowAccessPanel.test.tsx
+++ b/control-ui/components/__tests__/WorkflowAccessPanel.test.tsx
@@ -168,17 +168,70 @@ describe('WorkflowAccessPanel', () => {
})
it('sorts visible access records by human identity with a stable id tie-break', async () => {
- vi.mocked(listWorkflowGrants).mockResolvedValue({ items: [bobGrant, aliceGrant] })
+ vi.mocked(listWorkflowGrants).mockResolvedValue({
+ items: [
+ bobGrant,
+ { id: 'u-10', email: '[email protected]', name: 'Same', displayName: null },
+ { id: 'u-3', email: '[email protected]', name: 'Same', displayName: null },
+ aliceGrant,
+ ],
+ })
render(<EditHarness />)
const section = screen.getByTestId('workflow-access-trigger-users')
await waitFor(() => expect(within(section).getByText('Alice')).toBeInTheDocument())
const rows = section.querySelectorAll('.cu-workflow-access__row-title')
- expect([...rows].map(row => row.textContent)).toEqual(['Alice', 'Bob'])
+ expect([...rows].map(row => row.textContent)).toEqual(['Alice', 'Bob', 'Same', 'Same'])
+ expect(
+ within(section)
+ .getAllByRole('listitem')
+ .map(row => row.getAttribute('data-access-id'))
+ ).toEqual(['u-1', 'u-2', 'u-3', 'u-10'])
expect(section.querySelector('.cu-workflow-access__rows')).toHaveAttribute('role', 'list')
})
+ it('sorts trigger-team and approval-team records by name with stable id tie-breaks', async () => {
+ vi.mocked(listWorkflowTeamGrants).mockResolvedValue({
+ items: [
+ { id: 'team-z', name: 'Zulu' },
+ { id: 'team-10', name: 'Same Team' },
+ { id: 'team-2', name: 'Same Team' },
+ { id: 'team-a', name: 'Alpha Team' },
+ ],
+ })
+ vi.mocked(listWorkflowApprovalAllowedTeams).mockResolvedValue({
+ items: [
+ { id: 'approval-z', name: 'Zulu Approval', createdAt: '2026-01-01T00:00:00Z' },
+ { id: 'approval-10', name: 'Same Approval', createdAt: '2026-01-01T00:00:00Z' },
+ { id: 'approval-2', name: 'Same Approval', createdAt: '2026-01-01T00:00:00Z' },
+ { id: 'approval-a', name: 'Alpha Approval', createdAt: '2026-01-01T00:00:00Z' },
+ ],
+ })
+
+ render(<EditHarness />)
+
+ fireEvent.click(screen.getByRole('tab', { name: /Teams/ }))
+ const teamSection = screen.getByTestId('workflow-access-trigger-teams')
+ await waitFor(() => expect(within(teamSection).getByText('Alpha Team')).toBeInTheDocument())
+ expect(
+ within(teamSection)
+ .getAllByRole('listitem')
+ .map(row => row.getAttribute('data-access-id'))
+ ).toEqual(['team-a', 'team-2', 'team-10', 'team-z'])
+
+ fireEvent.click(screen.getByRole('tab', { name: /Approval target teams/ }))
+ const approvalSection = screen.getByTestId('workflow-access-approval-target-teams')
+ await waitFor(() =>
+ expect(within(approvalSection).getByText('Alpha Approval')).toBeInTheDocument()
+ )
+ expect(
+ within(approvalSection)
+ .getAllByRole('listitem')
+ .map(row => row.getAttribute('data-access-id'))
+ ).toEqual(['approval-a', 'approval-2', 'approval-10', 'approval-z'])
+ })
+
it('blocks live grant writes until the current edit-mode grants are loaded', async () => {
const userGrants = createDeferred<{ items: (typeof aliceGrant)[] }>()
const teamGrants = createDeferred<{ items: (typeof triggerTeamGrant)[] }>()