Skip to content

feat: add per-status package counts to list endpoint (CM-1245) - #4216

Merged
gaspergrom merged 2 commits into
mainfrom
feat/packages-status-counts
Jun 16, 2026
Merged

feat: add per-status package counts to list endpoint (CM-1245)#4216
gaspergrom merged 2 commits into
mainfrom
feat/packages-status-counts

Conversation

@gaspergrom

@gaspergrom gaspergrom commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds getPackageStatusCounts to the DAL (osspckgs/api.ts) — returns a count breakdown by all stewardship statuses for the currently active filters (excluding the status filter itself)
  • The listPackages API endpoint now fires both queries in parallel via Promise.all and returns statusCounts alongside the existing paginated rows
  • Enables the frontend tab bar to always show counts for every status tab while respecting ecosystem, lifecycle, health band, vuln severity, stale, unstewareded, and bus-factor filters

Test plan

  • Call GET /api/v1/packages with no filters — verify statusCounts is present in the response with all equalling the sum of individual status counts
  • Apply an ecosystem or name filter — verify statusCounts reflects only matching packages and all matches total
  • Apply a status filter — verify statusCounts still shows counts across all statuses (not filtered by the selected status)
  • Apply stale-only / bus-factor-1 / unstewareded filters — verify counts update accordingly

Note

Medium Risk
Adds a second heavy aggregate query on every list request; counts must stay in sync with list filter logic as those evolve.

Overview
GET /api/v1/packages now returns statusCounts — stewardship tab totals (all plus each status) that respect the same non-status filters as the list (ecosystem, name, lifecycle, health band, vuln severity, stale/unstewarded/bus-factor flags) but ignore the status query param so every tab can show counts while one status is selected.

The handler loads paginated rows and counts in parallel (Promise.all) after splitting shared filter options from pagination/sort/status. The DAL adds getPackageStatusCounts with a grouped SQL query aligned to listPackagesForApi’s filter joins (stewardships, advisories, maintainers, scorecard).

Also adds .claude to backend/.prettierignore.

Reviewed by Cursor Bugbot for commit fd7fa68. Bugbot is set up for automated code reviews on this repo. Configure here.

- Add getPackageStatusCounts() to the data-access-layer that runs the
  same filter conditions as listPackagesForApi (minus the status filter)
  and returns a breakdown of package counts per stewardship status
- Run status counts query in parallel with the package list query to
  avoid extra round-trips
- Include statusCounts in the GET /v1/packages response so the UI
  tab bar can show accurate counts for all statuses across active filters

Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
Copilot AI review requested due to automatic review settings June 16, 2026 08:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.

@gaspergrom
gaspergrom requested a review from ulemons June 16, 2026 08:33
ulemons
ulemons previously approved these changes Jun 16, 2026
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
@gaspergrom
gaspergrom merged commit b7d97d5 into main Jun 16, 2026
15 checks passed
@gaspergrom
gaspergrom deleted the feat/packages-status-counts branch June 16, 2026 08:56
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.

3 participants