You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds GET /v1-alpha/oss-index/collections (IN-1416, epic IN-1146). It returns a cursor-paged list of OSS Index collections with their top projects, plus the category details when a category is picked.
categorySlug and categoryGroupId filter the collections. sort (totalContributors or softwareValue, default totalContributors) orders them. cursor and pageSize page them like the leaderboard routes.
With categorySlug, the route reads the category from category_list first and returns it as category. An unknown slug answers 404 not_found, and the collections pipe is then skipped.
Collections come from collections_oss_index. Their project tuples carry slug, so src/lib/oss-index.ts gains CollectionProject and its guard and mapper.
An invalid cursor answers 400. A malformed row answers 503 upstream_unavailable.
Notes
The pipe's total row count ignores the category filter, so the route detects the last page from a short pipe page. A full last page returns a nextCursor that leads to an empty page.
Counts and software values must be non-negative integers, matching the groups and categories endpoints.
tests/oss-index-collections.test.ts: filter and sort forwarding, the category lookup and 404, tuple mapping, paging across pipe pages with the cursor walk, 400 for bad input, 503 for malformed rows, and the OpenAPI entry.
tests/oss-index.test.ts: the 10-slot guard and mapper.
Low Risk
Read-only endpoint following existing OSS Index pipe and pagination patterns; risk is mainly upstream shape mismatches, which are guarded with 503 responses.
Overview
Adds GET /v1-alpha/oss-index/collections, a cursor-paged read API for OSS Index collections (totals, project count, and leading projects).
Query params categorySlug and categoryGroupId narrow the list; sort orders by totalContributors (default) or softwareValue. Data is loaded from Tinybird pipes (collections_oss_index, and category_list when filtering by slug). Unknown categorySlug returns 404 before the collections pipe runs; when the slug is valid, the response includes a category object.
Because the collections pipe embeds projects as 10-slot tuples (slug before status), oss-index.ts adds CollectionProject, isCollectionProjectTuple, and toCollectionProject instead of reusing the 9-slot project shape. Pagination follows other OSS Index routes, with nextCursor inferred from a full last pipe page when the upstream total ignores category filters.
This guarantee is too broad: with pageSize=2, cursor offset 1, and three rows total, the second pipe page is short and this handler returns nextCursor: null despite returning two rows. Document that only some full final responses produce an empty follow-up page.
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
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
Adds
GET /v1-alpha/oss-index/collections(IN-1416, epic IN-1146). It returns a cursor-paged list of OSS Index collections with their top projects, plus the category details when a category is picked.categorySlugandcategoryGroupIdfilter the collections.sort(totalContributorsorsoftwareValue, defaulttotalContributors) orders them.cursorandpageSizepage them like the leaderboard routes.categorySlug, the route reads the category fromcategory_listfirst and returns it ascategory. An unknown slug answers 404not_found, and the collections pipe is then skipped.collections_oss_index. Their project tuples carryslug, sosrc/lib/oss-index.tsgainsCollectionProjectand its guard and mapper.upstream_unavailable.Notes
nextCursorthat leads to an empty page.Tests
tests/oss-index-collections.test.ts: filter and sort forwarding, the category lookup and 404, tuple mapping, paging across pipe pages with the cursor walk, 400 for bad input, 503 for malformed rows, and the OpenAPI entry.tests/oss-index.test.ts: the 10-slot guard and mapper.main