Commit 1aed0ae
committed
fix(live): never paint from cache on paused load — data only when run is active
Root cause: the synchronous optimistic reveal in DOMContentLoaded trusted the
localStorage snapshot (_cachedRunActive → rehydrateFromCache). But a snapshot
persisted mid-run keeps state.status:'running' after the run is stopped —
persistence halts on stop, so the cache is never updated to a terminal state.
On a paused hard-refresh that stale 'running' cache made the page:
- paint the last run's rows + restore the TESTED/progress counters behind the
opaque paused overlay (visible if you delete the overlay in devtools), and
- set _liveState to the stale running state, so applyLiveModeBadge saw
active=true and fired /api/public/sdk-info — all with no network proof that
a run was actually live.
The cache can't know the run stopped without asking the server, so the
cache-only synchronous decision is unsound. Remove it entirely: nothing paints
until checkBroadcastState polls /api/broadcast and gets activeRun=true, which
runs connectLiveWork (the sole paint path: cache rehydrate → render → SSE →
live-state → batch → stats). The paused overlay ships shown in markup, so a
paused page stays covered AND data-free from first paint. Deleted the now-dead
_cachedRunActive(). Cost: a genuine mid-run refresh shows the overlay for one
/api/broadcast round-trip before connectLiveWork paints — correct over stale.
Tests: live-load-gating [0] now asserts _cachedRunActive is gone and there's no
optimistic reveal (with a hard regression guard that exits non-zero if either
returns); rehydrate/seed active-gating tests unchanged. Full suite green.1 parent f79a364 commit 1aed0ae
2 files changed
Lines changed: 38 additions & 51 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
964 | 964 | | |
965 | 965 | | |
966 | 966 | | |
967 | | - | |
968 | | - | |
969 | | - | |
970 | | - | |
971 | | - | |
972 | | - | |
973 | | - | |
974 | | - | |
975 | | - | |
976 | | - | |
977 | | - | |
978 | | - | |
979 | | - | |
980 | | - | |
981 | | - | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
982 | 979 | | |
983 | 980 | | |
984 | 981 | | |
| |||
1976 | 1973 | | |
1977 | 1974 | | |
1978 | 1975 | | |
1979 | | - | |
1980 | | - | |
1981 | | - | |
1982 | | - | |
1983 | | - | |
1984 | | - | |
1985 | | - | |
1986 | | - | |
1987 | | - | |
1988 | | - | |
1989 | | - | |
1990 | 1976 | | |
1991 | 1977 | | |
1992 | 1978 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
13 | 19 | | |
14 | 20 | | |
15 | 21 | | |
16 | | - | |
17 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
18 | 25 | | |
19 | 26 | | |
20 | 27 | | |
| |||
48 | 55 | | |
49 | 56 | | |
50 | 57 | | |
51 | | - | |
| 58 | + | |
52 | 59 | | |
53 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
54 | 71 | | |
55 | 72 | | |
56 | 73 | | |
| |||
110 | 127 | | |
111 | 128 | | |
112 | 129 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
134 | 135 | | |
135 | 136 | | |
136 | 137 | | |
| |||
0 commit comments