Skip to content

fix(metrics): include GraphQL discussion activity in engagement score - #3461

Open
nyxsky404 wants to merge 4 commits into
Priyanshu-byte-coder:mainfrom
nyxsky404:fix/community-engagement-discussions
Open

fix(metrics): include GraphQL discussion activity in engagement score#3461
nyxsky404 wants to merge 4 commits into
Priyanshu-byte-coder:mainfrom
nyxsky404:fix/community-engagement-discussions

Conversation

@nyxsky404

Copy link
Copy Markdown
Contributor

Summary

/api/metrics/devtrack-badges always returned discussions.count/points: 0 because the score used a hardcoded placeholder. This wires up the same GraphQL contributionsCollection fields used by /api/metrics/discussions (discussion + discussion-comment counts for the last 30 days) and folds them into the weighted breakdown (* 2, capped at 15). GraphQL failures soft-fail to 0 so the rest of the score still returns.

Closes #3352


Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing behavior)
  • Documentation update
  • Refactor / code cleanup (no functional change)
  • Performance improvement
  • Security fix
  • Tests only

What Changed

  • Added GraphQL discussion contribution fetch in src/app/api/metrics/devtrack-badges/route.ts
  • Included real discussion count/points in the community engagement breakdown
  • Added unit coverage for users with activity, without activity, and GraphQL failure

How to Test

  1. Sign in with a GitHub account that has discussion or discussion-comment activity in the last 30 days
  2. Call GET /api/metrics/devtrack-badges
  3. Confirm breakdown.discussions.count and points are non-zero and total includes those points
  4. For an account with no discussion activity, confirm discussions stay at 0 while other categories still populate

Expected result:

Discussions reflect real GitHub contribution data instead of a permanent zero placeholder.


Checklist

  • Linked the related issue above
  • Self-reviewed my own diff
  • No unnecessary console.log, debug code, or commented-out blocks
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Added or updated tests where applicable
  • Updated documentation / comments if behavior changed

Additional Context

Weight matches issuesOpened (count * 2, max 15). Overall score still clamps to 100.

Made with Cursor

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI lite review requested due to automatic review settings August 6, 2026 11:29

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added type:bug GSSoC type bonus: bug fix type:feature GSSoC type bonus: new feature type:testing GSSoC type bonus: tests (+10 pts) type:performance GSSoC type bonus: performance (+15 pts) gssoc26 GSSoC 2026 contribution labels Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@github-actions github-actions Bot added the type:design GSSoC type bonus: UI/design (+10 pts) label Aug 9, 2026
@github-actions github-actions Bot added the type:devops GSSoC type bonus: devops (+15 pts) label Aug 9, 2026
@nyxsky404

Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder please review pr and merge it, i have also fixed the ci failures

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix type:design GSSoC type bonus: UI/design (+10 pts) type:devops GSSoC type bonus: devops (+15 pts) type:feature GSSoC type bonus: new feature type:performance GSSoC type bonus: performance (+15 pts) type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Community engagement metric always reports zero discussion activity

2 participants