Skip to content

Commit e9fc504

Browse files
committed
fix: don't hard-require project in contributors_leaderboard when collectionSlug is set
Found by live-verifying the segments_filtered_by_collection deploy against prod: contributors_leaderboard's is_request_from_non_lf_project node had its own independent required=True on project (unrelated to segment scoping, used only to decide displayName vs publicName), which broke data-mode calls with collectionSlug even though count mode worked. A collection spans many projects with mixed LF/non-LF status, so collection-scoped requests now always use displayName. Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
1 parent 4498228 commit e9fc504

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

services/libs/tinybird/pipes/contributors_leaderboard.pipe

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ DESCRIPTION >
44
- Calculates contribution counts and percentages, showing different display names based on project type (LF vs non-LF).
55
- Primary use case: powering contributor ranking widgets in development insights.
66
- Parameters:
7-
- `project`: Required string for project slug (e.g., 'k8s', 'tensorflow') - inherited from `segments_filtered`
7+
- `project`: Required string for project slug (e.g., 'k8s', 'tensorflow') - inherited from `segments_filtered`. Required unless `collectionSlug` is given.
8+
- `collectionSlug`: Collection slug (e.g., 'cncf') - inherited from `segments_filtered_by_collection`. Required unless `project` is given. A collection spans many projects with mixed LF/non-LF status, so the non-LF `publicName` display-name substitution below only applies in single-project mode; collection-scoped requests always use `displayName`.
89
- `repos`: Optional array of repository URLs for filtering (inherited from `segments_filtered`)
910
- `startDate`: Optional DateTime filter for activities after timestamp (e.g., '2024-01-01 00:00:00')
1011
- `endDate`: Optional DateTime filter for activities before timestamp (e.g., '2024-12-31 23:59:59')
@@ -39,12 +40,16 @@ SQL >
3940
NODE is_request_from_non_lf_project
4041
SQL >
4142
%
42-
SELECT not isLF AS result
43-
FROM insightsProjects final
44-
WHERE
45-
isNull (deletedAt)
46-
AND enabled = 1
47-
and slug = {{ String(project, description="Filter by project slug", required=True) }}
43+
{% if defined(collectionSlug) %}
44+
SELECT false AS result
45+
{% else %}
46+
SELECT not isLF AS result
47+
FROM insightsProjects final
48+
WHERE
49+
isNull (deletedAt)
50+
AND enabled = 1
51+
and slug = {{ String(project, description="Filter by project slug", required=True) }}
52+
{% end %}
4853

4954
NODE contributors_leaderboard_2
5055
SQL >

0 commit comments

Comments
 (0)