Skip to content

feat: add maintainer analytics trends#195

Open
saurabhhhcodes wants to merge 1 commit into
Coder-s-OG-s:mainfrom
saurabhhhcodes:feat/maintainer-analytics-trends-92
Open

feat: add maintainer analytics trends#195
saurabhhhcodes wants to merge 1 commit into
Coder-s-OG-s:mainfrom
saurabhhhcodes:feat/maintainer-analytics-trends-92

Conversation

@saurabhhhcodes
Copy link
Copy Markdown
Contributor

Summary

  • adds 12-week weekly merge-rate and XP-distributed trend charts to /maintainer
  • adds a 6-month stacked L0/L1/L2/L3+ contributor level distribution chart
  • scopes analytics to the selected maintainer installation repositories and caches the compact chart payload for 30 minutes
  • adds a Supabase SQL aggregation function so the page receives aggregated JSON instead of raw PR/recommendation/profile rows

Performance notes

The heavy aggregation is done in Postgres via maintainer_analytics_trends(repo_names text[], as_of timestamptz default now()).

EXPLAIN ANALYZE query used for review:

explain analyze
select maintainer_analytics_trends(array['demo/sample-repo']::text[]);

The query is bounded to 12 weeks for weekly PR/XP trends and 6 months for level distribution snapshots. It filters by repo_full_name = any(repo_names) and uses existing indexed tables/columns around pull_requests.repo_full_name, pull_requests.state, recommendation issue joins, and profile/level-up lookups. The function returns one JSON payload, so the route avoids shipping raw event rows to React.

Tests

  • npm run test -- src/lib/maintainer/analytics.test.ts
  • npm run lint -- --file 'src/app/(app)/maintainer/page.tsx' --file 'src/app/(app)/maintainer/analytics-trends.tsx' --file src/app/actions/maintainer.ts --file src/lib/maintainer/analytics.ts
  • npm run typecheck
  • npm run build passes; existing unrelated warnings remain in src/app/(app)/dashboard/sync-button.tsx, src/app/(app)/issues/issues-list.tsx, and metadataBase.

Closes #92

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 21, 2026

@saurabhhhcodes 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.

@saurabhhhcodes
Copy link
Copy Markdown
Contributor Author

Thanks again for assigning #92. I kept this scoped to the maintainer analytics page and moved the aggregation into Postgres so the UI only receives compact chart data. When reviewing, could you also add the appropriate GSSoC approval / difficulty / type labels if this fits the program scoring? I included the EXPLAIN ANALYZE query in the PR body for the performance check.

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.

Maintainer analytics - merge rate and XP distribution over time

1 participant