Workflow parameters: types, defaults, checked before a run #84

Merged
jared merged 1 commits from workflow-params into main 2026-11-23 18:24:24 -05:00
Owner

Closes #23, closes #11. This is a UI change, so it needs your approval.

Run dialog, before and after

#23: parameters

  • Types: a parameter can be text (the default), number (with min and max), select (with options), boolean, or worker. Each can have a default. The Run dialog shows a matching field:
    • text boxes show the allowed characters;
    • number boxes show the range;
    • worker parameters are a dropdown of connected workers, online ones first.
  • Checked before anything starts. A bad value used to create a run that failed partway with "Unsafe value for workflow parameter". Now it's caught twice, up front:
    • in the dialog, which names the characters that aren't allowed (e.g. "Not allowed: space ;");
    • by the server (resolveParams), which answers 400 Invalid parameters: … and creates no execution.
  • Defaults fill in any field left empty.
  • Errors stay in the dialog: a server error now shows inside the dialog instead of a toast.

#11: definition checks on save

Saving a workflow now checks its shape (definitionErrors) and refuses it with the reasons:

  • each step's type and required fields (execute needs command; prompt needs message and options; route needs conditions);
  • unique ids, which the README already claimed were checked;
  • prompt routes that match the options;
  • the parameter definitions.

Unknown step types were silently skipped at run time. The goto and condition checks (#20, #77) still apply. I added the README's own example to the checks as a sanity test, and it passes.

Existing workflows: I didn't run the new checks against production's saved workflows, because that needs production access. They keep running unchanged. The checks only run when a workflow is saved, so if one is flagged when you next edit it, the reason will say what's wrong.

README: documents the parameter types and the save-time checks.

Tests

  • Unit tests for resolveParams and definitionErrors.
  • Integration:
    • bad parameters get a 400 and no run is created;
    • defaults are used;
    • an unknown step type is refused on save.
  • The old test that expected a run to fail on an unsafe value now expects the 400.
  • A UI test checks the typed fields and their defaults, that a bad value is caught without a request, and that a good run ends with the expected output.
  • Locally: unit 158/158, integration 56/56, UI 47/47, lint and semgrep are clean.

🤖 Generated with Claude Code

Closes #23, closes #11. **This is a UI change, so it needs your approval.** ![Run dialog, before and after](https://code.lotusguild.org/LotusGuild/pulse/raw/branch/pr-assets/pr-84/run-dialog.png) ## #23: parameters - **Types:** a parameter can be `text` (the default), `number` (with `min` and `max`), `select` (with `options`), `boolean`, or `worker`. Each can have a `default`. The Run dialog shows a matching field: - text boxes show the allowed characters; - number boxes show the range; - worker parameters are a dropdown of connected workers, online ones first. - **Checked before anything starts.** A bad value used to create a run that failed partway with "Unsafe value for workflow parameter". Now it's caught twice, up front: - in the dialog, which names the characters that aren't allowed (e.g. "Not allowed: space ;"); - by the server (`resolveParams`), which answers 400 `Invalid parameters: …` and creates no execution. - **Defaults** fill in any field left empty. - **Errors stay in the dialog:** a server error now shows inside the dialog instead of a toast. ## #11: definition checks on save Saving a workflow now checks its shape (`definitionErrors`) and refuses it with the reasons: - each step's type and required fields (`execute` needs `command`; `prompt` needs `message` and `options`; `route` needs `conditions`); - unique ids, which the README already claimed were checked; - prompt routes that match the options; - the parameter definitions. Unknown step types were silently skipped at run time. The goto and condition checks (#20, #77) still apply. I added the README's own example to the checks as a sanity test, and it passes. **Existing workflows:** I didn't run the new checks against production's saved workflows, because that needs production access. They keep running unchanged. The checks only run when a workflow is saved, so if one is flagged when you next edit it, the reason will say what's wrong. **README:** documents the parameter types and the save-time checks. ## Tests - Unit tests for `resolveParams` and `definitionErrors`. - Integration: - bad parameters get a 400 and no run is created; - defaults are used; - an unknown step type is refused on save. - The old test that expected a run to fail on an unsafe value now expects the 400. - A UI test checks the typed fields and their defaults, that a bad value is caught without a request, and that a good run ends with the expected output. - **Locally:** unit 158/158, integration 56/56, UI 47/47, lint and semgrep are clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jared added 1 commit 2026-11-23 18:12:04 -05:00
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
a6d693c13e
#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>
jared merged commit 777ab728c0 into main 2026-11-23 18:24:24 -05:00
jared deleted branch workflow-params 2026-11-23 18:24:26 -05:00
Sign in to join this conversation.