Repository navigation
Commit b13d8c9
committed
test(openai-native): drop the four fixed sleeps that trip the lint idiom rule
The required compile arm runs `pnpm run lint` in src, and at 2a9c3d0 it
exits 1 with 4 `no-restricted-globals` errors in
src/api/providers/__tests__/openai-native.spec.ts (601:63, 609:20, 1263:36,
2037:35): "Unexpected use of 'setTimeout'. Poll with vi.waitFor on the
observable condition. A fixed sleep either flakes or hides a missing await."
The rule is apiSpecSleepConfig in
packages/config-eslint/api-provider-hygiene.js, scoped to
api/**/__tests__/**/*.spec.ts, which is why this file carries it and no other
provider spec does; src/eslint-suppressions.json holds no entry for this rule,
so these 4 errors were never suppressed.
Site by site:
- tick() has nothing observable to poll, so it is flushMacrotasks() from
src/test-utils/timers, whose own header says to use it when there is no
observable signal and to poll with vi.waitFor when there is one.
- untilSignalAborted() is waiting for a deadline, so its fallback is now
AbortSignal.timeout(timeoutMs) raced against the same abort event: same
window, no timer to clear, nothing to forget on early abort.
- The 429-races-abort row polls pullStarted (set when the reader enters pull
and parks on the gate) and then flushes one macrotask, so the abort lands on
a registered pending read instead of after 10 wall-clock ms.
- The completePrompt abort row polls sdkRequestStarted, set inside the SDK
double, so the abort arrives mid-request instead of after one timeout(0).
A first cut polled untilSignalAborted with vi.waitFor(signal.aborted) at a
10 ms interval. That variant turned two abort-bridging rows red - "abort it
mid-flight" (head :740) and "stop consuming the SDK stream" (head :788) -
because the mocked stream's blocking window is load-bearing for those
assertions: resolving it in ~10 ms lets the SDK iterator finish before the
provider's between-pulls check runs. The deadline form is what is committed.
Gates, run by hand from src with node v22.23.4: pnpm run lint exit 0 (was exit
1 with those 4 rows); eslint on this file exit 0, and with head content put
back at the same path the same command exits 1 with exactly those 4 rows, so
the change is what the control removes; vitest api shard 114 files, 4115
passed, 2 skipped (4117) exit 0; this file alone 128 passed; pnpm run
check-types exit 0; prettier --check exit 0. eslint --prune-suppressions
exits 0 and rewrites src/eslint-suppressions.json from 30,910 to 33,294 bytes
with identical parsed content and 265 records both ways - the reformat
6e43f34 had just landed - so that file is reverted and is not in this
commit.
Test-only diff: __tests__ is in EXCLUDED_PATH_SEGMENTS of
scripts/stryker-diff.mjs, so this delta adds no mutants and no production line
moves.1 parent 2a9c3d0 commit b13d8c9
1 file changed
Lines changed: 25 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
598 | 599 | | |
599 | 600 | | |
600 | 601 | | |
601 | | - | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
602 | 605 | | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
603 | 609 | | |
604 | 610 | | |
605 | 611 | | |
606 | 612 | | |
607 | 613 | | |
608 | 614 | | |
609 | | - | |
610 | | - | |
611 | | - | |
612 | | - | |
613 | | - | |
614 | | - | |
615 | | - | |
616 | | - | |
617 | | - | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
618 | 622 | | |
619 | 623 | | |
620 | 624 | | |
| |||
1240 | 1244 | | |
1241 | 1245 | | |
1242 | 1246 | | |
| 1247 | + | |
1243 | 1248 | | |
1244 | 1249 | | |
1245 | 1250 | | |
| 1251 | + | |
1246 | 1252 | | |
1247 | 1253 | | |
1248 | 1254 | | |
| |||
1260 | 1266 | | |
1261 | 1267 | | |
1262 | 1268 | | |
1263 | | - | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
1264 | 1273 | | |
1265 | 1274 | | |
1266 | 1275 | | |
| |||
2020 | 2029 | | |
2021 | 2030 | | |
2022 | 2031 | | |
| 2032 | + | |
2023 | 2033 | | |
2024 | 2034 | | |
| 2035 | + | |
2025 | 2036 | | |
2026 | 2037 | | |
2027 | 2038 | | |
| |||
2034 | 2045 | | |
2035 | 2046 | | |
2036 | 2047 | | |
2037 | | - | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
2038 | 2051 | | |
2039 | 2052 | | |
2040 | 2053 | | |
| |||
0 commit comments