Commit 95f838f
authored
test: stop pinning settle capture counts against a wall-clock loop (#1307)
* test: model the UI in settle-observation fixtures instead of a capture count
settle-observation's "contention flakes" were a zero-margin comparison
meeting a 1ms clock skew, not generic load.
runStableCaptureLoop derives pollMs = min(300, max(25, quietMs)), so the
test's settleQuietMs: 25 made pollMs === quietMs, and the settle check
(one sleep(25) plus capture time, against >= 25) a 0ms margin. Node's
setTimeout(25) advances Date.now() by only 24ms in 0.13% of calls idle
and 0.63% under load, because libuv's timers and Date.now() read
different clocks. On a 24 the loop takes a third capture that the
transcript never scripted, and settle's best-effort catch reports the
resulting throw as settled: false.
The fixtures now model the surface rather than the runner's speed: a
quiet UI serves the settled tree to every capture, a busy one a fresh
tree per capture, via new transcript `repeat` entries and result
factories. The snapshot-floor economy guard survives as a bound (2-3
captures), and the follow-up's "no fresh capture" cost — previously
implied by the exact transcript — is now asserted directly.
Production is untouched: the same zero margin only costs a wasted extra
capture and poll there, filed separately as #1306.
* test: stop pinning the settle capture count in the iOS contract scenario too
A sweep for the same bug class found direct-ios-selector's settleObservation
scenario carrying the identical 0ms margin: settleQuietMs: 25 (so pollMs ===
quietMs) against a consume-once transcript scripting exactly two settle
captures, with no injected clock. It has not lost the coin flip in CI yet,
but it fails the same way when it does — a third capture finds no entry and
settle's best-effort catch reports settled: false.
Same fix: the fixture models a quiet UI (every settle capture sees the same
tree) instead of scripting how many captures fit in a wall-clock window.
The rest of the sweep was clean. The other contract scenarios and the
interaction runtime tests already use clamped mocks that repeat the last
snapshot, so any capture count is tolerated; the fake-clock tests are correct
to pin exact counts.
* style: oxfmt quietRunnerSnapshotEntry signature
* test: make one-shot-outranks-repeat a real transcript rule (P2 review)
The review is right: `one-shot entries still outrank a repeat entry` asserted
a guarantee the lookup did not provide. It passed only because the one-shot
happened to be declared first — unordered lookup took the first match, so a
repeat declared ahead of a matching one-shot shadowed it forever and left it
permanently unconsumed. Both failure modes reproduce; the reverse-order test
added here fails on the previous implementation.
Unordered lookup now searches matching one-shots before repeats, so
outranking holds whatever the declaration order. A repeat is documented as
its command's fallback.
Ordered transcripts now reject repeats at construction: ordered lookup only
ever reads the head, so a repeat there never advances and strands every entry
behind it. Refusing the combination beats failing later as a confusing
"Provider command mismatch".
Coverage added for both: reverse declaration order, and ordered + repeat.1 parent 117f781 commit 95f838f
5 files changed
Lines changed: 207 additions & 27 deletions
File tree
- test/integration
- interaction-contract
- provider-scenarios
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
72 | 79 | | |
73 | 80 | | |
74 | 81 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
188 | 189 | | |
189 | 190 | | |
190 | 191 | | |
191 | | - | |
| 192 | + | |
192 | 193 | | |
193 | 194 | | |
194 | | - | |
195 | | - | |
| 195 | + | |
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| |||
Lines changed: 60 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
133 | 157 | | |
134 | 158 | | |
135 | 159 | | |
| |||
155 | 179 | | |
156 | 180 | | |
157 | 181 | | |
158 | | - | |
159 | | - | |
| 182 | + | |
160 | 183 | | |
161 | 184 | | |
162 | 185 | | |
| |||
212 | 235 | | |
213 | 236 | | |
214 | 237 | | |
215 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
216 | 246 | | |
217 | 247 | | |
218 | 248 | | |
| |||
229 | 259 | | |
230 | 260 | | |
231 | 261 | | |
| 262 | + | |
232 | 263 | | |
233 | 264 | | |
234 | 265 | | |
235 | 266 | | |
236 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
237 | 275 | | |
238 | 276 | | |
239 | 277 | | |
| |||
258 | 296 | | |
259 | 297 | | |
260 | 298 | | |
261 | | - | |
262 | | - | |
| 299 | + | |
| 300 | + | |
263 | 301 | | |
264 | 302 | | |
265 | | - | |
266 | | - | |
267 | | - | |
| 303 | + | |
268 | 304 | | |
269 | 305 | | |
270 | 306 | | |
| |||
293 | 329 | | |
294 | 330 | | |
295 | 331 | | |
296 | | - | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
297 | 336 | | |
298 | 337 | | |
299 | 338 | | |
| |||
324 | 363 | | |
325 | 364 | | |
326 | 365 | | |
327 | | - | |
328 | | - | |
| 366 | + | |
329 | 367 | | |
330 | 368 | | |
331 | 369 | | |
| |||
392 | 430 | | |
393 | 431 | | |
394 | 432 | | |
| 433 | + | |
395 | 434 | | |
396 | 435 | | |
397 | 436 | | |
398 | 437 | | |
399 | 438 | | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
400 | 443 | | |
401 | 444 | | |
402 | 445 | | |
| |||
651 | 694 | | |
652 | 695 | | |
653 | 696 | | |
654 | | - | |
655 | | - | |
| 697 | + | |
656 | 698 | | |
657 | 699 | | |
658 | 700 | | |
| |||
724 | 766 | | |
725 | 767 | | |
726 | 768 | | |
| 769 | + | |
727 | 770 | | |
728 | 771 | | |
729 | 772 | | |
730 | 773 | | |
731 | 774 | | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
732 | 779 | | |
733 | 780 | | |
734 | 781 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
18 | 105 | | |
19 | 106 | | |
20 | 107 | | |
| |||
0 commit comments