Phase 10.1: Aggressive Workflow Modularization - 5 plan(s) in 3 wave(s) - Wave 1: Foundation (rename files, analyze boundaries, user approval) - Wave 2: 3 parallel extractions (batch-ui, status, confirmation) - Wave 3: Integration verification and UAT - Ready for execution Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
8.7 KiB
phase, plan, type, wave, depends_on, files_modified, autonomous, must_haves
| phase | plan | type | wave | depends_on | files_modified | autonomous | must_haves | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 10.1-aggressive-workflow-modularization | 02 | execute | 2 |
|
|
true |
|
Purpose: Remove ~40-50 nodes from main workflow by extracting the cohesive batch selection/navigation/execution domain. Output: New n8n-batch-ui.json sub-workflow, updated main workflow with batch nodes extracted.
<execution_context> @/home/luc/.claude/get-shit-done/workflows/execute-plan.md @/home/luc/.claude/get-shit-done/templates/summary.md </execution_context>
@.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.md @.planning/phases/10.1-aggressive-workflow-modularization/10.1-CONTEXT.md @.planning/phases/10.1-aggressive-workflow-modularization/10.1-01-SUMMARY.md @n8n-workflow.json @n8n-actions.json @n8n-update.json Task 1: Create n8n-batch-ui.json sub-workflow with extracted batch nodes n8n-batch-ui.json (new) Create new sub-workflow containing all batch UI related nodes from main workflow.Input contract (Execute Workflow Trigger):
- chatId: number (required)
- messageId: number (optional, 0 for new message)
- callbackData: string (the callback data triggering batch action)
- responseMode: string ('text' or 'callback')
Nodes to extract (all nodes with "Batch" in name + related batch state nodes):
- Build Batch Keyboard, Build Batch Select Keyboard, Edit Batch Select Keyboard, Edit To Batch Select Keyboard
- Rebuild Batch Select Keyboard, Send Batch Confirmation, Send Batch Start Message, Send Batch Summary
- Build Batch Select Stop Confirmation, Build Batch Stop Confirmation, Build Batch Stop Expired
- Check Batch Stop Expired, Send Batch Stop Confirmation, Send Batch Stop Expired, Delete Batch Confirm Message
- Delete Batch Select Message, Delete Batch Stop Cancel Message
- Handle Batch Toggle, Handle Batch Clear, Handle Batch Exec, Handle Batch Action Result Sub
- Handle Batch Update Result, Execute Batch Action Sub-workflow, Execute Batch Update
- Initialize Batch State, Is Batch Command, Is Batch Complete, Match Batch Containers
- Needs Batch Confirmation, Prepare Batch Action Input, Prepare Batch Cancel Return
- Prepare Batch Exec, Prepare Batch Loop, Prepare Batch Nav, Prepare Batch Stop Exec
- Prepare Batch Update Input, Prepare Immediate Batch Exec, Prepare Update All Batch
- Route Batch Action, Route Batch Loop Action, Detect Batch Command, Get Containers for Batch
- Fetch Containers For Batch Mode, Answer Batch* nodes (all Answer Batch callbacks)
Structure:
- Execute Workflow Trigger (entry point)
- Parse Input (validate and extract callback data)
- Route Batch Action (switch on callback type: toggle, clear, exec, nav, cancel)
- Domain logic for each branch
- Return structured result to main workflow
Output contract (return to main workflow):
{
success: true/false,
action: 'toggle|clear|exec|nav|cancel|summary',
// For keyboard updates:
keyboard: {...} || null,
text: "message text",
// For execution results:
results: [{containerId, containerName, success, message}],
// Error info:
error: "error message" || null
}
Important: Sub-workflow should call existing single-container sub-workflows (n8n-actions.json, n8n-update.json) for actual container operations in batch loops.
cat n8n-batch-ui.json | python3 -c "import json,sys; d=json.load(sys.stdin); print(f'Nodes: {len(d.get(\"nodes\",[]))}')"shows node count- Sub-workflow has Execute Workflow Trigger node
- Sub-workflow has Execute Workflow nodes calling n8n-actions.json and n8n-update.json n8n-batch-ui.json created with all batch UI nodes extracted from main workflow structure.
-
Remove extracted batch nodes from main workflow (all nodes identified in Task 1)
-
Add Execute Workflow node ("Execute Batch UI"):
- Source: database
- WorkflowId: use TODO_DEPLOY_BATCH_UI_WORKFLOW placeholder (same pattern as logs)
- Mode: once
- waitForSubWorkflow: true
- Input: { chatId, messageId, callbackData, responseMode }
-
Update routing in main workflow:
- Route Callback should route batch callbacks (bsel:, bexec:, bnav:, bclear:, bcancel:) to new Execute Batch UI node
- Handle result from sub-workflow (success/failure, keyboard updates, error messages)
-
Add result handler after Execute Batch UI:
- If result has keyboard: send/edit Telegram message with keyboard
- If result has error: send error message
- If result has summary: send summary message
-
Preserve Answer Callback nodes in main workflow for the batch callbacks, OR move them to sub-workflow if they're tightly coupled with batch logic.
Data flow: Main receives callback -> Route Callback -> Execute Batch UI sub-workflow -> Return result -> Send Telegram response
Verification after changes:
- Count nodes in main workflow (should be ~140-150 after this extraction)
- Verify Route Callback still has proper branches
cat n8n-workflow.json | python3 -c "import json,sys; d=json.load(sys.stdin); print(f'Main workflow nodes: {len(d.get(\"nodes\",[]))}')"shows reduced count (~140-150)- Main workflow has "Execute Batch UI" node
- No batch-related nodes remain in main workflow except routing entry point
- TODO_DEPLOY_BATCH_UI_WORKFLOW placeholder is searchable Main workflow updated with batch nodes extracted and replaced by sub-workflow call.
-
Verify the extraction is complete:
- Main workflow node count reduced by ~40-50
- n8n-batch-ui.json exists with extracted nodes
- No orphan references in main workflow
-
Commit the extraction:
git add n8n-workflow.json n8n-batch-ui.json n8n-workflow.json.backup-batch git commit -m "feat(10.1-02): extract batch UI to sub-workflow - Created n8n-batch-ui.json with ~45 batch-related nodes - Main workflow reduced from 192 to ~145 nodes - Batch UI sub-workflow calls n8n-actions.json and n8n-update.json for operations - Added TODO_DEPLOY_BATCH_UI_WORKFLOW placeholder for n8n import"
<success_criteria>
- New n8n-batch-ui.json sub-workflow created with all batch UI logic
- Main workflow reduced from 192 to ~140-150 nodes
- Sub-workflow properly calls existing action/update sub-workflows
- Backup created for rollback capability
- Changes committed to git </success_criteria>