2026-10-16 01:23:32 +03:00
|
|
|
# Game clock: tasks
|
|
|
|
|
|
|
|
|
|
Work through the tasks in order; each ends with its tests passing and a commit. Tick a task when it is committed.
|
|
|
|
|
|
2026-10-16 01:25:15 +03:00
|
|
|
- [x] 1. **Core types and helpers**: `GameClock`, `CLOCK_LOW_TIME_MS`, the new optional fields on `Game`,
|
2026-10-16 01:23:32 +03:00
|
|
|
`GameEndMessage`, `MoveRecord` and `FinishedGameSummary`; `getClockTimes`, `ClockSync`, `getClockAtMove`,
|
|
|
|
|
`formatClock` with unit tests; English timeout texts.
|
2026-10-16 01:27:28 +03:00
|
|
|
- [x] 2. **Clock in the game lifecycle**: `GameClock.ts`, `GAME_CLOCK_MS`, `clock` and `moveRemainingMs` on
|
2026-10-16 01:23:32 +03:00
|
|
|
`BackendGame`, start, charging moves, refusing late moves, stopping the clock on every ending, `clock` and
|
|
|
|
|
`serverTime` in client messages; unit tests.
|
2026-10-16 01:29:22 +03:00
|
|
|
- [x] 3. **Scheduled service**: `endGamesOutOfTime`, `GameClockScheduler` wired in `index.ts`; remove
|
|
|
|
|
`checkTimeouts`, the 10-second timer and the backend's `offlineSince`; unit tests.
|
2026-10-16 01:30:39 +03:00
|
|
|
- [x] 4. **Restore and saving**: snapshot version 2 and restore of versions 1 and 2, `remainingMs` and
|
2026-10-16 01:23:32 +03:00
|
|
|
`clockInitialMs` in game records, migration `002_clock` and the repository; unit and integration tests.
|
2026-10-16 01:39:36 +03:00
|
|
|
- [x] 5. **Web app, live game**: `useGameClock`, `GameClockView`, clocks in `GamePage` on desktop and mobile
|
2026-10-16 01:29:22 +03:00
|
|
|
layouts; remove the offline countdown, and with it `TURN_TIMEOUT_MS`, `INACTIVE_TIMEOUT_MS`,
|
|
|
|
|
`UserConnectionInfo.offlineSince` and `OpponentOfflineCountdown` from core (the web app uses them until then).
|
2026-10-16 01:23:32 +03:00
|
|
|
- [ ] 6. **Web app, replay**: clocks in `ReplayView` from `getClockAtMove`.
|
|
|
|
|
- [ ] 7. **Mobile app**: clocks in `GameScreen`; type check and bundle.
|
|
|
|
|
- [ ] 8. **End to end and docs**: Chrome tests from `design.md`; README, `AGENTS.md` and `TODO.md` (release the mobile
|
|
|
|
|
update before or with the backend; the out of scope items); mark `game-history` R3.3 and R3.4 as replaced.
|