5557 Resolve nested task data pill references and relax label to a warning - #5565
Conversation
…rning Resolve bare data pill references against allTasksMap so tasks nested inside a task dispatcher are found, descend into branch cases[].tasks when validating nested tasks, and report a missing label as a warning rather than an error. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes validation gaps in platform-workflow-validator around nested task handling (especially branch/v1 case tasks) and bare data-pill task references, and changes missing label from an error to a warning so workflows can still be saved while preserving type validation.
Changes:
- Resolve bare
${taskName}references against the live task registry (including nested tasks) rather than an immutable task-name list. - Ensure nested tasks inside
branch/v1cases[].tasksare discovered and validated (structure/params/data pills). - Downgrade missing
labelto a warning across workflow/task/input/trigger validation, while keeping non-stringlabelas an error; add/adjust tests accordingly.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| server/libs/platform/platform-workflow/platform-workflow-validator/platform-workflow-validator-service/src/main/java/com/bytechef/platform/workflow/validator/WorkflowValidator.java | Threads warnings through structure + input validation and treats workflow label as optional (warning). |
| server/libs/platform/platform-workflow/platform-workflow-validator/platform-workflow-validator-service/src/main/java/com/bytechef/platform/workflow/validator/TaskValidator.java | Makes task label optional (warning), improves nested-task discovery for ARRAY<OBJECT{..., tasks: ARRAY<TASK>}>, and plumbs warnings through structure validation APIs. |
| server/libs/platform/platform-workflow/platform-workflow-validator/platform-workflow-validator-service/src/main/java/com/bytechef/platform/workflow/validator/FieldValidator.java | Introduces optional-string validation that emits warnings when missing while still erroring on wrong type. |
| server/libs/platform/platform-workflow/platform-workflow-validator/platform-workflow-validator-service/src/main/java/com/bytechef/platform/workflow/validator/DataPillValidator.java | Fixes bare task reference existence checks to use the live all-tasks map (nested included). |
| server/libs/platform/platform-workflow/platform-workflow-validator/platform-workflow-validator-service/src/main/java/com/bytechef/platform/workflow/validator/ArrayPropertyValidator.java | Passes warnings into nested task-array validation. |
| server/libs/platform/platform-workflow/platform-workflow-validator/platform-workflow-validator-service/src/test/java/com/bytechef/platform/workflow/validator/WorkflowValidatorTest.java | Updates existing tests for new warning plumbing and missing-label behavior changes. |
| server/libs/platform/platform-workflow/platform-workflow-validator/platform-workflow-validator-service/src/test/java/com/bytechef/platform/workflow/validator/WorkflowValidatorInputsTest.java | Updates missing-input-label expectations from error to warning. |
| server/libs/platform/platform-workflow/platform-workflow-validator/platform-workflow-validator-service/src/test/java/com/bytechef/platform/workflow/validator/WorkflowValidatorDuplicateNodeNamesTest.java | Minor doc update (author tag). |
| server/libs/platform/platform-workflow/platform-workflow-validator/platform-workflow-validator-service/src/test/java/com/bytechef/platform/workflow/validator/WorkflowValidatorOptionalLabelTest.java | Adds focused coverage for optional label behavior (warnings vs errors). |
| server/libs/platform/platform-workflow/platform-workflow-validator/platform-workflow-validator-service/src/test/java/com/bytechef/platform/workflow/validator/WorkflowValidatorNestedTaskReferenceTest.java | Adds coverage for bare references to nested tasks and for validating tasks nested in branch/v1 cases. |
Suppressed comments (1)
server/libs/platform/platform-workflow/platform-workflow-validator/platform-workflow-validator-service/src/test/java/com/bytechef/platform/workflow/validator/WorkflowValidatorNestedTaskReferenceTest.java:68
- With
@ExtendWith(ObjectMapperSetupExtension.class)in place, the@BeforeAllmethod that mutates the globalJsonUtilsObjectMapper should be removed to avoid leaking state between tests.
public static void beforeAll() {
JsonUtils.setObjectMapper(
JsonMapper.builder()
.build());
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The message a data pill emits for an unknown task read "doesn't exits". It is rendered in the workflow editor, so the misspelling is user visible. The two tests asserting the exact string are updated with it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…new validator tests The two tests added for nested task references and the optional label each set JsonUtils up through their own @BeforeAll, while the project convention is @ExtendWith(ObjectMapperSetupExtension.class). The extension performs the same setup for ConvertUtils, MapUtils and XmlUtils as well, so the module gains a test dependency on test-support. The five tests that predate this change still use @BeforeAll and are left alone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|



Closes #5557
Three related defects in
platform-workflow-validator, all reachable from one workflow whosebranch/v1cases contain anaiAgenttask referenced as${aiAgent_1}.1. Bare references to nested tasks reported as non-existent
DataPillValidator.validateTaskReferenceresolved a pathless data pill (${aiAgent_1}) againstValidationContext.getTaskNames(), which returns a defensive copy — unlike its siblingsgetAllTasksMap/getTaskNameToTypeMap, which return the live collections.TaskValidator.addNestedTaskToContextwas therefore writing every nested task name into a throwaway list, and the registration silently no-opped.Property references (
${aiAgent_1.someField}) were unaffected because they resolve through the livetaskNameToTypeMap— which is why only bare references ever showed the error.Existence now resolves against
allTasksMap. The ordered name list is deliberately left alone: it also backs the task-order check viaindexOf, and appending nested names there would produce bogus "Wrong task order" errors for a top-level task legitimately referencing a task nested in an earlier dispatcher.2. Tasks nested in
branch/v1cases were never validatedTaskValidator.processTaskArrayPropertyonly recognisedARRAY-of-TASK.branch/v1declarescasesasARRAY-of-OBJECT{key, tasks: ARRAY-of-TASK}, and that one extra object level made everything insidecases[].tasksinvisible to structure, parameter and cluster-element validation. (defaultworked, being a flatARRAY-of-TASK.) It now descends one object level and recurses intofindAndValidateNestedTasks.3.
labelwas a hard error though the engine treats it as optionalA missing
labelblocked saving from the workflow code editor (WorkflowCodeEditorSheetdisables Save onhasErrors), even though every domain model serialises it only when non-null —WorkflowTask/WorkflowTriggerguard onlabel != null, andWorkflowroot /Workflow.Inputread it viaMapUtils.getString. A missinglabelon the workflow, its inputs, its triggers and its tasks is now a warning (Missing recommended field: label); alabelof the wrong type stays an error, via a newFieldValidator.appendWarningOptionalStringField.Known gap, not addressed here
WorkflowCodeEditorSheetandWorkflowNodeDetailsPanelrendererrorsonly, so validator warnings are not surfaced anywhere in the editor. Withlabeldowngraded, that signal is now invisible rather than soft. Surfacing warnings in both panels is worth a separate change.Tests
WorkflowValidatorNestedTaskReferenceTest— bare reference inside a condition, bare reference inside a branch case, structure validation reaching a branch-nested taskWorkflowValidatorOptionalLabelTest— workflow / input / trigger / task missing label yields a warning and no error; a non-string label still errors:platform-workflow-validator-service:checkon this branch: 156 tests, 0 failures, spotless / checkstyle / PMD / SpotBugs clean.🤖 Generated with Claude Code