Skip to content

feat(scans): polish scans list card — drop noise, surface commit SHA - #278

Merged
sachiniyer merged 1 commit into
mainfrom
siyer/scans-card-polish
May 6, 2026
Merged

feat(scans): polish scans list card — drop noise, surface commit SHA#278
sachiniyer merged 1 commit into
mainfrom
siyer/scans-card-polish

Conversation

@sachiniyer

Copy link
Copy Markdown
Contributor

Summary

Two small triage-friendly tweaks to scans list card output (audit items #10 and #11 — bundled because they both touch Formattable for Scan):

1. Header parenthetical (#10)
Drop the (N Open) parenthetical when it would be noise:

  • total == 0 — leading 0 Bugs Found already says nothing; (0 Open) is boilerplate
  • open == total(N Open) just restates the leading number

Otherwise the existing "{repo} N Bugs Found (M Open)" form is preserved.

2. Commit row (#11)
Surface Scan.commit_sha (truncated to 7 chars, matching format_introduced_in's blame style) so users can answer "did this scan run on the current main?" without an extra round-trip. Conditional — omitted when commit_sha is null/absent so older scans stay quiet.

Test refactor

Existing scan-card tests addressed pairs[N] by numeric index, which would silently break once the new conditional Commit row shifts later positions. Rewrote them to look up by key name via a small scan_pair helper.

Testing

Automated, run locally and passing:

  • cargo test — full suite green. New tests:
    • scan_card_header_drops_parenthetical_when_total_is_zero"usedetail/cli 0 Bugs Found"
    • scan_card_header_drops_parenthetical_when_open_equals_total"usedetail/cli 7 Bugs Found" (7 found, 7 open)
    • scan_card_header_keeps_parenthetical_when_partially_resolved → still emits (3 Open) when partial
    • scan_card_includes_short_commit_sha → 24-char sha truncated to "deadbee"
    • scan_card_omits_commit_when_null
    • Existing scan_card_workflow_id_present etc. updated to look up by key
  • cargo clippy -- -D warnings — clean
  • cargo fmt --check — clean
  • cargo xtask check — clean (no flag changes; HELP.md unchanged)

Manual end-to-end against live API (usedetail/detail):

1. usedetail/detail 0 Bugs Found              ← was "0 Bugs Found (0 Open)"
    Status       complete
    Scan Type    -
    Initiator    scheduler
    Workflow ID  wr_387e02f8-…
    Created      2026-05-06 11:23:02 -07:00
2. usedetail/detail 0 Bugs Found              ← parenthetical dropped
    Status       complete
    Scan Type    recentChanges
    Initiator    scheduler
    Commit       5373780                       ← new row, conditional
    Workflow ID  wr_d0b4fdfd-…
    Created      2026-05-06 11:22:34 -07:00
3. usedetail/detail 1 Bugs Found (0 Open)     ← parenthetical kept (open ≠ total)
    Status       complete
    Scan Type    recentChanges
    Initiator    scheduler
    Commit       aa4ba49
    Workflow ID  wr_27be25a4-…
    Created      2026-05-05 16:36:24 -07:00
  • Verified the older scan Chore: Update readme to correct download link #4 with no commitSha cleanly omits the Commit row.
  • The open == total branch wasn't representable in usedetail/detail's recent scans (everything is resolved), so it's covered by unit test only.

🤖 Generated with Claude Code

Two small triage-friendly tweaks to the Scan to_card:

1. Header parenthetical
   `(0 Open)` and `(N Open)` (when N == total) read as boilerplate.
   Drop the parenthetical when:
     - total == 0       — leading "0 Bugs Found" already says nothing
     - open == total    — "(N Open)" just restates the total
   Otherwise keep the existing `"{repo} N Bugs Found (M Open)"` form.

2. Commit row
   Surface `Scan.commit_sha` (truncated to 7 chars, like
   format_introduced_in does for blame) so users can answer "did
   this scan run on the current main?" without an extra round-trip.
   Conditional: omitted when commit_sha is null or absent so older
   scans stay quiet.

Existing scan tests addressed `pairs[N]` by index; rewrote them
to look up by key name (via a small `scan_pair` helper) so the
new conditional Commit row doesn't break them.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sachiniyer
sachiniyer temporarily deployed to integration-tests May 6, 2026 20:55 — with GitHub Actions Inactive

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@sachiniyer
sachiniyer merged commit 1bbaa0d into main May 6, 2026
13 checks passed
@sachiniyer
sachiniyer deleted the siyer/scans-card-polish branch May 6, 2026 21:23
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