Skip to content

feat: collection detail endpoint - #2340

Open
epipav wants to merge 2 commits into
mainfrom
feat/IN-1405
Open

epipav wants to merge 2 commits into
mainfrom
feat/IN-1405

Conversation

@epipav

@epipav epipav commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds GET /v1-alpha/collections/{slug} (IN-1405, epic IN-1146), stacked on #2337. It returns one public collection with the shared Collection fields plus its projectIds and repositoryUrls.

  • findCollectionDetail in src/lib/collections-db.ts reads the collection row and both member lists in one statement, reusing the shared visibility and membership fragments, so the three always agree.
  • Unknown and private slugs answer 404, and a CM database failure answers 503.

Tests

  • tests/collections-collection.test.ts: response shape, 404, 503 and the OpenAPI entry.
  • tests/collections-db.test.ts: the detail query's visibility predicate and its null result.

Copilot AI balanced review requested due to automatic review settings October 1, 2026 09:39
@cursor

cursor Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Read-only public collection lookup with established visibility rules and patterns; no auth or mutation paths.

Overview
Adds GET /v1-alpha/collections/{slug} so clients can load one public collection with standard Collection fields plus projectIds and repositoryUrls.

findCollectionDetail in collections-db.ts fetches the full collection row and both member lists in a single query (same visibility and membership fragments as existing helpers), so metadata and members stay consistent. Missing or private slugs return 404; CM DB failures surface as 503 via existing error handling.

Coverage includes route response shape, error codes, OpenAPI schema, and assertions that the detail query is public-only and includes both member arrays.

Reviewed by Cursor Bugbot for commit e44d90d. 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

🟡 Changes recommended

The endpoint fixture uses values that violate its documented UUID contract, leaving that contract inadequately tested.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds the public collection-detail endpoint with database lookup, response schemas, and integration coverage.

Changes:

  • Adds GET /v1-alpha/collections/{slug}.
  • Fetches collection metadata and membership lists atomically.
  • Covers success, 404, 503, SQL, and OpenAPI behavior.
File Description
api/​src/​lib/​collections-db.ts Adds the collection-detail query.
api/​src/​versions/​v1-alpha/​collections/​collection.ts Defines the route and response schema.
api/​tests/​collections-db.test.ts Tests query construction and missing collections.
api/​tests/​collections-collection.test.ts Tests endpoint behavior and documentation.

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

Comment thread api/tests/collections-collection.test.ts Outdated
Copilot AI balanced review requested due to automatic review settings October 1, 2026 09:47

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 implementation is consistent with existing collection patterns and has appropriate endpoint and database coverage.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@epipav epipav self-assigned this Oct 1, 2026
Base automatically changed from feat/IN-1403 to main October 1, 2026 11:24
@epipav
epipav requested review from gaspergrom and themarolt October 1, 2026 11:24

@themarolt themarolt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

@gaspergrom gaspergrom left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Checked the detail query against the shared visibility and membership fragments. The slug filter, the soft-delete checks and the member lists all line up with the list endpoint. LGTM.

epipav added 2 commits October 1, 2026 14:10
Signed-off-by: anilb <epipav@gmail.com>
Signed-off-by: anilb <epipav@gmail.com>
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.

4 participants