Skip to content

Improved points and duration validation#354

Merged
animir merged 7 commits intomasterfrom
allow-negative-points
Mar 14, 2026
Merged

Improved points and duration validation#354
animir merged 7 commits intomasterfrom
allow-negative-points

Conversation

@animir
Copy link
Copy Markdown
Owner

@animir animir commented Mar 10, 2026

points and duration options are required numbers.
duration can't be negative.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens the RateLimiter configuration contract by making points and duration explicitly required (types + docs) and enforcing runtime validation (notably: duration must be non-negative), with broad test updates to reflect the new requirements.

Changes:

  • Make points and duration required in TypeScript types and README docs.
  • Add stricter runtime validation in RateLimiterAbstract and add unit tests around validation behavior.
  • Update many tests/fixtures to pass points/duration, and update CI matrix versions.

Reviewed changes

Copilot reviewed 24 out of 25 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
lib/RateLimiterAbstract.js Enforces required points/duration with validation logic.
types.d.ts Makes points/duration required in IRateLimiterOptions.
README.md Documents points/duration as required options.
lib/RateLimiterValkeyGlide.js Updates JSDoc to reflect required points/duration.
.github/workflows/test.yml Updates Node/Valkey matrix versions.
test/RateLimiterAbstract.test.js Adds validation-focused unit tests; updates instantiation for required options.
test/RLWrapperTimeouts.test.js Updates wrapper and stubbed limiters to pass required options.
test/RateLimiterSQLite.test.js Adjusts concurrency assertion (now order-independent).
test/RateLimiterRedis.redis.test.js Adds required options to constructors in tests.
test/RateLimiterRedis.ioredis.test.js Adds required options to constructors in tests.
test/RateLimiterValkeyGlide.test.js Adds required options to constructors in tests.
test/RateLimiterValkey.iovalkey.test.js Adds required options to constructors in tests.
test/RateLimiterPrisma/Postgres/RateLimiterPrismaPostgres.test.js Adds required duration to constructor usage.
test/RateLimiterDrizzle/Postgres/RateLimiterDrizzlePostgres.test.js Adds required duration to constructor usage.
test/RateLimiterDrizzle/Postgres/RateLimiterDrizzleNonAtomicPostgres.test.js Adds required duration to constructor usage.
test/RateLimiterPostgres.test.js Adds required options to numerous constructor usages.
test/RateLimiterMySQL.test.js Adds required options to constructor usages.
test/RateLimiterMongo.test.js Adds required options to constructor usages.
test/RateLimiterMemcache.test.js Adds required options to constructor usage.
test/RateLimiterInsuredAbstract.test.js Updates stubs/constructors to satisfy new requirements.
test/RateLimiterEtcd.test.js Adds required options to constructor usages (including error-path tests).
test/RateLimiterEtcdNonAtomic.test.js Adds required options to constructor usages (including error-path tests).
test/RateLimiterDynamo.test.js Adds required options and formatting cleanup.
test/RateLimiterCluster.test.js Adds required options to cluster constructor usages.
test/BurstyRateLimiter.test.js Adds required options to limiter constructors used in tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/RateLimiterAbstract.js Outdated
Comment thread lib/RateLimiterAbstract.js Outdated
Comment thread lib/RateLimiterAbstract.js
Comment thread test/RateLimiterSQLite.test.js Outdated
animir and others added 4 commits March 10, 2026 20:59
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@animir animir merged commit 6a011b3 into master Mar 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants