diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2026-11-23 00:51:32 +0100 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2026-11-23 00:51:32 +0100 |
| commit | 93970f361b831f17d48ff2a345fc78488ac71fba (patch) | |
| tree | f3844cc343c95dcc19a1444bdb6666e807bc59ef /README.md | |
| parent | b884441ba0d10bdd3559748507a0991888f66194 (diff) | |
Phase 7: hardening and shipping (M7)
E2E (Playwright, e2e/):
- table fixture: one real compiled server per test (temp saves dir, free
port, workers: 1); a Tab helper drives the real UI (menus, rows,
initiative, draw, seats) over one WS per fresh browser context
- full round: onboarding, secret initiative masked to ?? per connection,
draw revealing on every screen, turns, next round, round-2 secrecy
- seats: claim/re-claim on owner-leave, reload keeps the session and
re-claims, two sessions can't own one character
- resilience: a dropped tab resyncs on reconnect (no drift); a SIGKILL'd
server restarts with state + seats surviving (incl. the owner's secret
initiative and the enabled draw); a throttled tab converges on the same
state as the fast tabs; a double-tapped draw runs once, error sent to
the sender only
- figure edit: set a character level + rename from the status menu
Cross-check vs the reference (feature parity):
- status menu: level pills (setCharacterLevel) + a name field
(changeName), mirroring SetCharacterLevelMenu
- ability-card removal: draw-pile-only "send to bottom"
(reorderAbilityList -> index 0) + "shuffle undrawn cards"
(shuffleDrawnAbilityCard), mirroring RemoveCardMenu
- Add Character: already-added classes disabled (Objective/Escort may be
added repeatedly), matching _characterAlreadyAdded
- every remaining registry command verified reachable from the UI
Session persistence (found by the restart test):
- the client never learned its session id before the first welcome, so a
reconnect minted a new id and orphaned the restored seat; fixed with
establishSessionCookie() (a GET /session before the WS upgrade, plus a
vite /session proxy) so the x-haven-session cookie survives restarts
- the initiative input now prefills from re-synced state (CharacterRow
effect, guarded against clobbering a live edit) so a reload/reconnect
doesn't blank an entry
Performance + deployment:
- immutable asset caching (Cache-Control: 1yr, immutable) for the game
data / images / in-game translations; no-cache for the SPA index.html
so rebuilt apps reach open tabs
- server tool/perf_measure.dart: the performance probe (state payload
size at full-table scale, WS fan-out bytes per action, traffic per
connection)
- Dockerfile (server + built web); docs/DEPLOYMENT.md (Docker,
persistence, reverse proxy, measured performance, smoke-test list)
- README quickstart + production/Docker/testing sections
Server:
- --saves-dir and --data-dir CLI options (Docker / multi-game hosts),
threaded through the stores and data loading
Misc:
- app.css: height 100% on .row so the turn-done tap zone resolves to a
clickable height; fake-socket.ts readyState constants corrected to the
real WebSocket values (0 CONNECTING, 1 OPEN)
- scripts/ci.sh: the Playwright E2E gate (runs when PLAYWRIGHT is set)
- PLAN.md: Phase 7 boxes checked, M7 progress-log entry
Verification: svelte-check 0 errors; web 196/196 tests; vite build OK;
dart analyze 0 errors / 0 warnings; dart test 604/604; Playwright 9/9;
scripts/ci.sh green end-to-end.
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 59 |
1 files changed, 55 insertions, 4 deletions
@@ -26,10 +26,14 @@ live in [`PLAN.md`](PLAN.md). - `server/` — the Dart game server. Owns all game state, serves the built web app, and hosts the game WebSocket at `/ws`. Game data is copied from the reference app into `server/assets/` (`data/`, `images/`, `i18n/`, `fonts/`, - `testData/`). + `testData/`). `tool/perf_measure.dart` is the Phase 7 performance probe. - `web/` — the Svelte + TypeScript single-page app. Carries no game state; it renders the server's state and submits player input. -- `scripts/ci.sh` — analyze, test, and build both halves. +- `e2e/` — Playwright end-to-end tests (full round, seats, resilience). +- `docs/DEPLOYMENT.md` — production notes: Docker, persistence, reverse + proxy, measured performance, smoke-test list. +- `Dockerfile` — server + built web in one image. +- `scripts/ci.sh` — analyze, test, and build both halves (plus the E2E suite). - `FrosthavenAssistant/` — read-only reference implementation (gitignored). ## Requirements @@ -58,6 +62,27 @@ npm run dev Open <http://localhost:5173> — you should see the connection status and, once the handshake completes, your session/role/state index. +## Quickstart (playing a game) + +1. Start the server (see *Production run* below, or the Docker one-liner in + [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md)). +2. Open the game URL in a browser tab — each player gets their **own tab** + (and ideally their own device); other tabs can just watch as spectators. +3. In your tab open the main menu (top-left) → **Add Character** and pick + your class. Your tab becomes a *player* the moment you own a character; + a character someone leaves behind shows a **Claim** chip any player can + tap. +4. **Set Scenario** (same menu) picks the scenario. +5. Each player taps their character's initiative slot and enters a number — + it is **secret**: only your tab sees your entry until the round is drawn. +6. Once every player has entered, any player taps **Draw** (bottom bar). All + tabs reveal the initiative and switch to turns; end a figure's turn by + tapping its right-hand zone, then **Next Round** when the round is done. + +Full per-step verification (what to expect in each tab) is in the +[smoke-test list](docs/DEPLOYMENT.md#smoke-test-list); the same flow is +automated by the Playwright suite in `e2e/`. + ## Production run ```bash @@ -67,7 +92,20 @@ cd server && dart run bin/main.dart # serves web/dist + /ws on :4567 Open <http://localhost:4567>. The port and static dir can be overridden: `dart run bin/main.dart --port 8080 --static-dir ../web/dist` (the `PORT` -environment variable is also honored). +environment variable is also honored). Game state persists in `saves/` next +to the server; all options are in `server/bin/main.dart`. + +### Docker + +```bash +docker build -t xhaven . +docker run --rm -p 4567:4567 -v xhaven-saves:/app/saves xhaven +``` + +One image (web build + compiled server + game assets); state lives in the +`/app/saves` volume. See [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md) for the +full list of options, persistence semantics, reverse-proxy/TLS notes, and +the measured performance figures. ## Testing @@ -76,7 +114,20 @@ scripts/ci.sh ``` runs `dart analyze` + `dart test` for the server and `svelte-check` + -`vitest` + `vite build` for the web app. +`vitest` + `vite build` for the web app, then the Playwright E2E suite +(two players + a spectator play a full round through the real UI; seat +claiming; resilience — offline tabs, throttled tabs, server restart +mid-game). The E2E steps are skipped when the `PLAYWRIGHT` environment +variable is unset (it is set on CI). + +Individual suites: + +```bash +cd server && dart test # server (604 tests) +cd web && npm run test # client (195 tests) +cd e2e && npx playwright test # end-to-end (needs `npm install` + + # `npx playwright install chromium`) +``` ## License |
