Skip to content

Persist solves by hiding expired rooms#140

Draft
coder13 wants to merge 2 commits into
masterfrom
agent/persist-user-solves
Draft

Persist solves by hiding expired rooms#140
coder13 wants to merge 2 commits into
masterfrom
agent/persist-user-solves

Conversation

@coder13

@coder13 coder13 commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Stop using MongoDB TTL deletion for normal room expiry.
  • Add hiddenAt to rooms and use it as the lobby visibility cutoff while keeping room documents, scrambles, attempts, and embedded solve results intact.
  • Filter hidden rooms out of lobby room lists and reject joins once a room is hidden.
  • Emit the existing ROOM_DELETED socket event when a room reaches hiddenAt, so connected clients remove it from the lobby without deleting it from MongoDB.
  • Change admin room deletion to hide the room document instead of removing it.
  • Fix existing lint-only formatting in server/middlewares/auth.js so server lint passes.

Notes

The old expireAt field is now cleared whenever room stale state changes, so an existing production TTL index on expireAt will no longer remove rooms touched by the app. New hide timing is stored in hiddenAt instead.

Validation

  • cd server && npm run lint

coder13 added 2 commits July 8, 2026 14:31
Archive submitted and edited room results into a durable solves collection with room, attempt, and scramble context.

Add a backfill command for existing embedded room results so historical solves can be preserved before room TTL cleanup.
Replace the solve archive approach with retained room documents: normal rooms now use hiddenAt for lobby visibility and clear expireAt so MongoDB TTL cleanup no longer removes their attempts/results.

Room deletion now hides the room document, and lobby queries exclude hidden rooms while existing solve data remains embedded on the room.
@coder13 coder13 changed the title Persist user solves Persist solves by hiding expired rooms Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant