Uh oh!
There was an error while loading. Please reload this page.
fix(bugs): print empty-results hint when --vulns alone yields no matches - #264
Conversation
PR #254 introduced the `empty_filter_hint` helper with a dedicated "No security vulnerabilities found with the current filters." branch and a unit test asserting that message, but only wired the helper into the `--introduced-by` branch of the handler. When the user runs `bugs list --vulns` without an author filter and zero vulnerabilities come back, the helper is never reached — they just see an empty table with no explanation. Add the matching early return for the `--vulns`-alone case: if the post-`--vulns` filter is empty and no `--introduced-by` was given, print `empty_filter_hint(&[], true)` and return the empty list. Fixes#259. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
| } else if filtered.is_empty() { | ||
| // `--vulns` alone filtered everything out. Without this | ||
| // branch the user just sees an empty table and no hint, | ||
| // even though `empty_filter_hint` already has the right | ||
| // message for this case. | ||
| if matches!(format, crate::OutputFormat::Table) { | ||
| let hint = empty_filter_hint(&filtered, *vulns); | ||
| Term::stdout().write_line(&hint)?; | ||
| } | ||
| return output_list(&filtered, 0, *page, *limit, format); | ||
| } |
There was a problem hiding this comment.
📝 Info: New else-if branch is only reachable when --vulns is true
The new else if filtered.is_empty() at line 340 is the else-branch of if !introduced_by.is_empty() (line 330), meaning introduced_by is empty here. Since we only enter the outer block at line 323 when *vulns || !introduced_by.is_empty(), and introduced_by is empty, *vulns is necessarily true. This means empty_filter_hint(&filtered, *vulns) at line 346 always receives vulns=true and an empty slice, which correctly returns "No security vulnerabilities found with the current filters." via empty_filter_hint at src/commands/bugs.rs:59-60. No unreachable or incorrect path here.
Was this helpful? React with 👍 or 👎 to provide feedback.
Uh oh!
There was an error while loading. Please reload this page.
## Summary Patch release rolling up the seven fixes merged since 0.2.1: - fix(bugs): print empty-results hint when `--vulns` alone yields no matches (#264) - fix(datetime): floor sub-second negative timestamps instead of snapping to epoch (#262) - chore(deps): bump rustls-webpki to 0.103.13 for RUSTSEC-2026-0104 (#263) - fix(repos): normalize whitespace in repo identifiers before lookup (#261) - fix(git): parse GitHub remotes with embedded http(s) credentials (#260) - fix(auth): redirect browser and surface OAuth errors on PKCE callback failure (#258) - refactor(config): rewrite `update_config` through the locked handle (#257) On merge, the release workflow will tag `v0.2.2` and publish platform artifacts via cargo-dist. ## Test plan - [x] `cargo build` succeeds with version 0.2.2 - [ ] Tag `v0.2.2` is created on merge and release workflow publishes artifacts 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/usedetail/cli/pull/265" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open in Devin Review"> </picture> </a> <!-- devin-review-badge-end --> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Follow-up to #254. That PR introduced
empty_filter_hintwith a dedicated "No security vulnerabilities found with the current filters." branch — and a unit test (empty_filter_hint_vulns_flag_with_empty_prefilter) asserting that exact message — but only wired the helper into the--introduced-bybranch of the handler. When a user runsdetail bugs list --vulnswithout an author filter and zero vulnerabilities match, the helper is never reached: they just see an empty table with no explanation.Add the matching early return for the
--vulns-alone case: if the post---vulnsfilter is empty and--introduced-bywasn't given, print the hint and return.Test plan
cargo test --lib bugs::— 35 passcargo clippy -- -D warningscleancargo fmt --checkcleandetail bugs list <repo-without-vulns> --vulnsnow prints "No security vulnerabilities found with the current filters." instead of an empty tableFixes#259.
🤖 Generated with Claude Code