feat(scans): add --status / --scan-type / --since / --until to scans list#282
Merged
sachiniyer merged 2 commits intomainfrom May 6, 2026
Merged
feat(scans): add --status / --scan-type / --since / --until to scans list#282sachiniyer merged 2 commits intomainfrom
sachiniyer merged 2 commits intomainfrom
Conversation
99e3862 to
a808e75
Compare
e8bf8f1 to
44fd3fb
Compare
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
44fd3fb to
e5d5b9a
Compare
a75903d to
e4515dc
Compare
…list The scans list cards already render `Status` and `Scan Type`, but you couldn't filter on either. Triage prompts like "failed scans in the last 24h" had to fall through to grep over `--format json`. Add four filter flags to `scans list`: --status WorkflowStatus (in-progress | complete | failed | dlq) --scan-type ScanType (default | recent-changes) --since duration / ISO date / RFC3339 --until same as --since The scans API has no server-side filtering today, so any active filter forces an all-fetch path (mirroring the bugs / vulns plumbing): the CLI paginates server-side to gather every scan, filters the combined set, then re-paginates client-side. Bare `scans list` (no filter) still hits the cheap single-page server fetch and is byte-equivalent to before. Reuses `parse_time_spec` from PR3 (`siyer/bugs-list-since-until`) — this PR is stacked on that branch. If PR3 merges first, PR6 rebases cleanly; if PR6 lands first, the PR3 conflict is just "both branches add the same util." `WorkflowStatus` and `ScanType` get `clap::ValueEnum` impls so they work as flag values. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CI's rustfmt insisted the long `f.iter().map(...).collect()` chains in three filter_scans tests get broken across multiple lines. Local fmt missed it — different version. Let CI's view win. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
e5d5b9a to
8980b32
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
The scans list cards already render
StatusandScan Type, but you couldn't filter on either. Triage prompts like "failed scans in the last 24h" had to fall through to grepping--format json.Add four filter flags to
scans list:--statusin-progress | complete | failed | dlqWorkflowStatus--scan-typedefault | recent-changesScanType--sinceparse_time_specwithbugs list--until--sincenowso windows read as one intervalWorkflowStatusandScanTypegetclap::ValueEnumimpls so they work as flag values.Implementation
The scans API has no server-side filtering today (only
repo_id/limit/offset), so any active filter forces an all-fetch path — same shape as the bugs--vulns/--introduced-byplumbing: paginate server-side to gather every scan, filter the combined set, then re-paginate client-side for output. Barescans list(no filter) still hits the cheap single-page server fetch and is byte-equivalent to before.Stacking
This PR is stacked on #275 (
siyer/bugs-list-since-until) so it can reuseparse_time_spec. If #275 merges first, PR6 rebases cleanly; if PR6 lands first, the eventual merge conflict is just "both branches add the same util."Testing
Automated, run locally and passing:
cargo test— full suite green. 9 new tests insrc/commands/scans.rs::tests:filter_no_filters_returns_allfilter_by_status_failed,filter_by_status_completefilter_by_scan_type_default,filter_by_scan_type_recent_changesfilter_combines_status_and_scan_type_as_andfilter_since_inclusive_lower_bound,filter_until_inclusive_upper_boundfilter_window_with_status(status + since combined)cargo clippy -- -D warnings— cleancargo fmt --check— cleancargo xtask check— clean (HELP.md regenerated for the new flags)Manual end-to-end against live API (
usedetail/detail):scans list … --status complete --limit 5→total=124, everyworkflowStatus == "complete"✅scans list … --status failed --limit 5→total=13, first itemworkflowStatus == "failed"✅scans list … --scan-type recent-changes --limit 5→total=75, everyscanType == "recentChanges"✅scans list … --status complete --scan-type default --since 7d --limit 5→total=1, both filters satisfied ✅scans list … --since garbage→Error: invalid --since value: could not parse 'garbage' as a duration (e.g. 1d, 24h), a date (YYYY-MM-DD), or an RFC3339 timestamp✅scans list usedetail/detail --format json --limit 3(regression) →total=137, page=1— single-page server fetch unchanged🤖 Generated with Claude Code