Skip to content

♻️ Invert reducer ↔ delimiter control#1164

Draft
cowboyd wants to merge 1 commit intov4from
cl/invert-reducer
Draft

♻️ Invert reducer ↔ delimiter control#1164
cowboyd wants to merge 1 commit intov4from
cl/invert-reducer

Conversation

@cowboyd
Copy link
Copy Markdown
Member

@cowboyd cowboyd commented May 7, 2026

Motivation

Issues #1153, #1154, and #1159 share a single root cause: cancellation
in v4 is one-shot.

The proposed fix is to have the co-routine, after cancellation, continually return, and return, and return with each yield, and then protect "critical" sections with a shield that makes normal execution for secments of the effect stream.

This PR is an attempt to enable these refactors by allowing the conetxt control exactly how the co-routine is advanced at every stem.

Approach

Invert control from the co-routine to the delimiter.

As part of the work to fix the various races in teardown, implement
shielding, use a v4 style sticky return, we need to consolidate
control over the coroutine so that different behaviors can be swapped
out at runtime.

This moves control over _how_ a co-routine is reduced completely into
the delimiter that sits around its currently executing body. This will
allow us to "shield" segments of the effect stream, as well as enforce
relentless returns.
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 7, 2026

Open in StackBlitz

npm i https://pkg.pr.new/effection@1164

commit: 7e68f4e

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant