test: harden asynchronous test coverage - #144
Merged
Merged
Conversation
- Coordinate async-enumerable disposal after the first observed value.\n- Cover fallback and null branches reported as partial coverage.
- Remove tests that mutate synchronization context on the runner thread. - Exclude ambient context accessors that parallel tests cannot exercise safely.
- Coordinate exception and cancellation paths with explicit completion signals. - Remove timer-driven waits that flake under loaded Windows runners.
ChrisPulman
approved these changes
Jul 25, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #144 +/- ##
==========================================
+ Coverage 98.09% 98.11% +0.01%
==========================================
Files 676 676
Lines 20944 20940 -4
Branches 2530 2528 -2
==========================================
Hits 20546 20546
+ Misses 196 195 -1
+ Partials 202 199 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
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.



What kind of change does this PR introduce?
Test reliability and coverage improvements.
What is the new behavior?
Async-enumerable disposal waits until the first value reaches the observer before disposing. PairLatest and SyncLatest enumerable construction branches are exercised through public behavior and report complete condition coverage.
Ambient synchronization-context access is excluded from coverage at the smallest method or accessor scope. Tests no longer mutate the synchronization context on the test runner thread.
What is the current behavior?
AsyncEnumerableFactoryCancelsEnumeratorOnDispose relies on Task.Yield, so disposal can race the first observed value on loaded runners. Analyzer-update lines also report partial branch coverage.
Failed run: https://github.com/reactiveui/Primitives/actions/runs/30157203382/job/89676919459
What might this PR break?
None.
Checklist
Additional information
Cobertura verification reports complete condition coverage for PairLatest and SyncLatest enumerable construction. SynchronizationContextSequencer.Current and AsyncContext.GetCurrent are excluded because they depend on ambient thread state that parallel tests cannot safely change.