diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-08 03:29:35 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-08 03:29:35 +0100 |
| commit | 058432130628d00764663ecf819a9adc6793768d (patch) | |
| tree | d3f49f111fbfaa48647cca2600adcf9017af2d30 /docs/TESTING.md | |
| parent | web: serve latest.php through PHP and refuse stray PHP files (diff) | |
| download | zagan-bet-058432130628d00764663ecf819a9adc6793768d.tar.gz zagan-bet-058432130628d00764663ecf819a9adc6793768d.zip | |
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.
Diffstat (limited to 'docs/TESTING.md')
| -rw-r--r-- | docs/TESTING.md | 52 |
1 files changed, 43 insertions, 9 deletions
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. | |||
| 210 | 210 | ||
| 211 | 1. `play crash` shows the ready board with a 1.00x multiplier; Space starts and | 211 | 1. `play crash` shows the ready board with a 1.00x multiplier; Space starts and |
| 212 | reserves the bet. | 212 | reserves the bet. |
| 213 | 2. The multiplier rises smoothly with no network traffic. Cash out with C and | 213 | 2. The multiplier rises smoothly from the server-clock anchor and is refreshed |
| 214 | confirm the board shows the cashout multiplier, the payout and the new | 214 | by 10 Hz ticks. Cash out with C and confirm the board shows the cashout |
| 215 | balance. | 215 | multiplier, the payout and the new balance. |
| 216 | 3. On another round, press nothing. The board must switch to `CRASHED at Xx` | 216 | 3. On another round, press nothing. The board must switch to `CRASHED at Xx` |
| 217 | by itself when the crash point is reached, and the bet must be lost. | 217 | by itself when the crash point is reached, and the bet must be lost. |
| 218 | 4. Press C just as a round crashes. Either it pays or the crashed result wins; | 218 | 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. | |||
| 220 | 5. Q during a live round forfeits the bet; Q when idle just leaves. | 220 | 5. Q during a live round forfeits the bet; Q when idle just leaves. |
| 221 | 6. Check the audit rows: one per round, `game_type = crash`, the reserved bet, | 221 | 6. Check the audit rows: one per round, `game_type = crash`, the reserved bet, |
| 222 | the payout, and `crash_point`/`multiplier`/`result` in `details`. | 222 | the payout, and `crash_point`/`multiplier`/`result` in `details`. |
| 223 | 7. Confirm the crash point is absent from the `CRASH_START` line (it must only | 223 | 7. Confirm the crash point and seed are absent from the `CRASH_START` message; |
| 224 | appear once the round is over). | 224 | only `commit` and `started_at` appear. When the round ends, `seed` appears |
| 225 | and `sha256(seed) == commit`; recompute the crash point from the seed. | ||
| 226 | 8. Confirm `CRASH_BUSTED` is an `EVT`, not a `RES`, and that a second poll | ||
| 227 | produces no repeated settlement. | ||
| 225 | 228 | ||
| 226 | ## Manual restart check | 229 | ## Manual restart check |
| 227 | 230 | ||
| @@ -237,7 +240,7 @@ terminal client; a saved login from one signs in the other. | |||
| 237 | 240 | ||
| 238 | 1. Connect a client and server from the same release: the client connects and | 241 | 1. Connect a client and server from the same release: the client connects and |
| 239 | the server log shows the `HELLO` exchange. | 242 | the server log shows the `HELLO` exchange. |
| 240 | 2. Connect a 4.x client to a 3.x server (or the reverse): the client must print | 243 | 2. Connect a 5.x client to a 4.x server (or the reverse): the client must print |
| 241 | `Version mismatch: client ..., server ...` and never reach the login prompt. | 244 | `Version mismatch: client ..., server ...` and never reach the login prompt. |
| 242 | 3. With a deliberately skew-built server (PATCH differs) the connection is | 245 | 3. With a deliberately skew-built server (PATCH differs) the connection is |
| 243 | accepted and, when the server's version is newer, the client prints | 246 | 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. | |||
| 269 | 272 | ||
| 270 | ## Packaging checklist | 273 | ## Packaging checklist |
| 271 | 274 | ||
| 272 | 1. Set the version in `Cargo.toml` and `gui/Cargo.toml` (same MAJOR.MINOR), | 275 | 1. Set the version in `Cargo.toml`, `gui/Cargo.toml` and `webd/Cargo.toml` |
| 273 | run `cargo test --workspace`, and commit. `publish.sh` refuses a dirty tree | 276 | (same MAJOR.MINOR), run `cargo test --workspace`, build the browser app |
| 274 | because the site links the committed git history as the GPL source. | 277 | (`cd web/play && npm ci && npm run build`), and commit. `publish.sh` refuses |
| 278 | a dirty tree because the site links the committed git history as the GPL | ||
| 279 | source. | ||
| 275 | 2. `./scripts/publish.sh` (add `DEST=` to stage elsewhere). It builds the GUI | 280 | 2. `./scripts/publish.sh` (add `DEST=` to stage elsewhere). It builds the GUI |
| 276 | with `gui-release` and the terminal clients and servers. The installers are | 281 | with `gui-release` and the terminal clients and servers. The installers are |
| 277 | stable site files and are not regenerated. | 282 | stable site files and are not regenerated. |
| @@ -284,4 +289,33 @@ terminal client; a saved login from one signs in the other. | |||
| 284 | menu entry. It must install the newest version even when an older app sits | 289 | menu entry. It must install the newest version even when an older app sits |
| 285 | next to it, and refuse a corrupted download. | 290 | next to it, and refuse a corrupted download. |
| 286 | 5. Repeat on Windows for the `.ps1` installer and the Start-menu shortcut. | 291 | 5. Repeat on Windows for the `.ps1` installer and the Start-menu shortcut. |
| 292 | 6. Start `webd` against the staging server with a pinned fingerprint and open | ||
| 293 | `/play/` through nginx. Run the manual web checklist below. | ||
| 294 | |||
| 295 | ## Manual web checklist | ||
| 296 | |||
| 297 | 1. Open `/play/` in a fresh browser. The auth card must appear; the top bar | ||
| 298 | must not claim a balance until login. | ||
| 299 | 2. Register, then log in with the password. The lobby must show 1 000 Kr and | ||
| 300 | every game. Refresh the page; the session cookie must reattach and the | ||
| 301 | balance must survive (within `ZAGAN_GRACE_SECONDS`). | ||
| 302 | 3. Open the same URL in a second tab. The first tab must show "Opened in | ||
| 303 | another tab" and stop reconnecting; the second must continue. | ||
| 304 | 4. Slots: spin and watch the reels settle on the server result; check the | ||
| 305 | payout and balance. Roulette: place straight, dozen, column and outside | ||
| 306 | chips, right-click one back, clear, spin, and confirm the result. | ||
| 307 | 5. Blackjack: deal, hit/stand/double, then deal again; forfeiting must warn | ||
| 308 | and lose the reserved bet. | ||
| 309 | 6. Crash: start a round, watch the curve and ticks, cash out; on another | ||
| 310 | round let it bust. Confirm the reveal line shows `sha256(seed) == commit` | ||
| 311 | and the recomputed crash point matches. | ||
| 312 | 7. Refresh in the middle of a live crash round. The current view must return | ||
| 313 | with the same `commit` and a rising multiplier; the round must still settle. | ||
| 314 | 8. Close the tab mid-round and wait past the grace window. The next visit must | ||
| 315 | log in again, and the server must have forfeited the round. | ||
| 316 | 9. Stop the gateway. The browser must show the reconnect overlay, then recover | ||
| 317 | when `webd` returns. Stop it for longer than the grace window: the round is | ||
| 318 | forfeited and a login is required. | ||
| 319 | 10. Check the browser console: no credential is stored, the cookie is HttpOnly, | ||
| 320 | and the only network target is `/ws`. | ||
| 287 | 321 | ||
