Deprecated Generation Code Cleanup
Documentation for Plans
Deprecated Generation Code Cleanup — Post-S204
Background
S204 discovered that the platform generation pipeline had TWO parallel systems:
- backend-ai-api WorkflowService with
full-configurationworkflow type — a template-selection system that matched business descriptions to predefined templates. It NEVER decomposed requirements into actual modules (always produced 0 modules). - backend-vitto-api ModuleGenerationService with a real 6-phase pipeline (PRE-FLIGHT, ENHANCE, ANALYZE, DECOMPOSE, PLAN, EXECUTE, DEPLOY) — the correct, working system.
S204 fixed routing so all entry points now delegate to the Vitto pipeline:
GenerationHubService.startGeneration()(frontend lib, S204.5) now callsstartVittoGeneration()directly- The broken
full-configurationworkflow path is bypassed entirely
This session should remove the dead code left behind by that rerouting.
Files to Read First
Read these files in order before making any changes:
apps/backend-ai-api/src/app/workflow/workflow.types.ts— WorkflowType union, WORKFLOW_TEMPLATES constantapps/backend-ai-api/src/app/workflow/workflow.service.ts— execute() method, full-configuration handlerapps/backend-ai-api/src/app/workflow/workflow.controller.ts— POST/GET /workflow/start endpoints + module/generate endpointslibs/libs-ai/ai-generation-hub/src/lib/services/generation-hub.service.ts— main frontend orchestration service (~1200 lines)libs/libs-structural/vibe-universe/src/lib/components/vibe-universe-generator/vibe-universe-generator.component.ts— calls startGeneration()libs/libs-ai/ai-outcome-tracker/src/lib/types/module-outcome.types.ts— GenerationSource type
Cleanup Tasks
Task 1: Remove Dead Workflow Types from backend-ai-api
File: apps/backend-ai-api/src/app/workflow/workflow.types.ts
The WorkflowType union (line 12-18) defines 6 types. After S204, only single-module generation via PhaseExecutorService is active. The following types are dead:
| Type | Status | Reason |
|---|---|---|
full-configuration |
DEAD | S204 bypassed it; never decomposed modules |
system-generation |
DEAD | Placeholder from Session 71, never wired to frontend |
tenant-setup |
DEAD | Never implemented beyond template definition |
module-configuration |
DEAD | Never called from frontend |
page-layout |
DEAD | Never called from frontend |
widget-configuration |
DEAD | Never called from frontend |
Action:
- Remove these 6 values from the
WorkflowTypeunion - Remove their entries from
WORKFLOW_TEMPLATESconstant (lines 298-443) - Keep the SSE event types (WorkflowSSEEvent and its sub-interfaces) — they may still be referenced by PhaseExecutorService or other importers
- Search for all imports of
WorkflowTypeandWORKFLOW_TEMPLATESbefore removal to check impact
Verification: npx tsc --noEmit on backend-ai-api after changes.
Task 2: Audit WorkflowService.execute() and Controller Endpoints
File: apps/backend-ai-api/src/app/workflow/workflow.service.ts
The execute() method handles the broken full-configuration flow. Check:
- Whether
execute()is called from anywhere besides the controller'sstartWorkflow/startWorkflowSSEendpoints - Whether any other service or external caller still hits
POST /ai-api/workflow/startorGET /ai-api/workflow/start
File: apps/backend-ai-api/src/app/workflow/workflow.controller.ts
Endpoints to evaluate:
| Endpoint | Status | Notes |
|---|---|---|
POST /workflow/start (line 48) |
Likely DEAD | Routes to WorkflowService.execute() which uses broken flow |
GET /workflow/start (line 66) |
Likely DEAD | Same broken flow via SSE |
POST /:id/continue (line 108) |
Likely DEAD | Continues a broken workflow |
GET /:id/status (line 120) |
Likely DEAD | Status of broken workflows |
POST /workflow/module/generate (line 152) |
KEEP | Uses PhaseExecutorService (phase-executor/) for single-module gen |
GET /workflow/module/generate (line 194) |
KEEP | SSE version of above |
GET /workflow/module/templates (line 262) |
KEEP | Lists template types |
GET /workflow/templates (line 319) |
Likely DEAD | Lists broken workflow templates |
GET /workflow/modules/:id/context (line 419) |
KEEP | Retrieves generated module context |
GET /workflow/modules/:id/files (line 436) |
KEEP | Retrieves generated files |
GET /workflow/modules/recent (line 453) |
KEEP | Lists recent modules |
Action:
- Remove the dead endpoints and their handler methods
- Remove the
WorkflowServicedependency from the controller constructor ifexecute()/continue()/getStatus()are no longer called - Do NOT remove the
PhaseExecutorServiceimport or any module/generate endpoints - Check
WorkflowModule(apps/backend-ai-api/src/app/workflow/workflow.module.ts) for providers that can be removed
Verification: Search for workflow/start in all frontend code to confirm no callers remain.
Task 3: Remove Dead Methods from GenerationHubService
File: libs/libs-ai/ai-generation-hub/src/lib/services/generation-hub.service.ts
After S204.5 rerouted startGeneration() to call startVittoGeneration() directly, the following private methods are dead (no callers):
Dead methods (confirmed by grep, all private):
| Method | Line | LOC (approx) | Reason Dead |
|---|---|---|---|
startStreamingWorkflow() |
422 | ~230 | Was the broken SSE flow to backend-ai-api |
mergeToolResult() |
668 | ~20 | Only called from startStreamingWorkflow |
transformToGeneratedModule() |
691 | ~30 | Only called from startStreamingWorkflow |
transformManifestToGeneratedModule() |
720 | ~60 | Only called from startStreamingWorkflow |
inferEmbeddableType() |
783 | ~12 | Only called from transformManifestToGeneratedModule |
generateModuleName() |
795 | ~20 | Only called from transformToGeneratedModule |
extractEntities() |
816 | ~20 | Only called from transformToGeneratedModule |
parseEntitiesFromDescription() |
840 | ~140 | Only called from extractEntities |
moduleIdToEntityName() |
980 | ~10 | Only called from extractEntities/transform methods |
generateFieldsForEntity() |
990 | ~15 | Only called from extractEntities/transform methods |
extractActions() |
1005 | ~25 | Only called from transformToGeneratedModule |
extractEmbeddables() |
1031 | ~140 | Only called from transformToGeneratedModule |
initializeProgress() |
1171 | ~20 | Was the old progress init; replaced by initializeVittoProgress() |
getPhasesForMode() |
1190 | ~20 | Only called from initializeProgress |
Action:
- Remove all 14 dead methods listed above
- Remove the
eventSourcefield (line 51) ONLY IF it is not used by the Vitto SSE stream methods (startVittoSSEStream). Check carefully — the Vitto path may usefetch()instead ofEventSource. - Remove any imports that become unused after deletion
- Keep:
startGeneration(),startVittoGeneration(),startVittoSSEStream(),enhancePromptVitto(),initializeVittoProgress(), all public signals,setMode(),getRequestDescription(),completeProgress(),failProgress(), and any methods used by the Vitto SSE flow
Estimated removal: ~700 lines of dead code.
Verification: npx tsc --noEmit on ai-generation-hub and any app that imports it.
Task 4: Audit vibe-universe-generator Component
File: libs/libs-structural/vibe-universe/src/lib/components/vibe-universe-generator/vibe-universe-generator.component.ts
This component calls startGeneration() (confirmed at lines 1289, 1305, 2911, 2988). Since startGeneration() now delegates to startVittoGeneration(), the component should work correctly without changes.
Action:
- Verify the component does NOT directly construct SSE URLs to
/ai-api/workflow/start - Verify it only uses
GenerationHubService.startGeneration()(which is now correct) - No changes expected — just confirm
Task 5: Audit ToolOrchestrationService References
File: libs/libs-foundational/core-angular/src/lib/services/tool-orchestration.service.ts
This service coordinates navigation between platform building tools (vibe-universe, modular-universe, module-workbench, etc.). It references ai-generation-hub as a tool conceptually but does NOT import or call GenerationHubService directly.
Action:
- Verify no direct dependency on the broken workflow path
- No changes expected — just confirm
Task 6: Update GenerationSource Type
File: libs/libs-ai/ai-outcome-tracker/src/lib/types/module-outcome.types.ts
Current type (line 13):
export type GenerationSource = 'ai-panel' | 'module-workbench' | 'cursor-agent' | 'visual-builder';
This type tracks where a module was generated from. It does NOT include 'ai-generation-hub' as previously suggested. However, with the Vitto pipeline now being the canonical path:
Action:
- Add
'vitto-pipeline'to the union:'ai-panel' | 'module-workbench' | 'cursor-agent' | 'visual-builder' | 'vitto-pipeline' - Check
module-outcome-tracker.service.tsline 612 where sources are hardcoded ingetStatsBySource()and add the new value - This is additive — no breaking changes
Task 7: Remove Unused WorkflowService Dependencies
File: apps/backend-ai-api/src/app/workflow/workflow.service.ts
After removing the broken flow, check if these injected services are still needed:
TemplateToolsService— used only in template-matching phaseManifestAdapterService— used only in manifest-export phaseModuleCatalogService— check if PhaseExecutorService also uses itModuleCodeGeneratorService— check if PhaseExecutorService also uses itBackendAPIGeneratorService— check if PhaseExecutorService also uses itPlatformOrchestrationService— check usage
For each, search for imports across the entire workflow directory. If only WorkflowService uses them, they can be removed from the module providers too.
Verification Checklist
After all changes:
TypeScript compilation:
npx tsc --noEmit -p apps/backend-ai-api/tsconfig.app.json npx tsc --noEmit -p libs/libs-ai/ai-generation-hub/tsconfig.lib.json npx tsc --noEmit -p libs/libs-ai/ai-outcome-tracker/tsconfig.lib.jsonSearch for dangling references:
# Search for removed method names grep -r "startStreamingWorkflow\|mapModeToWorkflowType\|full-configuration" --include="*.ts" libs/ apps/ # Search for removed workflow start endpoint grep -r "workflow/start" --include="*.ts" libs/ apps/Confirm Vitto path still works:
GenerationHubService.startGeneration()should still compile and route tostartVittoGeneration()GenerationHubService.startVittoGeneration()should still callVITTO_API_BASE/generate- vibe-universe-generator component should still call
startGeneration()without errors
Backend module wiring:
- Check
WorkflowModuleproviders array — remove services that are no longer injected anywhere - Verify the module still exports PhaseExecutorService and its dependencies
- Check
Anti-Patterns to Avoid
| DO NOT | WHY |
|---|---|
Remove the entire ai-generation-hub library |
It is used in live routes; startVittoGeneration() is the active path |
Remove PhaseExecutorService or phase-executor/ directory |
Handles single-module generation from frontend (/module/generate) |
Remove workflow.controller.ts entirely |
Still hosts active /module/generate and /modules/* endpoints |
Change ModuleGenerationService in backend-vitto-api |
That is the canonical pipeline — leave it alone |
| Remove SSE event type interfaces from workflow.types.ts | They may be imported by phase-executor or frontend code |
Remove WorkflowModule from backend-ai-api |
Still needed for module generation endpoints |
| Batch-remove without checking imports first | Some "dead" methods may have been re-used elsewhere since S204 |
Estimated Impact
| Metric | Before | After |
|---|---|---|
| Dead workflow types | 6 | 0 |
| Dead methods in GenerationHubService | 14 (~700 lines) | 0 |
| Dead controller endpoints | ~4 | 0 |
| Dead WorkflowService.execute() flow | ~500+ lines | 0 |
| Total dead code removed | ~1,200+ lines | 0 |
Commit Convention
Follow SAGP v1.2:
[S{N}.1] refactor: remove dead workflow types from backend-ai-api
[S{N}.2] refactor: remove dead methods from GenerationHubService
[S{N}.3] refactor: remove dead controller endpoints from WorkflowController
[S{N}.4] feat: add 'vitto-pipeline' to GenerationSource type
[S{N}.5] refactor: remove unused WorkflowService dependencies
Where {N} is the session number assigned to this cleanup work.