Skip to content

fix: collection dev-velocity scope + repo contributor count inflation (IN-1195)#4361

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

fix: collection dev-velocity scope + repo contributor count inflation (IN-1195)#4361
gaspergrom merged 1 commit into
mainfrom
fix/IN-1195-collection-dev-velocity

Conversation

@gaspergrom

Copy link
Copy Markdown
Contributor

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.pipe and pull_requests_average_resolve_velocity.pipe scoped only to a single project (segmentId = (SELECT segmentId FROM segments_filtered)). segments_filtered requires a project param, so a collection-scoped call (with collectionSlug) matched no segment and returned null. The frontend rendered that null as a literal "Avg. velocity: 0 seconds".

2. Projects table — Contributors column inflated by stargazers

repositories_populated_copy.pipe computed repo-level contributorCount as uniq(memberId) over all activity in activityRelations_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 through project_insights_copy_dsproject_repo_insights → the collection projects-table Contributors column.

Fix

  1. Add the collectionSlug branch to both velocity pipes — segmentId IN (SELECT segmentId FROM segments_filtered_by_collection) — mirroring the exact pattern already used by activities_filtered.pipe and the other collection-scoped widget pipes. Project-scope behavior is unchanged.
  2. Exclude type IN ('star', 'fork') when counting repo contributors, matching the "contributions only" semantics the widget pipes use via onlyContributions/activityTypes_filtered.

Verification (against prod Tinybird)

Metric Before After
CNCF collection avg issue-resolve velocity null → UI "0 seconds" 8,744,956 s (~101 days)
OpenClaw repo contributorCount 483,139 46,031

tb check passes on all three pipes; tb fmt applied.

Blast radius / note for reviewers

  • The velocity change is additive (a new collectionSlug branch); project-scoped callers are unaffected.
  • The contributorCount change affects repo-level contributor counts platform-wide, not just collections — it can only reduce an inflated count (removes star/fork engagement). repositories_populated_copy is 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

https://claude.ai/code/session_014Fc86j8FLeWFAs3fDCQs38

… (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>
Copilot AI review requested due to automatic review settings July 18, 2026 13:47
@cursor

cursor Bot commented Jul 18, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Collection velocity is an additive branch with low blast radius; contributor counts change platform-wide wherever repositories_populated_copy feeds metrics, though only downward corrections.

Overview
Fixes collection in-depth Development metrics and repository contributor counts in Tinybird pipes.

Avg. velocity on collections: issues_average_resolve_velocity and pull_requests_average_resolve_velocity previously filtered to a single segmentId via segments_filtered (project-only). Collection calls with collectionSlug matched no segment and returned null (UI showed “0 seconds”). Both pipes now branch on collectionSlug to use segmentId IN (SELECT segmentId FROM segments_filtered_by_collection), consistent with pipes like activities_filtered. Project-scoped behavior is unchanged.

Inflated Contributors column: repositories_populated_copy counted every distinct memberId in activity data, including star and fork events. Repo-level contributorCount (and downstream collection project tables) is corrected by excluding type IN ('star', 'fork'), aligning with contribution-only semantics used elsewhere. Counts can only decrease; the COPY pipe recomputes on its schedule after deploy.

Reviewed by Cursor Bugbot for commit 6664f5e. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

Triggered by learned rule: Tinybird pipes counting contributors must filter by activityTypes

Reviewed by Cursor Bugbot for commit 6664f5e. 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

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')
@gaspergrom
gaspergrom merged commit 9c0f754 into main Jul 18, 2026
16 checks passed
@gaspergrom
gaspergrom deleted the fix/IN-1195-collection-dev-velocity branch July 18, 2026 14:41
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