The tile gate no longer takes dbLock or runs a SQL session JOIN per tile: a published
in-memory view (server/sessions.nim) holds token hashes -> player/role and one explored
bitmap per player. Sessions load from the DB at startup and are updated by join, key
replacement and player removal in the same lock as the write; refreshed cells publish
before the ack. The gate is one snapshot read (parse + session + bit test + redirect)
over scalar data only, so a tile burst is answered while a mutation holds dbLock.
Evidence: tests/tsessions.nim pins the cache/bitmap lifecycle and gate rule; tiles.test
adds the lock-held burst and the revocation/restart seam; auth.test adds the
LEAK_FAULT=sessioncache negative control (a stale entry makes the auth group fail);
mutation c5 keeps the cache drop load-bearing. Explored wire and persistence untouched.
Bench (devbox run bench, in-process): tile gate old 0.006 ms -> new 0.001 ms per
request; incremental explored mark 0.001 ms; snapshot build 2.0 ms at 262144 cells
(startup only).
lib.mjs gains a node:net WebSocket client (frames, opcodes, masked sends, a close
handshake that mirrors a browser) so the harness can send what the global WebSocket
cannot: oversize, binary, unmasked, bad-opcode and garbage frames, and read Ping/Pong
and the empty close frame. wsUrl/rawUpgrade now carry the required proto query.
withserver.mjs gains the GM-server helpers (gm-key, withGmServer, signIn, openAs) that
auth.test.mjs used to keep privately, so both harnesses share one copy.
protocol.test.mjs is the protocol group of DESIGN 13 M3: hello/n, catalogue types,
proto, unknown type and ignored fields, exactly one ack per reqId, unnamed player,
malformed + binary frames, the flood close, the intent bucket, the 64 KB boundary,
unmasked/bad opcode, server Ping and Pong, the connection cap, and closing-then-1005.
auth.test.mjs now also asserts the closing reason on eviction and revocation.