fix: four validation-related backlog items - #31
Conversation
…itive, whitespace description, broad assertions
EricWittmann
left a comment
There was a problem hiding this comment.
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.
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.stringifywithstableStringifythat 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 #24 —
DUPLICATE_EDGE_PRIORITYfalse 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 #25 —
MISSING_TASK_DESCRIPTIONdoesn't trim whitespace. Added.trim() === ''check so whitespace-only descriptions are flagged, consistent with every other string validation in the file.Engine Test Quality
assertThrows(Exception.class). ChangedstartWorkflowValidatesDefinitionto assertWorkflowValidationException.classandstartWorkflowValidatesRequiredInputsto assertIllegalArgumentException.class. These assertions now fail if the wrong exception type is thrown.Tests Added