Skip to content

test: harden asynchronous test coverage - #144

Merged
glennawatson merged 3 commits into
mainfrom
fix/harden-async-enumerable-test
Jul 25, 2026
Merged

test: harden asynchronous test coverage#144
glennawatson merged 3 commits into
mainfrom
fix/harden-async-enumerable-test

Conversation

@glennawatson

@glennawatson glennawatson commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

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

  • I have read the Contribute guide
  • Tests have been added or updated (for bug fixes / features)
  • Docs have been added or updated (not applicable: test and coverage metadata changes)
  • Changes target the main branch
  • PR title follows Conventional Commits

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.

- 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.
@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.11%. Comparing base (4efc1c7) to head (6ccfcb6).

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.
📢 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.

@sonarqubecloud

Copy link
Copy Markdown

@glennawatson
glennawatson merged commit 37841ed into main Jul 25, 2026
13 checks passed
@glennawatson
glennawatson deleted the fix/harden-async-enumerable-test branch July 25, 2026 14:28
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.

2 participants