Skip to content

feat: add filters and sorting to project insights#3911

Open
gaspergrom wants to merge 1 commit intomainfrom
feat/project-insights-filters-sorting
Open

feat: add filters and sorting to project insights#3911
gaspergrom wants to merge 1 commit intomainfrom
feat/project-insights-filters-sorting

Conversation

@gaspergrom
Copy link
Contributor

@gaspergrom gaspergrom commented Mar 11, 2026

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.pipe now supports an optional isLF filter and adds query-time sorting and pagination via new orderBy, orderDirection, pageSize, and page parameters.

The SQL adds a dynamic ORDER BY (defaulting to contributorCount) and applies LIMIT/OFFSET so 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.

Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
@gaspergrom gaspergrom requested review from Copilot and emlimlf March 11, 2026 11:24
@github-actions
Copy link
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

2 similar comments
@github-actions
Copy link
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

@github-actions
Copy link
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 isLF filter parameter.
  • Added dynamic orderBy / orderDirection sorting support.
  • Added pageSize / page pagination via LIMIT and OFFSET.

💡 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 %}
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
{% end %}
{% end %},
id ASC

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +12
- `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)
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
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.

3 participants