Files
Lucas Berger 1d55988aff docs(phase-10): complete workflow modularization phase
Phase 10 achievements:
- 3 sub-workflows: Update, Actions, Logs (all deployed)
- Main workflow: 209 → 192 nodes (-8%)
- Consolidated all container operations
- Removed old batch inline path
- Modernized callback formats

Deferred to Phase 10.1: Aggressive modularization (50-80 node target)
Added Phase 10.2: Better Logging & Log Management

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 15:10:19 -05:00

253 lines
8.6 KiB
Markdown

---
phase: 10-workflow-modularization
plan: 06
type: remediation
wave: 5
depends_on: [10-05]
files_modified: [n8n-workflow.json]
files_deleted: [refactor_workflow.py, task1_batch_update.py, task2_batch_actions.py, task3_logs_subworkflow.py, task3_update_main.py, task4_cleanup.py]
autonomous: true
must_haves:
truths:
- "Batch actions route to Container Actions sub-workflow"
- "Logs Execute Workflow nodes have real workflow ID (not PLACEHOLDER)"
- "Old batch action inline execution path removed"
- "Python helper scripts removed from repository"
artifacts:
- path: "n8n-workflow.json"
provides: "Fixed main workflow"
contains: "fYSZS5PkH0VSEaT5 in batch action path"
- path: "n8n-workflow.json"
provides: "Logs wired to sub-workflow"
not_contains: "PLACEHOLDER_LOGS_ID"
key_links:
- from: "Route Callback (batch action)"
to: "Execute Batch Action Sub-workflow"
via: "Corrected rule order or flag logic"
---
<objective>
Close verification gaps from Phase 10 by fixing routing, wiring logs, and cleaning up artifacts.
Purpose: Phase 10 verification found 3 critical gaps:
1. Batch actions bypass sub-workflow due to Route Callback rule order
2. Logs sub-workflow has PLACEHOLDER_LOGS_ID (not deployed/wired)
3. Python helper scripts committed to repo but no longer needed
Output: Fully functional modularized workflow with all gaps closed and repo cleaned.
</objective>
<execution_context>
@/home/luc/.claude/get-shit-done/workflows/execute-plan.md
@/home/luc/.claude/get-shit-done/templates/summary.md
</execution_context>
<context>
@.planning/phases/10-workflow-modularization/10-VERIFICATION.md
@.planning/phases/10-workflow-modularization/10-05-SUMMARY.md
@n8n-workflow.json
@n8n-container-actions.json
@n8n-container-logs.json
</context>
<tasks>
<task type="auto">
<name>Task 1: Fix batch actions routing to use sub-workflow</name>
<files>n8n-workflow.json</files>
<action>
Fix Route Callback so batch actions use Container Actions sub-workflow instead of old inline path.
**Root cause from verification:**
- Route Callback output[4] matches `isBatch == true` BEFORE output[13] matches `isBatchExec == true`
- Parse Callback Data sets BOTH `isBatch: true` AND `isBatchExec: true` for batch execution
- Result: batch execution goes to old "Build Batch Commands" path (output[4])
**Fix options (choose one):**
Option A - Fix rule order in Route Callback:
- Move the `isBatchExec == true` rule BEFORE the `isBatch == true` rule
- Or make rule 4 explicitly exclude: `isBatch == true AND isBatchExec != true`
Option B - Fix Parse Callback Data:
- When `isBatchExec: true`, do NOT set `isBatch: true`
- This makes the flags mutually exclusive
**Recommended: Option A** - More surgical, doesn't change data model.
**Steps:**
1. Find "Route Callback" Switch node in n8n-workflow.json
2. Identify output[4] rule (isBatch) and output[13] rule (isBatchExec)
3. Either reorder rules or add exclusion condition to rule 4
4. Verify the "Execute Batch Action Sub-workflow" node exists and uses workflow ID `fYSZS5PkH0VSEaT5`
**After fix:** Batch action callbacks should flow:
Parse Callback → Route Callback (isBatchExec rule) → Execute Batch Action Sub-workflow
</action>
<verify>
- Route Callback correctly routes batch execution to sub-workflow path
- Grep for "fYSZS5PkH0VSEaT5" shows it's used in batch action path
- No batch actions go through "Build Batch Commands" anymore
</verify>
<done>Batch actions correctly routed to Container Actions sub-workflow</done>
</task>
<task type="auto">
<name>Task 2: Wire logs sub-workflow with real workflow ID</name>
<files>n8n-workflow.json</files>
<action>
Replace PLACEHOLDER_LOGS_ID with actual logs workflow ID.
**Current state:**
- n8n-container-logs.json exists (9 nodes, valid sub-workflow)
- Main workflow has "Execute Text Logs" and "Execute Inline Logs" nodes
- Both have `workflowId: "PLACEHOLDER_LOGS_ID"`
**Options:**
Option A - If logs workflow already deployed to n8n:
1. Get workflow ID from n8n (via API or UI)
2. Update both Execute Workflow nodes with real ID
Option B - If logs workflow NOT yet deployed:
1. Note: User must deploy n8n-container-logs.json to n8n
2. Update PLACEHOLDER with instruction comment for now
3. Document in SUMMARY that deployment is required
**Check deployment status:**
- Look for workflow ID pattern in n8n-container-logs.json
- If it has an ID, workflow may already be deployed
**Steps:**
1. Search n8n-workflow.json for "PLACEHOLDER_LOGS_ID"
2. Find the two Execute Workflow nodes that need updating
3. If logs workflow ID is known, update both nodes
4. If not known, document that user must deploy and update
**Note:** The logs workflow ID will be assigned by n8n on import. If not yet deployed, this task documents the requirement clearly.
</action>
<verify>
- No "PLACEHOLDER_LOGS_ID" remains in n8n-workflow.json (OR clear documentation that deployment required)
- Execute Text Logs and Execute Inline Logs have valid workflow ID or clear TODO
</verify>
<done>Logs sub-workflow wired (or deployment requirement documented)</done>
</task>
<task type="auto">
<name>Task 3: Remove old batch action inline execution path</name>
<files>n8n-workflow.json</files>
<action>
Remove the old inline batch execution nodes that are no longer used after Task 1 fix.
**Nodes to evaluate for removal (from verification):**
- "Build Batch Commands" - if only used by old batch action path
- "Execute Batch Action" (the old executeCommand version)
- Any nodes only connected to the old path
**Caution:**
- Some "batch" nodes may still be needed for batch UPDATE (which works correctly)
- Only remove nodes specific to batch ACTION inline execution
- Verify connections before removing
**Steps:**
1. Trace the old path: Route Callback output[4] → Build Batch Commands → ...
2. Identify which nodes are ONLY reachable via this path
3. Remove those nodes
4. Verify batch update path still works (uses different nodes)
**Expected reduction:** 5-10 nodes removed
</action>
<verify>
- Old inline batch action execution path removed
- Batch update path still intact
- No orphaned nodes
</verify>
<done>Old batch action inline path cleaned up</done>
</task>
<task type="auto">
<name>Task 4: Remove Python helper scripts</name>
<files>refactor_workflow.py, task1_batch_update.py, task2_batch_actions.py, task3_logs_subworkflow.py, task3_update_main.py, task4_cleanup.py</files>
<action>
Remove the Python scripts that were used during Phase 10 development.
**Files to remove:**
- refactor_workflow.py
- task1_batch_update.py
- task2_batch_actions.py
- task3_logs_subworkflow.py
- task3_update_main.py
- task4_cleanup.py
**Steps:**
1. Delete all 6 Python files
2. Stage deletions for commit
3. Verify no other code depends on these scripts
These were development-time helpers for JSON manipulation, not runtime code.
</action>
<verify>
- No .py files in repository root
- `git status` shows 6 deleted files staged
</verify>
<done>Python helper scripts removed from repository</done>
</task>
<task type="auto">
<name>Task 5: Final verification and commit</name>
<files>n8n-workflow.json</files>
<action>
Verify all gaps are closed and commit the remediation.
**Verification checklist:**
1. Batch actions: Route to sub-workflow ✓
2. Logs: No PLACEHOLDER_LOGS_ID (or documented) ✓
3. Old paths: Removed ✓
4. Python scripts: Deleted ✓
5. Node count: Document final count
**Node count assessment:**
- Original target was 120-140 nodes
- Current: 199 nodes
- After this remediation: estimate ~190-195 nodes
- Note: Significant reduction requires deeper refactoring (future phase)
**Commit message:**
```
fix(phase-10): close verification gaps
- Fix batch actions routing to use Container Actions sub-workflow
- Wire logs sub-workflow (or document deployment requirement)
- Remove old inline batch action execution path
- Remove Python helper scripts from repository
```
</action>
<verify>
- All 4 gaps addressed
- Clean git status (only planned changes)
- Commit created with descriptive message
</verify>
<done>Phase 10 remediation complete</done>
</task>
</tasks>
<verification>
1. Batch actions use Container Actions sub-workflow (not old inline path)
2. Logs workflow properly wired (or deployment documented)
3. Old batch action inline execution nodes removed
4. No Python scripts in repository
5. All changes committed
</verification>
<success_criteria>
- Phase 10 verification gaps closed
- Repository cleaned of development artifacts
- Workflow functions correctly for all paths
</success_criteria>
<output>
After completion, create `.planning/phases/10-workflow-modularization/10-06-SUMMARY.md`
</output>