Round Redis persistence TTLs - #7019
Conversation
🦋 Changeset detectedLatest commit: 446a4cd The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
ℹ️ No critical issues — minor suggestions inline.
Reviewed changes
- Rounded single-entry Redis persistence TTLs up to whole milliseconds for
SET ... PXinpackages/effect/src/unstable/persistence/Persistence.ts. - Rounded batch Redis persistence TTLs up to whole milliseconds for the
PEXPIREscript in the same file. - Added regression coverage for both paths in
packages/effect/test/unstable/persistence/Redis.test.ts. - Added a patch changeset for the
effectpackage.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏
| <Config extends { readonly params: ReadonlyArray<unknown>; readonly result: unknown }>() => | ||
| (...params: Config["params"]) => { | ||
| scripts.push(params[0]) | ||
| return Effect.succeed(undefined as Config["result"]) |
There was a problem hiding this comment.
The eval mock returns undefined cast to Config["result"], but the real setManyRedis script returns an array of string results from redis.call. Consider returning an empty array so the mock's signature better matches the production contract.
Technical details
# Test mock return type
## Affected sites
- `packages/effect/test/unstable/persistence/Redis.test.ts:51` — `eval` mock returns `undefined as Config["result"]`.
## Required outcome
- The mock should return a value that matches the runtime return type of the Redis script it intercepts, to avoid misleading future readers or accidental false positives if assertions start depending on the return value.
## Suggested approach
Return `[] as Config["result"]` instead of `undefined as Config["result"]`.
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|

Summary
SET ... PXand batchPEXPIREwritesWhy
Duration.toMilliscan return fractional values, but Redis requires integer millisecond arguments forPXandPEXPIRE. Redis 8.8.1 reproduces the failure withERR value is not an integer or out of rangeforPX 1.5.Rounding upward preserves the requested TTL without expiring entries early.
Validation
pnpm lint-fixpnpm test --run packages/effect/test/unstable/persistence/Redis.test.tspnpm checkCloses EFF-464