feat: add filters and sorting to project insights#3911
feat: add filters and sorting to project insights#3911gaspergrom wants to merge 1 commit intomainfrom
Conversation
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
2 similar comments
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
|
|
There was a problem hiding this comment.
Pull request overview
Adds filtering, sorting, and pagination capabilities to the Tinybird project_insights endpoint to support more flexible querying of project insights data.
Changes:
- Added
isLFfilter parameter. - Added dynamic
orderBy/orderDirectionsorting support. - Added
pageSize/pagepagination viaLIMITandOFFSET.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| {{ column(orderBy, 'contributorCount') }} | ||
| {% if defined(orderDirection) and orderDirection == 'asc' %} ASC | ||
| {% else %} DESC | ||
| {% end %} |
There was a problem hiding this comment.
Pagination is now supported via LIMIT/OFFSET, but the ORDER BY only uses the user-selected sort column. If many rows share the same value for that column (e.g., contributorCount), page boundaries can be unstable/non-deterministic across requests. Consider adding a deterministic tiebreaker (e.g., slug or id) after the primary sort key so pagination is consistent.
| {% end %} | |
| {% end %}, | |
| id ASC |
| - `isLF`: Optional boolean to filter by LF status | ||
| - `orderBy`: Optional string for dynamic sorting by any column (default: 'contributorCount') | ||
| - `orderDirection`: Optional string ('asc' or 'desc'), defaults to 'desc' | ||
| - `pageSize`: Optional integer for number of results per page (default: 10) | ||
| - `page`: Optional integer for page number, 0-based (default: 0) |
There was a problem hiding this comment.
The DESCRIPTION says orderBy can sort by “any column”, and the query passes the request value directly into column(orderBy, ...). If a client supplies a non-existent or non-orderable column, the endpoint will error at runtime. Consider documenting an explicit list of supported orderBy values (like other list endpoints do) and/or enforcing an allowlist/fallback to the default when an unsupported value is provided.
Note
Medium Risk
Introduces dynamic ordering and pagination on a production query, which can change result ordering/shape and impact performance or error behavior if callers pass unexpected sort columns/values.
Overview
project_insights.pipenow supports an optionalisLFfilter and adds query-time sorting and pagination via neworderBy,orderDirection,pageSize, andpageparameters.The SQL adds a dynamic
ORDER BY(defaulting tocontributorCount) and appliesLIMIT/OFFSETso callers can page through multi-project results instead of always returning the full set.Written by Cursor Bugbot for commit 4d7909d. This will update automatically on new commits. Configure here.