Skip to content

fix: four validation-related backlog items - #31

Merged
EricWittmann merged 1 commit into
mainfrom
fix/validation-issues
Aug 21, 2026
Merged

fix: four validation-related backlog items#31
EricWittmann merged 1 commit into
mainfrom
fix/validation-issues

Conversation

@EricWittmann

Copy link
Copy Markdown
Contributor

Summary

Fixes all four remaining validation-related backlog items.

TS Validator Bugs

  • chore(deps): update dependency python to v3.14.7 #18 — Duplicate event receiver comparison is order-sensitive. Replaced JSON.stringify with stableStringify that sorts object keys before serializing. Two receive-event nodes with the same match config in different key order are now correctly detected as duplicates.

  • fix(ui): WorkflowEditor fires onChange on initial render #24DUPLICATE_EDGE_PRIORITY false positive with default edges. Filtered default edges out of the priority count. Default edges use priority as a fallback position, not for routing order, so they shouldn't trigger collision warnings with conditional edges.

  • fix(engine): two critical bugs in WorkflowEngine #25MISSING_TASK_DESCRIPTION doesn't trim whitespace. Added .trim() === '' check so whitespace-only descriptions are flagged, consistent with every other string validation in the file.

Engine Test Quality

  • Improvement chore(deps): update dependency python to v3.14.7 #18 — Over-broad assertThrows(Exception.class). Changed startWorkflowValidatesDefinition to assert WorkflowValidationException.class and startWorkflowValidatesRequiredInputs to assert IllegalArgumentException.class. These assertions now fail if the wrong exception type is thrown.

Tests Added

  • Default edge sharing priority 0 with conditional edge → no false positive
  • Whitespace-only human task description → flagged as missing
  • Duplicate event receivers with different key order → detected as duplicates

…itive, whitespace description, broad assertions

@EricWittmann EricWittmann left a comment

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.

Code Review

This PR fixes four validation-related backlog items: an order-sensitive duplicate event receiver comparison, a false-positive DUPLICATE_EDGE_PRIORITY for default edges, a missing whitespace trim on human task descriptions, and overly broad exception assertions in engine tests.

Findings

No issues found. Each change is correct, well-scoped, and consistent with existing patterns in the codebase.

Details

stableStringify (validateWorkflow.ts:378–388) — Clean implementation. The JSON.stringify replacer correctly sorts keys at every nesting level. The v && typeof v === 'object' && !Array.isArray(v) guard properly handles null (avoids typeof null === 'object' trap) and preserves array element order, which is semantically meaningful. Handles undefined match configs identically to the old JSON.stringify path, so no behavioral regression there.

Default edge priority filter (validateWorkflow.ts:254) — Filtering outgoing.filter(e => !e.isDefault) before counting priorities is the right fix. The surrounding code already separates default-edge logic (lines 238–245), so this is consistent with the existing design that treats default edges as fallbacks rather than priority-routed branches.

Whitespace description check (validateWorkflow.ts:298) — The typeof node.config.description === 'string' guard is appropriately defensive given that config is Record<string, any>, preventing a runtime error if description were somehow a non-string truthy value. The .trim() === '' pattern matches every other blank-string check in this file (e.g., lines 21, 24, 37, 41, 119, 131).

Engine test assertions (WorkflowEngineStartTest.java:89, 100) — Verified against the engine source: startWorkflow throws WorkflowValidationException from the validator (line 49) and IllegalArgumentException from validateInputs (lines 637–638). Both narrowed assertions are correct.

Tests — All three new tests target the exact bug scenarios described in the PR. Test structure follows the existing patterns (helper functions, hasProblem assertions).

Verdict

Looks good to merge. Clean, focused fixes with matching tests. No correctness, security, or performance concerns.

@EricWittmann
EricWittmann merged commit 72444b7 into main Aug 21, 2026
2 checks passed
EricWittmann added a commit that referenced this pull request Aug 21, 2026
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.

1 participant