feat(web): pipeline exception boundary, status-code pages, 404 terminal via OnError hook [L03.01.01.19] - #920
Merged
Conversation
Commit 6688b71 renamed HttpAuthenticationFeature -> AuthenticationFeature but left HttpContextAuthenticationExtensions (namespace Assimalign.Cohesion.Web.Authentication) without a using for the child .Internal namespace where the concrete type lives, breaking the Web.Authentication build and every project that references it — including the Web.Hosting test project this task needs to verify. Add the missing using. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…al via OnError hook [L03.01.01.19] Implements #881 as a CONSUMER of the shipped #864 OnError chain (PR #893), re-scoped from the issue's IResult design: IResult was withdrawn pre-merge, so the Web area is middleware-first and there is no result-carrier channel. No IResult, no Results.Problem/ExecuteResultAsync, no second handler abstraction. Web.ErrorHandling (new pipeline verbs, homed with AddErrorHandling): - UseErrorHandling() installs the exception-boundary middleware: catches faults escaping downstream, publishes IHttpExceptionFeature (caught exception + path), and on an unstarted response resets it and dispatches through the shipped IErrorHandlingFeature.Handlers chain (registration order, first-true wins) to the ProblemDetails-500 terminal. No-clobber: when IHttpResponseStreamingFeature .HasStarted reports the head is committed, it aborts the one exchange via IHttpContext.CancelAsync instead of half-writing (connection survives). - Developer-detail toggle (off by default) enriches only the boundary's terminal fallback. OnException observation hook + SuppressDiagnosticsCallback are the Cohesion parity for .NET 10 SuppressDiagnosticsCallback (no Microsoft.Extensions logging). Handler faults propagate, never masked (shipped OnError semantics); an observer fault is swallowed (observation must not defeat rendering). - UseStatusCodePages() upgrades a bodyless 4xx/5xx terminal response into problem+json (or a custom responder). Web.Hosting: - The silent Task.CompletedTask pipeline terminal now sets a bodyless 404 for an unhandled request (still 200, no body/content-type/location). It stays payload- free because COHRES002 forbids the runtime module referencing Web.ProblemDetails; UseStatusCodePages upgrades it. A deliberate empty 200 must be terminal (not chain to next) — the TLS integration test's terminal handler is adapted to match. Tests: 22 new Web.ErrorHandling unit tests + 3 end-to-end (UseErrorHandling default, handler-owns, UseStatusCodePages 404 upgrade) + 3 Web.Hosting terminal tests. Docs: Web.ErrorHandling DESIGN/OVERVIEW, Web.Hosting DESIGN, Web README updated; fixed the IHttpErrorHandler/IHttpErrorHandlingFeature naming drift in OVERVIEW. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ature naming drift Review follow-ups on the #881 branch: implement IWebApplicationContext.ContentRootPath on the Web.Routing TestWebApplicationContext (stale since 6688b71) and correct the IHttpErrorHandlingFeature -> IErrorHandlingFeature name drift in the ErrorHandling csproj description, xmldoc, and DESIGN.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 19, 2026
dotnetcadet
added a commit
that referenced
this pull request
Jul 20, 2026
…ack reconciliation) PRs #920-#925 squash-merged to main leave this stacked branch's copy of those commits content-identical but history-divergent; the only textual conflicts were Web.Caching's wiring lines sitting alphabetically adjacent to Web.Compression's in App.props, the CI matrix, both slnx files, and the README project map - resolved to the union. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Stack 1/8 of the Web/Http Batch 4b stacked series (base:
main).Rebuilds the pipeline fault story as a consumer of the shipped #864 seams — middleware-first, no IResult (the issue body predates the 2026-07-10 re-scope; the plan's §4 row is the authority):
UseErrorHandling()(Web.ErrorHandling): exception-boundary middleware — catches faults escaping downstream middleware, publishesIHttpExceptionFeature, resets the unstarted response (no-clobber guard viaIHttpResponseStreamingFeature.HasStarted; started responses abort the exchange viaCancelAsyncinstead), then dispatches the shippedOnErrorchain (registration order, first-true owns) with a ProblemDetails-500 terminal. Handler faults propagate to the server's last-resort isolation — never masked.UseStatusCodePages()(opt-in): upgrades bodyless 4xx/5xx terminal responses to RFC 9457 problem+json (customRespondersupported); never touches started responses or existing bodies.WebApplication.Build()'s silentTask.CompletedTaskterminal now sets a bodyless 404 on unshaped fall-through responses. Payload-free by design — COHRES002 forbids Web.Hosting referencing Web.ProblemDetails; status-code pages renders the body.IncludeDeveloperDetails, off by default) enriches only the fallback payload;SuppressDiagnosticsCallback+OnExceptionobserver give .NET-10-parity diagnostics suppression.Review follow-ups included: repaired the pre-existing
6688b71abreaks (Web.Authentication missing using; Web.Routing test double missingContentRootPath) and theIErrorHandlingFeaturenaming drift.Tests
Web.ErrorHandling 37 · Web.Hosting 49 · Web.Routing 250 — all passing locally; full Web regression sweep green (Testing, Query, Diagnostics, ForwardedHeaders, HostFiltering, RequestTimeouts, Authentication, ProblemDetails, Serialization, StaticFiles, Forms, Health).
Notes
catch (Exception)sites carry deviation markers (boundary fault-catch + two best-effort callback guards).docs/Assembly/pages deferred with the package's existing doc maturity.Closes #881
🤖 Generated with Claude Code