Skip to content

Comments

fix(gh): show fallback note for filtered body; fix api truncation message#235

Open
polaminggkub-debug wants to merge 1 commit intortk-ai:masterfrom
polaminggkub-debug:fix/gh-body-and-api-truncation
Open

fix(gh): show fallback note for filtered body; fix api truncation message#235
polaminggkub-debug wants to merge 1 commit intortk-ai:masterfrom
polaminggkub-debug:fix/gh-body-and-api-truncation

Conversation

@polaminggkub-debug
Copy link
Contributor

Problems

Two related issues in `gh_cmd.rs`, same category as the body-display fix from #214.

1. Silent body loss in `view_pr()` and `view_issue()`

When `filter_markdown_body()` removes all content (body contains only badges, images, or HTML comments), the body section is silently skipped — no output, no indication that content existed.

Example body that disappears completely:
```markdown

CI
screenshot

```

The user sees PR metadata but has no way to know a body was present and filtered.

Fix: Show `(body contained only badges/images/comments)` so the user is aware.

2. Naive `.take(20)` with double iteration in `run_api()`

The non-JSON fallback in `run_api()` used the same naive truncation pattern that #214 fixed for `view_pr`:

  • Calls `raw.lines()` twice (once to take 20, once to count total)
  • Shows `"... (truncated)"` with no line count

Fix: Single pass, message shows exact count: `"... N more lines (use gh api for full output)"`, consistent with `list_prs()` and the rest of the module.

Testing

All 412 existing tests pass.

🤖 Generated with Claude Code

Two fixes in gh_cmd.rs:

1. view_pr() and view_issue(): when filter_markdown_body() returns an
   empty string (body contained only badges, images, or HTML comments),
   the body was silently skipped. Now shows a note so the user knows
   content existed but was filtered.

2. run_api() non-JSON fallback: replaced naive .take(20) + double
   iteration with a single pass that shows line count in the truncation
   message ("... N more lines"), consistent with the rest of the module.

Co-Authored-By: Claude Sonnet 4.6 <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.

1 participant