feat: add per-status package counts to list endpoint (CM-1245) - #4216
Merged
Conversation
- 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>
Contributor
There was a problem hiding this comment.
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.
ulemons
previously approved these changes
Jun 16, 2026
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
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
getPackageStatusCountsto the DAL (osspckgs/api.ts) — returns a count breakdown by all stewardship statuses for the currently active filters (excluding the status filter itself)listPackagesAPI endpoint now fires both queries in parallel viaPromise.alland returnsstatusCountsalongside the existing paginated rowsTest plan
GET /api/v1/packageswith no filters — verifystatusCountsis present in the response withallequalling the sum of individual status countsstatusCountsreflects only matching packages andallmatchestotalstatusfilter — verifystatusCountsstill shows counts across all statuses (not filtered by the selected status)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/packagesnow returnsstatusCounts— stewardship tab totals (allplus 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 thestatusquery 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 addsgetPackageStatusCountswith a grouped SQL query aligned tolistPackagesForApi’s filter joins (stewardships, advisories, maintainers, scorecard).Also adds
.claudetobackend/.prettierignore.Reviewed by Cursor Bugbot for commit fd7fa68. Bugbot is set up for automated code reviews on this repo. Configure here.