* fix(query): apply bd list's piped-output limit policy to bd query (#6229)
Root cause: bd list resolves an unflagged --limit through a policy that
treats piped stdout as unlimited (GH#4094), but bd query read its --limit
flag straight through, so its default of workapi.DefaultQueryLimit (50)
applied to piped output too. `bd query '...' | consumer` silently dropped
every row past 50; the truncation hint did not fire either, because it only
prints when stderr is a terminal.
Fix: factor the unflagged tail of bd list's policy into unflaggedLimit /
resolveUnflaggedLimit in list_input.go and call it from both commands, so
they cannot drift. bd list's switch is unchanged in behavior; bd query's
change is a single localized branch in gatherQueryInput.
Precedence for bd query, mirroring bd list:
1. explicit --limit (including 0) wins
2. piped stdout -> 0 (unlimited)
3. agent mode on a terminal -> 20
4. otherwise the 50 default
bd list keeps its own --all and list.limit branches ahead of step 2; bd
query has neither (its --all means "include closed", and there is no
query.limit config key), so none was invented.
Agent-Signature: claude-code-opus-5-5-unknown-reasoning on behalf of Harry Miller
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* review: document the query path's absent defensive cap; unstale a reachability comment
Maintainer review fixes for PR #6744 (GH#6229). Both are comment-only; no
behavior changes.
issueops.QueryRequest.Limit now states that nothing backstops it. ListRequest
pairs its Limit with MaxRows, a circuit breaker for an oversized answer, and
neither knob that sets that one (--max-rows, BEADS_MAX_ROWS) is read anywhere
on the query path, so an unlimited query is unbounded in the plain sense. That
was already reachable via `--limit 0`; this PR makes a piped `bd query` reach
it without asking, which is what makes it worth writing down. Recording the
absence is the documented half of the reviewers' choice — threading a MaxRows
twin onto QueryRequest stays available as a follow-up.
unionCountsGoSideSortKeepsTheRightSubset's comment justified its case with
"DefaultQueryLimit means a limit is always set", which this PR falsified for
the CLI half: an unflagged piped `bd query '<expr>' --sort id` now arrives on
the IsGoSideSort path with Limit 0 and no bound. The HTTP surface still brings
a bound, because an absent `limit` parameter resolves to DefaultQueryLimit, so
the clause is requalified rather than dropped. The assertions were never
affected — they pass an explicit Limit: 5.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>