Repository navigation
Description
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_argshandles>fileatpkgs/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_commandwrites the preview to a file whenargs.output_fileis set (runner.rs:991) — but today only-o/--outputcan 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
-
peek q --first >out.txtandpeek q --last >out.txtparse like find: limit defaults to 1 and the redirect is honored (no integer error). -
peek q >out.txtsetsoutput_file=Some("out.txt")(and the handler writes the preview there) instead of adding>out.txtto the query list. -
peek q --lines >out.txtno longer fails with an integer error (triage pins: redirect honored with default lines, consistent with--first/--last). - Non-numeric operands still error (
peek q --first abckeeps the fix(id/repl): reject nonnumeric result limits #4072 message); bare>handling matches whatever id(repl): find/search/show/peek parsers silently swallow unknown and mistyped flags — a typo'd flag vanishes and its value becomes a query #2274 pins for find. - Regression tests in
runner.rscover all three>positions for peek plus the find-parity cases; existing parser tests pass.
Filed by new-issue-creator-code-a, verified this run.
Activity
dezren39 commentedon Nov 2, 2026
🤖 Agent note · filed
new-issue-creator-code-a)peeknever learned the>fileredirect:parse_peek_args(pkgs/id/src/repl/runner.rs:1244) has no>branch (find's is at :684) and its--first(:1273) /--last(:1284) /--lines(:1300) branches lack the>operand exclusion the fix(id/repl): reject nonnumeric result limits #4072 fix added toparse_find_args(:715/:731), sopeek q --first >out.txthard-errors--first requires an integer (got ">out.txt")andpeek q >out.txtsilently searches for a blob named>out.txt, even thoughhandle_peek_commandalready honorsoutput_file(:991). Verified this run on the laptop with the verbatim parsers from main fddd4ad (runner.rs md5 7de48728480a2975a55ebbfad09bd428): find controls redirect with default limit 1; peek controls (--first 2,-o) pass; all three peek>forms fail or misparse as tabled in the issue.>handling in parse_peek_args (operand exclusion + redirect branch), keep the fix(id/repl): reject nonnumeric result limits #4072 non-numeric rejection, regression tests for all three>positions; existing parser tests pass.~/git/fleet/probe-2026-11-01-laneA-peekredirect/(laptop); queue packet enqueued this run (repo-health-code-pilot). Related: id(repl): a non-numeric --first/--last/--lines value silently becomes a search query — 'find report --first two' searches for 'two' too, truncated to 1 #2009/fix(id/repl): reject nonnumeric result limits #4072 (the fix that created the asymmetry), id(repl): find/search/show/peek parsers silently swallow unknown and mistyped flags — a typo'd flag vanishes and its value becomes a query #2274 (unknown-flag swallowing — distinct, noted in the issue).dezren39 commentedon Nov 2, 2026
agent-note:v1 — state: picked-up at=2026-11-02T03:43:40Z (OpenChamber scheduled lane)
4 remaining items
dezren39 commentedon Nov 2, 2026
agent-note:v1 — state: done at=2026-11-02T03:47:59Z (OpenChamber scheduled lane)
dezren39 commentedon Nov 2, 2026
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.
Merge pull request #4164 from developing-today/queue/6060-4161-peek-r…
dezren39 commentedon Nov 2, 2026
agent-note:v1 — task 6060 done
PR #4164 merged (f2006aa): parse_peek_args now mirrors parse_find_args for the
>fileredirect — 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.