The targets list showed 0 findings for a target whose findings were all entered by hand or imported. The stored findings_count only changes when a scan runs, so manual findings, imports and deletions left it wrong.
What changes
GET /api/v1/targets now counts each target's findings in one aggregation, alongside the query for the last scan run, and returns that live number as findings_count. The query uses the existing repo_id index on findings.
If the count query fails, the list falls back to the stored counts rather than showing zeros.
Checked
The manual-findings integration test now also asserts that the targets list shows 3 findings for a target that has never been scanned.
fmt; clippy with the CI flags (-p compliance-agent, lib and tests); agent lib tests.
The targets list showed 0 findings for a target whose findings were all entered by hand or imported. The stored `findings_count` only changes when a scan runs, so manual findings, imports and deletions left it wrong.
## What changes
- `GET /api/v1/targets` now counts each target's findings in one aggregation, alongside the query for the last scan run, and returns that live number as `findings_count`. The query uses the existing `repo_id` index on findings.
- If the count query fails, the list falls back to the stored counts rather than showing zeros.
## Checked
- The manual-findings integration test now also asserts that the targets list shows 3 findings for a target that has never been scanned.
- fmt; clippy with the CI flags (`-p compliance-agent`, lib and tests); agent lib tests.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
The stored findings_count only moves when a scan runs, so findings
entered by hand, imported or deleted left the list wrong (0 for a
target with only manual findings). The list now counts each target's
findings in one aggregation and falls back to the stored count if the
query fails.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang
merged commit 0441220330 into main2026-09-23 20:39:19 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The targets list showed 0 findings for a target whose findings were all entered by hand or imported. The stored
findings_countonly changes when a scan runs, so manual findings, imports and deletions left it wrong.What changes
GET /api/v1/targetsnow counts each target's findings in one aggregation, alongside the query for the last scan run, and returns that live number asfindings_count. The query uses the existingrepo_idindex on findings.Checked
-p compliance-agent, lib and tests); agent lib tests.🤖 Generated with Claude Code
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p