fix: collection dev-velocity scope + repo contributor count inflation (IN-1195)#4361
Conversation
… (IN-1195)
Two data-quality bugs found during Collections v2 prod QA:
- issues_average_resolve_velocity and pull_requests_average_resolve_velocity
only scoped by a single project (segmentId = segments_filtered), so a
collection-scoped call returned null, which the Development tab rendered as
'Avg. velocity: 0 seconds'. Add the collectionSlug branch
(segmentId IN segments_filtered_by_collection), matching activities_filtered.
- repositories_populated_copy computed repo contributorCount as uniq(memberId)
over ALL activity, counting stargazers and forkers as contributors. This
inflated the projects-table Contributors column massively (OpenClaw showed
483K vs a true ~46K; 404K were stargazers). Exclude type IN ('star','fork').
Verified against prod Tinybird: CNCF collection issue velocity now 8.74M s
(was null); OpenClaw contributorCount now 46,031 (was 483,139).
Claude-Session: https://claude.ai/code/session_014Fc86j8FLeWFAs3fDCQs38
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
PR SummaryMedium Risk Overview Avg. velocity on collections: Inflated Contributors column: Reviewed by Cursor Bugbot for commit 6664f5e. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6664f5e. Configure here.
| uniq(CASE WHEN memberId != '' THEN memberId ELSE NULL END) AS contributorCount, | ||
| uniq(CASE WHEN organizationId != '' THEN organizationId ELSE NULL END) AS organizationCount | ||
| FROM activityRelations_deduplicated_cleaned_bucket_union | ||
| WHERE type NOT IN ('star', 'fork') |
There was a problem hiding this comment.
Incomplete contributor activity type filter
Medium Severity
Repo contributorCount and organizationCount now exclude only star and fork activities. Pipes that define contributors on activityRelations_deduplicated_cleaned_bucket_union are expected to restrict rows to code and collaboration activity types via activityTypes, not a short denylist. Members with only other non-contribution activity (e.g. reactions or membership events) can still inflate counts relative to widgets and collection_insights_aggregate.
Triggered by learned rule: Tinybird pipes counting contributors must filter by activityTypes
Reviewed by Cursor Bugbot for commit 6664f5e. Configure here.
There was a problem hiding this comment.
Pull request overview
Fixes collection-scoped velocity metrics and repository contributor inflation.
Changes:
- Adds collection scoping to issue and pull-request velocity pipes.
- Excludes engagement activity from repository contributor counts.
- One issue remains: contributor filtering still includes other non-contribution activity types.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
repositories_populated_copy.pipe |
Updates repository contributor filtering. |
pull_requests_average_resolve_velocity.pipe |
Adds collection scope for PR velocity. |
issues_average_resolve_velocity.pipe |
Adds collection scope for issue velocity. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| uniq(CASE WHEN memberId != '' THEN memberId ELSE NULL END) AS contributorCount, | ||
| uniq(CASE WHEN organizationId != '' THEN organizationId ELSE NULL END) AS organizationCount | ||
| FROM activityRelations_deduplicated_cleaned_bucket_union | ||
| WHERE type NOT IN ('star', 'fork') |


Problem
Two data-quality bugs surfaced during Collections v2 (IN-1191) prod QA of the LF Foundation collection in-depth tabs.
1. Development tab — "Avg. velocity: 0 seconds" on every collection
issues_average_resolve_velocity.pipeandpull_requests_average_resolve_velocity.pipescoped only to a single project (segmentId = (SELECT segmentId FROM segments_filtered)).segments_filteredrequires aprojectparam, so a collection-scoped call (withcollectionSlug) matched no segment and returnednull. The frontend rendered that null as a literal "Avg. velocity: 0 seconds".2. Projects table — Contributors column inflated by stargazers
repositories_populated_copy.pipecomputed repo-levelcontributorCountasuniq(memberId)over all activity inactivityRelations_deduplicated_cleaned_bucket_union— with no contribution-type filter. That counts stargazers and forkers as contributors. For OpenClaw this produced 483,139 where the true contributor count is ~46,031 (404,619 of the counted members were stargazers, 86,360 forkers). This value flows throughproject_insights_copy_ds→project_repo_insights→ the collection projects-table Contributors column.Fix
collectionSlugbranch to both velocity pipes —segmentId IN (SELECT segmentId FROM segments_filtered_by_collection)— mirroring the exact pattern already used byactivities_filtered.pipeand the other collection-scoped widget pipes. Project-scope behavior is unchanged.type IN ('star', 'fork')when counting repo contributors, matching the "contributions only" semantics the widget pipes use viaonlyContributions/activityTypes_filtered.Verification (against prod Tinybird)
null→ UI "0 seconds"contributorCounttb checkpasses on all three pipes;tb fmtapplied.Blast radius / note for reviewers
collectionSlugbranch); project-scoped callers are unaffected.contributorCountchange affects repo-level contributor counts platform-wide, not just collections — it can only reduce an inflated count (removes star/fork engagement).repositories_populated_copyis a COPY pipe on a schedule, so counts recompute on the next run after deploy. Flagging in case the current (inflated) definition was relied upon anywhere; the corrected definition (excluding stars/forks) matches how contributors are counted elsewhere.Related
feat/collections-widget.copy-of-agentic-ai-momentum-watchlisthas 0 rows incollectionsInsightsProjects(CDC/collection-copy membership gap, not a pipe-logic bug).https://claude.ai/code/session_014Fc86j8FLeWFAs3fDCQs38