Skip to content

fix(workflows): preserve input drafts across editor modes - #1065

Merged
dovvnloading merged 1 commit into
mainfrom
agent/preserve-workflow-input-drafts
Nov 25, 2026
Merged

dovvnloading merged 1 commit into
mainfrom
agent/preserve-workflow-input-drafts

Conversation

@dovvnloading

Copy link
Copy Markdown
Owner

Summary

Fixes #1034. Switching the workflow launcher between the form and JSON used to replace partial or invalid drafts with example inputs and restore stale form values after editing JSON. Convert the current values in both directions; keep the active editor and show an error whenever the form cannot faithfully represent a request.

What Changed

  • Allow incomplete required inputs only during editor conversion; normal form preview and preset validation remain strict.
  • Round-trip representable text, JSON and table values, including removed inputs, and reject malformed JSON, changed specs, unknown fields and typed asset/table values that would be lost or altered in the form.
  • Start examples that are not representable in the form in JSON mode. Remove the silent fallback to examples.
  • Invalidate the run review on input edits and successful editor switches; failed switches keep the draft and unchanged review. Preview and explicit approval/start sequencing are unchanged.
  • Add 11 component regression cases covering partial drafts, repeated switches, preview payloads, malformed input, typed file/image references, lossy tables, unexpected fields, spec edits and typed examples.

Why

  • Users should not unknowingly preview or run example or stale values. Requests the form cannot express must stay in JSON until the user explicitly edits them into a representable shape.
  • A complete typed request round-trip guards against lossy conversions, including object key reordering, without changing the workflow wire schema or accepting a changed workflow spec in the form.

Validation

  • Strict isolated TypeScript compilation (Node 22, TypeScript 5.8.3) of the new conversion helper and extracted input-conversion functions with minimal generated-type fixtures.
  • Nine isolated Node tests passed, covering partial/strict validation, typed round-trip, invalid form JSON, malformed request shape, changed spec, file/image values, lossy CSV/unknown parameters, extra fields and deleted inputs. The tested helper's blob hash matches the committed helper after restoring its repository import path.
  • Reviewed the committed diff: one commit, four intended files, zero commits behind main at comparison time.
  • App launches
  • Relevant workflow was exercised manually
  • python -m compileall -q . passes (run from the repo root - matches CI)
  • python -m pytest -q passes (run from the repo root - matches CI)
  • cd web_ui && npm run check passes (matches CI)

Local Git checkout failed because github.com cannot be resolved in this environment. The isolated harness does not exercise React, Vitest, the full TypeScript project or the backend. The new component tests and required CI jobs remain unverified locally. From a configured checkout:

npm --prefix web_ui run test -- src/app/chrome/WorkflowRunLauncher.test.tsx src/app/chrome/workflowApi.test.ts src/app/chrome/WorkflowPresetsPanel.test.tsx
npm --prefix web_ui run check

Manual verification: fill one required input, leave another empty, switch to JSON, edit values, switch back, and preview. Try malformed JSON and an asset reference; verify the mode and draft remain unchanged on failure. Check keyboard operation and both themes.

UI Notes

  • Screenshots included if the change is visual
  • No screenshots needed

Uses the existing switch and InlineAlert kit, without new styles. Visual and keyboard checks still pending.

Additional Context

JSON formatting may change when switching successfully; the round-trip protects typed values, not whitespace or object key order. The existing CSV form parser's separate issues (#1031) are not changed; the JSON-to-form round-trip prevents silently coercing typed table values. No dependency, schema, workflow execution, approval, or CI changes. Draft pending CI and manual verification; do not merge until these pass.

@dovvnloading dovvnloading left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge review

Reviewed all four changed files against #1034's acceptance criteria. The conversion no longer resets to examples when required inputs are incomplete, JSON-to-form switching checks the complete typed request for loss, failed conversions retain the active editor, and edits invalidate the preview without changing the approval/start sequence. No blocking new code defect found. Existing CSV parser limitations (#1031) remain outside this patch.

Verified CI run 45594651177: Python compile/lint/pytest, frontend schema/typecheck/lint/Vitest/build, package build/import and POSIX checks passed. The frontend log explicitly shows all 11 launcher regressions passing, 185 test files and 4,181 tests total. The PR is one commit ahead of its merge base and main has advanced eight unrelated commits, with no changed-file overlap or GitHub-reported merge conflict at review time. No existing review comments/threads.

Limitations: the browser E2E job is intentionally skipped on PRs by repository CI policy; manual app/keyboard/theme verification was not performed because checkout and npm registry DNS are unavailable here. The original draft notes requested manual verification. For this targeted nonvisual fix, the repository owner's current request to process and merge a PR, the passing interaction regression tests covering the linked issue's acceptance criteria, and unchanged switch/design-system components are the basis for proceeding; this is not a claim that manual checks passed. This is a comment review rather than independent approval because the connected account authored the PR.

@dovvnloading
dovvnloading marked this pull request as ready for review November 25, 2026 11:18
@dovvnloading
dovvnloading merged commit 67294d0 into main Nov 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(workflows): toggling Edit as JSON silently discards workflow input edits

1 participant