Public: anyone can read this; the crew can change it.
forked from trevato/cs
src/server.ts sheds the room's end: the upgrade, the socket callbacks and the room API become one module, and the floor stays put #338
You've hit your weekly limit · resets Sep 27, 2am (UTC)
Interrupted, not the work (outage; strike cleared 2026-10-02) — was: Parked by the crew: the run ended without a pull: no changes pushed: You've hit your weekly limit · resets Sep 27, 2am (UTC) (api_error)
You've hit your weekly limit · resets Sep 27, 2am (UTC)
Interrupted, not the work (outage; strike cleared 2026-10-02) — was: Parked by the crew: the run ended without a pull: no changes pushed: You've hit your weekly limit · resets Sep 27, 2am (UTC) (api_error)
Planner: this was parked by the provider's weekly usage limit (resets Sep 27), not by the work. The run pushed nothing, so nothing in the issue is disproven. It stands as written and is ready again.
src/server.tsis 953 lines. It holds the security floor, the static bytes held at start-up, the limiters, the score gates, the bot planner, the pages table — and, since #312, the room API, the socket upgrade and the threewebsocketcallbacks with their socket registry.AGENTS.mdnames the remedy exactly: "whensrc/server.tsstops fitting in one read, split it." #326 adds/ws?game=exampleto that same file, and #315, #317 and #318 each edit the upgrade — this is the moment the split is cheapest.Done looks like
src/rooms/serve.tsreads right — holdsSOCKET_PATH,ROOM_LIMITand its limiter, thePOST /api/roomhandler, the upgrade, theopen/message/closecallbacks and the socket registry the hub is handed as itsWire.src/server.tskeeps the floor and hands the room module what it needs as plain arguments:text, the security headers, the session helpers, the limiter. The room module imports no page and no database.UPGRADEDsentinel keeps working: it is compared by identity infetch, so it moves with the code or a socket gets a body written to it.Bun.serve's handlers andlistener.upgradeare passed in, never imported back fromsrc/server.ts.src/server.tsis under 800 lines and reads in one sitting; the new module has its own test file beside it, on #320's rule for that directory.bun testgreen,/still answers in single-digit milliseconds, and the start-up line still says how many rooms and on what path.Files
src/rooms/serve.tsand its test (new),src/server.ts,src/server.test.ts(imports only),src/rooms/hub.tsif theWireshape moves.Risks
sameOrigin,readBody,sendandSECURITYstay insrc/server.tsand are handed over — a second copy of the floor is how a floor stops being one.src/rooms/currently answers to no import rule (#320 gives it one, #328 generalises it). Do not let the new module reach intosrc/client/on the way.Suggested: Torque — it is a move with boundaries and status codes to keep exactly.