Commit e1bb56a
committed
test(firestore): wait out the emulator's Listen-stream backoff
test/firestore.test.tsx flakes in CI at roughly 18% per run (11 of 60
iterations, 2026-08-11). The Firestore emulator intermittently corrupts a
Listen frame, so grpc-js reads four body bytes as a length prefix and reports
RESOURCE_EXHAUSTED with an absurd size. The SDK special-cases that code with
backoff.resetToMax(), parking the stream on a 60 second maximum backoff, then
self-heals.
This is an unresolved upstream emulator bug, firebase/firebase-tools#8654.
There is no fixed version to pin, so the goal is to survive it rather than
prevent it.
Only the tests that read a document which does not exist need a live server
round trip, so they are the only ones that can die; everything else is served
from the local cache. Those tests currently abandon the stream after one
second, so they fail while the SDK is still recovering. Raising both ceilings
lets them wait the backoff out. waitFor polls every 50ms, so a larger budget
costs nothing when the stream is healthy: measured at 80-114ms per test with
the change across five runs, against 79-105ms without it across three.
The budget is 120s rather than 60s because a third party hitting the same
upstream bug found a 60s ceiling insufficient at least once, and observed a
test self-heal at ~35s under a 120s ceiling.
Verified: a simulated 65 second stall survives the new budget while failing
under the default, and both typechecks are clean. Not verified, and it cannot
be locally: that this rescues a real occurrence. The desync has never
reproduced on a dev machine, so the evidence is CI once this lands, where
desyncs should keep appearing while the flake stops.
Refs #7761 parent bad1433 commit e1bb56a
1 file changed
Lines changed: 17 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
33 | 44 | | |
34 | 45 | | |
35 | 46 | | |
| |||
108 | 119 | | |
109 | 120 | | |
110 | 121 | | |
111 | | - | |
| 122 | + | |
112 | 123 | | |
113 | 124 | | |
114 | 125 | | |
115 | | - | |
| 126 | + | |
116 | 127 | | |
117 | 128 | | |
118 | 129 | | |
| |||
177 | 188 | | |
178 | 189 | | |
179 | 190 | | |
180 | | - | |
181 | | - | |
| 191 | + | |
| 192 | + | |
182 | 193 | | |
183 | 194 | | |
184 | 195 | | |
185 | 196 | | |
186 | 197 | | |
187 | | - | |
| 198 | + | |
188 | 199 | | |
189 | 200 | | |
190 | | - | |
| 201 | + | |
191 | 202 | | |
192 | 203 | | |
193 | 204 | | |
| |||
0 commit comments