Workflow parameters: types, defaults, checked before a run (#23, #11)
CI / Test (jest) (pull_request) Successful in 26s
CI / Lint (eslint) (pull_request) Successful in 29s
CI / Security (npm audit) (pull_request) Successful in 13s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m36s
CI / Integration (api) (pull_request) Successful in 2m26s
CI / UI (playwright) (pull_request) Successful in 2m25s
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 2m3s

#23
- Parameters can be text (default), number (min, max), select
  (options), boolean, or worker, with a default. The Run dialog shows a
  matching field, the allowed characters for text, and the range for
  numbers; worker parameters choose from the connected workers.
- Values are checked before anything starts: in the dialog, naming the
  characters that are not allowed, and by the server (resolveParams),
  which answers 400 "Invalid parameters: ..." and creates no execution.
  A bad value used to fail mid-run as "Unsafe value for workflow
  parameter". Server errors now show in the dialog instead of a toast.

#11
- Saving a workflow checks its shape (definitionErrors): known step
  types and their required fields, unique ids, prompt routes that match
  options, route conditions, and parameter definitions. Unknown step
  types were silently skipped at run time.
- README documents the parameter types and the checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jaredandClaude Opus 5.5 committed 2026-11-23 18:11:49 -05:00
1 parent 7204c806df
commit a6d693c13e
8 files changed
+477 -39

No files matched your search

+38
View File
@@ -121,3 +121,41 @@ test('a workflow execution re-runs as the whole workflow with its parameters (#1
return list.executions.filter(e => e.workflow_id === wf).length;
}).toBe(2);
});
test('the Run dialog has a field for each parameter type and checks values up front (#23)', async ({ page, request, problems }) => {
const name = `UI params ${Date.now()}`;
await request.post('/api/workflows', { data: { name, definition: {
params: [
{ name: 'host', label: 'Host', required: true },
{ name: 'mode', type: 'select', options: ['fast', 'safe'], default: 'safe' },
{ name: 'count', type: 'number', min: 1, max: 5, default: '2' },
{ name: 'force', type: 'boolean' },
{ name: 'node', type: 'worker', default: 'node-02' },
],
steps: [{ id: 'e', type: 'execute', command: 'echo {{host}} {{mode}} {{count}} {{force}} {{node}}', targets: ['node-01'] }],
} } });
await page.goto('/workflows');
await page.locator('#wf-list tr', { hasText: name }).getByRole('button', { name: 'Execute' }).click();
const modal = page.locator('#wf-run-modal');
await expect(modal.locator('#wf-run-param-mode')).toHaveValue('safe');
await expect(modal.locator('#wf-run-param-count')).toHaveValue('2');
await expect(modal.locator('#wf-run-param-force')).not.toBeChecked();
await expect(modal.locator('#wf-run-param-node')).toHaveValue('node-02');
await expect(modal).toContainText('Letters, digits and . _ : @ / - only');
// A bad value is caught in the dialog, before anything is sent.
let posted = false;
page.on('request', r => { if (r.method() === 'POST' && r.url().endsWith('/api/executions')) posted = true; });
await modal.locator('#wf-run-param-host').fill('web 01');
await modal.getByRole('button', { name: /Run/ }).click();
await expect(modal.locator('#wf-run-err-host')).toHaveText('Not allowed: space');
expect(posted).toBe(false);
await modal.locator('#wf-run-param-host').fill('web-01');
await modal.locator('#wf-run-param-mode').selectOption('fast');
await modal.locator('#wf-run-param-force').check();
await modal.getByRole('button', { name: /Run/ }).click();
await expect(page).toHaveURL(/\/executions\?open=/);
await expect(page.locator('#ex-detail-body')).toContainText('web-01 fast 2 true node-02', { timeout: 20_000 });
expect(problems).toEqual([]);
});