Skip to content

Round Redis persistence TTLs - #7019

Merged
tim-smart merged 1 commit into
mainfrom
agent/codex-engineer/e025b361
Aug 5, 2026
Merged

Round Redis persistence TTLs#7019
tim-smart merged 1 commit into
mainfrom
agent/codex-engineer/e025b361

Conversation

@tim-smart

Copy link
Copy Markdown
Contributor

Summary

  • round fractional Redis persistence TTLs up to whole milliseconds
  • apply the normalization to both single-entry SET ... PX and batch PEXPIRE writes
  • add regression coverage for both paths and a patch changeset

Why

Duration.toMillis can return fractional values, but Redis requires integer millisecond arguments for PX and PEXPIRE. Redis 8.8.1 reproduces the failure with ERR value is not an integer or out of range for PX 1.5.

Rounding upward preserves the requested TTL without expiring entries early.

Validation

  • pnpm lint-fix
  • pnpm test --run packages/effect/test/unstable/persistence/Redis.test.ts
  • pnpm check

Closes EFF-464

@changeset-bot

changeset-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 446a4cd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
effect Patch
@effect/ai-anthropic Patch
@effect/ai-openai Patch
@effect/ai-openai-compat Patch
@effect/ai-openrouter Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/docgen Patch
@effect/doctest Patch
@effect/openapi-generator Patch
@effect/opentelemetry Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-deno Patch
@effect/platform-node Patch
@effect/platform-node-shared Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/vitest Patch

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

@effect-slopcop effect-slopcop Bot added 4.0 bug Something isn't working labels Aug 5, 2026
@tim-smart
tim-smart enabled auto-merge (squash) August 5, 2026 05:19

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — minor suggestions inline.

Reviewed changes

  • Rounded single-entry Redis persistence TTLs up to whole milliseconds for SET ... PX in packages/effect/src/unstable/persistence/Persistence.ts.
  • Rounded batch Redis persistence TTLs up to whole milliseconds for the PEXPIRE script 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 effect package.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @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"])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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"]`.

@tim-smart
tim-smart merged commit 0a45ef3 into main Aug 5, 2026
19 of 20 checks passed
@tim-smart
tim-smart deleted the agent/codex-engineer/e025b361 branch August 5, 2026 05:20
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
basic.ts 7.06 KB 7.06 KB 0.00 KB (0.00%)
batching.ts 9.86 KB 9.86 KB 0.00 KB (0.00%)
brand.ts 6.34 KB 6.34 KB 0.00 KB (0.00%)
cache.ts 10.71 KB 10.71 KB 0.00 KB (0.00%)
config.ts 20.60 KB 20.60 KB 0.00 KB (0.00%)
differ.ts 20.20 KB 20.20 KB 0.00 KB (0.00%)
http-client.ts 21.53 KB 21.53 KB 0.00 KB (0.00%)
logger.ts 10.84 KB 10.84 KB 0.00 KB (0.00%)
metric.ts 8.98 KB 8.98 KB 0.00 KB (0.00%)
optic.ts 7.18 KB 7.18 KB 0.00 KB (0.00%)
pubsub.ts 14.99 KB 14.99 KB 0.00 KB (0.00%)
queue.ts 11.66 KB 11.66 KB 0.00 KB (0.00%)
schedule.ts 10.83 KB 10.83 KB 0.00 KB (0.00%)
schema-class.ts 19.14 KB 19.14 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 28.96 KB 28.96 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 25.29 KB 25.29 KB 0.00 KB (0.00%)
schema-string-transformation.ts 13.38 KB 13.38 KB 0.00 KB (0.00%)
schema-string.ts 10.94 KB 10.94 KB 0.00 KB (0.00%)
schema-template-literal.ts 15.17 KB 15.17 KB 0.00 KB (0.00%)
schema-toArbitraryLazy.ts 21.94 KB 21.94 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 24.34 KB 24.34 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 19.18 KB 19.18 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 19.01 KB 19.01 KB 0.00 KB (0.00%)
schema-toFormatter.ts 18.87 KB 18.87 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 22.60 KB 22.60 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 19.52 KB 19.52 KB 0.00 KB (0.00%)
schema.ts 18.41 KB 18.41 KB 0.00 KB (0.00%)
stm.ts 12.63 KB 12.63 KB 0.00 KB (0.00%)
stream.ts 9.80 KB 9.80 KB 0.00 KB (0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant