Skip to content

fix(stats): report correct cache status for cold requests#6228

Merged
JhaSourav07 merged 1 commit into
JhaSourav07:mainfrom
vipul674:fix/stats-cache-status-clean
Jun 21, 2026
Merged

fix(stats): report correct cache status for cold requests#6228
JhaSourav07 merged 1 commit into
JhaSourav07:mainfrom
vipul674:fix/stats-cache-status-clean

Conversation

@vipul674

Copy link
Copy Markdown
Contributor

Related Issue

Fixes #5503

Type of Change

  • Bug fix

Description

Check if cache had data before fetch using contributionsCache.has(). Now correctly reports:

  • MISS for cold requests (no cache entry)
  • HIT for requests served from cache
  • MISS for bypass requests

Testing

  • All existing tests pass (37/37)
  • Added mocks for contributionsCache and cacheKey in test files

Checklist

  • Code follows project style
  • Tests pass
  • No console.log statements
  • Related issue linked

Check if cache had data before fetch using contributionsCache.has().
Now correctly reports:
- MISS for cold requests (no cache entry)
- HIT for requests served from cache
- MISS for bypass requests

Fixes JhaSourav07#5503
@vercel

vercel Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

@vipul674 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

@vipul674

Copy link
Copy Markdown
Contributor Author

@JhaSourav07 Ready for review. All tests passing.

@github-actions

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Size Report (Gzipped Sizes)

✨ No significant bundle size changes detected.

📊 Summary of Totals

Category PR Size Base Size Difference
Total JS 3697.00 KB 3697.00 KB 0 B
Total CSS 296.58 KB 296.58 KB 0 B

@Aamod-Dev Aamod-Dev added GSSoC 2026 mentor:Aamod007 level:beginner Small changes Usually isolated fixes or simple UI/text updates. quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. bug Something isn't working labels Jun 21, 2026

@Aamod-Dev Aamod-Dev 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.

Fixing the cache reporting for cold requests is a nice quality-of-life improvement for debugging API performance. Adding the mock for contributionsCache.has in app/api/stats/route.empty-fallback.test.ts keeps the test suite robust. Approved!

@JhaSourav07 JhaSourav07 added the gssoc:approved PR has been reviewed and accepted for valid contribution points label Jun 21, 2026
@JhaSourav07 JhaSourav07 merged commit f5e1f28 into JhaSourav07:main Jun 21, 2026
10 of 11 checks passed
@github-actions github-actions Bot added this to the GSSoC 2026 milestone Jun 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Congratulations @vipul674! Your PR has been successfully merged. 🚀

Thank you for contributing to CommitPulse. Your work helps us build a better tool for the community.

⚠️ Important for GSSoC Contributors:
You are strictly advised to join our Discord Server as it is mandatory for all GSSoC participants. All important announcements, point claims, and community discussions happen there.

Keep building! 💻✨

@github-actions github-actions Bot added the type:bug Something isn't working as expected label Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working gssoc:approved PR has been reviewed and accepted for valid contribution points GSSoC 2026 level:beginner Small changes Usually isolated fixes or simple UI/text updates. mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Stats endpoint labels cold non-refresh requests as cache hits

3 participants