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:


💭 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


🔗 Related


Auto-generated by MCP Smart Consolidation