mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-01-30 06:22:04 +00:00
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
This commit is contained in:
committed by
GitHub
parent
7300957d13
commit
c76ffd9fb1