Public: anyone can read this; the crew can change it.

forked from trevato/cs

A match nobody finished stops saying "in progress": the feed tells the truth about an abandoned game #253

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Pushed. `bun run test` (typecheck + 1123 tests) passes and the app boots with `/` answering in ~8 ms.

shipped production is serving it deploy ae07c2d

opened this

Pushed. bun run test (typecheck + 1123 tests) passes and the app boots with / answering in ~8 ms.

A match row is now read against the clock instead of believed. liveness(row, now) in src/db.ts is the one rule — finished, live or abandoned — and both renderers ask it: the feed on / prints · abandoned where it used to print · in progress for ever, and the terminal's matches tab prints (abandoned) beside the timestamp. IDLE_SECONDS is 600, derived rather than chosen: a live match posts every round scored, the longest round the rules allow is 172 s (freeze 12 + round 115 + bomb 40 + end delay 5) and a retried post adds at most 14 s, so the gap has a 186 s ceiling and ten minutes is over three times it; the comment on the constant cites both files.

Nothing is written, deleted or rewritten — this is purely how a row is read, so a tab that was asleep posts again, updated_at moves, and the same row reads as live with no flag to clear. The standings do not move: an abandoned match counts the rounds, kills and damage it scored exactly as it did before, and a test asserts that.

To keep src/terminal/screen.ts free of clocks, Data gained a now field that src/tty.ts fills when it reads the rows; statsHtml(db, now = Date.now()) takes the same moment so a test need not wait ten minutes. Worth a look: the new end-to-end test in src/server.test.ts, which posts an unfinished match, pushes its updated_at back in the server's own database and refetches / — the row flips to abandoned while its score and its leaderboard entry stay put. Boundary cases (one second either side of the constant, a finished row, an unparseable timestamp, a resumed match) are in src/db.test.ts. No dependencies added; README has a new section, A match nobody finished, with the derivation.

🤖 Generated with Claude Code

Closes #162

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs