Flows YAML — Monaco editor with autocomplete, validation, dry-run, run trace #1077

Closed
opened 2026-05-10 15:42:52 +00:00 by claude-desktop · 0 comments
Collaborator

User story

As an operator, I want a polished in-browser YAML editor with list view, CRUD, IntelliSense-grade autocomplete, multi-layer validation, side-panel diagnostics + docs, dry-run, and historical run replay overlay, so that authoring and debugging flows feels as good as editing CI YAML in VS Code.

Replaces the React Flow canvas (NF-UI-1..7).

Acceptance criteria

Routes (apps/web/src/routes/)

  • flows/index.tsx — searchable table: name, source badge (default/custom), trigger summary, enabled pill, last-run pill, mtime. Row actions: edit, dry-run, disable, delete (custom only).
  • flows/new.tsx — name input + starter template picker (blank, pr-opened, issue-labeled, …); loads template YAML on submit.
  • flows/$name.tsx — split-pane: Monaco editor left, side-panel right.
  • flows/$name?run=<id> — same view, editor read-only with replay overlay.

Editor stack

  • monaco-editor + monaco-yaml lazy-loaded as a route-level chunk.
  • Tokyo Night theme (matches design/tokens.json).
  • Editor loads /schemas/flows.schema.json once on mount.
  • First paint < 300ms after route load (perf budget tracked in CI bundle audit).
  • If Monaco bundle > 500KB chunked, evaluate CodeMirror 6 fallback (spec §10.3.9); decision recorded in PR description.

Save bar

  • Dirty indicator, format button (yaml prettifier), validate button (server round-trip), save button.
  • Save disabled while client-side schema errors present.
  • PUT /flows/:name with expected_mtime; 409 → diff prompt with current server contents.

Autocomplete provider

  • Top-level keys: name, on, if, priority, concurrency, steps, env.
  • on: value list: trigger kinds; on.<kind> array list: subtypes filtered by kind.
  • steps[].uses: — registered op names from schema discriminator.
  • steps[].with: — required + optional args for the chosen uses:, with type hints + Zod .describe() text.
  • Inside ${{ }} and if:: event.*, steps.<id>.outputs.<key>, env.*, built-in functions, operators.

Custom diagnostics provider

  • Duplicate step.id within a flow.
  • ${{ steps.X.outputs.Y }} references unknown step or output key (uses outputsSchema).
  • if: expression fails to parse (mini-AST round-trip).
  • uses: not in registered ops list.
  • concurrency.group template references unknown variable.
  • Diagnostics run in a web worker, < 50ms p95 on keystroke.

Side panel tabs

  • Validation — Monaco markers grouped by severity, click → jump-to-line, live count update.
  • Help — schema docs auto-generated from Zod .describe(): per op, per trigger, per built-in; searchable.
  • Dry-run — synthetic-event picker (dropdown of triggers + JSON form prefilled per kind). Run button calls POST /flows/:name/dry-run. Output panel: per-step status, duration, resolved args, output. Sample-event templates seeded for each trigger.
  • RunsGET /flows/runs?flow=:name paginated list with status pill, duration, trigger summary, link to overlay.

Replay overlay (?run=<id>)

  • Editor read-only.
  • Per-step gutter decoration: green check, red x, gray skip.
  • Hover on step shows step output / error JSON in tooltip.
  • URL is shareable; deep-linked load fetches GET /flows/runs/:id.

Server defence in depth

  • Validate button calls POST /flows/:name?validate=1 (server returns 422 with same diagnostics shape if invalid).
  • Save blocks on server validation failures even if client-side reports clean.

Tests (Vitest browser mode)

  • List renders from mocked API; row actions navigate.
  • Create-flow dialog writes through to POST /flows.
  • Save fires PUT /flows/:name and updates dirty state; mtime conflict surfaces merge dialog.
  • Typing triggers each diagnostic class; autocomplete suggestions snapshot per position.
  • Dry-run smoke test against each default flow.
  • Replay overlay renders gutter decorations matching server trace.

Out of scope

  • Editing during replay.
  • Cross-flow timeline view.
  • Diff between two runs.
  • Git commit-and-push button.

References

  • Spec: docs/specs/flows-yaml.md §10.3 (all subsections).
