Feat/context cancellation propagation#25
Merged
Conversation
Add focused failing tests for parent-child cancellation propagation, child isolation, and timeout-derived cancellation so the new Context primitive ships with a concrete behavioral contract. Constraint: Cancellation must fit the existing GoOptions-centric API surface Rejected: Start implementation without tests | easy to drift on semantics Confidence: high Scope-risk: narrow Directive: Keep Context cancellation-focused in v1; do not add value storage during this pass Tested: dotnet test src/Concur.Tests/Concur.Tests.csproj --filter ContextTests -v minimal (expected compile failure) Not-tested: Full solution build
Add a small, cancellation-focused Context primitive and expose it through GoOptions so existing Concur APIs gain a shared operation lifetime without exploding the Go overload surface. Constraint: v1 must stay interoperable with CancellationToken-based APIs Rejected: Add value storage to Context | not needed for cancellation propagation Confidence: medium Scope-risk: moderate Directive: Keep Context additive; do not thread it as a positional argument across Go overloads in this change Tested: dotnet test src/Concur.Tests/Concur.Tests.csproj --filter ContextTests -v minimal Not-tested: Full solution build
Add cancellable WaitAsync/Wait overloads so callers can abandon waits when an operation Context is canceled without mutating the underlying wait-group state or breaking reuse semantics. Constraint: Existing lock-free WaitGroup state machine must remain intact Rejected: Build a separate cancellable wait primitive | unnecessary extra API surface Confidence: high Scope-risk: narrow Directive: Keep cancellation outside the wait-group count; never couple token cancellation to Done() Tested: dotnet test src/Concur.Tests/Concur.Tests.csproj --filter WaitGroupTests -v minimal Not-tested: Full solution build
Add focused tests for pre-start cancellation, blocked-on-limiter cancellation, channel failure on producer cancellation, and exception-handler suppression for cooperative OperationCanceledException paths. Constraint: Existing Go overloads must keep their current signatures Rejected: Infer semantics from docs alone | too easy to regress across overloads Confidence: high Scope-risk: narrow Directive: Treat cooperative cancellation separately from faults in every Go code path Tested: dotnet test src/Concur.Tests/Concur.Tests.csproj --filter "FullyQualifiedName~Concur.Tests.ConcurRoutineTests|FullyQualifiedName~Concur.Tests.ExceptionHandlingTests" -v minimal Not-tested: Full solution build
Teach ConcurRoutine to stop before delegate execution when an operation Context is canceled, to stop treating matching OperationCanceledException as a fault, and to surface producer cancellation through returned channels. Constraint: Public Go overload signatures must remain unchanged Rejected: Add Context as a new positional parameter to every overload | too much surface churn for v1 Confidence: medium Scope-risk: broad Directive: Reuse the helper methods for every overload; do not reintroduce raw semaphore.WaitAsync calls in individual Go bodies Tested: dotnet test src/Concur.Tests/Concur.Tests.csproj --filter "FullyQualifiedName~Concur.Tests.ConcurRoutineTests|FullyQualifiedName~Concur.Tests.ExceptionHandlingTests" -v minimal Not-tested: Full solution build
Explain how the new Context primitive works with GoOptions, WaitGroup, and channel-producing Go overloads so callers can adopt cancellation propagation without reading the implementation first. Constraint: README examples must stay aligned with the shipped public API Rejected: Leave the feature undocumented | increases adoption friction and misuse risk Confidence: high Scope-risk: narrow Directive: Keep README examples cooperative; show token propagation explicitly Tested: dotnet test src/Concur.Tests/Concur.Tests.csproj -v minimal; dotnet build src/Concur.sln -v minimal Not-tested: Benchmarks
…WithCancel methods
…ption The spec defines a dedicated Concur.Extensions.AspNetCore package with global-on Context parameter binding for controllers and minimal APIs, configurable token-source composition, and explicit strict/lenient failure policy. It also records the docs layout decision: detailed guidance lives in the new project directory while the root README links to it. Constraint: Existing docs/superpowers/specs markdown files are gitignored and must be force-added intentionally Rejected: Middleware-first Context injection | introduces ordering concerns and weaker native parameter UX Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep token-source configuration API unambiguous (separate method names, no delegate-overload ambiguity) Tested: Spec self-review (placeholder and consistency pass) Not-tested: Runtime ASP.NET behavior (design artifact only)
…ons.AspNetCore` package Add `Concur.Extensions.AspNetCore` with Context parameter binding for controllers and minimal APIs. Introduce configurable token-source composition and strict/lenient failure policies. Update solution structure and tests to validate ASP.NET Core-specific behavior and allow seamless global Context access. Update root README with new package details and link to detailed usage docs.
ManualResetEventSlim.Wait and Task.WhenAny sentinel delays in tests that wait on goroutines (Task.Run), timer callbacks, or channel operations can all be blocked when the CI thread pool is saturated by concurrent tests. Raising the ceiling to 5s gives enough headroom without making the suite meaningfully slower when the pool is healthy. Unaffected: SpinWait.SpinUntil calls that wait on direct cts.Cancel() propagation — those run synchronously on the cancelling thread and complete in microseconds regardless of thread pool state.
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.
No description provided.