Repository navigation
Description
Problem
id web — Go to Line (Ctrl+G) still silently reinterprets non-decimal input as a line number, the #832 residual pattern in the #712 strict validation.
pkgs/id/web/src/goto-line.ts:114 (main 12b7ec8a):
const raw = (dialogInput?.value ?? "").trim();
const line = Number(raw);
...
activeView && raw !== "" && Number.isInteger(line) && line >= 1 && line <= lineCountNumber() accepts forms that are not decimal line numbers, and Number.isInteger does not exclude them. The #712 fix rejected 0, negatives, fractions (2.9) and out-of-range values, but left every other Number() spelling:
| Input | Number() |
Result today |
|---|---|---|
0x10 |
16 | jumps to line 16, dialog closes |
1e2 |
100 | jumps to line 100, dialog closes |
0b11 |
3 | jumps to line 3, dialog closes |
2.0 |
2 | jumps to line 2, dialog closes |
The user typed none of those line numbers in decimal; the jump is plausible-looking and silent — the same failure class #707/#832 fixed in parseWorldSeed by requiring a run of decimal digits (/^\d+$/) before Number().
Evidence (verified this run)
Probe on the laptop (~/git/fleet/probe-2026-10-30-laneA-gotoline/): a copy of the real pkgs/id/web/src tree (goto-line.ts md5 aae213d1b5004353f65638dd795260b6, identical to main) with a vitest/happy-dom harness modelled on goto-line.test.ts, driving the real dialog over a 120-line code block (line k starts at doc pos 1 + (k-1)*3):
0x10→ selection pos 46 (= line 16), dialog closed1e2→ selection pos 298 (= line 100), dialog closed0b11→ selection pos 7 (= line 3), dialog closed2.0→ selection pos 4 (= line 2), dialog closed- control
10→ pos 28 (= line 10), correct - control
2.9→ no move, dialog stays open (the id(web): Go to Line accepts 0/negatives as line 1, truncates fractions, and silently closes on out-of-range lines #712 behaviour, correct)
All 6 probe tests passed, confirming the reinterpretation in current code. Dedup: #712 (closed) covered 0/negatives/fractions/out-of-range only; #832 (closed) fixed the same Number() residual in parseWorldSeed, not here. No open issue covers goto-line input spelling.
Why it matters
Go to Line is a navigation trust surface: a mistyped or pasted value (2.0 from a spreadsheet, 0x10, 1e2) lands the cursor on a wrong line with no feedback, instead of keeping the dialog open with the text selected so the user can correct it — the exact contract #712 established.
Acceptance criteria
- Only an optional-whitespace-wrapped run of decimal digits is accepted as a line number (the
parseWorldSeedrule inworld-seed.ts);0x10,1e2,0b11,2.0,+2and any other non-digit spelling keep the dialog open with the input selected and do not move the cursor. - Plain decimal input (including leading zeros, e.g.
007) still jumps to the named line; the existing id(web): Go to Line accepts 0/negatives as line 1, truncates fractions, and silently closes on out-of-range lines #712 rejections (0, negatives, fractions, out-of-range, empty) still hold. - New cases are added to
goto-line.test.ts's invalid-input table using spellings that reinterpret to an in-range line on the 3-line fixture (e.g.0x2,0b10,2.0), so the tests would fail on the old code — out-of-range spellings alone cannot distinguish acceptance from rejection.
Activity
dezren39 commentedon Oct 30, 2026
🤖 Agent note · picked up
dezren39 commentedon Oct 30, 2026
🤖 Agent note · handed off
style(id/web): use Number.NaN in goto-line validation (#2776)
Merge pull request #2777 from developing-today/creator-a/2776-gotolin…
dezren39 commentedon Oct 30, 2026
🤖 Agent note · done