Skip to content

feat(ui): headline summary on scan completion - #4

Merged
GautamTalksDev merged 4 commits into
mainfrom
feat/scan-summary-headline
Aug 30, 2026
Merged

feat(ui): headline summary on scan completion#4
GautamTalksDev merged 4 commits into
mainfrom
feat/scan-summary-headline

Conversation

@GautamTalksDev

Copy link
Copy Markdown
Owner

Adds a one-line summary above the Unattributed section stating the finding in
plain language — grant count, systems, unattributed, stale, irreversible. All
figures derived from scan data; zero-value clauses omitted. Header counts
clarified: pending, held, total.

GautamTalksDev and others added 4 commits August 29, 2026 19:57
Co-authored-by: Cursor <cursoragent@cursor.com>
Prevent overlapping identity ownership, preserve failed and capped scan state, score cards from reconciled identities, pace replay for live demos, and make held cards explicit in the queue.

Co-authored-by: Cursor <cursoragent@cursor.com>
Show a compact, data-driven scan finding summary before the approval queue and pace demo replay so the completed result is visible in time to understand it.

Co-authored-by: Cursor <cursoragent@cursor.com>
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add completed-scan finding headline to approval queue

✨ Enhancement 🧪 Tests ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Summarizes completed scans with grants, systems, unattributed, stale, and irreversible findings.
• Omits empty finding clauses while preserving singular/plural and accessible summary text.
• Applies replay pacing to the demo server so completion remains understandable.
Diagram

graph TD
  D["Demo Launcher"] --> R["Replay Server"] --> S["Scan Session"] --> A["App Shell"] --> Q["Approval Queue"] --> H["Summary Helpers"] --> B["Finding Headline"]
Loading
High-Level Assessment

The client-side approach is appropriate because the approval queue already has the complete card set and scan lifecycle state. Deriving counts in shared, tested helpers avoids expanding the API contract, while using subagent identifiers correctly represents all scanned systems, including systems that produced no cards.

Files changed (5) +126 / -20

Enhancement (3) +79 / -17
App.tsxPass scanned system identifiers into the approval queue +5/-15

Pass scanned system identifiers into the approval queue

• Supplies subagent system IDs alongside cards and scan state so the queue can report every scanned system, including those without grants. Remaining changes are formatting-only.

apps/web/src/App.tsx

ApprovalQueue.tsxRender a completed-scan finding headline +35/-1

Render a completed-scan finding headline

• Computes scan-level counts and displays a compact headline only after successful completion. Optional clauses highlight unattributed, year-idle, and irreversible grants, while an aria-label exposes the complete plain-language summary.

apps/web/src/components/ApprovalQueue.tsx

format.tsAdd scan summary counting and text helpers +39/-1

Add scan summary counting and text helpers

• Introduces a typed summary model that counts cards, unique scanned systems, unattributed grants, grants idle at least one year, and irreversible actions. Adds plural-aware plain-language formatting that excludes empty finding categories.

apps/web/src/lib/format.ts

Bug fix (1) +2 / -2
demo.tsApply replay pacing before starting the demo server +2/-2

Apply replay pacing before starting the demo server

• Sets default replay speed and maximum event gap on the parent environment before launching API and UI processes. This ensures the server-side replay driver receives pacing settings and leaves the completed result visible long enough to understand.

scripts/demo.ts

Tests (1) +45 / -1
format.test.tsCover scan summary counting and clause omission +45/-1

Cover scan summary counting and clause omission

• Verifies grant and connected-system totals, notable finding categories, deterministic staleness, singular wording, and omission of zero-value clauses.

apps/web/src/lib/format.test.ts

@GautamTalksDev
GautamTalksDev merged commit e623b31 into main Aug 30, 2026
1 check passed
@GautamTalksDev
GautamTalksDev deleted the feat/scan-summary-headline branch August 30, 2026 04:52
@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Stale refresh corrupts headline 🐞 Bug ≡ Correctness
Description
A card refresh started by the previous scan can resolve after a new scan begins and overwrite the
cleared queue, while the new headline counts those old cards against the new scan's subagents.
Because that stale response can also restore status completed, users can see a completed summary
containing mismatched grant and system counts during the new scan.
Code

apps/web/src/App.tsx[71]

+          systemIds={Object.keys(session.activity.subagents)}
Evidence
The terminal UI exposes the New scan form as soon as status becomes completed, while the same
completion event asynchronously starts refreshCards; therefore a user can begin another scan
before that request resolves. scan_starting clears cards and subagents, but refreshCards carries
no scan ID and the reducer unconditionally installs its cards/status, after which the new summary
independently receives subagent keys from the current activity state.

apps/web/src/components/AgentActivity.tsx[138-144]
apps/web/src/hooks/useScanSession.ts[85-103]
apps/web/src/hooks/useScanSession.ts[132-152]
apps/web/src/hooks/useScanSession.ts[469-509]
apps/web/src/components/ApprovalQueue.tsx[123-126]
apps/web/src/components/ApprovalQueue.tsx[199-208]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Card fetches from a prior scan can update state after a new scan starts, causing the summary to combine stale cards with the current scan's systems and status.

## Issue Context
`refreshCards` dispatches results without identifying their scan, and the reducer accepts every `cards` action. Track the request's scan ID or a session generation and ignore results that no longer belong to the active scan.

## Fix Focus Areas
- apps/web/src/hooks/useScanSession.ts[32-39]
- apps/web/src/hooks/useScanSession.ts[132-152]
- apps/web/src/hooks/useScanSession.ts[469-509]
- apps/web/src/App.tsx[69-73]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
Review mode: ⚖️ Balanced

Grey Divider

Tip of the day
💡 Did you know, you can enable the Remediation agent and Qodo fixes findings in a dedicated fix PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread apps/web/src/App.tsx
/>
<ApprovalQueue
cards={session.cards}
systemIds={Object.keys(session.activity.subagents)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

1. Stale refresh corrupts headline 🐞 Bug ≡ Correctness

A card refresh started by the previous scan can resolve after a new scan begins and overwrite the
cleared queue, while the new headline counts those old cards against the new scan's subagents.
Because that stale response can also restore status completed, users can see a completed summary
containing mismatched grant and system counts during the new scan.
Agent Prompt
## Issue description
Card fetches from a prior scan can update state after a new scan starts, causing the summary to combine stale cards with the current scan's systems and status.

## Issue Context
`refreshCards` dispatches results without identifying their scan, and the reducer accepts every `cards` action. Track the request's scan ID or a session generation and ignore results that no longer belong to the active scan.

## Fix Focus Areas
- apps/web/src/hooks/useScanSession.ts[32-39]
- apps/web/src/hooks/useScanSession.ts[132-152]
- apps/web/src/hooks/useScanSession.ts[469-509]
- apps/web/src/App.tsx[69-73]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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