Title: 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 · Issue #2009 · developing-today/code · GitHub
Open Graph Title: 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 · Issue #2009 · developing-today/code
X Title: 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 · Issue #2009 · developing-today/code
Description: Problem In the id REPL, a non-numeric value after --first / --last (and after --lines in peek) is silently reinterpreted as a search query, and the limit silently falls back to 1 (or, for --lines, to the default 5). No error or warning i...
Open Graph Description: Problem In the id REPL, a non-numeric value after --first / --last (and after --lines in peek) is silently reinterpreted as a search query, and the limit silently falls back to 1 (or, for --lines, ...
X Description: Problem In the id REPL, a non-numeric value after --first / --last (and after --lines in peek) is silently reinterpreted as a search query, and the limit silently falls back to 1 (or, for --lines, ...
Opengraph URL: https://github.com/developing-today/code/issues/2009
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"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","articleBody":"## Problem\n\nIn the `id` REPL, a non-numeric value after `--first` / `--last` (and after `--lines` in `peek`) is silently reinterpreted as a search query, and the limit silently falls back to 1 (or, for `--lines`, to the default 5). No error or warning is printed anywhere — the parsers return only a struct.\n\n- `pkgs/id/src/repl/runner.rs:675-700` — `parse_find_args` (used by REPL `find`, `search`, and `show`): when the token after `--first`/`--last` does not start with `-` and fails `parse::\u003cusize>()`, the branch sets `first`/`last = Some(1)` (\"default to 1\") but does **not** consume the token (`i += 1` happens only on parse success). The loop then reaches that same token, it does not start with `-`, and the final branch pushes it into `args.queries`.\n- `pkgs/id/src/repl/runner.rs:1190-1213` — `parse_peek_args` repeats the identical `--first`/`--last` shape, with the same fall-through into `find_args.queries`.\n- `pkgs/id/src/repl/runner.rs:1216-1223` — `parse_peek_args`' `--lines`/`-n` branch is worse in one way: on parse failure it sets nothing and consumes nothing, so the bad token again becomes a query and `lines` silently stays at the default 5.\n\n## Verified this run (2026-10-28, main `d069a613`)\n\nProbe compiled and run on the laptop (`~/git/fleet/probe-2026-10-28-laneA-replfirst/` there; the `--first`/`--last`/query branches and loop increment copied verbatim from `parse_find_args`):\n\n- Control `[\"report\", \"--first\", \"5\"]` → `queries=[\"report\"] first=Some(5)` ✓\n- Control `[\"report\", \"--first\"]` → `queries=[\"report\"] first=Some(1)` ✓ (documented bare-flag default)\n- `[\"report\", \"--first\", \"two\"]` → `queries=[\"report\", \"two\"] first=Some(1)` — the typo became a second search term **and** the result set was narrowed to 1\n- `[\"report\", \"--last\", \"abc\"]` → `queries=[\"report\", \"abc\"] last=Some(1)`\n- `[\"--first\", \"two\", \"report\"]` → `queries=[\"two\", \"report\"] first=Some(1)`\n\nSo `find report --first two` does not fail, does not warn, and does not search what the user asked: it searches for `report` AND `two`, truncated to the first match (`apply_search_options`, runner.rs:987-1013, applies the limit after collecting matches for all queries).\n\n## Why it matters\n\nA one-character-class typo in an interactive session silently changes *which blobs are searched for* and *how many come back* — the same silent-reinterpretation class as #1999 (selection prompt dropping unparseable numbers), one parser earlier. The REPL is the surface where users type these flags by hand, so typos are the common case, not an edge case.\n\n## Acceptance criteria\n\n- [ ] A non-numeric token following `--first`/`--last` in `parse_find_args` and `parse_peek_args`, or following `--lines`/`-n` in `parse_peek_args`, is never added to `queries` and never silently defaults the limit: the command reports the bad value (usage/error line naming the flag and the token) and runs no search, OR the triage-pinned contract is documented in the help text and implemented identically in both parsers.\n- [ ] The bare-flag form (`--first` with no following token, or followed by another flag) keeps its documented default of 1.\n- [ ] Regression tests in `runner.rs` cover at least: `[\"q\", \"--first\", \"two\"]`, `[\"q\", \"--last\", \"abc\"]`, and peek `[\"q\", \"--lines\", \"abc\"]` — asserting the bad token is not in `queries` and the failure is surfaced; existing parser tests (runner.rs:1540+) still pass.\n- [ ] Both parser copies behave identically (find/search/show and peek), so the fix is not applied to only one copy.\n\nFiled by new-issue-creator-code-a. Related: #1999 (same REPL, same silent-parse class, different site).\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-29T00:15:31Z","url":"https://github.com/developing-today/code/issues/2009"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2fbd3142-3ec7-ed9f-95ec-1a8176270146 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8866:74E58:A5812C:DDEA7F:6B0641CC |
| html-safe-nonce | 9bab0265d12f1c66acd1fe920f52ac1d0f9f5fc991f0bfa4d34b7f749892b956 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODY2Ojc0RTU4OkE1ODEyQzpEREVBN0Y6NkIwNjQxQ0MiLCJ2aXNpdG9yX2lkIjoiNTc5ODEzNjk1MTUzMDIwOTc0MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6bdede61741373c706a20ccebd6225e6f761fc97968ca367540c527a85688719 |
| hovercard-subject-tag | issue:6089975598 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/2009/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ba1701b129418007c59c34673fcbc2b1f6a2fde8f02705e3a32e5de8f713c0e6/developing-today/code/issues/2009 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ba1701b129418007c59c34673fcbc2b1f6a2fde8f02705e3a32e5de8f713c0e6/developing-today/code/issues/2009 |
| og:image:alt | Problem In the id REPL, a non-numeric value after --first / --last (and after --lines in peek) is silently reinterpreted as a search query, and the limit silently falls back to 1 (or, for --lines, ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1bff4f6bfaa96dc9c42cacf315424c24ebb548b06142ced5e3aaccb2a42dd652 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ac613d3698d3d8565651455086e1f74da07bf277 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width