Skip to content

feat: collection development routes - #2348

Open
epipav wants to merge 1 commit into
feat/IN-1411from
feat/IN-1412
Open

epipav wants to merge 1 commit into
feat/IN-1411from
feat/IN-1412

Conversation

@epipav

@epipav epipav commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Serves the 14 development widgets for a collection under /v1-alpha/collections/{slug}/development/* (IN-1412, epic IN-1146). It is stacked on #2347 and adopts its widgetRoutes helper, so each collection variant reuses the project route handler and passes collectionSlug to the pipe.

  • fetchActivityCounts in src/lib/activity-count.ts now takes the scope target in place of a project slug, so commit-activities works in both scopes. Project and scope params a caller passes are cleared before the target applies.
  • projectTarget in src/lib/widget-scope.ts is the project branch of widgetRoutes, exported for the popularity routes that use fetchActivityCounts and stay project-only for now.
  • A new description rule points collection readers to the endpoint of each member project for connectedPlatforms.
  • The project routes' behaviour and OpenAPI output are unchanged.

Notes

  • Pipe support for collectionSlug is taken from the Nuxt app: every development widget is available in collection scope and sends collectionSlug to the same pipes. No route is left out.

Tests

  • tests/project-routes.test.ts: development joins the pinned collection groups, so the shared collection suite covers all 14 routes, and the wording check also rejects a collection endpoint reference.
  • tests/activity-count.test.ts: the new signature, plus a collection target case that drops caller-supplied scope params.

Signed-off-by: anilb <epipav@gmail.com>
Copilot AI balanced review requested due to automatic review settings October 1, 2026 12:33
@cursor

cursor Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Adds many new collection endpoints and changes how Tinybird scope params are built across development widgets; project behavior is intended unchanged but regression risk is moderate across shared routing and query assembly.

Overview
Exposes all 14 development widgets under /v1-alpha/collections/{slug}/development/* by registering each handler through widgetRoutes, so collection requests reuse the same logic as projects but pass collectionSlug to Tinybird (unknown/private collections 404; repos is stripped from collection OpenAPI and query).

Handlers and fetchActivityCounts no longer call withBucket directly—they take a WithTarget callback and spread ...target into pipe params. fetchActivityCounts also clears project / collectionSlug / bucketId from caller pipeParams before applying the target so scope cannot be widened. projectTarget is exported for project-only popularity routes that still use fetchActivityCounts.

OpenAPI collection copy gains a wording tweak (“the project endpoint” → member-project endpoints). Tests extend the shared collection suite to development and add a collection-target case for fetchActivityCounts.

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

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 review overview

🟢 Approval recommended

The scope refactor is consistently applied and covered by shared route, OpenAPI, and target-isolation tests.

Review effort: Balanced
Findings: None

What changed in this PR

Adds collection-scoped routes for all 14 Development widgets while preserving project behavior.

Changes:

  • Reuses Development handlers for project and collection scopes via widgetRoutes.
  • Generalizes activity-count targeting and retains project-only Popularity routes.
  • Extends shared collection-route and activity-count tests.
File Description
api/​src/​lib/​widget-scope.ts Adds reusable project targets and collection wording.
api/​src/​lib/​activity-count.ts Generalizes activity counts across scopes.
api/​src/​versions/​v1-alpha/​development/​active-days.ts Adds collection routing.
api/​src/​versions/​v1-alpha/​development/​code-review-participants.ts Adds collection routing.
api/​src/​versions/​v1-alpha/​development/​code-reviews.ts Adds collection routing.
api/​src/​versions/​v1-alpha/​development/​commit-activities.ts Adds collection routing through shared targeting.
api/​src/​versions/​v1-alpha/​development/​contributions-outside-work-hours.ts Adds collection routing.
api/​src/​versions/​v1-alpha/​development/​issues-resolution.ts Adds collection routing.
api/​src/​versions/​v1-alpha/​development/​median-time-to-close.ts Adds collection routing.
api/​src/​versions/​v1-alpha/​development/​median-time-to-review.ts Adds collection routing.
api/​src/​versions/​v1-alpha/​development/​merge-lead-time.ts Adds collection routing.
api/​src/​versions/​v1-alpha/​development/​patchsets-per-review.ts Adds collection routing.
api/​src/​versions/​v1-alpha/​development/​pull-requests.ts Adds collection routing.
api/​src/​versions/​v1-alpha/​development/​review-comments.ts Adds collection routing.
api/​src/​versions/​v1-alpha/​development/​review-efficiency.ts Adds collection routing and adjusted documentation.
api/​src/​versions/​v1-alpha/​development/​review-time-by-pr-size.ts Adds collection routing.
api/​src/​versions/​v1-alpha/​popularity/​forks.ts Adapts to project target helper.
api/​src/​versions/​v1-alpha/​popularity/​mailing-lists-messages.ts Adapts to project target helper.
api/​src/​versions/​v1-alpha/​popularity/​stars.ts Adapts to project target helper.
api/​tests/​activity-count.test.ts Tests project and collection target isolation.
api/​tests/​project-routes.test.ts Covers all Development collection variants.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@epipav epipav self-assigned this Oct 1, 2026
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.

2 participants