Moves 45 documentation files from centralized /docs/ to subproject directories
following proximity-based organization principle. All moves use git mv to preserve history.
Changes:
- workflow/ docs: Move 27 files from docs/workflow/ to workflow/docs/
- DAG executor docs, workflow compliance, executor analysis, loaderv2 guides, etc.
- Result: workflow/docs/ now has 27 files
- dbal/ docs: Move 11 files from docs/dbal/ to dbal/docs/
- DBAL architecture, analysis, integration, and workflow integration docs
- Result: dbal/docs/ now has 18 files (11 new + 7 pre-existing)
- gameengine/ docs: Move 7 files from docs/gameengine/ to gameengine/docs/
- GameEngine compliance audits, packages, Quake3, soundboard, engine tester
- Result: gameengine/docs/ now has 20 files (7 new + 13 pre-existing)
Benefits:
- Docs are now closer to their code (easier to keep in sync)
- Reduces /docs/ clutter
- Establishes pattern for per-subproject documentation
- All git history preserved via git mv
Next phases:
- Phase 2: Move package-specific docs to /packages/{id}/docs/
- Phase 3: Separate N8N compliance docs by scope
- Phase 4: Organize UI documentation
- Phase 5: Create cross-project indices
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
13 KiB
Workflow Executor Technical Analysis - Document Index
Generated: 2026-01-22
Scope: TypeScript Workflow Executor Analysis (/workflow/executor/ts/)
Status: Complete - 4 Comprehensive Documents
📚 Document Collection
1. WORKFLOW_EXECUTOR_ANALYSIS.md (49 KB)
Comprehensive Technical Architecture Document
The complete deep-dive analysis of the workflow executor system. Start here for full understanding.
Contains:
- Executive summary with key characteristics
- Directory structure & file purposes (9 files analyzed)
- Core architecture diagram (9-layer execution flow)
- Node resolution mechanism (detailed flow)
- Plugin registration pattern (class-based + function-based)
- Registry integration points (5 key integration areas)
- Multi-tenant support (3-layer implementation + verification checklist)
- Execution flow & transformation layers (8 transformation layers)
- Backoff strategies (exponential, linear, fibonacci)
- Key type definitions (workflow, context, plugin, execution)
- Validation system (5 validation categories + error codes)
- Template engine (variable interpolation syntax + 20+ utility functions)
- Dependencies & imports (complete dependency graph)
- Current gaps & future improvements (5 identified gaps)
- Summary & recommendations (priority 1-3 actions)
When to Use: Architect review, detailed implementation planning, comprehensive codebase understanding
Key Sections:
- Lines 1-100: Executive summary & quick facts
- Lines 200-450: Architecture diagram with execution flow
- Lines 500-800: Node resolution mechanism
- Lines 900-1200: Multi-tenant implementation details
- Lines 1400-1600: Template engine reference
2. WORKFLOW_EXECUTOR_DIAGRAM.txt (36 KB)
Visual Architecture & Sequence Diagrams
Text-based diagrams showing architecture, dependencies, and execution sequences.
Contains:
- File structure & dependencies tree
- Execution sequence diagram (detailed steps)
- Registry & plugin resolution diagram
- Multi-tenant safety architecture
- Priority queue execution model
- Error handling & retry strategy
- Template engine variable scopes
- File dependency graph
When to Use: Understanding system structure, troubleshooting, presenting to team
Key Sections:
- Execution sequence (1000+ lines with detailed flow)
- Registry resolution (class-based + function-based paths)
- Multi-tenant safety pipeline (parameter interpolation example)
- Priority queue state example (heap visualization)
- Error handling flow (retry strategies)
3. WORKFLOW_EXECUTOR_QUICK_REFERENCE.md (16 KB)
Developer Quick Reference & Cheat Sheet
Fast lookup guide for common tasks and key concepts.
Contains:
- At-a-glance summary table
- Core concepts (4 key concepts explained)
- File quick reference (one-liner descriptions)
- Available node types (80 types categorized)
- Common tasks with code examples:
- Initialize workflow engine
- Execute a workflow
- Register custom executors (both patterns)
- Interpolate variables
- Error handling strategy
- Validation rules (by category)
- Architecture diagram (text summary)
- Performance characteristics (complexity analysis)
- Key design decisions (5 decisions explained)
- Testing strategy
- Troubleshooting guide
When to Use: Daily development, quick lookup, code examples
Key Code Examples:
- initializeWorkflowEngine() usage
- Custom executor registration (class-based)
- Custom executor registration (function-based)
- Variable interpolation examples
- Node type list
4. WORKFLOW_EXECUTOR_INTEGRATION_POINTS.md (30 KB)
Plugin Registry Integration Guide
Detailed mapping of all registry integration points and data flows.
Contains:
- Integration points map (6 key integration areas)
- Critical hot paths analysis
- Plugin registry lookup (per-node execution)
- Plugin registration (initialization)
- Plugin module interfaces (INodeExecutor + NodeExecutorPlugin)
- Where each registry method is called
- Complete data flow diagram (9 stages)
- Integration gaps analysis (4 identified gaps)
- Integration checklist for new plugins
- Testing strategy (unit + integration tests)
- Performance monitoring (metrics to track)
- Future enhancement proposal (dynamic plugin loading)
When to Use: Creating new plugins, optimizing registry, testing integration
Key Topics:
- Lines 1-100: Integration points overview
- Lines 150-300: Critical hot paths analysis
- Lines 400-700: Data flow from definition to execution
- Lines 800-1000: Integration gaps & solutions
- Lines 1100-1400: Testing & performance
🎯 Quick Navigation
By Role
Architect → Start with:
- WORKFLOW_EXECUTOR_ANALYSIS.md (full picture)
- WORKFLOW_EXECUTOR_DIAGRAM.txt (visual overview)
- WORKFLOW_EXECUTOR_INTEGRATION_POINTS.md (integration planning)
Plugin Developer → Start with:
- WORKFLOW_EXECUTOR_QUICK_REFERENCE.md (common tasks)
- WORKFLOW_EXECUTOR_INTEGRATION_POINTS.md (integration checklist)
- WORKFLOW_EXECUTOR_ANALYSIS.md (deep dive if needed)
DevOps/Infrastructure → Start with:
- WORKFLOW_EXECUTOR_QUICK_REFERENCE.md (performance section)
- WORKFLOW_EXECUTOR_ANALYSIS.md (multi-tenant section)
- WORKFLOW_EXECUTOR_DIAGRAM.txt (error handling flow)
QA/Tester → Start with:
- WORKFLOW_EXECUTOR_QUICK_REFERENCE.md (validation rules + testing)
- WORKFLOW_EXECUTOR_INTEGRATION_POINTS.md (testing strategy)
- WORKFLOW_EXECUTOR_ANALYSIS.md (error codes section)
By Topic
Node Type Resolution:
- WORKFLOW_EXECUTOR_ANALYSIS.md (lines 400-550)
- WORKFLOW_EXECUTOR_DIAGRAM.txt (section 3)
- WORKFLOW_EXECUTOR_QUICK_REFERENCE.md (lines 30-60)
Multi-Tenant Implementation:
- WORKFLOW_EXECUTOR_ANALYSIS.md (lines 750-900)
- WORKFLOW_EXECUTOR_DIAGRAM.txt (section 4)
- WORKFLOW_EXECUTOR_INTEGRATION_POINTS.md (data flow section)
Plugin Registration:
- WORKFLOW_EXECUTOR_ANALYSIS.md (lines 550-750)
- WORKFLOW_EXECUTOR_QUICK_REFERENCE.md (common tasks section)
- WORKFLOW_EXECUTOR_INTEGRATION_POINTS.md (integration checklist)
Error Handling:
- WORKFLOW_EXECUTOR_QUICK_REFERENCE.md (error handling section)
- WORKFLOW_EXECUTOR_DIAGRAM.txt (section 6)
- WORKFLOW_EXECUTOR_ANALYSIS.md (validation section)
Template Engine:
- WORKFLOW_EXECUTOR_ANALYSIS.md (template engine section)
- WORKFLOW_EXECUTOR_QUICK_REFERENCE.md (variable interpolation)
- WORKFLOW_EXECUTOR_DIAGRAM.txt (section 7)
📊 Document Statistics
| Document | Size | Lines | Focus |
|---|---|---|---|
| WORKFLOW_EXECUTOR_ANALYSIS.md | 49 KB | ~1900 | Complete technical analysis |
| WORKFLOW_EXECUTOR_DIAGRAM.txt | 36 KB | ~900 | Visual diagrams & flows |
| WORKFLOW_EXECUTOR_QUICK_REFERENCE.md | 16 KB | ~700 | Quick lookup & examples |
| WORKFLOW_EXECUTOR_INTEGRATION_POINTS.md | 30 KB | ~1200 | Plugin integration guide |
| Total | 131 KB | ~4700 | Comprehensive reference |
✅ Coverage Checklist
Code Structure
- ✅ 9 files analyzed in detail
- ✅ 5 directories mapped
- ✅ File dependencies charted
- ✅ Circular dependency check (zero found)
Architecture
- ✅ Execution flow documented (9 layers)
- ✅ Node resolution mechanism explained
- ✅ Plugin registry system described
- ✅ Template engine reference provided
- ✅ Validation system detailed
Multi-Tenant Support
- ✅ Type-level enforcement documented
- ✅ Validation-level checks listed
- ✅ Execution-level implementation shown
- ✅ Multi-tenant safety checklist provided
- ✅ Improvements recommended
Integration Points
- ✅ 6 integration areas identified
- ✅ Critical paths analyzed
- ✅ Hot path optimization noted
- ✅ Data flow documented
- ✅ Integration gaps listed with solutions
Plugin System
- ✅ Class-based pattern explained
- ✅ Function-based pattern explained
- ✅ Adapter mechanism detailed
- ✅ Registration methods documented
- ✅ Plugin interfaces defined
Testing & Quality
- ✅ Validation rules documented (9 categories)
- ✅ Error codes listed
- ✅ Testing strategy provided
- ✅ Performance characteristics analyzed
- ✅ Troubleshooting guide included
🔧 Key Findings Summary
Strengths
- Clean Plugin Architecture - Two complementary patterns (class + function)
- Comprehensive Validation - Multi-layer validation (node, connection, variable, multi-tenant)
- Robust Error Handling - Exponential/linear/fibonacci backoff with retryable error detection
- Multi-Tenant Aware - Enforced at type, validation, and execution layers
- Template Engine - Full variable interpolation with 20+ utilities
- Zero Circular Dependencies - Clean dependency graph
Gaps
- Registry Injection - Registry accessed inside nodeExecutor callback (coupling)
- Plugin Discovery - Plugins hardcoded, no dynamic discovery
- Plugin Validation - No manifest validation before registration
- Audit Logging - No runtime audit trail for multi-tenant access
- Rate Limiting - Defined in types but not enforced
Recommendations
| Priority | Action | Impact |
|---|---|---|
| P1 | Refactor registry dependency injection | Reduce coupling |
| P1 | Add plugin compatibility validation | Prevent invalid plugins |
| P1 | Implement audit logging | Multi-tenant safety |
| P2 | Dynamic plugin loading system | Runtime flexibility |
| P2 | Rate limiting enforcement | Resource protection |
| P3 | C++ executor support | Performance |
| P3 | Plugin marketplace | Extensibility |
📖 How to Use This Documentation
For New Project Members
- Read WORKFLOW_EXECUTOR_QUICK_REFERENCE.md first (30 min)
- Review WORKFLOW_EXECUTOR_DIAGRAM.txt (45 min)
- Deep dive into specific sections of WORKFLOW_EXECUTOR_ANALYSIS.md as needed
For Implementing New Features
- Check WORKFLOW_EXECUTOR_INTEGRATION_POINTS.md for integration point
- Find similar example in WORKFLOW_EXECUTOR_ANALYSIS.md
- Use code examples from WORKFLOW_EXECUTOR_QUICK_REFERENCE.md
- Verify against checklist in WORKFLOW_EXECUTOR_INTEGRATION_POINTS.md
For Code Review
- Verify against multi-tenant checklist in WORKFLOW_EXECUTOR_ANALYSIS.md
- Check validation rules in WORKFLOW_EXECUTOR_QUICK_REFERENCE.md
- Ensure error handling matches strategy in WORKFLOW_EXECUTOR_DIAGRAM.txt
- Validate plugin integration in WORKFLOW_EXECUTOR_INTEGRATION_POINTS.md
For Performance Optimization
- Review hot paths in WORKFLOW_EXECUTOR_INTEGRATION_POINTS.md
- Check performance characteristics in WORKFLOW_EXECUTOR_QUICK_REFERENCE.md
- Study execution flow in WORKFLOW_EXECUTOR_DIAGRAM.txt
- Consider recommendations in WORKFLOW_EXECUTOR_ANALYSIS.md
🔍 Key Code References
Main Files
- Execution Engine:
/workflow/executor/ts/executor/dag-executor.ts(447 lines) - Registry System:
/workflow/executor/ts/registry/node-executor-registry.ts(154 lines) - Built-in Registration:
/workflow/executor/ts/plugins/index.ts(135 lines) - Type Definitions:
/workflow/executor/ts/types.ts(342 lines) - Template Engine:
/workflow/executor/ts/utils/template-engine.ts(255 lines) - Validation:
/workflow/executor/ts/utils/workflow-validator.ts(474 lines)
Integration Points
- Workflow Service:
/frontends/nextjs/src/lib/workflow/workflow-service.ts - Plugin Examples:
/workflow/plugins/ts/dbal-read/src/index.ts
📝 Document Metadata
Analysis Scope: /Users/rmac/Documents/metabuilder/workflow/executor/ts/
Files Analyzed:
- executor/dag-executor.ts
- registry/node-executor-registry.ts
- plugins/function-executor-adapter.ts
- plugins/index.ts
- utils/priority-queue.ts
- utils/template-engine.ts
- utils/workflow-validator.ts
- types.ts
- index.ts
Analysis Depth:
- Full code review (all 9 files)
- Integration point analysis (5 layers)
- Multi-tenant security review
- Dependency graph analysis
- Performance characteristic analysis
Generated: 2026-01-22 Status: Complete & Ready for Use Version: 1.0
🎓 Learning Path
Beginner (Day 1)
- Read WORKFLOW_EXECUTOR_QUICK_REFERENCE.md (At a Glance + Core Concepts)
- Skim WORKFLOW_EXECUTOR_DIAGRAM.txt (sections 1-3)
- Run initializeWorkflowEngine() in test environment
Intermediate (Day 2-3)
- Read WORKFLOW_EXECUTOR_ANALYSIS.md (Architecture + Node Resolution)
- Study WORKFLOW_EXECUTOR_DIAGRAM.txt (sections 4-7)
- Implement custom class-based executor
- Implement custom function-based executor
Advanced (Day 4-5)
- Deep dive WORKFLOW_EXECUTOR_ANALYSIS.md (gaps + recommendations)
- Study WORKFLOW_EXECUTOR_INTEGRATION_POINTS.md (all sections)
- Implement plugin manifest system
- Add plugin compatibility validation
Documentation Complete ✅
All four documents are ready for architect review and team distribution.