Skip to content

feat: add cache-busting queryand X-cache-Status response headers#4155

Open
Vartika-l7 wants to merge 3 commits into
JhaSourav07:mainfrom
Vartika-l7:support-cache-busting-querys
Open

feat: add cache-busting queryand X-cache-Status response headers#4155
Vartika-l7 wants to merge 3 commits into
JhaSourav07:mainfrom
Vartika-l7:support-cache-busting-querys

Conversation

@Vartika-l7
Copy link
Copy Markdown
Contributor

Description

Fixes #4091

Added a ( ?bypassCache=true ) query parameter to all API routes so users can fetch fresh data without waiting for the 5-minute cache window.

Added an X-Cache-Status response header (BYPASS or HIT) to help debug cache behavior.

Also reduced the manual refresh cooldown from 5 minutes to 30 seconds

Pillar

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

Visual Preview

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.

ADDTIONALLY ( Tests verified ) :

lib/github.test.ts — 143/143 pass
app/api/streak/route.test.ts + tests/ — all pass
app/api/stats/route.test.ts — all pass
app/api/github/route.test.ts — all pass
Streak sub-tests (grace, refresh, views) — all pass
services/github/refresh-policy.empty-fallback.test.ts — pass (updated for 30s cooldown)
The 3 pre-existing failures (commitpulse-logo, CommitClock, Heatmap) are unrelated to my work.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Jun 6, 2026

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

A member of the Team first needs to authorize it.

@Vartika-l7 Vartika-l7 force-pushed the support-cache-busting-querys branch 2 times, most recently from bc731d6 to 7274553 Compare June 6, 2026 14:37
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 6, 2026

🚨 Hey @Vartika-l7, the CI Pipeline is failing on this PR and it has been marked as status:blocked.

Please fix the issues before this can be reviewed. Here's how:

1. Run checks locally before pushing:

npm run format:check   # Check Prettier formatting
npm run lint           # Run ESLint
npm run typecheck      # TypeScript type check
npm run test           # Run unit tests (Vitest)
npm run build          # Verify production build passes

2. Auto-fix common issues:

npm run format         # Auto-fix formatting with Prettier
npm run lint -- --fix  # Auto-fix lint errors where possible

3. Check the full failure log here:
👉 View CI Run

Once you push a fix and the CI passes, the status:blocked label will be removed automatically. 💪

@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jun 6, 2026
@Vartika-l7 Vartika-l7 marked this pull request as draft June 6, 2026 15:02
Copy link
Copy Markdown
Collaborator

@Aamod007 Aamod007 left a comment

Choose a reason for hiding this comment

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

Summary

The PR cannot be approved because there is a reference error in the API route which breaks functionality.

Required Changes

Issue 1

  • Problem: In �pp/api/stats/route.ts, the code attempts to call headers.set(...) but the headers variable is not instantiated or defined in that scope.
  • Impact: Will throw a ReferenceError at runtime and cause the API endpoint to crash with a 500 error.
  • Required Fix: Ensure that the response headers object is correctly created and returned as part of the NextResponse, rather than mutating an undefined headers object.

@Aamod007 Aamod007 added GSSoC 2026 level:intermediate Moderate complexity tasks quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. level:advanced Complex contributions involving architecture, optimization, or significant feature work and removed level:intermediate Moderate complexity tasks quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. labels Jun 6, 2026
Copy link
Copy Markdown
Collaborator

@Aamod007 Aamod007 left a comment

Choose a reason for hiding this comment

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

Summary

The PR cannot be approved because the CI tests or build are failing.

Required Changes

  • Problem: The CI tests or build are failing.
  • Impact: Breaks the continuous integration pipeline.
  • Required Fix: Investigate the failures locally and ensure all tests pass in the CI environment before requesting another review.

@Aamod007 Aamod007 added level:intermediate Moderate complexity tasks quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. and removed level:advanced Complex contributions involving architecture, optimization, or significant feature work quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. labels Jun 6, 2026
Copy link
Copy Markdown
Collaborator

@Aamod007 Aamod007 left a comment

Choose a reason for hiding this comment

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

Summary

The PR cannot be approved because the CI tests or build are failing.

Required Changes

  • Problem: The CI tests or build are failing.
  • Impact: Breaks the continuous integration pipeline.
  • Required Fix: Investigate the failures locally and ensure all tests pass in the CI environment before requesting another review.

@Aamod007 Aamod007 added level:intermediate Moderate complexity tasks quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. and removed level:intermediate Moderate complexity tasks quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. labels Jun 6, 2026
Copy link
Copy Markdown
Collaborator

@Aamod007 Aamod007 left a comment

Choose a reason for hiding this comment

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

LGTM! I have analyzed the diff and verified that the implementation is correct. All required CI checks are passing (ignoring Vercel deployment failures). Approved!

@Vartika-l7
Copy link
Copy Markdown
Contributor Author

Hi! Thanks for the review and approval.

When I initially opened the PR, everything was working except for one small issue. While fixing that, I ran into a few related problems, so I'm currently working through those and will push the remaining fixes shortly.

Thanks again for taking the time to review it!

@Vartika-l7 Vartika-l7 force-pushed the support-cache-busting-querys branch from 7274553 to b923776 Compare June 6, 2026 22:34
@github-actions github-actions Bot removed the status:blocked This PR is blocked due to a failing CI check. label Jun 6, 2026
@Vartika-l7 Vartika-l7 marked this pull request as ready for review June 6, 2026 23:03
@Vartika-l7
Copy link
Copy Markdown
Contributor Author

Hey! I went through the issues that were causing the CI failures and made the necessary fixes.

While running the test suite locally, I noticed that CopyRepoButton.massive-scaling.test.tsx was failing with a TestingLibraryElementError due to multiple elements matching the same text content. I updated the test to use getAllByText(...)[0], which resolves the failure and allows the test suite to pass.

I also looked into the comment regarding app/api/stats/route.ts. In the current revision, headers is instantiated with new Headers(...) and passed back through NextResponse.json(..., { headers }). I may be looking at a newer revision than the one originally reviewed, but I checked this area while addressing the feedback and it appears to be functioning correctly.

Additionally, I addressed the changes that were causing the CI pipeline to fail.

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

Labels

GSSoC 2026 level:intermediate Moderate complexity tasks quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: support cache-busting query parameters and X-Cache headers

2 participants