Skip to content

fix(dashboard): fetch real commit activity from weekly-summary API instead of hardcoded data - #3362

Open
nyxsky404 wants to merge 7 commits into
Priyanshu-byte-coder:mainfrom
nyxsky404:issue-3351
Open

fix(dashboard): fetch real commit activity from weekly-summary API instead of hardcoded data#3362
nyxsky404 wants to merge 7 commits into
Priyanshu-byte-coder:mainfrom
nyxsky404:issue-3351

Conversation

@nyxsky404

@nyxsky404 nyxsky404 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

User description

Summary

Replaced the hardcoded MOCK_TELEMETRY_DATA array in CommitActivityWidget with a useEffect fetch to /api/metrics/weekly-summary, which already returns real per-day commit counts (dailyCommits) for the authenticated user.

Changes

  • Removed MOCK_TELEMETRY_DATA constant.
  • Added useEffect to fetch /api/metrics/weekly-summary and map the dailyCommits response into the chart data format.
  • Added proper loading, error, and empty states so the widget never silently falls back to fake numbers.
  • Line additions/deletions display as 0 since the weekly-summary endpoint does not return per-day diff stats; this is honest rather than fabricated.

Fixes #3351


CodeAnt-AI Description

Show real commit activity in the dashboard

What Changed

  • Replaced fabricated weekly commit numbers with activity loaded for the signed-in user
  • Added loading, error, and no-activity states so the widget clearly reflects its current status
  • Displays daily commit counts from the weekly summary; unavailable line additions and removals are shown as zero instead of invented values

Impact

✅ Accurate commit activity
✅ Clearer loading and failure messages
✅ No fabricated repository metrics

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Copilot AI lite review requested due to automatic review settings August 4, 2026 20:19

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:design GSSoC type bonus: UI/design (+10 pts) type:performance GSSoC type bonus: performance (+15 pts) gssoc26 GSSoC 2026 contribution labels Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 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

@nyxsky404

Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder Please review, repo is already stared by me

@github-actions github-actions Bot added type:devops GSSoC type bonus: devops (+15 pts) type:testing GSSoC type bonus: tests (+10 pts) labels Aug 9, 2026
@nyxsky404

Copy link
Copy Markdown
Contributor Author

Hi @Priyanshu-byte-coder — gentle nudge.

This PR is ready for review from my side. I've rebased/kept it current where possible. If CI is red due to unrelated upstream/main issues or deploy previews, the code change itself should still be reviewable.

Please review and merge when you can — and add gssoc:approved (+ difficulty/type) if appropriate so it can count for GSSoC.

Thank you!

@Priyanshu-byte-coder

Copy link
Copy Markdown
Owner

The headline change is a real fix and I want it: CommitActivityWidget was rendering MOCK_TELEMETRY_DATA — a hardcoded array — on a dashboard whose whole purpose is showing real activity. Wiring it to /api/metrics/weekly-summary and adding explicit loading/error/empty states so it can't silently fall back to fake numbers is exactly right.

Some overlap has happened since you opened this on 15 Aug, so it needs a rebase. Three separate things:

1. ProfileQrModal and ShortcutsModal — you found the same bugs I did. #3499 landed fixes for both: the download handler was searching for an svg in a component that renders QRCodeCanvas, and the shortcuts modal's focus effect ran before mounted flipped so focus never entered the dialog. Your diff fixes the same two things. Mine went in first, which is purely an accident of timing — you diagnosed them independently and correctly.

The designs differ: main now has the parent mount ProfileQrModal conditionally rather than taking an isOpen prop. Both are defensible; the shipped one just needs fewer moving parts. So please drop those two files from this branch — that's where the conflict is.

One piece of yours is better than what shipped and I'd like it kept:

previousOverflowRef.current = document.body.style.overflow;
// ...
document.body.style.overflow = previousOverflowRef.current;

main hardcodes the restore to "", which clobbers any inline overflow that was set before the modal opened. Restoring the captured value is correct. Worth its own small PR — I'll merge that on sight.

2. Drop the automated-tests.yml change. Same note as on #3174: continue-on-error: true on pnpm test re-opens what #3354 closed. Your justification held when you wrote it — the suite was red repo-wide — but main is now at 2383 passing, 0 failing, so the gate is meaningful again.

3. The failing Build check is not your fault. The log shows Error while requesting resource ×4 then Turbopack build failed with 12 errors — that's next/font/google failing to fetch at build time. I hit the same thing locally and it passed on retry. It should clear on the rebase.

Rebase on current main, keep the widget fix, drop the two modal files and the workflow hunk, and this goes in.

Keep the weekly-summary CommitActivityWidget wiring and drop the workflow and modal changes that already landed on main.
@codeant-ai

codeant-ai Bot commented Aug 17, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Incremental review completed 5d5f0e9 Aug 17, 2026 · 20:04 20:04
✅ Reviewed your PR 4a47c82 Aug 17, 2026 · 17:12 17:15

@nyxsky404

Copy link
Copy Markdown
Contributor Author

Merged current main and dropped the extra files as requested:

This PR now only wires CommitActivityWidget to /api/metrics/weekly-summary with loading/error/empty states.

I'll open a small follow-up for the overflow restore (previousOverflowRef instead of hardcoding "") so that can land on its own.

Comment thread src/components/dashboard/CommitActivityWidget.tsx Outdated
Comment thread src/components/dashboard/CommitActivityWidget.tsx Outdated
Pass accountId so the widget refetches on account switch, and omit additions/deletions from the tooltip since weekly-summary does not provide them.
@codeant-ai codeant-ai Bot added size:L This PR changes 100-499 lines, ignoring generated files and removed size:M This PR changes 30-99 lines, ignoring generated files labels Aug 17, 2026
@codeant-ai

codeant-ai Bot commented Aug 17, 2026

Copy link
Copy Markdown

User description

Summary

Replaced the hardcoded MOCK_TELEMETRY_DATA array in CommitActivityWidget with a useEffect fetch to /api/metrics/weekly-summary, which already returns real per-day commit counts (dailyCommits) for the authenticated user.

Changes

  • Removed MOCK_TELEMETRY_DATA constant.
  • Added useEffect to fetch /api/metrics/weekly-summary and map the dailyCommits response into the chart data format.
  • Added proper loading, error, and empty states so the widget never silently falls back to fake numbers.
  • Line additions/deletions display as 0 since the weekly-summary endpoint does not return per-day diff stats; this is honest rather than fabricated.

Fixes #3351


CodeAnt-AI Description

Show account-specific commit activity from live weekly summaries

What Changed

  • Replaced hardcoded commit numbers with activity fetched from the weekly summary for the signed-in account
  • Refreshes the chart when the selected account changes
  • Shows clear loading, failure, and no-activity states instead of displaying misleading data
  • Tooltips now show only daily commit totals because line additions and removals are unavailable

Impact

✅ Accurate account-specific commit activity
✅ No fabricated repository metrics
✅ Clearer loading and failure messages

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

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

Labels

gssoc26 GSSoC 2026 contribution size:L This PR changes 100-499 lines, ignoring generated files 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] Commit Activity Tracker displays fixed telemetry for every user

3 participants