Repository navigation
Conversation
Signed-off-by: anilb <epipav@gmail.com>
PR SummaryMedium Risk Overview
Tests extend the shared collection route suite to popularity, skip invalid-query checks when a route has no Reviewed by Cursor Bugbot for commit 4cff796. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The updated route test passes a possibly undefined value where strict TypeScript requires a query record.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds collection-scoped /v1-alpha popularity endpoints by reusing existing project handlers.
Changes:
- Adds collection variants for six popularity widgets.
- Rewrites collection-specific OpenAPI descriptions.
- Expands shared route and description tests.
| File | Description |
|---|---|
api/src/lib/widget-scope.ts |
Adds collection description transformations. |
api/src/versions/v1-alpha/popularity/stars.ts |
Adds collection-scoped stars route. |
api/src/versions/v1-alpha/popularity/forks.ts |
Adds collection-scoped forks route. |
api/src/versions/v1-alpha/popularity/mailing-lists-messages.ts |
Adds collection-scoped message route. |
api/src/versions/v1-alpha/popularity/packages.ts |
Adds collection-scoped packages route. |
api/src/versions/v1-alpha/popularity/package-metrics.ts |
Adds collection-scoped package metrics route. |
api/src/versions/v1-alpha/popularity/search-queries.ts |
Adds collection-scoped search route. |
api/tests/project-routes.test.ts |
Extends shared collection route coverage. |
api/tests/widget-scope.test.ts |
Tests new description rewrites. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Summary
Serves the 6 popularity widgets for a collection under
/v1-alpha/collections/{slug}/popularity/*(IN-1413, epic IN-1146): stars, forks, mailing-lists-messages, packages, package-metrics and search-queries. It is stacked on #2348 and adoptswidgetRoutes, so each collection variant reuses the project route handler and passescollectionSlugto the pipe.fetchActivityCounts.Notes
collectionSlugis taken from the Nuxt app: every popularity widget with an API route is available in collection scope and sendscollectionSlugto the same pipes. No route is left out.packagestakes onlysearch, so the shared suite skips the bad-query case for it.Tests
tests/project-routes.test.ts: popularity joins the pinned collection groups, so the shared collection suite covers all 6 routes.tests/widget-scope.test.ts: cases for each new description rule.main