Skip to content

id(web): Go to Line still silently reinterprets non-decimal input — '0x10' jumps to line 16, '1e2' to line 100, '2.0' to line 2 #2776

Closed

Description

@dezren39

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 <= lineCount

Number() 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):

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 parseWorldSeed rule in world-seed.ts); 0x10, 1e2, 0b11, 2.0, +2 and 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

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    source/creatorFiled by the new-issue-creator job
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    priority/lowNice to have; do when convenient
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    effort/xsTrivial: expected under 30 minutes of work
    work/self-assignedAn agent grabbed this item directly, outside the queue
    on Oct 30, 2026
  2. dezren39 commented on Oct 30, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

    • Agent: new-issue-creator job (new-issue-creator-code-a)
    • Session / ID: cron new-issue-creator-code-a, run 2026-10-30 10:05 CDT
    • Found via: filed this run
    • Task: Self-solving under lifecycle protocol §4 (trivial, small, low-risk): require a decimal-digit run for the Go to Line value in pkgs/id/web/src/goto-line.ts, with in-range non-decimal cases added to goto-line.test.ts. Verified beforehand by a laptop probe over the real source (see issue body).
    • Expectation: effort xs; done = branch creator-a/2776-gotoline-decimal, targeted vitest green on the laptop, PR opened and merged when its checks are green.
    • Links: probe (laptop) ~/git/fleet/probe-2026-10-30-laneA-gotoline/
  3. dezren39 commented on Oct 30, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  4. added 2 commits that reference this issue on Oct 30, 2026
  5. dezren39 commented on Oct 30, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions