feat: Add auto-update node versions to autofixer

Implemented comprehensive node version upgrade functionality with intelligent
migration and breaking change detection.

Key Features:
- Smart version upgrades (typeversion-upgrade fix type)
- Version migration guidance (version-migration fix type)
- Auto-migration for Execute Workflow v1.0→v1.1 (adds inputFieldMapping)
- Auto-migration for Webhook v2.0→v2.1 (generates webhookId)
- Breaking changes registry with extensible patterns
- AI-friendly post-update validation guidance
- Confidence-based application (HIGH/MEDIUM/LOW)

Architecture:
- NodeVersionService: Version discovery and comparison
- BreakingChangeDetector: Registry + dynamic schema comparison
- NodeMigrationService: Smart property migrations
- PostUpdateValidator: Step-by-step migration instructions
- Enhanced database schema: node_versions, version_property_changes tables

Services Created:
- src/services/breaking-changes-registry.ts
- src/services/breaking-change-detector.ts
- src/services/node-version-service.ts
- src/services/node-migration-service.ts
- src/services/post-update-validator.ts

Database Enhanced:
- src/database/schema.sql (new version tracking tables)
- src/database/node-repository.ts (15+ version query methods)

Autofixer Integration:
- src/services/workflow-auto-fixer.ts (async, new fix types)
- src/mcp/handlers-n8n-manager.ts (await generateFixes)
- src/mcp/tools-n8n-manager.ts (schema with new fix types)

Documentation:
- src/mcp/tool-docs/workflow_management/n8n-autofix-workflow.ts
- CHANGELOG.md (comprehensive feature documentation)

Testing:
- Fixed all test scripts to await async generateFixes()
- Added test workflow for Execute Workflow v1.0 upgrade testing

Bug Fixes:
- Fixed MCP tool schema enum to include new fix types
- Fixed confidence type mapping (lowercase → uppercase)

Conceived by Romuald Członkowski - www.aiadvisors.pl/en
This commit is contained in:
czlonkowski
2025-10-24 08:34:47 +02:00
parent 5702a64a01
commit c7f8614de1
16 changed files with 2526 additions and 24 deletions

View File

@@ -7,6 +7,80 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### ✨ New Features
**Auto-Update Node Versions with Smart Migration**
Added comprehensive node version upgrade functionality to the autofixer, enabling automatic detection and migration of outdated node versions with intelligent breaking change handling.
#### Key Features
1. **Smart Version Upgrades** (`typeversion-upgrade` fix type):
- Automatically detects outdated node versions
- Applies intelligent migrations with auto-migratable property changes
- Handles well-known breaking changes (Execute Workflow v1.0→v1.1, Webhook v2.0→v2.1)
- Generates UUIDs and sensible defaults for new required fields
- HIGH confidence for non-breaking upgrades, MEDIUM for breaking changes with auto-migration
2. **Version Migration Guidance** (`version-migration` fix type):
- Documents complex migrations requiring manual intervention
- Provides AI-friendly post-update guidance with step-by-step instructions
- Lists required actions by priority (CRITICAL, HIGH, MEDIUM, LOW)
- Documents behavior changes and their impact
- Estimates time required for manual migration steps
- MEDIUM/LOW confidence - requires review before applying
3. **Breaking Changes Registry**:
- Centralized registry of known breaking changes across n8n nodes
- Example: Execute Workflow v1.1+ requires `inputFieldMapping` (auto-added)
- Example: Webhook v2.1+ requires `webhookId` field (auto-generated UUID)
- Extensible for future node version changes
4. **Post-Update Validation**:
- Generates comprehensive migration reports for AI agents
- Includes required actions, deprecated properties, behavior changes
- Provides actionable migration steps with estimated time
- Helps AI agents understand what manual work is needed after auto-migration
#### Architecture
- **NodeVersionService**: Version discovery, comparison, upgrade path recommendation
- **BreakingChangeDetector**: Detects changes from registry and dynamic schema comparison
- **NodeMigrationService**: Applies smart migrations with confidence scoring
- **PostUpdateValidator**: Generates AI-friendly migration guidance
- **Enhanced Database Schema**:
- `node_versions` table - tracks all available versions per node
- `version_property_changes` table - detailed migration tracking
#### Usage Example
```typescript
// Preview all fixes including version upgrades
n8n_autofix_workflow({id: "wf_123"})
// Only upgrade versions with smart migrations
n8n_autofix_workflow({
id: "wf_123",
fixTypes: ["typeversion-upgrade"],
applyFixes: true
})
// Get migration guidance for breaking changes
n8n_autofix_workflow({
id: "wf_123",
fixTypes: ["version-migration"]
})
```
#### Impact
- Proactively keeps workflows up-to-date with latest node versions
- Reduces manual migration effort for Execute Workflow, Webhook, and other versioned nodes
- Provides clear guidance for AI agents on handling breaking changes
- Ensures workflows benefit from latest node features and bug fixes
**Conceived by Romuald Członkowski - www.aiadvisors.pl/en**
## [2.21.1] - 2025-10-23
### 🐛 Bug Fixes