Skip to content

Add full field support to tryTask form generation - #476

Open
handreyrc wants to merge 4 commits into
open-workflow-specification:feature/node-editingfrom
handreyrc:try-catch-form
Open

handreyrc wants to merge 4 commits into
open-workflow-specification:feature/node-editingfrom
handreyrc:try-catch-form

Conversation

@handreyrc

Copy link
Copy Markdown
Contributor

Closes #408

This PR introduces full field support to tryTask form generation in both read-only and edit mode.

Not Addressed in This PR

  • Layered validation (field-level and task-level).

Changes

  • Added full field support for tryTask form generation, covering backoff variants.
  • Extended schema walker to detect backoff schemas and generate EnumField definitions with discriminator valueMap and structured inner object support.
  • Enhanced EnumControl with discriminator selection and inline YAML/JSON textarea editing for inner backoff payloads.
  • Updated EditFormFooter with task ID resolution for try/catch child nodes and proper serialization/clearing of valueMap fields.
  • Added comprehensive unit and E2E tests for backoff form editing, clearing, and reset behavior.

How to Test

  • Use try task sample workflows from **EXAMPLES ** and NESTED EDITING stories in Storybook to validate the tryTask in both read-only and edit mode.

Signed-off-by: Handrey Cunha <handrey.cunha@gmail.com>
@changeset-bot

changeset-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f6a70bd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@openworkflowspec/diagram-editor Minor
@openworkflowspec/i18n Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify

netlify Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for openworkflow-editor ready!

Name Link
🔨 Latest commit f6a70bd
🔍 Latest deploy log https://app.netlify.com/projects/openworkflow-editor/deploys/6ac901c2cd8e360008e70061
😎 Deploy Preview https://deploy-preview-476--openworkflow-editor.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Object flattening, enum clearing, nested catch commits, and malformed payload handling currently have correctness issues.

3 open findings
What changed in this PR

Adds comprehensive tryTask form support, including editable backoff discriminators and nested payloads.

Changes:

  • Adds backoff schema detection, controls, serialization, and task-ID resolution.
  • Adds unit, integration, E2E, fixture, and Storybook coverage.
  • Includes minor history cleanup and Playwright timeout adjustment.
File Description
.changeset/​tryTask-form.md Records the minor release change.
playwright.config.ts Increases E2E timeout.
src/​core/​schemaToFormFields.ts Generates backoff enum descriptors.
src/​react-flow/​hooks/​useWorkflowHistory.ts Simplifies history reset handling.
src/​side-panel/​EditFormFooter.tsx Serializes and commits backoff values.
src/​side-panel/​forms/​TaskForm.tsx Preserves discriminator objects during flatten/reset.
src/​side-panel/​forms/​customFields/​EnumControl.tsx Adds discriminator and payload editing.
src/​side-panel/​forms/​taskFormContext.ts Collects value-map fields recursively.
stories/​nested-editing/​NestedEditing.stories.tsx Registers the new story.
stories/​nested-editing/​index.ts Exports the story workflow.
stories/​nested-editing/​workflows/​try-catch-retry-inline.yaml Provides an inline retry example.
tests-e2e/​backoff-clear.spec.ts Tests clearing backoff end-to-end.
tests/​core/​schemaToFormFields.test.ts Tests backoff schema conversion.
tests/​fixtures/​workflows.ts Adds backoff workflow fixtures.
tests/​side-panel/​EditFormFooter.test.tsx Updates footer visibility coverage.
tests/​side-panel/​EditFormFooter.tryTask.test.tsx Tests try/catch commits and resets.
tests/​side-panel/​forms/​TaskForm.test.ts Tests discriminator flattening.
tests/​side-panel/​forms/​customFields/​EnumControl.test.tsx Tests enum payload editing.
tests/​side-panel/​forms/​taskFormContext.test.ts Tests descriptor path collectors.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread packages/open-workflow-diagram-editor/src/side-panel/forms/TaskForm.tsx Outdated
Signed-off-by: Handrey Cunha <handrey.cunha@gmail.com>

@fantonangeli fantonangeli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, only a small suggestion


