Skip to content

fix: include community collections in collectionsSlugs (IN-1195)#4360

Merged
gaspergrom merged 1 commit into
mainfrom
fix/IN-1195-community-collection-metrics
Jul 18, 2026
Merged

fix: include community collections in collectionsSlugs (IN-1195)#4360
gaspergrom merged 1 commit into
mainfrom
fix/IN-1195-community-collection-metrics

Conversation

@gaspergrom

Copy link
Copy Markdown
Contributor

Problem

Community (non-LF) collection detail pages show Contributors: 0 and Avg. Health: — even when the collection has projects (e.g. agentic-ai-momentum-watchlist shows 88 projects but 0 contributors). Reported from a review of the Collections feature.

Root cause is in the Tinybird layer, not the frontend. The collection_insights_aggregate pipe (which powers the header metrics) resolves collection membership via insights_projects_populated_ds.collectionsSlugs. That array is built in insights_projects_populated_copy.pipe, whose collectionsSlugs node filtered with AND isNull(c.ssoUserId)ssoUserId is set for community/user-created collections and null only for curated (LF) ones. So every community collection was excluded from collectionsSlugs, and the aggregate pipe matched 0 projects for them → uniqueContributorCount: 0, avgHealthScore: nan. The Postgres-derived project count still worked, which is why the count showed but the other two metrics didn't.

Verified against prod Tinybird:

  • cloud-native-computing-foundation-(cncf) (curated) → 127 / 306251 / 72 ✅
  • agentic-ai-momentum-watchlist (community) → 0 / 0 / nan ❌
  • arrayJoin(collectionsSlugs) contains no community slugs (only curated).

Fix

Drop the AND isNull(c.ssoUserId) filter from the collectionsSlugs node so community collection memberships are populated alongside curated ones.

Blast radius

Other consumers of collectionsSlugs (collection_insights_aggregate, segments_filtered_by_collection, leaderboards_*, insightsProjects_filtered) only apply a collectionsSlugs filter when an explicit collectionSlug param is passed — so no un-scoped listing changes. The only new capability is that passing a community collectionSlug now returns results, which is the intended behavior.

insights_projects_populated_copy is a COPY pipe on a */15 * * * * schedule, so the 43 existing community collections will backfill correct metrics on the next run after deploy — no manual backfill needed.

Validation

  • tb check passes
  • tb fmt applied
  • No schema change; datasource collectionsSlugs column unchanged (only more rows populated)

Related

Frontend collection-widget wiring (Contributors/Popularity/Development tabs) is tracked separately in insights PR #2013 (IN-1191). This PR is the upstream data half and is independent of it.

https://claude.ai/code/session_014Fc86j8FLeWFAs3fDCQs38

collection_insights_aggregate reported 0 contributors and no health score
for community (non-LF) collections because insights_projects_populated_copy
excluded them via isNull(c.ssoUserId) when building collectionsSlugs. Drop
that filter so community collection memberships are populated too.

Downstream leaderboard and insightsProjects_filtered pipes only apply the
collectionsSlugs filter when an explicit collectionSlug param is passed, so
un-scoped listings are unaffected.

Claude-Session: https://claude.ai/code/session_014Fc86j8FLeWFAs3fDCQs38
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
Copilot AI review requested due to automatic review settings July 18, 2026 11:17
@cursor

cursor Bot commented Jul 18, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Single WHERE-clause change in a scheduled COPY pipe; scoped to collection slug filtering with no schema changes.

Overview
Fixes community collection header metrics (Contributors: 0, Avg. Health: —) by changing how collectionsSlugs is built in insights_projects_populated_copy.pipe.

The collectionsSlugs node no longer filters out collections where ssoUserId is set, so community memberships are written into insights_projects_populated_ds alongside curated ones. That lets collection_insights_aggregate resolve projects when a community collectionSlug is passed.

Downstream pipes only filter on collectionsSlugs when an explicit collectionSlug is provided, so un-scoped listings should be unchanged. The COPY pipe’s 15-minute schedule is expected to backfill existing community collections after deploy.

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

Pull request overview

Updates Tinybird collection membership so public community collections receive contributor and health metrics.

Changes:

  • Removes the curated-only collection filter.
  • Documents downstream impact.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

FROM collectionsInsightsProjects cip FINAL
JOIN collections c FINAL ON c.id = cip.collectionId
WHERE isNull (c.deletedAt) AND isNull (c.ssoUserId) AND isNull (cip.deletedAt)
WHERE isNull (c.deletedAt) AND isNull (cip.deletedAt)
@gaspergrom
gaspergrom merged commit 2fe97e5 into main Jul 18, 2026
16 checks passed
@gaspergrom
gaspergrom deleted the fix/IN-1195-community-collection-metrics branch July 18, 2026 12:12
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.

2 participants