- Fix cycle detection to allow legitimate SplitInBatches loops while preventing other cycles
- Fix loop back detection by properly accessing workflow connections structure
- Update test expectations to match actual validation behavior:
- Processing nodes on wrong outputs that loop back generate errors (not warnings)
- Valid loop structures should generate no split-related warnings
- Correct node naming in tests to avoid triggering unintended validation patterns
- Update node repository core tests to handle new outputs/outputNames columns
- Add comprehensive loop validation test coverage with 16 + 19 tests
All workflow validator tests now pass: 35/35 tests ✅🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
## Problem
AI assistants were consistently connecting SplitInBatches node outputs backwards because:
- Output index 0 = "done" (runs after loop completes)
- Output index 1 = "loop" (processes items inside loop)
This counterintuitive ordering caused incorrect workflow connections.
## Solution
Enhanced the n8n-mcp system to expose and clarify output information:
### Database & Schema
- Added `outputs` and `output_names` columns to nodes table
- Updated NodeRepository to store/retrieve output information
### Node Parsing
- Enhanced NodeParser to extract outputs and outputNames from nodes
- Properly handles versioned nodes like SplitInBatchesV3
### MCP Server
- Modified getNodeInfo to return detailed output descriptions
- Added connection guidance for each output
- Special handling for loop nodes (SplitInBatches, IF, Switch)
### Documentation
- Enhanced DocsMapper to inject critical output guidance
- Added warnings about counterintuitive output ordering
- Provides correct connection patterns for loop nodes
### Workflow Validation
- Added validateSplitInBatchesConnection method
- Detects reversed connections and provides specific errors
- Added checkForLoopBack with depth limit to prevent stack overflow
- Smart heuristics to identify likely connection mistakes
## Testing
- Created comprehensive test suite (81 tests)
- Unit tests for all modified components
- Edge case handling for malformed data
- Performance testing with large workflows
## Impact
AI assistants will now:
- See explicit output indices and names (e.g., "Output 0: done")
- Receive clear connection guidance
- Get validation errors when connections are reversed
- Have enhanced documentation explaining the correct pattern
Fixes#97🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add validation for invalid fixedCollection structures in Switch, If, and Filter nodes
- Detect and prevent nested 'conditions.values' patterns that cause n8n UI crashes
- Support both 'n8n-nodes-base.x' and 'nodes-base.x' node type formats
- Provide auto-fix suggestions for invalid structures
- Add comprehensive test coverage for all edge cases
This prevents AI agents from creating invalid node configurations that break n8n's UI.
- Add explicit type annotations for properties arrays in config validator tests
- Update ValidationResult mock to include required visibleProperties and hiddenProperties
- Fix all TypeScript compilation errors found in CI/CD pipeline
All tests passing with 85.36% coverage.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Major improvements based on comprehensive test suite review:
Test Fixes:
- Fix all 78 failing tests across logger, MSW, and validator tests
- Fix console spy management in logger tests with proper DEBUG env handling
- Fix MSW test environment restoration in session-management.test.ts
- Fix workflow validator tests by adding proper node connections
- Fix mock setup issues in edge case tests
Test Organization:
- Split large config-validator.test.ts (1,075 lines) into 4 focused files
- Rename 63+ tests to follow "should X when Y" naming convention
- Add comprehensive edge case test files for all major validators
- Create tests/README.md with testing guidelines and best practices
New Features:
- Add ConfigValidator.validateBatch() method for bulk validation
- Add edge case coverage for null/undefined, boundaries, invalid data
- Add CI-aware performance test timeouts
- Add JSDoc comments to test utilities and factories
- Add workflow duplicate node name validation tests
Results:
- All tests passing: 1,356 passed, 19 skipped
- Test coverage: 85.34% statements, 85.3% branches
- From 78 failures to 0 failures
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Remove AI agent coordination files and progress tracking
- Remove temporary test results and generated artifacts
- Remove diagnostic test scripts from src/scripts/
- Remove development planning documents
- Update .gitignore to exclude test artifacts
- Clean up 53 temporary files total
- Fixed simulateError helper to properly handle async error interceptors
- Made mock implementation async to handle promise rejections correctly
- Enabled all 7 previously skipped error handling tests
- All 666 tests now pass without unhandled promise rejections
This fixes the CI pipeline failure caused by unhandled promise rejections.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Create comprehensive test suite with 69 tests for WorkflowValidator
- Increase coverage from 2.32% to 97.59%
- Fix bugs in WorkflowValidator:
- Add null checks for workflow.nodes before accessing length
- Fix checkNodeErrorHandling to process each node individually
- Fix disabled node validation logic
- Ensure error-prone nodes generate proper warnings
- Test all major methods and edge cases:
- validateWorkflow with different options
- validateAllNodes with various node types
- validateConnections including cycles and orphans
- validateExpressions with complex expressions
- checkWorkflowPatterns for best practices
- checkNodeErrorHandling for error configurations
- generateSuggestions for helpful tips
All 69 tests now passing with excellent coverage.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>