You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
server: each hosted-project save leaves the previous version behind #521
Each save of a hosted project writes a new File document to Firestore (a full serialized project) and repoints the project at it.
The previous File is never deleted or referenced again, so a project accumulates one dead document per save.
Either delete superseded versions or keep them on purpose as history.
Why it matters
Firestore storage grows with total edit count across all hosted projects, with no bound. File.prev_id and createFile's prevId parameter suggest a version chain, but both callers pass undefined, so the schema implies history that does not exist.
Deleting a project already handles this: deleteProjectAndFiles removes every File with that project id.
The 409 and transport-failure paths of the save handler also clean up their own new File.
Only the steady-state leak on successful saves remains.
Fix
Recommended: after the conditional project update succeeds, delete the previously referenced File (log, do not fail, if the delete fails).
This keeps one File per project; a crash between the update and the delete leaks one document, which is acceptable.
Alternative: populate prev_id and keep the last K versions, which only makes sense if a restore-previous-version feature is planned.
Pointers
src/server/api.ts, the POST /projects/:username/:projectName handler
changed the title [-]server: hosted-project saves leak orphaned File docs in Firestore (no version chain, no GC)[/-][+]server: each hosted-project save leaves the previous version behind[/+]on Oct 12, 2026
Activity
server: add DELETE /api/projects route; UI delete-project action (#522)
[-]server: hosted-project saves leak orphaned File docs in Firestore (no version chain, no GC)[/-][+]server: each hosted-project save leaves the previous version behind[/+]