Skip to content

feat(maintainer/analytics): add PR Volume chart component - #770

Merged
jakharmonika364 merged 4 commits into
Coder-s-OG-s:mainfrom
diksha78dev:feat/maintainer-analytics-pr-volume
Jul 26, 2026
Merged

feat(maintainer/analytics): add PR Volume chart component#770
jakharmonika364 merged 4 commits into
Coder-s-OG-s:mainfrom
diksha78dev:feat/maintainer-analytics-pr-volume

Conversation

@diksha78dev

Copy link
Copy Markdown
Collaborator

Summary

Adds the PR Volume area chart to the maintainer analytics dashboard showing Merged, AI Blocked, and Stalled PR series over the selected time range.

Type of Change

  • Bug fix
  • New feature
  • UI / UX improvement
  • Refactor
  • Documentation
  • Other

Related Issue

Closes #717

What was changed?

  • Added getPrVolumeTimeSeries server action in src/app/actions/maintainer/analytics.ts to calculate dynamic bucket intervals (daily/weekly/monthly) and tally PRs.
  • Created <PrVolumeChart> in src/app/(app)/maintainer/analytics/pr-volume-chart.tsx using Recharts to match the design specifications (green area, dashed line graphs).
  • Added empty state handling for periods with no data.

Screenshots

Checklist

  • My code follows the project structure and conventions
  • I tested this locally (npm run dev)
  • No hardcoded secrets or credentials
  • I have updated documentation if needed

@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@diksha78dev is attempting to deploy a commit to the codersogs-3057's projects Team on Vercel.

A member of the Team first needs to authorize it.

@diksha78dev
diksha78dev force-pushed the feat/maintainer-analytics-pr-volume branch from 22c131a to b4d7f3d Compare July 22, 2026 05:18
@Ayush4958

Copy link
Copy Markdown
Collaborator

@diksha78dev
could you add on recording of feature ??
thnks

@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mergeship Ready Ready Preview, Comment Jul 22, 2026 12:18pm

@Siddhartha-singh01 Siddhartha-singh01 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

## Review #770

**Verdict:** Request changes

### Good
- `requireMaintainer` + install repo scoping looks right.
- Chart empty state and Recharts styling match existing analytics cards.
- CI green; Vercel preview ready.

### Blockers
1. **Not wired to the UI** `analytics/page.tsx` never calls `getPrVolumeTimeSeries` or renders `PrVolumeChart`. Feature would not appear after merge.
2. **Not exported** from `src/app/actions/maintainer/index.ts` like the other analytics actions.
3. **Merged under-count** query filters only `githubCreatedAt >= from`, but buckets merged by `mergedAt`. PRs created before the range and merged inside it are missed. Also add an upper bound to `to`.
4. **Stalled series is wrong** uses current `state === 'open'` and increments **every** bucket where `githubUpdatedAt` is older than bucketEnd−7d. One stale PR inflates the whole chart. Also uses 7d while `getStalePrs` defaults to 14d.

### Also
- Nested loop O(PRs × buckets) will hurt on `all` + large installs; bucket by event timestamp instead.
- No unit tests for bucketing / series rules.
- Please add the screen recording @Ayush4958 asked for once the chart is actually on the page (then we can clear **Needs author reply**).

@diksha78dev wire the chart into the analytics page, fix merge/stalled math, re-export the action, and this becomes a solid #717 close.

@diksha78dev

Copy link
Copy Markdown
Collaborator Author
Screen.Recording.2026-07-25.170945.mp4

@Ayush4958 , @Siddhartha-singh01 i have addressed all the fixes which are needed you can review again and let me know if anything else requires to be fixed or add i'd be happy to resolve them.
Thanks.

@Siddhartha-singh01 Siddhartha-singh01 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the updates and the screen recording, @diksha78dev! I've reviewed the latest code changes.

The Good ✅

  • UI & Exports: Everything is correctly exported and wired up to the analytics page.
  • Merged Under-Count Fixed: Changing the query to fetch all PRs created before to perfectly solves the missing merged PRs issue.
  • Stalled Series Fixed: The rolling window logic (githubUpdatedAt + 14 days) for calculating stalled PRs across buckets is much more accurate now.
  • Loop Optimization: Excellent job refactoring the nested loops. The findBucketIndex helper and the conditional overlap checks for stalled PRs are great optimizations.

Remaining Blocker ❌

  • Unit Tests: I noticed there are still no unit tests for the bucketing and series rules (which was requested in the original review). Since the date math for getPrVolumeTimeSeries (especially the stalled logic) is complex, we need a few test cases in a .test.ts file to ensure this doesn't accidentally break in the future.

@diksha78dev

Copy link
Copy Markdown
Collaborator Author

@Siddhartha-singh01 I have added the unit tests for the bucketing and series rules.

@jakharmonika364 jakharmonika364 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@jakharmonika364 jakharmonika364 added level:advanced Advanced level difficulty quality:clean Clean, well-structured contribution type:feature New feature gssoc:approved Approved by GSSOC admin SSoC26 Hard ECSoC26 ECSoC26-L3 Hard good-pr and removed Needs author reply Author need to reply labels Jul 26, 2026
@jakharmonika364
jakharmonika364 merged commit 774c77f into Coder-s-OG-s:main Jul 26, 2026
2 of 3 checks passed
@ecsoc-sentinel ecsoc-sentinel Bot removed the ECSoC26-L3 Hard label Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ECSoC26-L3 Hard ECSoC26 good-pr gssoc:approved Approved by GSSOC admin Hard level:advanced Advanced level difficulty quality:clean Clean, well-structured contribution SSoC26 type:feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(maintainer/analytics): add PR Volume area chart with Merged, AI Blocked, and Stalled series

5 participants