Skip to content

fix(cache): reject oversized keys to prevent memory bloat #1403#2040

Merged
JhaSourav07 merged 3 commits into
JhaSourav07:mainfrom
swarupio:test/cache-oversized-key-v2
Jun 1, 2026
Merged

fix(cache): reject oversized keys to prevent memory bloat #1403#2040
JhaSourav07 merged 3 commits into
JhaSourav07:mainfrom
swarupio:test/cache-oversized-key-v2

Conversation

@swarupio
Copy link
Copy Markdown
Contributor

Description

Added strict length validation to the TTLCache set method to reject extremely large cache keys (e.g., 'a'.repeat(20000)). This prevents potential memory bloat and database strain. Also updated the corresponding Vitest suite in lib/cache.test.ts to assert this new boundary behavior and removed an older, conflicting test.

Fixes #1403

Pillar

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

Visual Preview

N/A (Backend cache logic update)

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
Copy link
Copy Markdown
Contributor

vercel Bot commented May 31, 2026

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

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label May 31, 2026
@github-actions
Copy link
Copy Markdown

🚨 Hey @swarupio, 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 needs-rebase This PR has merge conflicts and needs a rebase. label May 31, 2026
@github-actions
Copy link
Copy Markdown

⚠️ Hey @swarupio, this PR has merge conflicts with the main branch.

Please pull the latest changes and resolve the conflicts so we can review it!

git fetch origin
git rebase origin/main
# resolve any conflicts, then:
git push --force-with-lease

Once resolved, the needs-rebase label will be removed automatically on the next check. 🙌

1 similar comment
@github-actions
Copy link
Copy Markdown

⚠️ Hey @swarupio, this PR has merge conflicts with the main branch.

Please pull the latest changes and resolve the conflicts so we can review it!

git fetch origin
git rebase origin/main
# resolve any conflicts, then:
git push --force-with-lease

Once resolved, the needs-rebase label will be removed automatically on the next check. 🙌

@github-actions github-actions Bot removed the needs-rebase This PR has merge conflicts and needs a rebase. label May 31, 2026
@Aamod007
Copy link
Copy Markdown
Collaborator

@swarupio look for conflicts

@swarupio swarupio force-pushed the test/cache-oversized-key-v2 branch from 952a1f7 to ad02c3c Compare June 1, 2026 03:16
@github-actions github-actions Bot removed the status:blocked This PR is blocked due to a failing CI check. label Jun 1, 2026
@Aamod007 Aamod007 added GSSoC 2026 mentor:Aamod007 type:security Security fixes, dependency updates, or hardening level:intermediate Moderate complexity tasks quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. labels Jun 1, 2026
@swarupio
Copy link
Copy Markdown
Contributor Author

swarupio commented Jun 1, 2026

@Aamod007 HI PLEASE MERGE IT IF THE REVIEW IS COMPLETE

@JhaSourav07 JhaSourav07 merged commit 6667c50 into JhaSourav07:main Jun 1, 2026
9 of 10 checks passed
@JhaSourav07 JhaSourav07 added the gssoc:approved PR has been reviewed and accepted for valid contribution points label Jun 1, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

🎉 Congratulations @swarupio! 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 this to the GSSoC 2026 milestone Jun 1, 2026
@swarupio swarupio deleted the test/cache-oversized-key-v2 branch June 1, 2026 09:49
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 GSSoC 2026 level:intermediate Moderate complexity tasks mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:security Security fixes, dependency updates, or hardening

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(cache): verify TTLCache behavior for oversized cache keys (Variation 2)

3 participants