Skip to content

Fix ScopedCache pending entries after expired finalizer failure - #8803

Merged
tim-smart merged 6 commits into
mainfrom
audit/effect-core/pr-cache-request-04
Oct 6, 2026
Merged

tim-smart merged 6 commits into
mainfrom
audit/effect-core/pr-cache-request-04

Conversation

@fubhy

@fubhy fubhy commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Fix ScopedCache reads getting stuck when an expired entry's finalizer fails. Expiry and capacity eviction now report cleanup failures using UnhandledLogLevel instead of delivering them to the caller that triggered cleanup.

The replacement is still published before cleanup, preserving shared lookups. The expiry-triggering read and readers that join its replacement can receive the fresh value. Explicit teardown through invalidate, set, and refresh retains its existing failure propagation.

The focused regression lives in packages/effect/test/ScopedCache.test.ts, under basic operations / get. It requires successful expiry-triggering and subsequent reads, both bounded with TestClock. No one-off audit test remains. Includes an effect patch changeset.

Validation

  • ScopedCache module suite: all 137 tests passed.
  • nix develop -c pnpm check passed.
  • nix develop -c pnpm lint-fix and nix develop -c pnpm lint passed.
  • git diff --check passed.

Closes EFF-1749

…finalizer leaves a permanently unresolved replacement entry
@fubhy fubhy added the audit Findings originating from the Effect runtime correctness audit label Oct 5, 2026
@changeset-bot

changeset-bot Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3bca43e

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

This PR includes changesets to release 32 packages
Name Type
effect Patch
@effect/opentelemetry Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-cloudflare Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/ai-typesafe Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-deno Patch
@effect/platform-node-shared Patch
@effect/platform-node 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/docgen Patch
@effect/doctest Patch
@effect/openapi-generator 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-janitor effect-janitor Bot added the 4.0 label Oct 5, 2026
@tim-smart tim-smart changed the title Reproduce: An expired entry's failing finalizer leaves a permanently unresolved replacement entry Fix ScopedCache pending entries after expired finalizer failure Oct 5, 2026
@github-actions

github-actions Bot commented Oct 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
arbitrary-combinators.ts 38.90 KB 38.90 KB +0.00 KB (+0.00%)
basic.ts 7.04 KB 7.05 KB -0.00 KB (-0.04%)
batching.ts 10.13 KB 10.14 KB -0.00 KB (-0.04%)
brand.ts 6.72 KB 6.72 KB 0.00 KB (0.00%)
cache.ts 10.88 KB 10.88 KB -0.00 KB (-0.02%)
config.ts 22.15 KB 22.15 KB -0.00 KB (-0.01%)
differ.ts 21.29 KB 21.29 KB -0.00 KB (-0.01%)
http-client.ts 22.43 KB 22.43 KB +0.00 KB (+0.01%)
http-router.ts 33.73 KB 33.73 KB +0.00 KB (+0.01%)
logger.ts 11.08 KB 11.08 KB -0.00 KB (-0.03%)
metric.ts 9.02 KB 9.02 KB -0.00 KB (-0.02%)
optic.ts 6.95 KB 6.95 KB 0.00 KB (0.00%)
pubsub.ts 15.17 KB 15.17 KB -0.00 KB (-0.01%)
queue.ts 12.12 KB 12.12 KB -0.00 KB (-0.02%)
schedule.ts 11.18 KB 11.18 KB -0.00 KB (-0.01%)
schema-bigdecimal.ts 13.73 KB 13.73 KB -0.00 KB (-0.01%)
schema-binary.ts 39.95 KB 39.96 KB -0.00 KB (-0.01%)
schema-class.ts 21.03 KB 21.04 KB -0.00 KB (-0.02%)
schema-fromJsonSchemaDocument.ts 32.06 KB 32.06 KB -0.00 KB (-0.00%)
schema-representation-roundtrip.ts 27.24 KB 27.24 KB -0.00 KB (-0.01%)
schema-string-transformation.ts 14.46 KB 14.46 KB -0.00 KB (-0.01%)
schema-string.ts 11.99 KB 11.99 KB -0.00 KB (-0.03%)
schema-template-literal.ts 16.05 KB 16.06 KB -0.00 KB (-0.02%)
schema-toArbitrary.ts 38.44 KB 38.45 KB -0.01 KB (-0.01%)
schema-toCodeDocument.ts 25.26 KB 25.26 KB -0.00 KB (-0.00%)
schema-toCodecJson.ts 20.21 KB 20.22 KB -0.00 KB (-0.01%)
schema-toEquivalence.ts 20.41 KB 20.42 KB -0.00 KB (-0.02%)
schema-toFormatter.ts 20.54 KB 20.55 KB -0.00 KB (-0.02%)
schema-toJsonSchemaDocument.ts 25.00 KB 25.01 KB -0.00 KB (-0.01%)
schema-toRepresentation.ts 20.50 KB 20.51 KB -0.00 KB (-0.01%)
schema.ts 20.25 KB 20.25 KB -0.00 KB (-0.01%)
stm.ts 13.08 KB 13.08 KB -0.00 KB (-0.02%)
stream.ts 9.98 KB 9.98 KB -0.00 KB (-0.01%)

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

Labels

4.0 audit Findings originating from the Effect runtime correctness audit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants