Skip to content

feat: add GroupBy, GroupByUntil and Window/Slice operators - #219

Merged
glennawatson merged 4 commits into
mainfrom
fix/open-defects-and-rx-parity
Sep 21, 2026
Merged

glennawatson merged 4 commits into
mainfrom
fix/open-defects-and-rx-parity

Conversation

@glennawatson

Copy link
Copy Markdown
Contributor

Summary

Adds keyed grouping and windowing operators, and fixes two defects in the extensions package.

  • GroupBy and GroupByUntil deliver a keyed GroupedSignal<TKey, T> per key. They cover the key, element and duration selector forms, and each group completes when its source or its duration signal completes.
  • Window and Slice hand back a signal per window. They cover count, count with skip, time, time with count, boundary, opening and closing forms. Slice is the primary name and Window is the migration alias.
  • Every new signal and witness is public under Advanced. Each is constructible directly, like BufferSignal<T>.
  • SkipWhileNull accepts nullable reference element types. Calling it on IObservable<string?> raises no nullability warning.
  • LatestOrDefault documents what it emits and when.

Why

Grouping and windowing are the largest operator families a System.Reactive user looks for and does not find. The SkipWhileNull constraint forced a suppression at call sites with nullable element types.

Breaking changes

None.

How this was verified

Tests cover every class this adds, using deterministic ordered state checks with a virtual clock for the time-based windows. The SkipWhileNull change has a test on a nullable reference source.

Notes for the reviewer

  • Start with GroupedSignal{TKey,T}.cs and SliceRouter{TOuter,T}.cs, which the group and window signals share.
  • The PublicAPI.txt baselines, the README rows and the per-signal witness files follow one pattern and are safe to skim.
  • The async mirror of these operators and the remaining System.Reactive parity operators are out of scope for this PR.

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

… LatestOrDefault

- SkipWhileNull accepts nullable reference element types without a nullability warning.
- LatestOrDefault documents what it emits and when.
- GroupBy and GroupByUntil deliver a keyed GroupedSignal per key.
- Window and Slice hand back a signal per window across count, time, boundary, opening and closing forms.
- Every signal and witness is public under Advanced.
@codecov

codecov Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.00881% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.78%. Comparing base (aacf8d8) to head (a19c0c0).

Files with missing lines Patch % Lines
...ByUntilWitness{TSource,TKey,TElement,TDuration}.cs 96.33% 4 Missing ⚠️
.../Primitives.Shared/Advanced/SliceTimeWitness{T}.cs 97.87% 2 Missing ⚠️
...itives.Shared/Advanced/SliceTimeCountWitness{T}.cs 98.75% 1 Missing ⚠️
...s.Core/Advanced/SliceClosingWitness{T,TClosing}.cs 98.75% 1 Missing ⚠️
...vanced/SliceOpeningWitness{T,TOpening,TClosing}.cs 98.92% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #219      +/-   ##
==========================================
- Coverage   99.80%   99.78%   -0.03%     
==========================================
  Files         757      781      +24     
  Lines       23650    24558     +908     
  Branches     2774     2886     +112     
==========================================
+ Hits        23605    24504     +899     
- Misses         45       54       +9     

☔ 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 caae6b7 into main Sep 21, 2026
14 of 16 checks passed
@glennawatson
glennawatson deleted the fix/open-defects-and-rx-parity branch September 21, 2026 10:25
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.

1 participant