Skip to content

4.x: Fix Streamable.takeUntil missing stop signals with synchronous sources - #8406

Merged
akarnokd merged 1 commit into
ReactiveX:4.xfrom
ZainnQureshii:fix-streamable-takeuntil-sync
Nov 28, 2026
Merged

akarnokd merged 1 commit into
ReactiveX:4.xfrom
ZainnQureshii:fix-streamable-takeuntil-sync

Conversation

@ZainnQureshii

Copy link
Copy Markdown
Contributor

Description

Streamable.range(1, 5).takeUntil(Streamable.empty()) emitted all five values before completing. The same five values escaped when the stop timer fired during the first synchronous pull. The operator started the upstream pull and registered its result before the stop callback (src/main/java/io/reactivex/rxjava4/internal/operators/streamable/StreamableTakeUntil.java:79).

next() now registers the stop callback before pulling upstream. It skips the pull if the stop stage has already signalled and cancels an active pull as soon as the stop wins. If the upstream pull wins, its item remains available to current() (src/main/java/io/reactivex/rxjava4/internal/operators/streamable/StreamableTakeUntil.java:79).

The Streamable.takeUntil(Streamable) overload is the sole constructor caller (src/main/java/io/reactivex/rxjava4/core/Streamable.java:1421). FlowableTakeUntil and ObservableTakeUntil subscribe to the stop source first and already emit zero values in the synchronous empty-stop case.

Checks

The regressions cover zero upstream reads with an empty stop and cancellation inside the synchronous pull when its timer fires (src/test/java/io/reactivex/rxjava4/internal/operators/streamable/StreamableTakeUntilTest.java:68 and :82).

./gradlew --offline --no-daemon --no-watch-fs --console=plain --max-workers=4 test --tests 'io.reactivex.rxjava4.internal.operators.streamable.*' --tests 'io.reactivex.rxjava4.validators.*' --tests '*FlowableTakeUntilTest' --tests '*ObservableTakeUntilTest' checkstyleMain checkstyleTest

On JDK 26, 1,240 tests passed and 82 were skipped. Checkstyle 10.24.0 reported zero diagnostics in both changed files.

AI disclosure

Codex and Claude Code were used to investigate the bug, prepare the code and tests, and draft this description.

Prepared with AI assistance (Codex and Claude Code) and reviewed with GitHub Copilot.

🤖 Generated with Claude Code

…ources

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🐷 TruffleHog + Entropy Beauty Scan

Average entropy of changed code: 4.668 bits/char
Verdict: ✅ Mid-4 beauty detected (thoughtful human code!)

Changed files entropy:

src/main/java/io/reactivex/rxjava4/internal/operators/streamable/StreamableTakeUntil.java: 4.589
src/test/java/io/reactivex/rxjava4/internal/operators/streamable/StreamableTakeUntilTest.java: 4.748

✅ No secrets or suspicious high-entropy strings found.

Mid-4 beauty heuristic in action — powered by our entropy chats! 😊

@codecov

codecov Bot commented Nov 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.61%. Comparing base (317ce36) to head (aeb0335).

Additional details and impacted files
@@             Coverage Diff              @@
##                4.x    #8406      +/-   ##
============================================
- Coverage     98.63%   98.61%   -0.03%     
  Complexity     7184     7184              
============================================
  Files           826      826              
  Lines         51043    51048       +5     
  Branches       6946     6947       +1     
============================================
- Hits          50346    50340       -6     
- Misses          474      479       +5     
- Partials        223      229       +6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@akarnokd
akarnokd merged commit 4f0f68c into ReactiveX:4.x Nov 28, 2026
8 checks passed
@akarnokd akarnokd added this to the 4.0 milestone Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants