Skip to content

feat: add WitnessLatestOn, run sequencers from a TimeProvider, add a shared IsImmediate check - #220

Merged
glennawatson merged 1 commit into
mainfrom
feat/sequencer-latest-value-time-provider-immediate
Sep 21, 2026
Merged

glennawatson merged 1 commit into
mainfrom
feat/sequencer-latest-value-time-provider-immediate

Conversation

@glennawatson

@glennawatson glennawatson commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Sequencers run from a TimeProvider, hopping to a sequencer can deliver only the newest value, and one check tells you whether a sequencer is immediate.

  • WitnessLatestOn(sequencer) delivers only the newest value. You get the latest value instead of a replay of every queued one.
  • WitnessLatestOnSignal<T> is a public sink under Advanced. You construct it directly, like the other operator sinks.
  • The thread pool, task pool, synchronization context, WebAssembly, immediate and current-thread sequencers take a TimeProvider. The time-based operators that take a sequencer run from that provider.
  • VirtualClock is a TimeProvider. A test drives time from a fake provider or from a VirtualClock.
  • WasmScheduler in the Reactive package takes a TimeProvider.
  • sequencer.IsImmediate tells you whether a sequencer is the immediate one. It works in both the lean and the Reactive packages.

Why

A two-way binding through a queuing sequencer livelocked in ReactiveUI.Binding, because WitnessOn replays every queued value. Binding also could not drive Throttle(TimeSpan, ISequencer) from a TimeProvider fake clock, and comparing a scheduler to Sequencer.Immediate misses the Reactive package's immediate scheduler.

Breaking changes

None.

How this was verified

Tests cover every type this adds and every changed sequencer, and they drive time with VirtualClock.

Notes for the reviewer

Start with WitnessLatestOnSignal{T}.cs and the sequencer constructors. The public API baselines are generated.

Checklist

  • I have read the Contribute guide
  • The PR title follows Conventional Commits
  • Tests cover this change, or the summary says why they do not
  • New or changed public API has XML documentation

…shared IsImmediate check

- `WitnessLatestOnSignal<T>` and `WitnessLatestOn(sequencer)` deliver only the newest queued value when hopping to a sequencer.
- `WitnessLatestOnSignal<T>` is a public sink under Advanced that you construct directly, and it delivers outside its lock.
- `ThreadPoolSequencer`, `TaskPoolSequencer`, `SynchronizationContextSequencer`, `WasmSequencer`, `ImmediateSequencer` and `CurrentThreadSequencer` take a `TimeProvider`.
- Time-based operators run from a `TimeProvider` through the sequencer they are given.
- `VirtualClock` is a `TimeProvider`, so a test drives time from a fake provider or a virtual clock.
- `WasmScheduler` in the Reactive package takes a `TimeProvider`.
- `SequencerImmediacyExtensions.IsImmediate` reports whether a sequencer is the immediate one, in both the lean and Reactive packages.
- Internal immediacy checks use `IsImmediate`.
- Public API baselines cover every target framework of both packages, Apple and Android included.
- The README documents the new members.
@sonarqubecloud

Copy link
Copy Markdown

@glennawatson
glennawatson merged commit 14054d5 into main Sep 21, 2026
13 checks passed
@glennawatson
glennawatson deleted the feat/sequencer-latest-value-time-provider-immediate branch September 21, 2026 11:52
@codecov

codecov Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.78%. Comparing base (caae6b7) to head (1fbb084).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main     #220    +/-   ##
========================================
  Coverage   99.78%   99.78%            
========================================
  Files         781      785     +4     
  Lines       24558    24774   +216     
  Branches     2886     2910    +24     
========================================
+ Hits        24504    24720   +216     
  Misses         54       54            

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

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