## User story As an operator, I want a polished in-browser YAML editor with list view, CRUD, IntelliSense-grade autocomplete, multi-layer validation, side-panel diagnostics + docs, dry-run, and historical run replay overlay, so that authoring and debugging flows feels as good as editing CI YAML in VS Code. Replaces the React Flow canvas (NF-UI-1..7). ## Acceptance criteria ### Routes (`apps/web/src/routes/`) - [ ] `flows/index.tsx` — searchable table: name, source badge (default/custom), trigger summary, enabled pill, last-run pill, mtime. Row actions: edit, dry-run, disable, delete (custom only). - [ ] `flows/new.tsx` — name input + starter template picker (blank, pr-opened, issue-labeled, …); loads template YAML on submit. - [ ] `flows/$name.tsx` — split-pane: Monaco editor left, side-panel right. - [ ] `flows/$name?run=<id>` — same view, editor read-only with replay overlay. ### Editor stack - [ ] `monaco-editor` + `monaco-yaml` lazy-loaded as a route-level chunk. - [ ] Tokyo Night theme (matches `design/tokens.json`). - [ ] Editor loads `/schemas/flows.schema.json` once on mount. - [ ] First paint < 300ms after route load (perf budget tracked in CI bundle audit). - [ ] If Monaco bundle > 500KB chunked, evaluate CodeMirror 6 fallback (spec §10.3.9); decision recorded in PR description. ### Save bar - [ ] Dirty indicator, format button (yaml prettifier), validate button (server round-trip), save button. - [ ] Save disabled while client-side schema errors present. - [ ] `PUT /flows/:name` with `expected_mtime`; 409 → diff prompt with current server contents. ### Autocomplete provider - [ ] Top-level keys: `name`, `on`, `if`, `priority`, `concurrency`, `steps`, `env`. - [ ] `on:` value list: trigger kinds; `on.<kind>` array list: subtypes filtered by kind. - [ ] `steps[].uses:` — registered op names from schema discriminator. - [ ] `steps[].with:` — required + optional args for the chosen `uses:`, with type hints + Zod `.describe()` text. - [ ] Inside `${{ }}` and `if:`: `event.*`, `steps.<id>.outputs.<key>`, `env.*`, built-in functions, operators. ### Custom diagnostics provider - [ ] Duplicate `step.id` within a flow. - [ ] `${{ steps.X.outputs.Y }}` references unknown step or output key (uses `outputsSchema`). - [ ] `if:` expression fails to parse (mini-AST round-trip). - [ ] `uses:` not in registered ops list. - [ ] `concurrency.group` template references unknown variable. - [ ] Diagnostics run in a web worker, < 50ms p95 on keystroke. ### Side panel tabs - [ ] **Validation** — Monaco markers grouped by severity, click → jump-to-line, live count update. - [ ] **Help** — schema docs auto-generated from Zod `.describe()`: per op, per trigger, per built-in; searchable. - [ ] **Dry-run** — synthetic-event picker (dropdown of triggers + JSON form prefilled per kind). Run button calls `POST /flows/:name/dry-run`. Output panel: per-step status, duration, resolved args, output. Sample-event templates seeded for each trigger. - [ ] **Runs** — `GET /flows/runs?flow=:name` paginated list with status pill, duration, trigger summary, link to overlay. ### Replay overlay (`?run=<id>`) - [ ] Editor read-only. - [ ] Per-step gutter decoration: green check, red x, gray skip. - [ ] Hover on step shows step output / error JSON in tooltip. - [ ] URL is shareable; deep-linked load fetches `GET /flows/runs/:id`. ### Server defence in depth - [ ] Validate button calls `POST /flows/:name?validate=1` (server returns 422 with same diagnostics shape if invalid). - [ ] Save blocks on server validation failures even if client-side reports clean. ### Tests (Vitest browser mode) - [ ] List renders from mocked API; row actions navigate. - [ ] Create-flow dialog writes through to `POST /flows`. - [ ] Save fires `PUT /flows/:name` and updates dirty state; mtime conflict surfaces merge dialog. - [ ] Typing triggers each diagnostic class; autocomplete suggestions snapshot per position. - [ ] Dry-run smoke test against each default flow. - [ ] Replay overlay renders gutter decorations matching server trace. ## Out of scope - Editing during replay. - Cross-flow timeline view. - Diff between two runs. - Git commit-and-push button. ## References - Spec: `docs/specs/flows-yaml.md` §10.3 (all subsections).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks#1077
No description provided.