Skip to content

fix(list): emit informative truncation hint in all output modes (GH#3212)#3243

Merged
maphew merged 3 commits into
gastownhall:mainfrom
maphew:fix/3212-list-truncation-hint
Apr 13, 2026
Merged

fix(list): emit informative truncation hint in all output modes (GH#3212)#3243
maphew merged 3 commits into
gastownhall:mainfrom
maphew:fix/3212-list-truncation-hint

Conversation

@maphew

@maphew maphew commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fetch effectiveLimit+1 rows so we can distinguish "exactly N matches" from "N+ matches truncated" without a second count query
  • Emit a clearer truncation hint to stderr across all output modes, including --json, --format, pretty/tree, and agent mode — closing the silent-data-loss gap called out in GH#3212

Motivation

bd list defaults to --limit 50 and previously:

  • Only hinted at truncation when len(issues) == limit, which false-positives when exactly N issues match
  • Never hinted at all in --json mode, so agents consuming JSON couldn't tell a truncated view from a complete one

New hint:

Showing 50 issues; more results matched but were hidden by --limit. Use --limit 0 for all, or --limit N to raise the cap.

Closes #3212.

Test plan

  • make build
  • go test -tags gms_pure_go ./cmd/bd/ -run TestList passes
  • Smoke: 60 issues created, bd list shows hint; bd list --json shows hint on stderr; --limit 100, --limit 0, and exact-count runs emit no hint (no false positives)

🤖 Generated with Claude Code

@codecov-commenter

codecov-commenter commented Apr 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 23 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
cmd/bd/list.go 0.00% 19 Missing ⚠️
cmd/bd/list_output.go 0.00% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

maphew and others added 3 commits April 13, 2026 12:47
…#3212)

bd list silently truncated at --limit (default 50) with no reliable signal
that results were hidden. The existing hint fired when len==limit, which
both gave false positives (exact match count) and no warning for JSON
consumers.

Fetch one extra row (effectiveLimit+1) to detect truncation accurately,
then emit a clearer one-line hint to stderr in all output modes —
including --json, --format, pretty/tree, and agent mode — so downstream
agents and scripts don't mistake a partial view for a complete one.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
TestEmbeddedList/limit used CombinedOutput() to parse JSON, so it choked
on the new stderr hint landing after the JSON array. Split stdout/stderr
in bdListJSON, add bdListCapture helper, and add a limit_truncation_hint
subtest covering GH#3212:
- hint appears on stderr when --limit truncates
- hint never leaks into stdout (JSON consumers)
- no hint with --limit 0 or when results fit under the cap

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The truncation-detection change fetches effectiveLimit+1 rows, but the
watch loop re-ran SearchIssues with the bumped filter and never trimmed,
so every refresh rendered one extra issue (e.g. 21 rows under --limit 20).

Pass effectiveLimit to watchIssues and trim both the initial render and
each refresh; also surface the truncation hint in watch mode so persistent
watchers don't quietly show a partial view.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@maphew maphew force-pushed the fix/3212-list-truncation-hint branch from 5e1903f to d2d2b5e Compare April 13, 2026 19:48
@maphew maphew merged commit 7ada790 into gastownhall:main Apr 13, 2026
37 checks passed
@maphew maphew deleted the fix/3212-list-truncation-hint branch April 13, 2026 20:10
mzlee pushed a commit to mzlee/beads that referenced this pull request Apr 22, 2026
…212) (gastownhall#3243)

* fix(list): show informative truncation hint and emit in JSON mode (GH#3212)

bd list silently truncated at --limit (default 50) with no reliable signal
that results were hidden. The existing hint fired when len==limit, which
both gave false positives (exact match count) and no warning for JSON
consumers.

Fetch one extra row (effectiveLimit+1) to detect truncation accurately,
then emit a clearer one-line hint to stderr in all output modes —
including --json, --format, pretty/tree, and agent mode — so downstream
agents and scripts don't mistake a partial view for a complete one.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test(list): capture stdout/stderr separately; cover truncation hint

TestEmbeddedList/limit used CombinedOutput() to parse JSON, so it choked
on the new stderr hint landing after the JSON array. Split stdout/stderr
in bdListJSON, add bdListCapture helper, and add a limit_truncation_hint
subtest covering GH#3212:
- hint appears on stderr when --limit truncates
- hint never leaks into stdout (JSON consumers)
- no hint with --limit 0 or when results fit under the cap

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(list): trim +1 overflow row in --watch mode (review feedback)

The truncation-detection change fetches effectiveLimit+1 rows, but the
watch loop re-ran SearchIssues with the bumped filter and never trimmed,
so every refresh rendered one extra issue (e.g. 21 rows under --limit 20).

Pass effectiveLimit to watchIssues and trim both the initial render and
each refresh; also surface the truncation hint in watch mode so persistent
watchers don't quietly show a partial view.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bd list: default --limit 50 silently truncates output with no indicator

2 participants