Skip to content

Extract admitted-error finalization from demo RC - #464

Open
ChristianPavilonis wants to merge 11 commits into
feature/kv-geoipfrom
review/admitted-error-finalization
Open

ChristianPavilonis wants to merge 11 commits into
feature/kv-geoipfrom
review/admitted-error-finalization

Conversation

@ChristianPavilonis

@ChristianPavilonis ChristianPavilonis commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Adds App::set_admitted_error_response_finalizer, an optional synchronous callback that runs once on each rendered admitted dispatch error, after the configured error renderer. It receives the request's existing GeoOutcome and &mut Response, so an application can add the headers its middleware adds to Ok responses.
  • EdgeZero keeps the failure classification, route and synthesized-response bookkeeping, and reapplies the rendered status and required protocol headers after the callback. Successful responses, detached errors, pre-admission refusals and admitted body-conversion errors don't call it. With no finalizer installed, behavior is unchanged.
  • This is a mechanical extraction of the demo RC commit 89c279b59b75eb33b96eb30a35f78bf933762f34. It doesn't redesign response ownership or Geo policy, and adds no body carrier, transport, timer policy or production Geo provider.

Changes

Crate / File Change
crates/edgezero-core/src/app.rs New finalizer field and setter. dispatch_admitted_with_geo calls it after rendering an admitted error and restores status and required headers. Three regression tests.
docs/guide/native-geo.md Explains when to use middleware and when to use the finalizer, and which errors bypass it.

Closes

Closes #518

Refs #461. Integration RC #462 includes this PR at 96c21d731501370044f11ca5832e85701e79a421.

Stack

Base is feature/kv-geoip (#454), following the placement in #510: #439, then #510, then #454, then this PR, outside official stack membership. The PR's own diff uses only #439 APIs (GeoOutcome, dispatch_admitted_with_geo).

The server-side identity plan (IABTechLab/trusted-server#1559, Part A and Part C) still says to drop #454's prototype commits and base this PR on #439's branch. That conflicts with #510 and is still open.

Head is dfec0db36401831188ee15db8f17e40084b23827. The commits after 96c21d73 are merges of the parent branches. The PR's changed lines are identical to 89c279b5. feature/kv-geoip has since moved ahead by eight commits that aren't merged here yet, including 2c41968b (Fastly and Cloudflare Geo through ctx.geo()) and 7ef4766d (Axum Geo from the manifest).

Test plan

  • Hosted CI at dfec0db3: all 29 checks pass, including workspace tests, Axum, Fastly, Cloudflare and Spin tests and clippy, cargo fmt and docs formatting.
  • cargo test -p edgezero-core --lib admitted_error_finalizer at dfec0db3: 3 passed.
  • At the original extraction (96c21d73): Core 1,174 default-parallel tests, Axum 488 and production-hosting 36 serial cases, scoped Clippy and formatting. These results are tied to that revision.

Earlier local runs saw native parallel timing failures that nobody has classified. This PR doesn't relax their assertions or claim to fix them.

Not covered: ALB credential validation, cloud ingress, browser behavior and deployment.

Ready for review. It merges with the stack above, not directly into main.

@aram356

aram356 commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

CREATOR: From the server-side identity plan (IABTechLab/trusted-server#1559, c7dc9de77): Rebase as Part A's table says.

@ChristianPavilonis
ChristianPavilonis changed the base branch from feature/pluggable-geo-providers to feature/kv-geoip November 17, 2026 17:01
@ChristianPavilonis
ChristianPavilonis marked this pull request as ready for review November 19, 2026 21:03

This branch has not been deployed

No deployments
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.

2 participants