Conversation
PR SummaryLow Risk Overview
The route validates a required non-empty Reviewed by Cursor Bugbot for commit 532227e. Bugbot is set up for automated code reviews on this repo. Configure here. |
Signed-off-by: anilb <epipav@gmail.com>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation matches the described contract and includes comprehensive route and database tests.
Review effort: Balanced
Findings: None
What changed in this PR
Adds the /v1-alpha/repositories/collections endpoint for retrieving public collections containing a repository.
Changes:
- Adds the validated route and 404 handling.
- Implements exact-URL, direct-membership database lookup.
- Covers response, validation, failure, routing, and OpenAPI behavior.
| File | Description |
|---|---|
api/src/versions/v1-alpha/collections/repository-collections.ts |
Defines the endpoint and response mapping. |
api/src/lib/collections-db.ts |
Adds the public collection lookup query. |
api/tests/collections-repository-collections.test.ts |
Tests route behavior and OpenAPI output. |
api/tests/collections-db.test.ts |
Tests query construction and result semantics. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Summary
Adds
GET /v1-alpha/repositories/collections?url=<repository url>(IN-1410, epic IN-1146). It returns the public collections that directly contain the repository, as{name, slug, logoUrl}, pluspublicCount. It reusesCollectionRefandCollectionMembershipsfrom #2345, so this PR is stacked on it.listRepositoryCollectionsinsrc/lib/collections-db.tsmatches the repository URL exactly and counts only livecollectionsRepositoriesrows, as the Nuxt route does. A repository that belongs only through a collected project is left out.urlis required and must be non-empty (400 otherwise). A CM database failure answers 503.Notes
privateCountcome later with the LFID-aware version of the shared query.Tests
tests/collections-repository-collections.test.ts: response shape, 404 against an empty list,urlvalidation, cache header, 503, absence under/v1and the OpenAPI entry.tests/collections-db.test.ts: the query's public-only filter, exact URL match, direct membership and the unknown or empty results.main