nri-redis: add zcard, zrem, zremrangebyscore to Redis.SortedSet - #161
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The test goldens embed the test-suite package version in `srcLocPackage`, so bumping the version requires the matching suffix update there too. Applied as a targeted substring substitution rather than a regeneration, which leaves the recorded source locations untouched. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends nri-redis’s sorted-set API to support transactional sliding-window rate limiting workflows by adding the missing primitives (ZCARD, ZREM, ZREMRANGEBYSCORE) and bumping the library version accordingly.
Changes:
- Add
zcard,zrem, andzremrangebyscoretoRedis.SortedSet, threading the new commands throughRedis.InternalandRedis.Handler. - Add query-level tests covering the new sorted-set operations.
- Bump
nri-redisto0.4.2.0and update observability golden outputs that embed the package version.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| nri-redis/src/Redis/SortedSet.hs | Exposes new sorted-set operations on the public SortedSet API record and module exports. |
| nri-redis/src/Redis/Internal.hs | Adds new Query constructors and threads them through cmds, mapKeys, mapReturnedKeys, and keysTouchedByQuery. |
| nri-redis/src/Redis/Handler.hs | Implements execution of the new queries via hedis (Database.Redis.*). |
| nri-redis/test/Spec/Redis.hs | Adds tests validating zcard, zrem, and zremrangebyscore behavior. |
| nri-redis/package.yaml | Bumps package version to 0.4.2.0. |
| nri-redis/nri-redis.cabal | Bumps cabal version to 0.4.2.0. |
| nri-redis/CHANGELOG.md | Documents the new API additions in the 0.4.2.0 release notes. |
| nri-redis/test/golden-results-9.8/observability-spec-reporting-without-query-timout | Updates golden to reflect the new srcLocPackage version string. |
| nri-redis/test/golden-results-9.8/observability-spec-reporting-with-query-timout | Updates golden to reflect the new srcLocPackage version string. |
| nri-redis/test/golden-results-9.8/observability-spec-reporting-redis-transaction | Updates golden to reflect the new srcLocPackage version string. |
| nri-redis/test/golden-results-9.8/observability-spec-reporting-redis-query-timeout | Updates golden to reflect the new srcLocPackage version string. |
| nri-redis/test/golden-results-9.8/observability-spec-reporting-redis-query | Updates golden to reflect the new srcLocPackage version string. |
| nri-redis/test/golden-results-9.8/observability-spec-reporting-redis-list-transaction | Updates golden to reflect the new srcLocPackage version string. |
| nri-redis/test/golden-results-9.8/observability-spec-reporting-redis-list-query | Updates golden to reflect the new srcLocPackage version string. |
| nri-redis/test/golden-results-9.8/observability-spec-reporting-redis-hash-transaction | Updates golden to reflect the new srcLocPackage version string. |
| nri-redis/test/golden-results-9.8/observability-spec-reporting-redis-hash-query | Updates golden to reflect the new srcLocPackage version string. |
| nri-redis/test/golden-results-9.8/observability-spec-reporting-redis-counter-transaction | Updates golden to reflect the new srcLocPackage version string. |
| nri-redis/test/golden-results-9.8/observability-spec-reporting-redis-counter-query | Updates golden to reflect the new srcLocPackage version string. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+122
to
+126
| -- | Removes all members in the sorted set with a score between the two | ||
| -- bounds (inclusive). Returns the number of members removed. | ||
| -- | ||
| -- https://redis.io/commands/zremrangebyscore | ||
| zremrangebyscore :: key -> Float -> Float -> Internal.Query Int, |
juanedi
approved these changes
Jul 29, 2026
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.
Adds
zcard,zrem, andzremrangebyscoretoRedis.SortedSet, and bumps nri-redis to 0.4.2.0.Adding these to support multi-window sliding-window rate limiting (e.g. 60 rpm | 300 req/day | 1k req/mo) built on
Redis.transaction(MULTI/EXEC) instead of Lua scripting.The bump also touches 11 test goldens: they embed the test-suite package version in
srcLocPackage, so the suffix has to follow the bump (same situation and same targeted-substitution approach as b62e011).🤖 Generated with Claude Code