feat: add the request/response pipeline (policies, runner, builder, entry point)#5
Merged
Merged
Conversation
Introduces PipelineStage (sparse enum with pillar/non-pillar semantics), HttpPipelinePolicy (abstract base; async-only in v1), and PipelineRunner (immutable readonly struct that advances the policy chain and terminates at the transport). Tests verify stage-order execution and re-entrancy. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Introduces PipelineBuilder with fluent Add/InsertBefore<T>/InsertAfter<T>/ Replace<T>/Remove<T> operations. Build stable-sorts by stage, validates pillar cardinality (throws InvalidOperationException naming the stage when violated), and produces an HttpPipeline. Also adds PipelineStageHelper (internal IsPillar/PillarStages) and HttpPipeline (entry point with async SendAsync and blocking Send bridge). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds HttpPipelineTests covering SendAsync and the blocking Send bridge. The implementation was already landed with PipelineBuilder in the prior commit; this commit captures the Group 3 test coverage. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace tautological NotNull-only assertions in PipelineBuilderTests with execution-log tests that exercise the actual pipeline chain. New tests confirm: stage-sort order (Operation → Redirect → Diagnostics) via recording stubs, InsertAfter/InsertBefore within the same stage, Replace swapping one policy for another, and Remove dropping the target while leaving others intact. Also fixes the import ordering that caused dotnet format --verify-no-changes to fail (Http.Response was listed before Http.Request; corrected to alphabetical order and added the missing Configuration using directive required by the new tests). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3 tasks
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
Adds the transport-agnostic request/response pipeline — the spine every cross-cutting concern (auth, retry, redirect, logging, tracing) plugs into.
HttpPipelinePolicy— the policy abstraction: aStageplusProcessAsync(PipelineContext, PipelineRunner continuation)(the Azure.Core-style object-policy model).PipelineRunner— an immutablereadonly struct"continuation" that advances through the ordered policies and invokes the transport at the tail. Because it's immutable, a policy may call it more than once — which is exactly how retry/redirect re-drive everything downstream (verified by test).PipelineStage— the ordered stage model (Operation → Redirect → PerCall → Retry → PerAttempt → Auth → Diagnostics): pillar stages admit a single policy; PerCall/PerAttempt stack user policies.PipelineBuilder— composes a pipeline withAdd/InsertBefore<T>/InsertAfter<T>/Replace<T>/Remove<T>, a stable stage-sort, and pillar-cardinality validation.HttpPipeline— the entry point:SendAsync(plus a thin blockingSendbridge) runs a request through the chain and returns the response.No new dependencies;
Corestays BCL + the standard abstractions.Test plan
dotnet build -c Releaseclean on net8.0 and net10.0 (warnings-as-errors)dotnet format --verify-no-changescleandotnet test -c Releasepasses (90 tests: 77 core, 13 serialization)🤖 Generated with Claude Code