Uh oh!
There was an error while loading. Please reload this page.
fix: distinguish empty --vulns result from missing author metadata in bugs list hint - #254
Conversation
| fn empty_filter_hint(pre_filter: &[Bug], vulns: bool) -> String { | ||
| if pre_filter.is_empty() { | ||
| if vulns { | ||
| "No security vulnerabilities found with the current filters.".to_string() | ||
| } else { | ||
| "No bugs found with the current filters.".to_string() | ||
| } | ||
| } else { | ||
| let known = collect_authors(pre_filter); | ||
| if known.is_empty() { | ||
| "No bugs matched --introduced-by. None of the current bugs have author information." | ||
| .to_string() | ||
| } else { | ||
| format!( | ||
| "No bugs matched --introduced-by. Known authors: {}", | ||
| known.join(", ") | ||
| ) | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
📝 Info: Intentional behavioral change when pre_filter is empty
The refactoring is not a pure extraction — it introduces a new branch. When pre_filter is empty (i.e., --vulns filtered out all bugs, or the repo had no bugs at all), the old code would fall through to collect_authors which returns empty, producing "No bugs matched --introduced-by. None of the current bugs have author information.". The new code instead produces "No security vulnerabilities found with the current filters." or "No bugs found with the current filters." depending on the --vulns flag. This is a deliberate improvement (the doc comment at src/commands/bugs.rs:51-56 explicitly describes the rationale), but reviewers should be aware this is a user-facing message change, not a no-op refactor.
Was this helpful? React with 👍 or 👎 to provide feedback.
… bugs list hint When `detail bugs list --vulns --introduced-by <author>` produced an empty `--vulns` pre-filter, the hint message conflated "no vulnerabilities exist" with "vulnerabilities exist but lack author info", sending users chasing author metadata that wasn't the real cause. Extract an `empty_filter_hint` helper that checks whether `pre_filter` is empty first and emits a dedicated message for that case. Fixes#226. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
e5740ff to
bdb0954CompareUh oh!
There was an error while loading. Please reload this page.
…hes (#264) ## Summary Follow-up to #254. That PR introduced `empty_filter_hint` with 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-by` branch of the handler. When a user runs `detail bugs list --vulns` without 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-`--vulns` filter is empty and `--introduced-by` wasn't given, print the hint and return. ## Test plan - [x] `cargo test --lib bugs::` — 35 pass - [x] `cargo clippy -- -D warnings` clean - [x] `cargo fmt --check` clean - [ ] Manual: `detail bugs list <repo-without-vulns> --vulns` now prints "No security vulnerabilities found with the current filters." instead of an empty table Fixes#259. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/usedetail/cli/pull/264" 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
detail bugs list --vulns --introduced-by <author>printed "None of the current bugs have author information." whenever--vulnsreturned nothing, conflating "no vulnerabilities exist" with "vulnerabilities exist but lack author metadata."empty_filter_hinthelper that checkspre_filter.is_empty()before inspecting authors, so an empty--vulnsresult gets its own dedicated message instead of a misleading author hint.--introduced-byalone against an empty repo).Test plan
cargo test --lib bugs::— 35 pass, including 4 newempty_filter_hint_*casescargo clippy -- -D warningscleancargo fmt --checkcleandetail bugs list --vulns --introduced-by someoneon a repo with zero vulnerabilities and confirm the hint now says "No security vulnerabilities found with the current filters."Fixes#226.
🤖 Generated with Claude Code