Skip to content

id(repl): peek never learned the >file redirect — --first/--last/--lines >out.txt hard-error as 'requires an integer' and a trailing >out.txt becomes a search query #4161

Closed

Description

@dezren39

Problem

The REPL peek parser never learned the >file redirection that find/search/show support, and the #4072 fix (merged in c8a2191, closing #2009) widened the gap: it taught parse_find_args to exclude a > token from the optional numeric operand of --first/--last, but the same change converted parse_peek_args to hard integer errors without the exclusion — and parse_peek_args has no > branch at all.

Evidence on main fddd4ad6:

  • parse_find_args handles >file at pkgs/id/src/repl/runner.rs:684-686 (strip_prefix('>') → output_file + to_file) and excludes > operands at :715 / :731.
  • parse_peek_args (runner.rs:1244) has no > branch; its --first (:1273), --last (:1284), and --lines/-n (:1300) branches accept any next token not starting with - as the numeric operand.
  • The peek handler already honors output_file — handle_peek_command writes the preview to a file when args.output_file is set (runner.rs:991) — but today only -o/--output can set it for peek.

Verified behavior (laptop probe, verbatim parsers from main fddd4ad, runner.rs md5 7de48728480a2975a55ebbfad09bd428; probe ~/git/fleet/probe-2026-11-01-laneA-peekredirect/)

Input Result
find q --first >out.txt Ok — first=Some(1), output_file=Some("out.txt"), to_file=true
find q --last >out.txt Ok — last=Some(1), output_file=Some("out.txt")
peek q --first 2 (control) Ok — first=Some(2)
peek q -o preview.txt (control) Ok — output_file=Some("preview.txt")
peek q --first >out.txt Err --first requires an integer (got ">out.txt")
peek q --last >out.txt Err --last requires an integer (got ">out.txt")
peek q --lines >out.txt Err --lines requires an integer (got ">out.txt")
peek q >out.txt Ok but wrong — queries=["q", ">out.txt"], output_file=None: the redirect token becomes a search query
peek q --first abc (control) Err --first requires an integer (got "abc") — the #4072 rejection itself works

Why it matters

find and peek are sibling REPL commands sharing FindArgs, limits, and output plumbing; a user who learns find q --first >out.txt reasonably expects peek q --first >out.txt to preview the first match into the file. Instead peek hard-errors with a message that blames the user's "integer", or — worse, with the redirect in final position — silently searches for a blob literally named >out.txt and reports no matches. The error message is actively misleading: >out.txt is not a malformed integer, it is a token peek's parser doesn't know.

Distinct from #2274 (unknown/mistyped --flags silently swallowed, value-flags missing values, and the bare > empty-target case in parse_find_args): this issue is peek's missing > handling and the asymmetric operand exclusion left by the #4072 fix. If triage judges the >out.txt-as-query half belongs to #2274, the --first/--last/--lines hard-error half still stands alone as a #4072 residual.

Acceptance criteria

Filed by new-issue-creator-code-a, verified this run.

Activity

  1. added
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/lowNice to have; do when convenient
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    effort/xsTrivial: expected under 30 minutes of work
    on Nov 2, 2026
  2. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  3. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    agent-note:v1 — state: picked-up at=2026-11-02T03:43:40Z (OpenChamber scheduled lane)

  4. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 2, 2026
  5. 4 remaining items

  6. added
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 2, 2026
  7. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    agent-note:v1 — state: done at=2026-11-02T03:47:59Z (OpenChamber scheduled lane)

  8. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 2, 2026
  9. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    agent-note:v1 — task 6060 picked up

    Lane E claimed task 6060 (small_fix for #4161: peek >file redirect parity with find). Revalidated fresh: #4161 OPEN, no held/user-owned/do-not-* labels, no competing open PR. Implementing on the laptop in a fleet worktree, branch queue/6060-4161-peek-redirect.

  10. added a commit that references this issue on Nov 2, 2026
  11. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    agent-note:v1 — task 6060 done

    PR #4164 merged (f2006aa): parse_peek_args now mirrors parse_find_args for the >file redirect — the redirect token is excluded from --first/--last/--lines numeric values (defaults kept), sets output_file, and never lands in queries; the existing peek handler writes the preview to that file.

    Verification on the laptop worktree: new test_parse_peek_args_with_output_file_redirect passes; all 10 test_parse_peek tests pass; the full test_parse_ set passes 81/81. Codex review on PR #4164 completed with no findings. GitHub Actions checks were still queued in the Actions backlog at merge time; merged under Drew's standing merge authority with laptop verification.

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

Metadata

Metadata

Assignees

No one assigned

    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