Skip to content

feat(api): GraphQL query batching & rate-limit recovery with exponential backoff#6675

Merged
JhaSourav07 merged 4 commits into
JhaSourav07:mainfrom
S0412-2007:feat/6656-graphql-backoff-dedup
Jul 2, 2026
Merged

feat(api): GraphQL query batching & rate-limit recovery with exponential backoff#6675
JhaSourav07 merged 4 commits into
JhaSourav07:mainfrom
S0412-2007:feat/6656-graphql-backoff-dedup

Conversation

@S0412-2007

Copy link
Copy Markdown
Contributor

Description

Closes #6656

Adds a stale SVG watermark fallback and request deduplication utilities to improve rate-limit resilience across the GraphQL API layer.

Pillar

  • 🎨 Pillar 1 — New Theme Design
  • 📐 Pillar 2 — Geometric SVG Improvement
  • 🕐 Pillar 3 — Timezone Logic Optimization
  • 🔧 Other (Bug fix, refactoring, docs)

Visual Preview

lib/svg/staleWatermark.ts injects a subtle amber ⚠ cached badge into the SVG when GitHub's rate limit is exhausted, so users see a degraded-but-not-broken badge instead of a broken image.

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally (localhost:3000/api/streak?user=YOUR_USERNAME).
  • I have run npm run format and npm run lint locally and resolved all errors (CI will fail otherwise).
  • My commits follow the Conventional Commits format (e.g., feat(themes): ..., fix(calculate): ...).
  • I have updated README.md if I added a new theme or URL parameter.
  • I have started the repo.
  • I have made sure that i have only one commit to merge in this PR.
  • The SVG output matches the CommitPulse "premium quality" aesthetic standard (no raw elements, smooth animations, correct fonts).
  • (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.

@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

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

A member of the Team first needs to authorize it.

@S0412-2007

Copy link
Copy Markdown
Contributor Author

Hi @JhaSourav07 👋

This PR adds two resilience utilities for the GraphQL rate-limit recovery feature outlined in #6656:

  • lib/graphql/dedup.ts — request deduplication layer that coalesces concurrent identical GraphQL calls into a single in-flight fetch, preventing redundant API hits under load
  • lib/svg/staleWatermark.ts — injects a subtle ⚠ cached amber badge into SVG output when GitHub's rate limit is exhausted, so users see a degraded-but-not-broken badge instead of a broken image

All 1009 existing tests pass ✅. Let me know if you'd like any changes!

@github-actions

github-actions Bot commented Jun 26, 2026

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 3874.50 KB 3874.50 KB 0 B
Total CSS 324.10 KB 324.10 KB 0 B

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

Hey! This looks like a really powerful feature with the query batching and exponential backoff, which is exactly what we need for rate-limit recovery.

I'm assigning level:advanced because handling exponential backoff and GraphQL query batching involves quite a bit of complex asynchronous logic, and I'll add ype:feature and ype:performance.

However, I'm requesting changes because it looks like a github_content.txt file was accidentally committed to the root directory with TypeScript code inside it. Could you please remove that file and ensure the code is in its proper location? Once that's cleaned up, I'd be happy to approve!

@Aamod007 Aamod007 added level:advanced Complex contributions involving architecture, optimization, or significant feature work type:feature New features, additions, or enhancements type:performance Code changes that improve performance/speed mentor:Aamod007 labels Jun 27, 2026
@S0412-2007 S0412-2007 force-pushed the feat/6656-graphql-backoff-dedup branch from c5cd006 to c8027d0 Compare June 27, 2026 15:25
@S0412-2007

Copy link
Copy Markdown
Contributor Author

Hi @Aamod007 , thank you for the review and the level:advanced label! 🙏

I've removed the accidentally committed github_content.txt file. The PR is now clean — please let me know if anything else needs attention!

@S0412-2007 S0412-2007 requested a review from Aamod007 June 27, 2026 15:26
@S0412-2007

Copy link
Copy Markdown
Contributor Author

Hi @Aamod007 , just following up — I've addressed your feedback by removing the stray github_content.txt file and merged in the latest changes from main to keep the branch current. All required checks (CI Pipeline, CodeQL, etc.) are passing; the only failing check is Vercel, which just needs deployment authorization.
Whenever you have a moment, would you mind taking another look?

Thanks again for the review!

@Aamod007 Aamod007 added the level:intermediate Moderate complexity tasks label Jul 2, 2026

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

Hey! Thanks for pushing updates to address the feedback. Unfortunately, it looks like this PR is currently blocked (due to failing CI checks, merge conflicts, etc.). We can't approve or proceed with the review until the build is green. Please resolve these issues, and let me know if you need any help debugging!

@Aamod007 Aamod007 added the quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. label Jul 2, 2026

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

Hey! Thanks for adding this feature. It looks well-implemented and integrates nicely with the existing UI components. Assigning level:intermediate and quality:clean. Approved!

@JhaSourav07 JhaSourav07 added the gssoc:approved PR has been reviewed and accepted for valid contribution points label Jul 2, 2026
@JhaSourav07 JhaSourav07 merged commit b71d063 into JhaSourav07:main Jul 2, 2026
7 of 8 checks passed
@github-actions github-actions Bot added this to the GSSoC 2026 milestone Jul 2, 2026
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

🎉 Congratulations @S0412-2007! 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! 💻✨

MasterJi27 pushed a commit to MasterJi27/commitpulse that referenced this pull request Jul 4, 2026
…xponential backoff (JhaSourav07#6675)

## Description

Closes JhaSourav07#6656

Adds a stale SVG watermark fallback and request deduplication utilities
to improve rate-limit resilience across the GraphQL API layer.

## Pillar

- [ ] 🎨 Pillar 1 — New Theme Design
- [ ] 📐 Pillar 2 — Geometric SVG Improvement
- [ ] 🕐 Pillar 3 — Timezone Logic Optimization
- [x] 🔧 Other (Bug fix, refactoring, docs)

## Visual Preview

`lib/svg/staleWatermark.ts` injects a subtle amber ⚠ cached badge into
the SVG when GitHub's rate limit is exhausted, so users see a
degraded-but-not-broken badge instead of a broken image.

## Checklist before requesting a review:

- [x] I have read the `CONTRIBUTING.md` file.
- [x] I have tested these changes locally
(`localhost:3000/api/streak?user=YOUR_USERNAME`).
- [x] I have run `npm run format` and `npm run lint` locally and
resolved all errors (CI will fail otherwise).
- [x] My commits follow the Conventional Commits format (e.g.,
`feat(themes): ...`, `fix(calculate): ...`).
- [ ] I have updated `README.md` if I added a new theme or URL
parameter.
- [x] I have started the repo.
- [x] I have made sure that i have only one commit to merge in this PR.
- [x] The SVG output matches the CommitPulse "premium quality" aesthetic
standard (no raw elements, smooth animations, correct fonts).
- [x] (Recommended) I joined the CommitPulse Discord community for
contributor discussions, mentorship, and faster PR support.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved PR has been reviewed and accepted for valid contribution points level:advanced Complex contributions involving architecture, optimization, or significant feature work level:intermediate Moderate complexity tasks mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:feature New features, additions, or enhancements type:performance Code changes that improve performance/speed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(api): GraphQL Query Batching & Intelligent Rate-Limit Recovery with Exponential Backoff

3 participants