Refuse a non-finite number where a text field coerces one #18
+1
-1
@@ -39,7 +39,7 @@ export function paramNumber(value: ParamValue | undefined, fallback: number): nu
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Spells a refused value for the caller who wrote it; JSON spells NaN and the infinities `null`. */
|
/** Spells a refused value for the caller who wrote it; JSON spells NaN and the infinities `null`. */
|
||||||
export function valueText(value: unknown): string {
|
export function valueText(value: ParamValue): string {
|
||||||
return typeof value === 'number' ? String(value) : JSON.stringify(value);
|
return typeof value === 'number' ? String(value) : JSON.stringify(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ describe('integers', () => {
|
|||||||
|
|
||||||
const notANumber = types.int8.write(NaN, Buffer.alloc(1), 0);
|
const notANumber = types.int8.write(NaN, Buffer.alloc(1), 0);
|
||||||
|
|
||||||
// JSON spells NaN and the infinities `null`, which is a value the caller never wrote.
|
|
||||||
assert.ok(notANumber.err instanceof Error);
|
assert.ok(notANumber.err instanceof Error);
|
||||||
assert.match(notANumber.err.message, /NaN/);
|
assert.match(notANumber.err.message, /NaN/);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -419,7 +419,8 @@ and is also what the panel ranked hardest — two methods, one answer.
|
|||||||
`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. `namedValue()`'s four sites — `messagingMode`, `encoding`, the time
|
`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
|
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.
|
as `true`. One fix closes all three, and `valueText()` in `defs/types.ts` is the quoted
|
||||||
|
spelling to take it from. 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
|
||||||
|
|||||||
Reference in New Issue
Block a user