test: deflake map fill gate and wall-locked under load

Map gate (a): measure the fastest of 4 fresh page loads after a warm-up (min-of-N,
TESTING 5.3) against 2x the 1 s DESIGN budget (the documented saturated-host
tolerance), and print every sample; a planted 50 ms/tile decode delay fails it.

Wall editor: an ack dispatch re-renders with the previous server record, and the
panel repopulated every control on every render, so a just-toggled checkbox was
reverted until the wall frame landed (Playwright saw 'did not change its state').
Repopulate only when the record changed (src/panels/wallSync.ts, unit-tested) and
restore the controls when the server refuses an edit.
This commit is contained in:
2026-11-21 17:37:11 +01:00
parent 9c7f9de910
commit ac5a6ac8dc
6 changed files with 160 additions and 35 deletions
+10 -4
View File
@@ -144,10 +144,13 @@ change them only if a slice needs a new *core* event, and say so in the PR.
- **Grid** (`src/render/modules/grid.ts`): one `TilingSprite` over a `grid_size` cell texture, drawn
once, toggled by `#grid-toggle` (story 18). No per-frame redraw.
- **Tile-size gate (a)** (`client/e2e/map.test.mjs`): mobile emulation 412×869 CSS px, DPR 2.625,
touch; real server through the TLS/HTTP2 nginx; viewport **412×869 at zoom 1**. The measurement is
from the canvas becoming visible to `data-tiles=ready`, i.e. the first viewport filling; the budget
is **< 1 s** (DESIGN §13). Measured on this dev host: **~0.4–0.8 s** for the 480-tile window
(marginal under parallel test load). The same test then applies CDP's 4× CPU throttle for the grid,
touch; real server through the TLS/HTTP2 nginx; viewport **412×869 at zoom 1**. Each sample is a
fresh page load measured from the canvas becoming visible to `data-tiles=ready`, i.e. one first
viewport filling. A single wall-clock sample is host-load-sensitive, so the gate is the fastest of
**4 samples after 1 warm-up** (min-of-N, TESTING §5.3), asserted against **2× the 1 s budget**
(the documented saturated-host tolerance) and printed with every sample on every run. Measured
2026-11-21: **439 ms** fastest on the dev host (samples 628, 778, 444, 439 ms); **1.3–1.9 s**
fastest under a saturated 16-core host with the same binary. The same test then applies CDP's 4× CPU throttle for the grid,
pinch and reconnect checks. Note: under the 4× throttle the *fill itself* takes ~3.2 s, because CDP
multiplies each of the ~480 image-load callbacks; that measures the throttler rather than the app,
so the gate is measured at real CPU and gate (b), the real-phone run (#77), remains authoritative
@@ -181,6 +184,9 @@ change them only if a slice needs a new *core* event, and say so in the PR.
`Apply switches`), the one-way flip, delete and Undo. A locked or secret door's open action shows
`locked: unlock first` / `secret: clear secret first` and the one click that clears the block
instead of sending a refused intent. No thickness, height or position control (ADR-0012).
Controls are repopulated only when the server record changed (`src/panels/wallSync.ts`): the ack
dispatch carries the previous record, so repopulating on every render would revert a just-toggled
switch for the round trip until the `wall` frame lands (and a host pause could make that visible).
- **Proof**: `test/walls.test.ts` (slice load/upsert/remove/reset, player frames ignored, preset
expansion, derived kind, arrow side, snap, payload XOR rules, `open` excluded from updates, undo
intents, local validation) and `e2e/walls.test.mjs` (real server: draw all four presets, label,