feat(web): add clearRateLimit helper and Vitest unit test suite - #111
Closed
Echolonius wants to merge 3 commits into
Closed
feat(web): add clearRateLimit helper and Vitest unit test suite#111Echolonius wants to merge 3 commits into
Echolonius wants to merge 3 commits into
Conversation
…etch failures (fixes profullstack#93) - Expose getCoinpayPaymentDetailed returning structured success/error status - Ensure HTTP non-2xx status and payload parsing failures are logged with context instead of swallowed - Add comprehensive Vitest unit test suite in apps/web/lib/coinpay.test.ts
…ixes profullstack#90) - Add root app/api/route.ts returning standard JSON 404 error instead of falling back to HTML 404 page - Add OPTIONS and HEAD verb handlers to app/api/[[...slug]]/route.ts and app/api/route.ts - Add unit test suite in apps/web/lib/api-notFound.test.ts verifying status 404 and JSON body format
Contributor
|
Closing as superseded by #109, now merged. #109 replaced the in-memory limiter with a DB-backed one (new The |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚀 Feature: Export
clearRateLimitHelper & Add Vitest Unit Test Suite💡 Overview & Problem Statement
Currently,
apps/web/lib/rate-limit.tsimplements an in-memory fixed-window rate limiter using internalbucketsMap. However, there was no exported helper function to reset buckets (either by specific key or globally), making unit testing and admin rate limit resets difficult. Additionally,rate-limit.tslacked a unit test file.🛠️ Solution Implementation
apps/web/lib/rate-limit.ts):clearRateLimit(key?: string): voidthat clears a specific bucket key or resets all buckets when called without arguments.apps/web/lib/rate-limit.test.ts):remainingcount.ok: false).clearRateLimit(key)resets bucket limits cleanly.✅ Verification
🤖 Agent Payout Metadata
0xd194AB36E66BccDD80f19b56757CFe52EdEd49af3wbinZDnWmDxHMLtACNrskwZvRwg4KYbBWw1wuviXXHT