test: cover the library with integration tests - #22
Open
xperiandri wants to merge 10 commits into
Open
xperiandri wants to merge 10 commits into
xperiandri wants to merge 10 commits into
Conversation
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Broad breaking API and concurrency changes warrant final human review despite extensive deterministic coverage.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds comprehensive deterministic integration coverage while fixing observable ordering, exception, cancellation, and asynchronous iteration defects.
Changes:
- Adds new observable factories/operators and cancellable query support.
- Corrects Async/Task behavior and processing validation.
- Expands tests, XML documentation, and changelog coverage.
| File | Description |
|---|---|
.github/copilot-instructions.md |
Updates project structure guidance. |
CHANGELOG.md |
Documents features and breaking changes. |
Directory.Packages.props |
Adds fake-time testing dependency. |
src/FSharp.Control.R3/AsyncObservable.fs |
Fixes Async errors, cancellation, and iteration. |
src/FSharp.Control.R3/FSharp.Control.R3.fsproj |
Includes new library sources. |
src/FSharp.Control.R3/IterationGuard.fs |
Tracks and propagates iteration failures. |
src/FSharp.Control.R3/Observable.fs |
Adds operators, validation, and builder fixes. |
src/FSharp.Control.R3/ObservableFactories.fs |
Adds ofSeq factories. |
src/FSharp.Control.R3/ProcessingOptions.fs |
Renames modes and expands configuration. |
src/FSharp.Control.R3/TaskObservable.fs |
Fixes Task iteration and terminal APIs. |
tests/FSharp.Control.R3.Tests/AsyncObservableTests.fs |
Covers Async behavior. |
tests/FSharp.Control.R3.Tests/BuilderTests.fs |
Expands query-builder coverage. |
tests/FSharp.Control.R3.Tests/ChunkTests.fs |
Covers deterministic chunking behavior. |
tests/FSharp.Control.R3.Tests/FSharp.Control.R3.Tests.fsproj |
Registers tests and dependency. |
tests/FSharp.Control.R3.Tests/IntegrationTests.fs |
Adds end-to-end scenarios. |
tests/FSharp.Control.R3.Tests/MapAsyncTests.fs |
Covers all asynchronous processing modes. |
tests/FSharp.Control.R3.Tests/ObservableTests.fs |
Covers observable operators and factories. |
tests/FSharp.Control.R3.Tests/ProcessingOptionsTests.fs |
Verifies processing mappings and defaults. |
tests/FSharp.Control.R3.Tests/TaskObservableTests.fs |
Covers Task behavior and factories. |
tests/FSharp.Control.R3.Tests/TestHelpers.fs |
Adds deterministic testing infrastructure. |
tests/FSharp.Control.R3.Tests/testconfig.json |
Adds per-test timeout. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| Assert.AreEqual (1, rightProbe.Disposed, "The failure must unsubscribe the pipeline from the source that is still open") | ||
|
|
||
| [<TestMethod>] | ||
| member _.``a failure the catch handler does not handle fails the merged pipeline and unsubscribes from the open source`` () = |
- `Microsoft.Extensions.TimeProvider.Testing` drives time-based operators with `FakeTimeProvider`. - `TestHelpers.fs` provides synchronous sources, a `Recorder` observer that also captures `OnErrorResume` and can be awaited, a `SubscriptionProbe` that counts subscriptions and disposals, a `GatedSelector` that lets a test decide when asynchronous selectors finish, a recording `SynchronizationContext`, the shared assertions `assertFailedWith` and `assertArgumentRejected`, `dataRows`, the `Fruits` grouping fixture, and `Flavour` and `Terminals`, which run `mapAsync` and every terminal function in either flavour. - `testconfig.json` fails a hung test after 10 seconds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`ProcessingOptionsTests` pin `Default`, `Parallel`, and the `AwaitOperation` and `MaxConcurrent` of every `AwaitOperationConfiguration` case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`ChunkTests` cover `chunkBySize`, `chunkBy` for every `ChunkConfiguration` case with time driven by `FakeTimeProvider`, `chunkByBoundaries` and the `ChunkConfiguration` helpers: empty sources, resumed errors, failures, eager validation, window tokens, disposal and `ConfigureAwait`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replaces the `Thread.Sleep` test with deterministic tests of the rxquery builder over R3 1.3.1: `for`, `yield`, `zero` and every custom operation in order and with synchronous completion, empty sources, terminal failures and `OnErrorResume`, short-circuit disposal on hot subjects, the `sumBy` regressions and the `rxqueryWith` token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replaces the two smoke tests with tests of every function of the Observable module except chunking and rxquery, against R3 1.3.1 with synchronous sources: values, errors reported through `OnErrorResume` and completion for each wrapper, terminal failures, empty sources, disposal and unsubscription proven on open subjects, `choose` and `ObservableOption.choose`, and `ofSeq`, including its R3 behaviour with cancellation, enumeration exceptions and early unsubscription. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Exercise both flavours of mapAsync (Task and Async, one data row each) against R3 1.3.1 SelectAwait: every await operation, CancelOnCompleted, source failures, selector exceptions, resumed source errors, empty sources, the eager concurrency-limit validation, disposal and the ConfigureAwait option. Gated selectors and awaited signals keep every test deterministic; the unlimited parallel cases complete the source before releasing the last selector to avoid the R3 completion race. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Exercise every function of `FSharp.Control.R3.Async` against R3 1.3.1: the cold subscription of `length`, `aggregate`, `all`, `existsAsync`, `firstAsync`, `iter`, `toArray`, `toList`, `ofAsync`, `iterAsync`, a default `mapAsync` projection and the four `toLookup` overloads, including the positional `keyComparer` and `elementSelector` calls that the removed `cancellationToken` parameter used to swallow. Every terminal function is checked for raising the original exception of a source failure or `OnErrorResume`, for cancellation through the Async token, for keeping no subscription with a cancelled token and for resuming on the synchronization context it started to wait on. `iterAsync` is checked for every way it used to keep running, hang or lose a failure of its action. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cover every function of `FSharp.Control.R3.Task` except the selector modes of `mapAsync`, against R3 1.3.1 behaviour and deterministically: - `length`, `aggregate`, `all`, `existsAsync`, `firstAsync`, `iter`, `toArray` and `toList` for values, empty sources, short-circuiting and callback exceptions. - `iterAsync`: order, failures of the action, including a late one and an `OperationCanceledException` of its own, synchronous sources, cancellation of the running action, and eager rejection of an invalid concurrency limit. - `ofTask` (both overloads): synchronous emission, one invocation per subscription, failures, disposal, and `configureAwait` defaulting to `true`, observed through a recording synchronization context. - Every `toLookup` overload, positional, with and without a token, including the empty lookup. - Every terminal function, through data rows: terminal failures and resumed errors fault with the same exception, and cancellation disposes the subscription, both while waiting and up front. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A hot subject through filter, distinct, mapi and chunkBySize, including a failed completion, a resumed predicate error and disposal. - Merged sources behind catch: the fallback, an unhandled exception type and resumed errors, each unsubscribing from the source still open. - The Task and Async terminal functions agree on the same pipeline, on an empty one, and fail with the same exception instance. - mapAsync failures and cancellation of the terminal function, time chunks driven by FakeTimeProvider, ofTask and ofAsync inside bind, rxquery feeding both flavours, chunkByBoundaries with a unit trigger feeding choose, and ofSeq feeding a whole pipeline. The type abbreviations are wrapped in a file-specific module, because namespace-level abbreviations with the same names in another test file fail to compile with FS0249. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
xperiandri
force-pushed
the
tests/integration-coverage
branch
from
October 5, 2026 00:17
9b77bdd to
5f4d048
Compare
This was referenced Oct 5, 2026
This was referenced Oct 5, 2026
This branch has not been deployed
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.

Proposed Changes
Covers the whole public API of
FSharp.Control.R3with 429 deterministic integration tests that run realR31.3.1pipelines – hot subjects, synchronous sources, chunking driven byFakeTimeProvider, gated asynchronous selectors, errors, cancellation and disposal. Closes #11 and supersedes the draft #12.The library fixes, the new API, the documentation and the test categories that this pull request used to carry are now the separate pull requests stacked below it (see the list at the end). This one is based on the top of that stack, #43, so it shows only the tests.
Types of changes
What types of changes does your code introduce to FSharp.Control.R3?
Put an
xin the boxes that applyChecklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
Commits – the test infrastructure first, then one commit per test file (processing options, chunking,
rxquery, theObservablemodule,mapAsync, the Async flavour, the Task flavour, cross-cutting scenarios), ordered so that no test class refers to a test file that does not exist yet, and finally the changelog line and the agent instructions. Every commit builds on its own and passes the tests that exist at that point.Test infrastructure
TestHelpers.fsprovides:Recorderthat also capturesOnErrorResume;SubscriptionProbe, which counts subscriptions and disposals;GatedSelector, whose results the test releases;FlavourandTerminalsdispatchers, which run the same test against both flavours.Microsoft.Extensions.TimeProvider.Testing10.10.0is added for the test project only.testconfig.jsonfails a hung test after 10 s.TestCategories.fs(test: categorize the tests per tested component #43), so a subset runs with--filter TestCategory=....Verification
R31.3.1defects found along the way are documented in docs: document the R3 1.3.1 limitations ofbind,catchandmapAsync#42 and reported upstream asToObservable(IEnumerable)keeps enumerating after the subscriber is disposed Cysharp/R3#396,SelectAwaitwithAwaitOperation.SequentialParallelandmaxConcurrentleaks a slot when the selector fails Cysharp/R3#397,SelectAwaitwithAwaitOperation.Parallelcan lose its completion (race in the completion handshake) Cysharp/R3#398,SelectAwait/SubscribeAwaitswallow everyOperationCanceledExceptionand stop the sequential modes for good Cysharp/R3#399,Catchdoes not unsubscribe from the handler's sequence when disposed Cysharp/R3#400 andSelectManydrops an inner failure that arrives after the source completed Cysharp/R3#401, with a root-cause analysis in SelectAwait and SubscribeAwait do not properly propagate exception to UnhandledExceptionHandler Cysharp/R3#377.Stack – every pull request is based on the one before it, so each shows only its own change. Merge them in this order:
AwaitOperationConfigurationcases withAwait#23 refactor!: prefixAwaitOperationConfigurationcases withAwaitmapAsyncoptions eagerly #24 fix: validate the concurrency limit ofmapAsyncoptions eagerlyyield/zerosynchronously to keep element order #25 fix(rxquery): emityield/zerosynchronously to keep element ordersumBywithUnchecked.defaultof#26 fix(rxquery)!: stop seedingsumBywithUnchecked.defaultofrxqueryWithto cancel the terminal query operators #27 feat(rxquery): addrxqueryWithto cancel the terminal query operatorsofSeqreachable asObservable.ofSeq#29 feat(observable)!: makeofSeqreachable asObservable.ofSeqObservable.choosetake avoptionchooser, addObservableOption#30 feat(observable)!: makeObservable.choosetake avoptionchooser, addObservableOptionchunkByBoundariesfor boundaries of any element type #31 feat(observable): addchunkByBoundariesfor boundaries of any element typecancellationTokenfromtoLookup#35 fix(async)!: remove the ignoredcancellationTokenfromtoLookupiterAsyncthroughForEachAsyncinstead ofCountAsync#37 fix: wait foriterAsyncthroughForEachAsyncinstead ofCountAsynciterAsyncreliably and never lose a failure of its action #38 fix: stopiterAsyncreliably and never lose a failure of its actionofTaskconfigureAwaittotrue#39 fix(task)!: defaultofTaskconfigureAwaittotruetoArrayandtoListinto theTask.Observablemodule #40 feat(task)!: movetoArrayandtoListinto theTask.Observablemodulebind,catchandmapAsync#42 docs: document the R3 1.3.1 limitations ofbind,catchandmapAsync🤖 Generated with Claude Code