fix(client): make data-tiles ready when the pass completes

A transient tile load error is terminal for the current window (retried only on
a new window or a reconnect), but data-tiles treated it as never settled, so one
host hiccup left it at 'loading' forever and every e2e readiness wait hung
(audit.test.mjs timed out under a parallel lane). TileScheduler.isPending() now
reports loading only for queued/in-flight tiles; ready means the pass is done.
Proven by aborting one tile request: the wait timed out before, passes after.
Unit-tested at the scheduler seam.
This commit is contained in:
2026-11-21 18:19:47 +01:00
parent ac5a6ac8dc
commit 9c05bb1f46
6 changed files with 63 additions and 32 deletions
+9 -7
View File
@@ -8,8 +8,10 @@
// the gate's answer for those tiles changed, so exactly those denied tiles are asked once more.
//
// The e2e contract on the canvas: `data-tiles` (`loading`/`ready`/`idle`) and
// `data-tile-requests` (how many fetches this page ever made). `ready` means every tile the current
// viewport wants has settled with `ok` or `denied`, which is what the tile-size gate (a) measures.
// `data-tile-requests` (how many fetches this page ever made). `ready` means this pass is complete:
// every wanted tile has a terminal answer (`ok`, `denied`, or a stored transient `error` that waits
// for a new window or a reconnect). A stored `error` must not keep `ready` away, or one host hiccup
// would hang the tile-size gate (a) and every e2e readiness wait.
import { Sprite, Texture } from 'pixi.js'
import type { RenderModule } from '../stage.ts'
@@ -109,11 +111,11 @@ export const renderModule: RenderModule = {
canvas.dataset['tileRequests'] = String(requests)
canvas.dataset['visibleTiles'] = String(wanted.length)
const settled = wanted.every(tile => {
const status = scheduler.status(tile.url)
return status === 'ok' || status === 'denied'
})
canvas.dataset['tiles'] = wanted.length === 0 ? 'idle' : settled ? 'ready' : 'loading'
// `ready` means this pass is done, not that every tile painted: a transient `error` is
// retried only on a new window or a reconnect (README), so it must not hold the flag at
// `loading` for the rest of the session (a host hiccup would hang every e2e readiness wait).
canvas.dataset['tiles'] =
wanted.length === 0 ? 'idle' : scheduler.isPending(wanted.map(tile => tile.url)) ? 'loading' : 'ready'
}
const unsubscribe = viewport.subscribe(scheduleSync)