Skip to content

feat: add the request/response pipeline (policies, runner, builder, entry point)#5

Merged
OmarAlJarrah merged 4 commits into
feat/pipeline-prerequisitesfrom
feat/pipeline-spine
Jun 16, 2026
Merged

feat: add the request/response pipeline (policies, runner, builder, entry point)#5
OmarAlJarrah merged 4 commits into
feat/pipeline-prerequisitesfrom
feat/pipeline-spine

Conversation

@OmarAlJarrah

Copy link
Copy Markdown
Member

Summary

Adds the transport-agnostic request/response pipeline — the spine every cross-cutting concern (auth, retry, redirect, logging, tracing) plugs into.

Stacked on #4 — merge that first. This PR's base is feat/pipeline-prerequisites, so it shows only the pipeline diff.

  • HttpPipelinePolicy — the policy abstraction: a Stage plus ProcessAsync(PipelineContext, PipelineRunner continuation) (the Azure.Core-style object-policy model).
  • PipelineRunner — an immutable readonly 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 with Add / InsertBefore<T> / InsertAfter<T> / Replace<T> / Remove<T>, a stable stage-sort, and pillar-cardinality validation.
  • HttpPipeline — the entry point: SendAsync (plus a thin blocking Send bridge) runs a request through the chain and returns the response.

No new dependencies; Core stays BCL + the standard abstractions.

Test plan

  • dotnet build -c Release clean on net8.0 and net10.0 (warnings-as-errors)
  • dotnet format --verify-no-changes clean
  • dotnet test -c Release passes (90 tests: 77 core, 13 serialization)

🤖 Generated with Claude Code

OmarAlJarrah and others added 4 commits June 15, 2026 22:42
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>
@OmarAlJarrah OmarAlJarrah merged commit d837241 into feat/pipeline-prerequisites Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant