Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/cli
Original file line number Diff line number Diff line change
Expand Up @@ -1182,14 +1182,14 @@ while test $# -gt 0; do
exit
;;
service-restart-fe-dev)
IGNORED_SERVICES=("frontend" "python-worker" "job-generator" "webhook-api" "profiles-worker" "organizations-enrichment-worker" "merge-suggestions-worker" "members-enrichment-worker" "exports-worker" "entity-merging-worker")
IGNORED_SERVICES=("frontend" "python-worker" "job-generator" "webhook-api" "profiles-worker" "organizations-enrichment-worker" "merge-suggestions-worker" "members-enrichment-worker" "exports-worker" "entity-merging-worker" "automatic-projects-discovery-worker" "pcc-sync-worker" "projects-evaluation-worker" "bq-dataset-ingest" "cargo-worker" "dockerhub-sync" "github-repos-enricher" "go-worker" "maven-worker" "npm-worker" "nuget-worker" "osv-worker" "pypi-worker" "rubygems-worker" "security-contacts-worker")
DEV=1
kill_all_containers
service_start
exit
;;
clean-start-fe-dev)
IGNORED_SERVICES=("frontend" "python-worker" "job-generator" "webhook-api" "profiles-worker" "organizations-enrichment-worker" "merge-suggestions-worker" "members-enrichment-worker" "exports-worker" "entity-merging-worker" "cache-worker" "categorization-worker" "cron-service" "data-sink-worker" "git-integration" "integration-run-worker" "integration-stream-worker" "nango-webhook-api" "nango-worker" "script-executor-worker" "search-sync-api" "search-sync-worker" "security-best-practices-worker" "snowflake-connectors-worker")
IGNORED_SERVICES=("frontend" "python-worker" "job-generator" "webhook-api" "profiles-worker" "organizations-enrichment-worker" "merge-suggestions-worker" "members-enrichment-worker" "exports-worker" "entity-merging-worker" "cache-worker" "categorization-worker" "cron-service" "data-sink-worker" "git-integration" "integration-run-worker" "integration-stream-worker" "nango-webhook-api" "nango-worker" "script-executor-worker" "search-sync-api" "search-sync-worker" "security-best-practices-worker" "snowflake-connectors-worker" "automatic-projects-discovery-worker" "pcc-sync-worker" "projects-evaluation-worker" "bq-dataset-ingest" "cargo-worker" "dockerhub-sync" "github-repos-enricher" "go-worker" "maven-worker" "npm-worker" "nuget-worker" "osv-worker" "pypi-worker" "rubygems-worker" "security-contacts-worker")
CLEAN_START=1
DEV=1
start
Expand Down
50 changes: 50 additions & 0 deletions services/libs/tinybird/pipes/collection_insights_aggregate.pipe
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
DESCRIPTION >
Comment thread
joanagmaia marked this conversation as resolved.
Comment thread
joanagmaia marked this conversation as resolved.
- `collection_insights_aggregate.pipe` serves aggregate insights metrics for a collection.
- Returns a single row with metrics aggregated across every project in the collection, not one row per project.
- Parameters:
- `collectionSlug`: Required collection slug. insights_projects_populated_ds.collectionsSlugs already lists
every collection each project belongs to (see insightsProjects_filtered.pipe for the same filter pattern),
so this pipe resolves collection membership directly rather than requiring the caller to first look up a
project id list.
- Response:
- `projectCount`: count of distinct projects in the collection.
- `uniqueContributorCount`: total unique contributors across all projects in the collection, deduplicated (a contributor active on multiple projects in the collection is counted once).
- `avgHealthScore`: average of each project's health score in the collection, rounded.

TAGS "Insights, Widget", "Collection"

NODE collection_insights_aggregate_projects
DESCRIPTION >
Resolves the collection's member projects to their segment ids and health scores directly via
collectionsSlugs, matching the same has(collectionsSlugs, ...) filter already used by
insightsProjects_filtered.pipe.

SQL >
%
SELECT id, segmentId, healthScore
FROM insights_projects_populated_ds
WHERE
enabled = 1
AND has(
collectionsSlugs,
{{ String(collectionSlug, description="Filter by collection slug", required=True) }}
Comment thread
joanagmaia marked this conversation as resolved.
)
Comment thread
joanagmaia marked this conversation as resolved.
Comment thread
joanagmaia marked this conversation as resolved.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing empty segmentId filter

Medium Severity

The projects node does not exclude rows where segmentId is an empty string before those ids feed the activity IN filter. Elsewhere (e.g. leaderboards_members, health_score_copy) empty segmentId values are dropped. Matching on '' can pull unrelated activity rows and inflate uniqueContributorCount.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit cc3b759. Configure here.


NODE collection_insights_aggregate_results
DESCRIPTION >
Aggregates health score across matched projects and counts unique contributors across their segments in one pass

SQL >
SELECT
(SELECT count(distinct id) FROM collection_insights_aggregate_projects) AS projectCount,
uniq(ar.memberId) AS uniqueContributorCount,
(SELECT round(avg(healthScore)) FROM collection_insights_aggregate_projects) AS avgHealthScore
FROM activityRelations_deduplicated_cleaned_bucket_union AS ar
WHERE
ar.memberId != ''
AND ar.segmentId IN (SELECT segmentId FROM collection_insights_aggregate_projects)
Comment thread
gaspergrom marked this conversation as resolved.
Comment thread
gaspergrom marked this conversation as resolved.
Comment thread
gaspergrom marked this conversation as resolved.
Comment thread
cursor[bot] marked this conversation as resolved.
Comment thread
gaspergrom marked this conversation as resolved.
AND (ar.type, ar.platform) IN (
SELECT activityType, platform
FROM activityTypes
WHERE isCodeContribution = 1 OR isCollaboration = 1
)
Comment on lines +38 to +50
Comment on lines +38 to +50
Loading