Repository navigation
feat: add CombineAsync - #37
Merged
Merged
Conversation
Validated.CombineAsync waits for two to eight validations that run as tasks and combines them like Combine, every error in argument order (V7, V10). Every input is a task (C# cannot infer types through conversions, see #16); completed tasks give a completed result without allocating, and every task is observed before combining. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012weRUz3QcTAaQw32ZmQkoK
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
TP-11, card 6.2 of milestone M6 (1.0.0-beta.1), in the shape decided in #16.
Validated.CombineAsync(t1, …, tN, combine)for N = 2…8Task<Validated<…>>inputs: the asynchronousCombine. The tasks run concurrently, and every error of every input comes back in argument order (V7). It is generated from one template, likeCombine.ZipAsyncalternatives were dropped (see the comment in feat: add CombineAsync (TP-11) #16). A synchronous check goes in asTask.FromResult(...), or the synchronous checks are combined on their own and joined withZip.Task.WhenAllobserves every task: a failed task comes out as itself, a canceled one cancels the result, an uninitialized result givesArgumentException, and a null from the combiner givesInvalidOperationException. The library never resumes on the caller's synchronization context.Tests:
CombineAsyncProperties(every arity ≡ awaiting each input +Combine, with completed and yielding tasks; a completed result for completed tasks; a failure at any position of every arity comes out as itself; cancellation; null and uninitialized results; no posts to a countingSynchronizationContextfor any arity; missing tasks by name for every position). The first Stryker run left 83 survivors. 34 wereConfigureAwaiton already completed tasks, gone now that the results are read in a non-async helper. The rest showed missing per-arity tests, which are now in place. Allocation lines:CombineAsync(2)and(8)with completed tasks, 0 B.CombineAsyncContracts: tasks infer; a bare validation hits CS0411 andTask.FromResultfixes it; the split +Zippattern compiles. Stryker locally: 100 %. README "Async" with the split pattern; AOT smoke extended (a yielding task, accumulation, joining withZip).Closes #16
Checklist
dotnet test --solution dotValid.slnxis green locally🤖 Generated with Claude Code
https://claude.ai/code/session_012weRUz3QcTAaQw32ZmQkoK