"token deadline bounds fetch that ignores abort" rewrote every 15000ms
timer to 20ms. The credential read and the token exchange each arm their
own 15000ms deadline through bounded(), so the read's deadline was cut to
20ms too. When the read took longer than that on a loaded machine, it
timed out with the same "token acquisition timed out" message before
fetch was ever called, and `upstream.aborted` threw on undefined.
The test now keeps both timers at 15000ms, records each deadline's
callback, and fires the exchange's (the second) from inside the fake
fetch. It checks that two deadlines were armed and that fetch was entered
before it checks the abort. The source is unchanged: a separate 15s bound
on the read is intended.
Run (wsl-run, magpie-desktop, Bun 1.4.2, HOME=$(mktemp -d)):
- bun test packages/sap-aicore: 343 pass, 0 fail.
- bun scripts/check.mjs: exit 0.
Injected by hand:
- A 50ms wait at the start of readCredentials' operation. The old test
failed with "TypeError: undefined is not an object (evaluating
'upstream.aborted')" at 28ms, the issue's case. The new test passes
with the same wait.
- The exchange run without bounded() (no deadline). The new test fails.
Not tried: the full root bun test run under load where it first failed.