Skip to content

id(repl): find selection prompt silently drops unparseable numbers — a typo changes which blobs are fetched, and duplicates fetch twice #1999

Closed

Description

@dezren39

Summary

In the id REPL, the interactive find selection prompt (pkgs/id/src/repl/runner.rs:1110-1117) parses the typed selection with filter_map(|s| s.trim().parse::<usize>().ok()). Any token that fails to parse is silently dropped, and the command then acts on the remaining numbers as if the user had typed exactly those. A typo therefore does not stop the operation — it changes which blobs are fetched/printed/written, with no warning. Duplicate numbers are also kept, so the same blob is fetched and output once per duplicate.

The "invalid selection" message at :1118-1121 only fires when every token was dropped, which is exactly the harmless case. The harmful case — a mostly-valid line with one bad token — proceeds silently.

Evidence (verified this run)

Verbatim extraction of the :1110-1117 snippet (standalone rustc probe on the laptop, ~/git/fleet/probe-2026-10-28-laneB-replselect/, against main 6a284efd, 5 matches):

Input Parsed selections Effect
1 3 5 (control) [1, 3, 5] as typed
1 x 3 [1, 3] x silently dropped; blobs 1 and 3 fetched
1,three,2 [1, 2] three silently dropped
2.9 4 [4] 2.9 silently dropped (user plausibly meant item 2 or 29)
99999999999999999999999 2 [2] overflowing token silently dropped
1 1 [1, 1] duplicate kept: the output loops at :1129/:1140/:1148 fetch and emit blob 1 twice (in --dir mode it is fetched twice and printed to stdout twice)
x (control) [] "invalid selection" — the only case that is reported

Downstream, each surviving number is dereferenced as filtered_matches[n - 1] and passed to ctx.get(...) in all three output modes (:1129-1155), so a silently-altered selection set is a silently-altered set of file writes / stdout dumps.

This is the same bare-parse pattern the codebase has been removing elsewhere — strict, all-or-nothing validation with the dialog kept open on bad input in the web go-to-line control (#712), strict seed parsing (#707/#832), strict port parsing in bin/proxy-port.mjs. The REPL prompt is the remaining silent-drop site in this interaction class.

Why it matters

The selection prompt is the safety step between a search and bulk retrieval: the user confirms which matches to fetch precisely because acting on the wrong set is wasteful and, in --dir/file modes, writes files the user did not ask for. A parser that silently edits the confirmed set defeats that step — find with a fumbled keystroke retrieves a different set of blobs than the user confirmed, and duplicates repeat work and output.

Acceptance criteria

  • Any non-empty token in the selection line that is not a valid in-range number makes the whole selection invalid: print "invalid selection" (or equivalent) and perform no fetches/output — no partial action on the surviving tokens.
  • Duplicate numbers are either rejected the same way or deduplicated before acting; a blob is never fetched/output twice for one prompt answer. (Triage pins which.)
  • Valid forms keep working unchanged: 1 3 5, 1,2,3, mixed separators, surrounding whitespace, Enter to cancel.
  • The parse is extracted or otherwise unit-testable, with tests covering: control valid line, one bad token among valid ones, a fractional token, an overflowing token, duplicates, and all-invalid input.
  • Existing REPL/find tests pass.

Found by new-issue-creator lane B, 2026-10-28 run. Dedup: gh search issues for "repl find selection", "selection prompt", "select numbers invalid selection" (open + closed) returned no matching issue.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    source/creatorFiled by the new-issue-creator job
    priority/lowNice to have; do when convenient
    on Oct 28, 2026
  2. developing-today commented on Oct 28, 2026

    @developing-today
    Contributor
  3. added
    queue/queuedHas a queued task in the Supabase agent queue
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    effort/xsTrivial: expected under 30 minutes of work
    on Oct 28, 2026
  4. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator lane B (new-issue-creator-code-b)
    • Session / ID: cron new-issue-creator-code-b run 2026-10-28 17:55 CDT
    • Found via: filed this run
    • Task: Triage the REPL find selection prompt's silent token drop (repl/runner.rs:1110-1117) — pin strict all-or-nothing validation and duplicate handling, with tests.
    • Expectation: effort/xs — done when any bad token invalidates the whole selection with no partial fetches, and valid forms (space/comma lists, Enter to cancel) are unchanged.
    • Links: probe ~/git/fleet/probe-2026-10-28-laneB-replselect/ (laptop, verbatim snippet, main 6a284ef)
  5. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 1, 2026
  6. 30 remaining items

  7. added
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedQueue worker lifecycle state
    on Nov 1, 2026
  8. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked

    • Agent: repo-worker-code (lane E shift)
    • Session / ID: queue task 5060, lane E
    • Found via: repo-health-code-pilot
    • Task: PR fix(id): strict all-or-nothing find selection parse (#1999) #3356 verified on fresh state: canonical task PR, Codex review clean on head 13bb3a5, diff matches every acceptance item (strict all-or-nothing parse_selection, dedup order-preserved, 5 tests covering control/bad-token/fractional/overflow/duplicates/all-invalid).
    • Blocker: No Actions check runs exist for this head (id workflow infra stall), and the laptop targeted-test compile (isolated CARGO_TARGET_DIR=~/git/fleet/target-5060, partial build retained) did not finish within 1700s under fleet-wide compile contention (laptop load ~103, ~111 rustc processes). No test failure on the merits — verification simply incomplete, so no merge yet.
    • Resume: Rerun cargo test --lib parse_selection in ~/git/fleet/5060/pkgs/id with the isolated target dir; if green, merge PR fix(id): strict all-or-nothing find selection parse (#1999) #3356, close this issue, complete task 5060 as fixed_merged.
  9. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 1, 2026
  10. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up (resume)

  11. added a commit that references this issue on Nov 1, 2026
  12. dezren39 commented on Nov 1, 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 jobstatus:donetask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions