Fix: Why did the Railway production build fail with TS2322 on mod...
Documentation for Sessions
📝 Fix: Why did the Railway production build fail with TS2322 on mod...
Date: 2026-03-13
Time: 14:17:03 UTC
Session: gspace1-211.5
Agent: angular
Confidence: 98%
Status: ✅ Documented
📋 Decision Context
Question:
Why did the Railway production build fail with TS2322 on module-gen-phase.executor.ts?
Task: S211.1: Fix production build failure
🎯 Decision Made
Chosen:
Changed 'module-gen.error' to 'module-gen.failed' in the SSE event type at line 127. The type 'module-gen.error' does not exist in the ModuleGenSSEEventType union — the correct type for generation failures is 'module-gen.failed'.
Options Considered:
- No alternatives documented
💭 Reasoning
Root cause: S212 budget enforcement code was added to module-gen-phase.executor.ts with an SSE event type 'module-gen.error' that doesn't exist in the ModuleGenSSEEventType discriminated union (which defines: preflight, started, phase-start, phase-progress, phase-complete, phase-error, module-generated, deploy-start, deploy-complete, completed, failed, heartbeat, pipeline.status, phase.file.list, phase.token.usage, phase.mastery.update). The correct type for a generation failure is 'module-gen.failed'. This passed local dev because webpack in development mode doesn't enforce strict type checking the same way production builds do. Early warning signal: any new SSE event emission should be verified against the type union before committing.
📁 Files Involved
APIs/backend-vitto-api/src/app/module-generation/phases/module-gen-phase.executor.tsAPIs/backend-vitto-api/src/app/module-generation/module-generation.types.ts
🔗 Related
- Decision ID:
dev_1773411423687_0jc56v2 - Session: 211
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation