Add reproduction for Sink issue - #6876
Conversation
🦋 Changeset detectedLatest commit: 33a6afa 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 new issues found.
Reviewed changes
Sink.reduceWhileArrayreproduction test — adds a test case verifying the reducer is called once per non-empty input array, exposing the bug where the internalforloop atpackages/effect/src/Sink.ts:1339callsfper element rather than per array pull (the effectful counterpartreduceWhileArrayEffectat line 1370 handles this correctly).
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Fixed
Sink.reduceWhileArray— removed the internalforloop that called the reducer once per element in the pulled array; now calls the reducer once per array, matching the behavior ofreduceWhileArrayEffect. - Added changeset —
"effect": patchfor the fix.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|

Summary
Sink.reduceWhileArrayinvokes its reducer once per non-empty input arraySink.reduceWhileArrayto reduce each pulled array once instead of once per elementeffectRoot cause
The synchronous implementation looped over every element in a pulled array while passing the full array to the reducer on each iteration. The effectful counterpart already applied its reducer once per pulled array.
Validation
pnpm test --run packages/effect/test/Sink.test.ts -t "applies the reducer once per non-empty input array"pnpm test --run packages/effect/test/Sink.test.tspnpm checkpnpm lintCloses EFF-312