Refuse a non-finite number where a text field coerces one #18

Merged
lilleman merged 9 commits from worktree-non-finite-text into main 2026-09-21 10:46:52 +02:00
3 changed files with 3 additions and 3 deletions
Showing only changes of commit 0620d205d6 - Show all commits
+1 -1
View File
@@ -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`. */
export function valueText(value: unknown): string {
export function valueText(value: ParamValue): string {
return typeof value === 'number' ? String(value) : JSON.stringify(value);
}
-1
View File
@@ -42,7 +42,6 @@ describe('integers', () => {
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.match(notANumber.err.message, /NaN/);
});
+2 -1
View File
@@ -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
`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.
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
`outgoing-requests.ts` runs `misuse()` and the abort check before the wait, precisely so a call