Executions: Re-run Workflow, and search that finds commands (#18, #16)
CI / Test (jest) (pull_request) Successful in 23s
CI / Lint (eslint) (pull_request) Successful in 26s
CI / Security (npm audit) (pull_request) Successful in 15s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m42s
CI / Integration (api) (pull_request) Successful in 2m37s
CI / UI (playwright) (pull_request) Successful in 2m45s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m41s

- #18: a workflow execution's detail now offers Re-run Workflow, which
  starts the same workflow with the parameters from its params log entry
  (after a confirm listing them) and opens the new run. Quick commands
  keep Re-run Command.
- #16: search runs on the server: workflow name, who started it, the id,
  or any command the execution ran (JSON_SEARCH over the logs). The page
  sends it as you type (debounced 300 ms, from the first page); the
  status filter stays local.
- Regression tests for #12 (Create Workflow starts with the example) and
  #13 (dry run works for workflows without parameters), which the UI
  rewrite had already fixed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jaredandClaude Opus 5.5 committed 2026-11-23 13:03:42 -05:00
1 parent 06d6c72709
commit 4cf3c084a9
5 files changed
+116 -16

No files matched your search

+11
View File
@@ -65,3 +65,14 @@ test('the Automated and Manual views filter on the server (#4)', async () => {
expect(manual.executions.some(e => automated(e.started_by))).toBe(false);
expect(auto.executions.some(e => e.id === submit.json.execution_id)).toBe(true);
});
test('execution search finds runs by the command they ran (#16)', async () => {
const marker = `srch-${Date.now().toString(36)}`;
const submit = await gandalf('POST', '/api/internal/command', { worker_id: workerId, command: `echo ${marker}` });
await waitForExecution(submit.json.execution_id);
const hit = (await sso('GET', `/api/executions?search=${marker}&limit=50`)).json;
expect(hit.executions.map(e => e.id)).toEqual([submit.json.execution_id]);
const byId = (await sso('GET', `/api/executions?search=${submit.json.execution_id.slice(0, 13)}`)).json;
expect(byId.executions.map(e => e.id)).toContain(submit.json.execution_id);
expect((await sso('GET', '/api/executions?search=no-such-command-anywhere')).json.executions).toEqual([]);
});
+13
View File
@@ -63,3 +63,16 @@ test('Executions updates live when a command starts elsewhere', async ({ page, r
// Its own row appears without a reload (by id, so it works however full the list is).
await expect(page.locator(`#ex-list-manual .ex-row[data-execution-id="${id}"]`)).toBeVisible();
});
test('searching Executions finds a run by its command (#16)', async ({ page, request }) => {
const marker = token();
const workers = await (await request.get('/api/workers')).json();
const node1 = workers.find(w => w.name === 'node-01');
const { execution_id: id } = await (await request.post(`/api/workers/${node1.id}/command`, { data: { command: `echo ${marker}` } })).json();
await page.goto('/executions');
await page.locator('#ex-search').fill(marker);
const rows = page.locator('#ex-list-manual .ex-row');
await expect(rows).toHaveCount(1);
await expect(rows.first()).toHaveAttribute('data-execution-id', id);
});
+39
View File
@@ -58,3 +58,42 @@ test('a run waiting on a prompt shows as waiting, and the Waiting filter finds i
await request.post(`/api/executions/${ex}/respond`, { data: { response: 'Yes' } });
});
test('the Create Workflow dialog starts with the example definition (#12)', async ({ page }) => {
await page.goto('/workflows');
await page.getByRole('button', { name: '+ Create Workflow' }).click();
const def = JSON.parse(await page.locator('#wf-create-definition').inputValue());
expect(Array.isArray(def.steps) && def.steps.length).toBeTruthy();
});
test('a workflow without parameters can still be dry-run (#13)', async ({ page, request }) => {
const name = `UI noparams ${Date.now()}`;
await request.post('/api/workflows', { data: { name, definition: { steps: [
{ id: 'a', type: 'execute', command: 'echo hi', targets: ['node-01'] },
] } } });
await page.goto('/workflows');
await page.locator('#wf-list tr', { hasText: name }).getByRole('button', { name: 'Execute' }).click();
await expect(page.locator('#wf-run-dryrun')).toBeVisible();
await page.locator('#wf-run-dryrun').check();
await page.locator('#wf-run-form').getByRole('button', { name: /Run/ }).click();
await expect(page.locator('#ex-detail-body')).toContainText(/dry run/i);
});
test('a workflow execution re-runs as the whole workflow with its parameters (#18)', async ({ page, request }) => {
const name = `UI rerun ${Date.now()}`;
const wf = (await (await request.post('/api/workflows', { data: { name, definition: {
params: [{ name: 'who', required: true }],
steps: [{ id: 'a', type: 'execute', command: 'echo hello {{who}}', targets: ['node-01'] }],
} } })).json()).id;
const first = (await (await request.post('/api/executions', { data: { workflow_id: wf, params: { who: 'world' } } })).json()).id;
await page.goto(`/executions?open=${first}`);
await expect(page.locator('#ex-detail-body')).toContainText('hello world');
await page.getByRole('button', { name: /Re-run Workflow/ }).click();
await page.getByRole('button', { name: 'RE-RUN', exact: true }).click();
await expect.poll(async () => {
const list = await (await request.get('/api/executions?hide_internal=true&limit=20')).json();
return list.executions.filter(e => e.workflow_id === wf).length;
}).toBe(2);
});