Skip to content

feat: add gitlab mr stats to pr metrics#293

Open
Akanksha-020 wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
Akanksha-020:feat/issue-11-gitlab-pr-metrics
Open

feat: add gitlab mr stats to pr metrics#293
Akanksha-020 wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
Akanksha-020:feat/issue-11-gitlab-pr-metrics

Conversation

@Akanksha-020
Copy link
Copy Markdown

@Akanksha-020 Akanksha-020 commented May 17, 2026

Summary

Brief description of what this PR does.

Closes #10

Type of Change

  • Bug fix
  • [..] New feature
  • Documentation update
  • Refactor / code cleanup

Changes Made

  • Fetch GitLab MRs when session.gitlabToken exists and merge with GitHub PR stats.
  • Return combined totals plus per‑source stats in the PR metrics API.
  • Display a GitLab “Sources” section in the PRMetrics card when available.

How to Test

Steps for the reviewer to verify this works:

  1. Sign in and ensure session.gitlabToken is set.
  2. Open the dashboard → verify PR Metrics shows combined totals and a GitLab section.
  3. Call GET /api/metrics/prs and confirm sources.gitlab appears with metrics.
  4. Repeat without a GitLab token and confirm GitHub‑only stats.

Screenshots (if UI change)

NA

Checklist

  • [.. ] Linked issue in summary
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • [.. ] Self-reviewed the diff
  • Added/updated tests if applicable

@vercel
Copy link
Copy Markdown

vercel Bot commented May 17, 2026

@Akanksha-020 is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

This PR conflicts with recently merged changes. Please rebase onto main:

git fetch upstream && git rebase upstream/main

Resolve any conflicts, push, and I'll review.

@Akanksha-020
Copy link
Copy Markdown
Author

okay I will do that and get back to you

Copy link
Copy Markdown
Owner

@Priyanshu-byte-coder Priyanshu-byte-coder left a comment

Choose a reason for hiding this comment

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

Changes Required

1. Depends on unmerged GitLab OAuth (PR #317)
session.gitlabToken won't exist until the GitLab OAuth PR lands — and that PR itself has blocking issues. This feature silently no-ops until then. Please mark as draft or rebase after #317 merges.

2. Rebase required
Conflicts with PRs #392 and #396 which also modify prs/route.ts. Rebase after those are resolved.

3. Only 100 GitLab MRs fetched — no pagination
per_page=100 with no follow-up pages means heavy GitLab users lose data silently. Add X-Total-Pages header handling or at least document the 100-MR cap.

4. Missing withMetricsCache wrapper
Other metric routes (post PR #311) use withMetricsCache. This route hits both GitHub and GitLab on every request with no caching.

5. GitHub state === "closed" counts rejected PRs as merged
githubStats.merged++ triggers on pr.state === "closed" which includes PRs closed without merging. Use pr.pull_request?.merged_at != null to count only actually merged PRs (same fix applied in PR #396).

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.

[FEAT] GitLab — contribution graph data

2 participants