Romuald Członkowski
|
eac4e67101
|
fix: recognize all trigger node types including executeWorkflowTrigger (#351) (#352)
This fix addresses issue #351 where Execute Workflow Trigger and other
trigger nodes were incorrectly treated as regular nodes, causing
"disconnected node" errors during partial workflow updates.
## Changes
**1. Created Shared Trigger Detection Utilities**
- src/utils/node-type-utils.ts:
- isTriggerNode(): Recognizes ALL trigger types using flexible pattern matching
- isActivatableTrigger(): Returns false for executeWorkflowTrigger (not activatable)
- getTriggerTypeDescription(): Human-readable trigger descriptions
**2. Updated Workflow Validation**
- src/services/n8n-validation.ts:
- Replaced hardcoded webhookTypes Set with isTriggerNode() function
- Added validation preventing activation of workflows with only executeWorkflowTrigger
- Now recognizes 200+ trigger types across n8n packages
**3. Updated Workflow Validator**
- src/services/workflow-validator.ts:
- Replaced inline trigger detection with shared isTriggerNode() function
- Ensures consistency across all validation code paths
**4. Comprehensive Tests**
- tests/unit/utils/node-type-utils.test.ts:
- Added 30+ tests for trigger detection functions
- Validates all trigger types are recognized correctly
- Confirms executeWorkflowTrigger is trigger but not activatable
## Impact
Before:
- Execute Workflow Trigger flagged as disconnected node
- Schedule/email/polling triggers also rejected
- Users forced to keep unnecessary webhook triggers
After:
- ALL trigger types recognized (executeWorkflowTrigger, scheduleTrigger, etc.)
- No disconnected node errors for triggers
- Clear error when activating workflow with only executeWorkflowTrigger
- Future-proof (new triggers automatically supported)
## Testing
- Build: ✅ Passes
- Typecheck: ✅ Passes
- Unit tests: ✅ All pass
- Validation test: ✅ Trigger detection working correctly
Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en
|
2025-10-23 09:42:46 +02:00 |
|
Romuald Członkowski
|
c76ffd9fb1
|
fix: sticky notes validation - eliminate false positives in workflow updates (#350)
Fixed critical bug where sticky notes (UI-only annotation nodes) incorrectly
triggered "disconnected node" validation errors when updating workflows via
MCP tools (n8n_update_partial_workflow, n8n_update_full_workflow).
Problem:
- Workflows with sticky notes failed validation with "Node is disconnected" errors
- n8n-validation.ts lacked sticky note exclusion logic
- workflow-validator.ts had correct logic but as private method
- Code duplication led to divergent behavior
Solution:
1. Created shared utility module (src/utils/node-classification.ts)
- isStickyNote(): Identifies all sticky note type variations
- isTriggerNode(): Identifies trigger nodes
- isNonExecutableNode(): Identifies UI-only nodes
- requiresIncomingConnection(): Determines connection requirements
2. Updated n8n-validation.ts to use shared utilities
- Fixed disconnected nodes check to skip non-executable nodes
- Added validation for workflows with only sticky notes
- Fixed multi-node connection check to exclude sticky notes
3. Updated workflow-validator.ts to use shared utilities
- Removed private isStickyNote() method (8 locations)
- Eliminated code duplication
Testing:
- Created comprehensive test suites (54 new tests, 100% coverage)
- Tested with n8n-mcp-tester agent using real n8n instance
- All test scenarios passed including regression tests
- Validated against real workflows with sticky notes
Impact:
- Sticky notes no longer block workflow updates
- Matches n8n UI behavior exactly
- Zero regressions in existing validation
- All MCP workflow tools now work correctly with annotated workflows
Files Changed:
- NEW: src/utils/node-classification.ts
- NEW: tests/unit/utils/node-classification.test.ts (44 tests)
- NEW: tests/unit/services/n8n-validation-sticky-notes.test.ts (10 tests)
- MODIFIED: src/services/n8n-validation.ts (lines 198-259)
- MODIFIED: src/services/workflow-validator.ts (8 locations)
- MODIFIED: tests/unit/validation-fixes.test.ts
- MODIFIED: CHANGELOG.md (v2.20.8 entry)
- MODIFIED: package.json (version bump to 2.20.8)
Test Results:
- Unit tests: 54 new tests passing, 100% coverage on utilities
- Integration tests: All 10 sticky notes validation tests passing
- Regression tests: Zero failures in existing test suite
- Real-world testing: 4 test workflows validated successfully
Conceived by Romuald Członkowski - www.aiadvisors.pl/en
|
2025-10-22 17:58:13 +02:00 |
|