Commit 4b239fa
authored
fix(tests): stop pi-lifetime asserting the ceiling on a racing boundary (#6082)
`keeps the ceiling when the run outlives it` passed a deadline of exactly
`PI_SANDBOX_MAX_LIFETIME_MS`, then asserted the resolved lifetime equalled
that ceiling. But the lifetime is `Math.min(ceiling, deadline - Date.now())`,
so the remaining budget decays below the ceiling as soon as one millisecond
of test time elapses and `Math.min` returns the budget instead. It passed
only when zero milliseconds happened to pass, which is why it failed CI as
`expected 5399999 to be 5400000` — 1 failure in 16,047.
Demonstrated: with the old input, a 5ms delay before the assertion yields
5399994 (off by 6ms); with a deadline 60s past the ceiling it yields
5400000 exactly, regardless of elapsed time.
An equal deadline was also not the case the test name describes — the run
has to *outlive* the ceiling, not match it — so raising it past the ceiling
fixes the assertion and the intent together. Derives the input from
`PI_SANDBOX_MAX_LIFETIME_MS` rather than restating 90 minutes, so the test
cannot drift if the async execution ceiling moves.
Also drops the old comment's claim that "the provider cap still wins": the
provider cap is 24h, far above the 90m async ceiling, so the ceiling is what
wins here.1 parent 911b958 commit 4b239fa
1 file changed
Lines changed: 8 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
131 | | - | |
132 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
133 | 138 | | |
134 | 139 | | |
135 | 140 | | |
| |||
0 commit comments