fix(shared): dispatch redis TTL and Lua calls on the detected client - #29
Merged
Conversation
ExorTek
force-pushed
the
fix/shared-redis-dialect
branch
from
August 6, 2026 09:14
9fda475 to
713d42a
Compare
`setWithTTL` tried the ioredis positional form and fell back to the options form only if the first call threw. node-redis does not throw on it: it accepts `set(key, value, 'PX', ms)`, ignores the trailing arguments, and stores the key with no expiry. The fallback therefore never ran, and every caller of this helper silently lost its TTL on node-redis — including the oauth2 authorization-code, PAR and device-code stores, where the whole point of the write is that it expires quickly. `incr-store` had the same problem in its `eval` call. That one at least failed loudly, because Redis rejects a script invoked with no keys. Adds `detectDialect` and `evalScript` to the shared redis helpers so there is one answer to "which convention does this client want", and routes both call sites through it. `incr` now also reports a driver failure through the binding package's `wrap`, so callers get their own error class and a `code` to branch on instead of a bare driver reply. The fake clients in the unit suites now declare which driver they imitate (ioredis exposes `status`), since that is what the code keys on, and the shared suite asserts both argument forms rather than just one.
ExorTek
force-pushed
the
fix/shared-redis-dialect
branch
from
August 6, 2026 09:17
713d42a to
12ae013
Compare
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.
Stacked on #28.
The internal
setWithTTLhelper tried the ioredis argument form and fell back only if it threw:node-redis does not throw on that call. It accepts it, ignores the trailing arguments, and stores the key with no expiry — so the fallback never ran and the TTL was silently dropped.
Measured against a real server:
Everything written through this helper lost its lifetime on node-redis: OAuth 2 authorization codes, PAR request URIs, device codes, opaque entries. This is the quietest defect in the set — nothing throws, nothing logs.
incr-storehad the same problem in itsevalcall, where it at least failed loudly because Redis rejects a script invoked with no keys.Changes
detectDialectandevalScriptadded to the shared redis helpers, so there is one answer to which convention a client wants.incrreports driver failures through the binding package'swrap, so callers get their own error class and acodeinstead of a bare driver reply.