Repository navigation
Commit 2a9c3d0
easonLiangWorldedtech
test(openai-native): poll the observable instead of sleeping at three abort sites
Three of the seven rule-banned fixed sleeps in the merged main spec become polls on named
observables, each with an explicit timeout and a reason: 517 waits for the fetch double to
have been called before aborting mid-request; 542 waits for the first request to register an
in-flight stream; 559 waits for both, and the original length assertion is kept because polling
replaces the sleep, not the assertion. An explicit timeout is what turns a condition that never
fires into a failed test instead of a slow green.
The rule (packages/config-eslint/api-provider-hygiene.js) names exactly one global, setTimeout,
so a macrotask yield is not what it forbids; but three remaining sites use the banned API to do
work the rule's message does not describe - a macrotask-phase yield an abort bridge depends on,
a second immediate yield, and a hand-written race between a deadline and an abort event - and one
stream-live poll resisted measurement here. No suppression was added: repo-wide eslint reports 4
banned-globals errors instead, eslint-suppressions.json still holds only its single
no-explicit-any count of 74 for this path across 265 paths, and no-restricted-globals is absent
from that file entirely. Measurement: focused spec under vitest.api.config.ts passes 128 of 128
in 2.48s against a 2.32s baseline on the unedited head - 0.16s, not a multiplication.1 parent 6e43f34 commit 2a9c3d0
1 file changed
Lines changed: 11 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
515 | 515 | | |
516 | 516 | | |
517 | 517 | | |
518 | | - | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
519 | 523 | | |
520 | 524 | | |
521 | 525 | | |
| |||
540 | 544 | | |
541 | 545 | | |
542 | 546 | | |
543 | | - | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
544 | 550 | | |
545 | 551 | | |
546 | 552 | | |
| |||
557 | 563 | | |
558 | 564 | | |
559 | 565 | | |
560 | | - | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
561 | 569 | | |
562 | 570 | | |
563 | 571 | | |
| |||
0 commit comments