Skip to content

feat: repos collaboration signal [CM-1332] - #4404

Open
mbani01 wants to merge 4 commits into
mainfrom
feat/collaboration-signal
Open

feat: repos collaboration signal [CM-1332]#4404
mbani01 wants to merge 4 commits into
mainfrom
feat/collaboration-signal

Conversation

@mbani01

@mbani01 mbani01 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces a new "collaboration signal" for repositories, which is calculated based on recent external pull request activity, issue responsiveness, and advisory status. It adds new fields to the database, updates the enrichment pipeline to collect and store external PR metrics, and includes a scoring/tiering mechanism that is periodically recomputed. These changes improve the system's ability to assess and track repository collaboration health.

Database Schema Changes:

  • Added external_prs_opened_12m and external_prs_merged_12m columns to repo_activity_snapshot, and collaboration_score and collaboration_tier columns to repos to support collaboration signal tracking.

Data Collection and Enrichment:

  • Updated the enrichment pipeline to collect the number of external PRs opened/merged in the past 12 months (excluding maintainers) and store these metrics in repo_activity_snapshot. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Collaboration Signal Computation:

  • Implemented the updateCollaborationSignal function, which computes a collaboration score and tier for each critical repository based on responsiveness, external PR activity, and advisory status, and updates these values in the repos table.

Pipeline Integration:

  • Integrated the collaboration signal recomputation into the enrichment loop so that scores and tiers are updated after each processing sweep. [1] [2]

These changes provide a more nuanced and up-to-date view of repository collaboration health, enabling better insights and prioritization.

mbani01 added 4 commits July 27, 2026 17:04
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
@mbani01 mbani01 self-assigned this Jul 27, 2026
Copilot AI review requested due to automatic review settings July 27, 2026 17:08
@cursor

cursor Bot commented Jul 27, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
New batch SQL updates repos for all critical-package repos each sweep; scoring logic and external-PR classification affect downstream prioritization if consumed in product.

Overview
Adds a collaboration signal on critical-package repos: new snapshot fields for external PR volume, plus collaboration_score / collaboration_tier on repos.

Activity enrichment now requests authorAssociation on PRs and derives 12m external PR opened/merged counts (excluding OWNER/MEMBER/COLLABORATOR) via computeExternalPrCounts, persisted through the snapshot upsert path.

After each full enrichment sweep, updateCollaborationSignal recomputes score and tier for critical repos from issue responsiveness, external (or fallback all) PR merge rate, and advisory fix/age signals; archived/disabled repos get tier inactive. Failures are logged and retried on the next sweep.

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

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@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 4ba2b92. Configure here.

BOOL_OR(EXISTS (
SELECT 1 FROM advisory_affected_ranges rg
WHERE rg.advisory_package_id = ap.id AND rg.fixed_version IS NOT NULL
)) AS any_fixed,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Soft-deleted fixes inflate score

Medium Severity

The any_fixed check reads advisory_affected_ranges without filtering deleted_at IS NULL. Soft-deleted ranges (from OSV reconcile or deps.dev supersede) still count as fixes, so comp_a can stay 1.0 after a fix was removed or superseded and inflate the collaboration score.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4ba2b92. 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

Adds repository collaboration scoring based on external PRs, issue responsiveness, and advisory status.

Changes:

  • Collects and persists external PR metrics.
  • Computes collaboration scores and tiers for critical repositories.
  • Recomputes signals after enrichment sweeps.

Metadata: PR title should end with (CM-1332), not [CM-1332].

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
updateRepoActivitySnapshot.ts Persists external PR counts.
updateCollaborationSignal.ts Computes and stores collaboration signals.
types.ts Types external PR metrics.
runEnrichmentLoop.ts Schedules signal recomputation.
fetchActivitySnapshot.ts Fetches PR author associations.
computeMedians.ts Counts non-maintainer PRs.
V1785167431__collaboration_signal.sql Adds collaboration columns.

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

Comment on lines +82 to +83
SET collaboration_score = f.new_score,
collaboration_tier = f.new_tier
Comment on lines +15 to +16
SELECT 1 FROM advisory_affected_ranges rg
WHERE rg.advisory_package_id = ap.id AND rg.fixed_version IS NOT NULL
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.

3 participants