Bugfix: Why does compileRspack() find 0 modules and show 'No modules...
Documentation for Sessions
🐛 Bugfix: Why does compileRspack() find 0 modules and show 'No modules...
Date: 2026-03-19
Time: 11:55:15 UTC
Session: gspace1-236.3
Agent: angular
Confidence: 95%
Status: ✅ Documented
📋 Decision Context
Question:
Why does compileRspack() find 0 modules and show 'No modules generated yet' even though generation succeeded?
Task: S236: Fix platform generation pipeline — preview compiles before VFS has content
🎯 Decision Made
Chosen:
Replace fire-and-forget refreshModule() calls with refreshAllModules() (which emits modulesLoaded$ on completion). Emit filesReadyForReview$ only AFTER modulesLoaded$ fires, not immediately.
Options Considered:
- Wait for modulesLoaded$ before triggering preview (chosen — proper completion signal)
- Add a longer fixed delay (e.g. 5s) before preview compilation (fragile — depends on network speed)
- Embed file content in the SSE event so VFS doesn't need GitLab fetch (bandwidth-heavy for 131 files)
- Use retry logic in compileRspack to re-check VFS (wastes CPU, unpredictable timing)
💭 Reasoning
Root cause: handleCompleted() called vfsSync.refreshModule(slug) for each module name — these are fire-and-forget async calls that fetch from GitLab. Then immediately emitted filesReadyForReview$.next() synchronously. The dock shell received filesReadyForReview$ + 500ms delay → compileRspack() → detectModulesInVfs() → 0 modules because GitLab fetch was still in progress. The 500ms timer was NOT enough for HTTP round-trips. Fix: refreshAllModules() has a built-in completion signal via modulesLoaded$ (uses forkJoin to wait for ALL file fetches). Subscribe to modulesLoaded$.pipe(take(1)) and only then emit filesReadyForReview$. Also added clearLoadedSlugs() before refresh so updated/replaced modules get fresh content.
📁 Files Involved
libs/libs-structural/vitto-studio/src/lib/services/studio-generation-listener.service.tslibs/libs-structural/vitto-studio/src/lib/services/vfs-sync.service.ts
🔗 Related
- Decision ID:
dev_1773921315730_oil3e2i - Session: 236
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation