chore(deps): update dependency effect to v3.20.0 [security]#553
chore(deps): update dependency effect to v3.20.0 [security]#553renovate[bot] wants to merge 1 commit intomainfrom
Conversation
|
|
View your CI Pipeline Execution ↗ for commit 30cdb98
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Nx Cloud has identified a possible root cause for your failed CI:
We were unable to classify this failure as a code change because the error — a Playwright web server startup timeout — does not reference any specific code, function, or import touched by the effect dependency update. As the failure is deterministic (0% flakiness rate) and isolated to this branch, we suspect an environment condition is preventing the web server from starting rather than a direct consequence of the effect 3.19.3 → 3.20.0 upgrade.
No code changes were suggested for this issue.
Trigger a rerun:
🎓 Learn more about Self-Healing CI on nx.dev
This PR contains the following updates:
3.19.3→3.20.0GitHub Vulnerability Alerts
CVE-2026-32887
Versions
effect: 3.19.15@effect/rpc: 0.72.1@effect/platform: 0.94.2@clerk/nextjs: 6.xRoot cause
Effect's
MixedSchedulerbatches fiber continuations and drains them inside a single microtask or timer callback. TheAsyncLocalStoragecontext active during that callback belongs to whichever request first triggered the scheduler's drain cycle — not the request that owns the fiber being resumed.Detailed mechanism
1. Scheduler batching (
effect/src/Scheduler.ts,MixedScheduler)scheduleTaskonly callsstarve()whenrunningisfalse. Subsequent tasks accumulate inthis.tasksuntilstarveInternaldrains them all. ThePromise.then()(orsetTimeout) callback inherits the ALS context from whichever call site created it — i.e., whichever request's fiber first setrunning = true.Result: Under concurrent load, fiber continuations from Request A and Request B execute inside the same
starveInternalcall, sharing a single ALS context. If Request A triggeredstarve(), then Request B's fiber reads Request A's ALS context.2.
toWebHandlerRuntimedoes not propagate ALS (@effect/platform/src/HttpApp.ts:211-240)Effect's own
Context(containingHttpServerRequest) is correctly set per-request. But the Node.js ALS context — which frameworks like Next.js, Clerk, and OpenTelemetry rely on — is not captured at fork time or restored when the fiber's continuations execute.3. The dangerous pattern this enables
The
async () => auth()thunk executes when the fiber continuation is scheduled byMixedScheduler. At that point, the ALS context belongs to an arbitrary concurrent request.Reproduction scenario
Minimal reproduction
Impact
auth()returns wrong user's sessioncookies()/headers()from Next.js read wrong requestWorkaround
Capture ALS-dependent values before entering the Effect runtime and pass them via Effect's own context system:
Suggested fix (for Effect maintainers)
Option A: Propagate ALS context through the scheduler
Capture the
AsyncLocalStoragesnapshot when a fiber continuation is scheduled, and restore it when the continuation executes:AsyncLocalStorage.snapshot()(Node.js 20.5+) returns a function that, when called, restores the ALS context from the point of capture. This ensures each fiber continuation runs with its originating request's ALS context.Trade-off: Adds one closure allocation per scheduled task. Could be opt-in via a
FiberRefor scheduler option.Option B: Capture ALS at
runForkand restore per fiber stepWhen
Runtime.runForkis called, capture the ALS snapshot and associate it with the fiber. Before each fiber step (in the fiber runtime'sevaluateEffectloop), restore the snapshot.Trade-off: More invasive but provides correct ALS propagation for the fiber's entire lifetime, including across
flatMapchains andEffect.tryPromisethunks.Option C: Document the limitation and provide a
contextinjection APIIf ALS propagation is intentionally not supported, document this prominently and provide a first-class API for
toWebHandlerto accept per-request context. The existingcontext?: Context.Context<never>parameter on the handler function partially addresses this, but it requires callers to know about the issue and manually extract values before entering Effect.Related
AsyncLocalStoragedocs: https://nodejs.org/api/async_context.htmlAsyncLocalStorage.snapshot(): https://nodejs.org/api/async_context.html#static-method-asynclocalstoragesnapshotcookies(),headers(),auth()in App RouterFiberRefpropagation for this)POC replica of my setup
Used util functions
The actual effect that was run within the RPC context that the bug was found
Release Notes
Effect-TS/effect (effect)
v3.20.0Compare Source
Minor Changes
8798a84Thanks @mikearnaldi! - Fix scheduler task draining to isolateAsyncLocalStorageacross fibers.Patch Changes
#6107
fc82e81Thanks @gcanti! - BackportTypes.VoidIfEmptyto 3.x#6088
82996bcThanks @taylorOntologize! - Schema: fixSchema.omitproducing wrong result on Struct withoptionalWith({ default })and index signaturesgetIndexSignaturesnow handlesTransformationAST nodes by delegating toast.to, matching the existing behavior ofgetPropertyKeysandgetPropertyKeyIndexedAccess. Previously,Schema.omiton a struct combiningSchema.optionalWith(with{ default },{ as: "Option" }, etc.) andSchema.Recordwould silently take the wrong code path, returning a Transformation with property signatures instead of a TypeLiteral with index signatures.#6086
4d97a61Thanks @taylorOntologize! - Schema: fixgetPropertySignaturescrash on Struct withoptionalWith({ default })and other Transformation-producing variantsSchemaAST.getPropertyKeyIndexedAccessnow handlesTransformationAST nodes by delegating toast.to, matching the existing behavior ofgetPropertyKeys. Previously, callinggetPropertySignatureson aSchema.StructcontainingSchema.optionalWithwith{ default },{ as: "Option" },{ nullable: true }, or similar options would throw"Unsupported schema (Transformation)".#6097
f6b0960Thanks @gcanti! - Fix TupleWithRest post-rest validation to check each tail index sequentially.v3.19.19Compare Source
Patch Changes
#6079
4eb5c00Thanks @tim-smart! - add short circuit to fiber.await internals#6079
4eb5c00Thanks @tim-smart! - build ManagedRuntime synchronously if possible#6081
2d2bb13Thanks @tim-smart! - fix semaphore race condition where permits could be leakedv3.19.18Compare Source
Patch Changes
12b1f1eThanks @tim-smart! - prevent Stream.changes from writing empty chunksv3.19.17Compare Source
Patch Changes
a8c436fThanks @jacobconley! - FixStream.decodeTextto correctly handle multi-byte UTF-8 characters split across chunk boundaries.v3.19.16Compare Source
Patch Changes
#6018
e71889fThanks @codewithkenzo! - fix(Match): handle null/undefined inMatch.tagandMatch.tagStartsWithAdded null checks to
discriminatoranddiscriminatorStartsWithpredicates to prevent crashes when matching nullable union types.Fixes #6017
v3.19.15Compare Source
Patch Changes
#5981
7e925eaThanks @bxff! - Fix type inference loss inArray.flattenfor complex nested structures like unions of Effects with contravariant requirements. Uses distributive indexed access (T[number][number]) in theFlattentype utility and addsconstto theflattengeneric parameter.#5970
d7e75d6Thanks @KhraksMamtsov! - fix Config.orElseIf signature#5996
4860d1eThanks @parischap! - fix Equal.equals plain object comparisons in structural modev3.19.14Compare Source
Patch Changes
488d6e8Thanks @mikearnaldi! - FixEffect.retryto respecttimes: 0option by using explicit undefined check instead of truthy check.v3.19.13Compare Source
Patch Changes
#5911
77eeb86Thanks @mattiamanzati! - Add test for ensuring typeConstructor is attached#5910
287c32cThanks @mattiamanzati! - Add typeConstructor annotation for Schemav3.19.12Compare Source
Patch Changes
a6dfca9Thanks @fubhy! - Ensureperformance.nowis only used if it's availablev3.19.11Compare Source
Patch Changes
#5888
38abd67Thanks @gcanti! - filter non-JSON values from schema examples and defaults, closes #5884Introduce JsonValue type and update JsonSchemaAnnotations to use it for
type safety. Add validation to filter invalid values (BigInt, cyclic refs)
from examples and defaults, preventing infinite recursion on cycles.
#5885
44e0b04Thanks @gcanti! - feat(JSONSchema): add missing options for target JSON Schema version in make function, closes #5883v3.19.10Compare Source
Patch Changes
#5874
bd08028Thanks @mattiamanzati! - Fix NoSuchElementException instantiation in fastPath and add corresponding test case#5878
6c5c2baThanks @Hoishin! - prevent crash from Hash and Equal with invalid Date objectv3.19.9Compare Source
Patch Changes
3f9bbfeThanks @gcanti! - Fix the arbitrary generator for BigDecimal to allow negative scales.v3.19.8Compare Source
Patch Changes
f03b8e5Thanks @lokhmakov! - Prevent multiple iterations over the same Iterable in Array.intersectionWith and Array.differenceWithv3.19.7Compare Source
Patch Changes
7ef13d3Thanks @tim-smart! - fix SqlPersistedQueue batch sizev3.19.6Compare Source
Patch Changes
af7916aThanks @tim-smart! - add RcRef.invalidate apiv3.19.5Compare Source
Patch Changes
079975cThanks @tim-smart! - backport Effect.gen optimizationv3.19.4Compare Source
Patch Changes
#5752
f445b87Thanks @janglad! - Fix Types.DeepMutable mapping over functions#5757
d2b68acThanks @tim-smart! - add experimental PartitionedSemaphore moduleA
PartitionedSemaphoreis a concurrency primitive that can be used tocontrol concurrent access to a resource across multiple partitions identified
by keys.
The total number of permits is shared across all partitions, with waiting
permits equally distributed among partitions using a round-robin strategy.
This is useful when you want to limit the total number of concurrent accesses
to a resource, while still allowing for fair distribution of access across
different partitions.
Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR was generated by Mend Renovate. View the repository job log.