Add RunInChildContextAsync#2370
Draft
GarrettBeatty wants to merge 1 commit into
Draft
Conversation
d943d16 to
7ca2099
Compare
cd3e24c to
e146869
Compare
Adds child-context support to the .NET Durable Execution SDK. A child context is a logical sub-workflow with its own deterministic operation-ID space, persisted as a CONTEXT operation so subsequent invocations replay the cached value without re-executing the function. Public surface: - IDurableContext.RunInChildContextAsync<T> (reflection + AOT-safe ICheckpointSerializer<T> overloads, plus a void overload). - ChildContextConfig with SubType (observability label) and ErrorMapping (transform exceptions before they surface to the caller). - ChildContextException for failure surfacing. Used as a building block for upcoming WaitForCallbackAsync. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
e146869 to
369a029
Compare
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.
Summary
RunInChildContextAsynctoIDurableContext(3 overloads: reflection, AOT-safeICheckpointSerializer<T>, and void-returning).ChildContextConfig(SubTypefor observability,ErrorMappingfor exception remapping) andChildContextExceptionfor failure surfacing.Internal/ChildContextOperation<T>mirroring the Step/Wait pattern: sync-flush CONTEXT START → run user func → emit SUCCEED with serialized result, or FAIL with error and throwChildContextException. Replay: SUCCEEDED returns cached value, FAILED throws (afterErrorMapping), STARTED/PENDING re-runs the func and lets the child's own operations replay from their own checkpoints.LambdaDurableServiceClient.MapFromSdkOperationto copyContextDetails(Result+Error).This is a building block for upcoming
WaitForCallbackAsync, which (per the Java/JS reference SDKs) wrapsCreateCallbackAsync+ a submitter step inside a child context for observability and clean error mapping.Test plan
ChildContextOperationTests.cscovering: fresh execution + checkpoint emission, deterministic child operation IDs, replay SUCCEEDED, replay FAILED (with and withoutErrorMapping), suspended child (Wait inside child propagates termination), replay STARTED with completed inner step, void overload, AOT-safe serializer overload.🤖 Generated with Claude Code