Repository navigation
fix: concurrent error settlement and iterator-protocol compliance - #400
Merged
Merged
Conversation
Two failing regressions: - next() after the iterator is finished returns a plain object instead of a Promise, violating the AsyncIterator protocol - when the source throws inside a window, only the head waiter is rejected and any other pending consumers are left unsettled forever Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…rotocol - reject delivers the failure to the head waiter as before, and the remaining waiters now resolve as done instead of hanging forever - next() after finished returns Promise.resolve(...) as the AsyncIterator protocol requires Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the two defects found while reviewing
concurrent(follow-up to theconcurrentPoolreview, separate PR as agreed). Regression tests were committed first and fail on the previous implementation.consumeBufferrejected only the head waiter andbreak-ed, leaving any other pendingnext()promises unsettled forever (reproducible with three concurrentnext()calls racing a 500ms timeout). Remaining waiters now resolve asdone, matchingconcurrentPool's drain behavior.next()after the iterator finished returned a plain object instead of aPromise<IteratorResult>. Consumers calling.next().then(...)directly would crash; theas AsyncIterableIteratorcast was hiding the type error. It now returnsPromise.resolve(...).The window-based evaluation semantics of
concurrentare intentionally unchanged.Test plan
compile:check0🤖 Generated with Claude Code