From 058432130628d00764663ecf819a9adc6793768d Mon Sep 17 00:00:00 2001 From: salmonik Date: Sun, 8 Nov 2026 03:29:35 +0100 Subject: v5.0.0: protocol v5 and the browser frontend Protocol v5 replaces newline lines with bounded [u32 len][text] frames and REQ/RES/EVT envelopes. Requests carry correlation ids and the server replays the last 256 replies per connection, so a gateway retry cannot double-debit and a late reply cannot clobber a newer request. HELLO/PONG carry server time; crash rounds announce started_at and push coalesced 10 Hz ticks. Crash now commits sha256(seed) before a round and reveals the seed when it ends, so clients recompute the crash point. Adds the webd/ gateway: one blocking thread, one ClientCore and one pinned upstream TLS connection per session, an HttpOnly session cookie, takeover, and a 60-second grace window. The browser sends Command JSON and renders View JSON; it never speaks the game protocol or stores credentials. Adds the vanilla TypeScript browser app at /play/ (login, lobby, all four games, history, notices, crash verification), the nginx /play and /ws routes, and the headless DOM smoke test. webd and the app stay out of the TUI/GUI/server build graph. The client/server version moves to 5.0.0 in lockstep; v4 peers are refused at HELLO. --- docs/TESTING.md | 52 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 9 deletions(-) (limited to 'docs/TESTING.md') diff --git a/docs/TESTING.md b/docs/TESTING.md index 09ceb82..fbd510b 100644 --- a/docs/TESTING.md +++ b/docs/TESTING.md @@ -210,9 +210,9 @@ terminal client; a saved login from one signs in the other. 1. `play crash` shows the ready board with a 1.00x multiplier; Space starts and reserves the bet. -2. The multiplier rises smoothly with no network traffic. Cash out with C and - confirm the board shows the cashout multiplier, the payout and the new - balance. +2. The multiplier rises smoothly from the server-clock anchor and is refreshed + by 10 Hz ticks. Cash out with C and confirm the board shows the cashout + multiplier, the payout and the new balance. 3. On another round, press nothing. The board must switch to `CRASHED at Xx` by itself when the crash point is reached, and the bet must be lost. 4. Press C just as a round crashes. Either it pays or the crashed result wins; @@ -220,8 +220,11 @@ terminal client; a saved login from one signs in the other. 5. Q during a live round forfeits the bet; Q when idle just leaves. 6. Check the audit rows: one per round, `game_type = crash`, the reserved bet, the payout, and `crash_point`/`multiplier`/`result` in `details`. -7. Confirm the crash point is absent from the `CRASH_START` line (it must only - appear once the round is over). +7. Confirm the crash point and seed are absent from the `CRASH_START` message; + only `commit` and `started_at` appear. When the round ends, `seed` appears + and `sha256(seed) == commit`; recompute the crash point from the seed. +8. Confirm `CRASH_BUSTED` is an `EVT`, not a `RES`, and that a second poll + produces no repeated settlement. ## Manual restart check @@ -237,7 +240,7 @@ terminal client; a saved login from one signs in the other. 1. Connect a client and server from the same release: the client connects and the server log shows the `HELLO` exchange. -2. Connect a 4.x client to a 3.x server (or the reverse): the client must print +2. Connect a 5.x client to a 4.x server (or the reverse): the client must print `Version mismatch: client ..., server ...` and never reach the login prompt. 3. With a deliberately skew-built server (PATCH differs) the connection is accepted and, when the server's version is newer, the client prints @@ -269,9 +272,11 @@ terminal client; a saved login from one signs in the other. ## Packaging checklist -1. Set the version in `Cargo.toml` and `gui/Cargo.toml` (same MAJOR.MINOR), - run `cargo test --workspace`, and commit. `publish.sh` refuses a dirty tree - because the site links the committed git history as the GPL source. +1. Set the version in `Cargo.toml`, `gui/Cargo.toml` and `webd/Cargo.toml` + (same MAJOR.MINOR), run `cargo test --workspace`, build the browser app + (`cd web/play && npm ci && npm run build`), and commit. `publish.sh` refuses + a dirty tree because the site links the committed git history as the GPL + source. 2. `./scripts/publish.sh` (add `DEST=` to stage elsewhere). It builds the GUI with `gui-release` and the terminal clients and servers. The installers are stable site files and are not regenerated. @@ -284,4 +289,33 @@ terminal client; a saved login from one signs in the other. menu entry. It must install the newest version even when an older app sits next to it, and refuse a corrupted download. 5. Repeat on Windows for the `.ps1` installer and the Start-menu shortcut. +6. Start `webd` against the staging server with a pinned fingerprint and open + `/play/` through nginx. Run the manual web checklist below. + +## Manual web checklist + +1. Open `/play/` in a fresh browser. The auth card must appear; the top bar + must not claim a balance until login. +2. Register, then log in with the password. The lobby must show 1 000 Kr and + every game. Refresh the page; the session cookie must reattach and the + balance must survive (within `ZAGAN_GRACE_SECONDS`). +3. Open the same URL in a second tab. The first tab must show "Opened in + another tab" and stop reconnecting; the second must continue. +4. Slots: spin and watch the reels settle on the server result; check the + payout and balance. Roulette: place straight, dozen, column and outside + chips, right-click one back, clear, spin, and confirm the result. +5. Blackjack: deal, hit/stand/double, then deal again; forfeiting must warn + and lose the reserved bet. +6. Crash: start a round, watch the curve and ticks, cash out; on another + round let it bust. Confirm the reveal line shows `sha256(seed) == commit` + and the recomputed crash point matches. +7. Refresh in the middle of a live crash round. The current view must return + with the same `commit` and a rising multiplier; the round must still settle. +8. Close the tab mid-round and wait past the grace window. The next visit must + log in again, and the server must have forfeited the round. +9. Stop the gateway. The browser must show the reconnect overlay, then recover + when `webd` returns. Stop it for longer than the grace window: the round is + forfeited and a login is required. +10. Check the browser console: no credential is stored, the cookie is HttpOnly, + and the only network target is `/ws`. -- cgit v1.2.3