Bound the wait in the default test, and pin the boolean a refusal prints
Mirror / push (push) Successful in 4s
Test / lint (pull_request) Successful in 21s
Test / test (18) (pull_request) Failing after 18s
Test / test (20) (pull_request) Successful in 22s
Test / test (22) (pull_request) Successful in 19s
Test / test (24) (pull_request) Successful in 19s
Test / test (26) (pull_request) Successful in 19s

This commit is contained in:
2026-09-20 20:46:45 +02:00
parent a24f350b7a
commit 45171c2697
3 changed files with 7 additions and 10 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ export function errorFrom(reason: unknown): Error {
const printable: readonly string[] = ['boolean', 'number', 'string']; const printable: readonly string[] = ['boolean', 'number', 'string'];
/** String() throws on a null-prototype object or a symbol, so those are named by type instead. */ /** String() throws on a null-prototype object, so anything but these is named by its type. */
export function namedValue(value: unknown): string { export function namedValue(value: unknown): string {
return printable.includes(typeof value) ? String(value) : typeof value; return printable.includes(typeof value) ? String(value) : typeof value;
} }
+3 -8
View File
@@ -1055,19 +1055,13 @@ describe('connectTimeout', () => {
assert.equal(settled.session, undefined); assert.equal(settled.session, undefined);
}); });
// The fallback is what every call that names no timeout gets, and localhost settles too fast to see it.
test('bounds a connect nobody asked to bound, at the default', async t => { test('bounds a connect nobody asked to bound, at the default', async t => {
const { accepted, port } = await stalledListener(t); const { port } = await stalledListener(t);
t.mock.timers.enable({ apis: ['setTimeout'] }); t.mock.timers.enable({ apis: ['setTimeout'] });
const connecting = client({ host: '127.0.0.1', port, reconnect: false, tls: true }); const connecting = client({ host: '127.0.0.1', port, reconnect: false, tls: true });
while (accepted.length === 0) {
await new Promise(resolve => setImmediate(resolve));
}
await new Promise(resolve => setImmediate(resolve));
t.mock.timers.tick(10_000); t.mock.timers.tick(10_000);
t.mock.timers.reset(); t.mock.timers.reset();
@@ -1123,9 +1117,10 @@ describe('connectTimeout', () => {
/got "5000"/, /got "5000"/,
'an env var read without Number() is the commonest untyped value, and it is a correct number', 'an env var read without Number() is the commonest untyped value, and it is a correct number',
); );
assert.match(checkSessionOptions({ connectTimeout: true }).err?.message ?? '', /got true/);
assert.match( assert.match(
checkSessionOptions({ connectTimeout: 2_147_483_648 }).err?.message ?? '', checkSessionOptions({ connectTimeout: 2_147_483_648 }).err?.message ?? '',
/2147483647 ms or less/, /2147483647 ms or less \(about 24 days\), got 2147483648; false waits the OS out instead/,
'a delay Node cannot hold in 32 bits fires after 1 ms, the inverse of what it asked for', 'a delay Node cannot hold in 32 bits fires after 1 ms, the inverse of what it asked for',
); );
assert.equal(checkSessionOptions({ connectTimeout: 2_147_483_647 }).err, undefined); assert.equal(checkSessionOptions({ connectTimeout: 2_147_483_647 }).err, undefined);
+3 -1
View File
@@ -192,7 +192,9 @@ the rewrite, for a dependency added later. Maintainer's call, 2026-09-14.
of what it asked for, explained only by a warning on stderr. `connectTimeout` refuses one of what it asked for, explained only by a warning on stderr. `connectTimeout` refuses one
already, which is the asymmetry to close. The same four print an untyped value bare, so already, which is the asymmetry to close. The same four print an untyped value bare, so
`idleTimeout: '5000'` is refused with `got 5000` — a value the reader reads as correct — where `idleTimeout: '5000'` is refused with `got 5000` — a value the reader reads as correct — where
`connectTimeout` quotes it. Raised by review, 2026-09-20. `connectTimeout` quotes it. `namedValue()`'s four sites — `messagingMode`, `encoding`, the time
options and `smsIdFormat` — are the same defect once more: there `true` and `'true'` both print
as `true`. One fix closes all three. Raised by review, 2026-09-20.
- [ ] **A send the codec will refuse waits for a link and a window slot first.** `refuse()` in - [ ] **A send the codec will refuse waits for a link and a window slot first.** `refuse()` in
`outgoing-requests.ts` runs `misuse()` and the abort check before the wait, precisely so a call `outgoing-requests.ts` runs `misuse()` and the abort check before the wait, precisely so a call