export default defineConfig({
testDir: "tests-e2e",
timeout: 60000,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need this timeout? Even the slowest job (macos-latest) runs the full E2E suite in 60'', and these tests pass locally without it on my laptop.

@handreyrc handreyrc Oct 9, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@fantonangeli,

Yes, we need it. I have text editor tests failing consistently due to timeouts with build:prod.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@handreyrc just curious, what I read under ubuntu-latest job is:

  packages/open-workflow-diagram-editor build:prod: > @openworkflowspec/diagram-editor@1.1.0 test-e2e /home/runner/work/editor/editor/packages/open-workflow-diagram-editor
  packages/open-workflow-diagram-editor build:prod: > playwright test
  packages/open-workflow-diagram-editor build:prod: Running 10 tests using 2 workers
  packages/open-workflow-diagram-editor build:prod: ··········
  packages/open-workflow-diagram-editor build:prod:   10 passed (32.6s)

https://github.com/open-workflow-specification/editor/actions/runs/37802840700/job/113399252881?pr=476#step:5:410
So it seems that executing 10 e2e tests takes 32 seconds in total.
But of course, I don't want to block this PR for a small setting.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure if cause my laptop is sort of old and it is taking more time.
image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

From your image I see 1.8m on text-editor and 35s on diagram-editor.
But I don't see a particular text-editor test slowing down on your machine.
In my local env I have this execution time for the TE, using your branch:

> @openworkflowspec/text-editor@1.1.0 test-e2e /home/fantonan/NotBackedUp/repos/open-workflow-specification-editor-review/packages/text-editor
> playwright test


Running 12 tests using 1 worker

  ✓   1 tests-e2e/text-editor.spec.ts:35:3 › TextEditor JSON › Monaco editor is interactive (2.3s)
  ✓   2 tests-e2e/text-editor.spec.ts:44:5 › TextEditor JSON › Completions › JSON schema completion adds the `do` property (1.9s)
  ✓   3 tests-e2e/text-editor.spec.ts:64:5 › TextEditor JSON › Completions › Hello World Completion inserts the sample workflow (1.3s)
  ✓   4 tests-e2e/text-editor.spec.ts:76:5 › TextEditor JSON › Completions › completions are not available in read-only mode (1.1s)
  ✓   5 tests-e2e/text-editor.spec.ts:90:5 › TextEditor JSON › CodeLenses › Hello World CodeLens activates and inserts the sample workflow (2.0s)
  ✓   6 tests-e2e/text-editor.spec.ts:101:5 › TextEditor JSON › CodeLenses › CodeLens is hidden in read-only mode (1.1s)
  ✓   7 tests-e2e/text-editor.spec.ts:107:5 › TextEditor JSON › CodeLenses › JSON → YAML: CodeLens disappears after language switch (2.0s)
  ✓   8 tests-e2e/text-editor.spec.ts:120:5 › TextEditor JSON › CodeLenses › YAML → JSON: CodeLens reappears after language switch (2.0s)
  ✓   9 tests-e2e/text-editor.spec.ts:133:5 › TextEditor JSON › CodeLenses › YAML + isReadOnly true → false: CodeLens stays hidden (1.1s)
  ✓  10 tests-e2e/text-editor.spec.ts:151:5 › TextEditor JSON › Diagnostics › syntactically invalid JSON shows an error marker (1.3s)
  ✓  11 tests-e2e/text-editor.spec.ts:159:5 › TextEditor JSON › Diagnostics › OWS-schema-invalid JSON shows a warning marker (1.3s)
  ✓  12 tests-e2e/text-editor.spec.ts:168:5 › TextEditor JSON › Diagnostics › replacing OWS-invalid JSON with a valid workflow removes warning markers (1.5s)

  12 passed (22.3s)

Which seems good

@lornakelly

lornakelly commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

@handreyrc The value in backoff box does seem to hold when I collapse the section

Screen.Recording.2026-10-09.at.10.32.22.mov

Signed-off-by: Handrey Cunha <handrey.cunha@gmail.com>
@handreyrc

Copy link
Copy Markdown
Contributor Author

@handreyrc The value in backoff box does seem to hold when I collapse the section

Screen.Recording.2026-10-09.at.10.32.22.mov

I added code reset it, I see it caused and undesired side effect.
It is fixed!

@handreyrc
handreyrc requested review from fantonangeli and a balanced review from Copilot October 9, 2026 14:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Reset handling can clobber reusable retry references, while malformed or format-switched payloads are not handled safely.

2 open findings
3 resolved since last review
Previously missed (2)

In code that hasn't changed since last review

Medium severity Preserve reusable retry references when padding backoff

packages/​open-workflow-diagram-editor/​src/​side-panel/​forms/​TaskForm.tsx:79

The new reset callers use this helper to pad catch.retry.backoff even when the active retry variant is a reusable-policy string (for example, stories/examples/workflows/try-catch-retry-reusable.yaml has retry: default). Since this helper replaces an existing scalar intermediate with an object, Apply or an external reset turns that form default into retry: { backoff: "" }, so the reference disappears from the form. Preserve existing non-object parents, or restrict padding to fields in the active one-of variant.

Medium severity Reserialize fields when content format changes

packages/​open-workflow-diagram-editor/​src/​side-panel/​forms/​customFields/​EnumControl.tsx:187

The resync condition only watches defaultValues, not field.innerObjectFormat. Calling setContent with the same workflow serialized in the other format changes contentFormat and recreates these descriptors, but the structurally equal task does not reset the form; the textarea therefore keeps YAML text in JSON mode (or vice versa), and the next edit/Apply parses it using the wrong format. Re-serialize when the field format changes, as StructuredValueField already does.

🧠 Review effort: Balanced

Comment thread packages/open-workflow-diagram-editor/src/side-panel/EditFormFooter.tsx Outdated
Signed-off-by: Handrey Cunha <handrey.cunha@gmail.com>
@handreyrc
handreyrc requested a review from lornakelly October 9, 2026 15:01

@lornakelly lornakelly left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

This branch has not been deployed

No deployments
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.

4 participants