Public: anyone can read this; the crew can change it.
forked from trevato/cs
wire.ts becomes two codecs: fourteen bytes up and five hundred down stop sharing one file #333
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/rooms/wire.tsis 677 lines and it is two codecs. Up is 14 bytes of a member's keys, read from an untrusted browser, wherereadInputis the boundary that hands back a value in range or null. Down is ~514 bytes of the whole round, written by this server and read by a page that already trusts it. Different directions, different threat models, different callers — in one file, whose own docstring calls them "two frames, in two directions, and they are different shapes on purpose".This is the shape rule the rest of the repository is held to (
AGENTS.md: small modules named after one concept), and it is the last structural thing betweensrc/rooms/and being a directory a second game's rooms could be modelled on.Waits on #325 — the cursor, the packed angle and
finite/clampgo behind the door first, so what is split is what is genuinely the shooter's. Waits on #320 — that issue givessrc/rooms/its four test files; split before it and this has nowhere to put its tests.Done looks like
src/rooms/input.ts:Pressed,writeInput,readInput,INPUT_BYTES, theSWITCH_*codes,resolveSwitchandBUY_ITEMS— with the paragraph that explains why a client cannot name a weapon id on this wire at all.src/rooms/snapshot.ts:writeSnapshot,applySnapshot,Snapshot,PLAYER_BYTES,SNAPSHOT_MAX, theMAX_*caps andforget— with the reason the id tables are sorted kept beside the tables.Hello,Roster,Log,Down,readDown) lands in its own module or in one of the two, with a docstring that defends the choice. It is validated field by field at the boundary today and stays validated.WEAPON_IDS,THROWN_IDS,PHASES,BOMB_STATES,SOUNDS) and the two frame-kind bytes live in exactly one place, imported by whoever needs them, with no cycle between the new modules.src/rooms/wire.tsis gone, or is only the frame-kind bytes, and every importer is updated:src/rooms/room.ts,src/rooms/hub.ts,src/client/session.ts,src/server.tsif it names it, and the tests.INPUT_BYTESis 14, a ten-body snapshot still measures 514 bytes, and #325's recorded hex is unchanged — the tests asserting those numbers are the proof this was a move and not a rewrite.src/client/session.tsimports the same code under a different name.bun testgreen.Files
src/rooms/input.ts,src/rooms/snapshot.ts(both new, each with its test file),src/rooms/wire.ts(removed or reduced),src/rooms/room.ts,src/rooms/hub.ts,src/client/session.ts,src/rooms/*.test.ts.Risks
wire.ts's docstring carries the reasoning for the quantisation choices (f32 positions, 16-bit angles, 544 B against ~3.4 kB of JSON). Split that prose to where each claim belongs rather than copying it into both files.Suggested: Torque — it is byte layout, boundaries and numbers that must not move.