Repository navigation
A geo module is called with the request, as a device module is - #1374
Draft
jwrosewell wants to merge 14 commits into
Draft
jwrosewell wants to merge 14 commits into
jwrosewell wants to merge 14 commits into
Conversation
locate_request on dyn GeoModule builds the call every geo call carries, the request as evidence from its headers and the client address, the settings when the caller has them, the services and the client, and the Edge Cookie path, the auction endpoint, the Didomi module and the seam probe call it. The Fastly adapter's two finalize paths call it without headers and say why: the module there is the host's own lookup or the disabled one, chosen by build_geo_module, which reads the address alone, so the middleware no longer clones the headers for it.
# Conflicts: # CHANGELOG.md
…the deployment selects The finalize step that writes the x-geo-* headers on every response built its geo module with build_geo_module alone, which answers the host's own lookup for "platform" and the disabled module for every other name, because it cannot see the registry. A deployment whose [geo] module names a module from the registry therefore got no location on that path, and every page carried x-geo-info-available: false, while the same module answered the request path. The adapter now hands the finalize step the registry's module when the selector names one, through finalize_geo_module, and the host's own lookup or the disabled module otherwise, as before. The step keeps the request's headers before the handler takes the request and hands them to the module as its evidence, so a module that reads the request, as a device module does, is called the way the request path calls it, and the answer it holds for the same evidence from earlier in the request is the one it gives. The note on locate_request no longer says the finalize paths never call a registry module. A test proves the finalize step hands a geo module the request's headers, with a module that records the user agent of the evidence it is called with.
This branch has not been deployed
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
Changes
crates/trusted-server-core/srccrates/trusted-server-adapter-fastly/srcdocs/guidecrates/cmp/didomicrates/testing/seam-probecrates/trusted-server-adapter-axum/testscrates/trusted-server-cli/srccrates/auction/prebid-servercrates/loading-cache/51degreesCHANGELOG.mdcrates/trusted-server-adapter-spin/srcCloses
Closes #1321
Test plan
CI: 19 of 19 checks green, the fork's CI on 1b8b438 (jwrosewell#28).
cargo test-fastly && cargo test-axumcargo clippy-fastly && cargo clippy-axumcargo fmt --all -- --checkcd crates/trusted-server-js/lib && npx vitest runcd crates/trusted-server-js/lib && npm run formatcd docs && npm run formatcargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1fastly compute serveChecklist
unwrap()in production code (clippy deniesunwrap_usedin CI)logmacros as AGENTS.md asks (notprintln!)On top of a module declares the caches it loads through (#27). Issue: #1321.
What this adds
A geo module is a
GeoModule, called with the request's module call as a device module is,locate(call), so it sees the request's evidence, the settings and the services, and a module whose one service answers location and device from the same request can answer both from one call. A module that resolves from the client address alone keeps implementingPlatformGeoand is offered throughPlatformGeoModule::new(name, module), which hands the platform lookup the address the call carries and asks nothing when the call carries no services.RuntimeServices::geoandIntegrationRegistration::with_geo_moduletake anArc<dyn GeoModule>,build_geo_modulereturns one (platformwraps the host's lookup, anything else the disabled one), and the registry resolves[geo] moduleto aGeoModule. Core builds the call in one place,locate_requestondyn GeoModule, from the request's view, its headers, the settings and the services. The Edge Cookie path, the auction endpoint, the Didomi module and the seam probe call it with the request's headers. The Fastly adapter's two finalize paths call it without headers, since none survive to them, and the module on those paths is the host's own lookup or the disabled one, chosen bybuild_geo_module, which reads the address alone.Why
A geo module was called as
lookup(client_ip, services), with the address and nothing else of the request, while a device module is called with the request's evidence. A vendor whose one service answers location and device from the same request could not make the geo answer from the same call as the device answer, so either the two were asked separately or the geo answer depended on the device module having run first on the same adapter. The adapters resolved geo in four places with the request in hand and handed the module only the address.What breaks
Crates outside core that passed a
PlatformGeotowith_geo_moduleorRuntimeServices::geowrap it inPlatformGeoModule::new(name, module), or implementGeoModuleto see the request. The Didomi module's geo call is rewritten to go throughlocate_request, and reads the resolvedGeoInfoas before. Nothing in a deployment's documents changes.The commits
CI passed on dbaa36b (d66b7ce passed every job but the CLI ones), and runs on 5a1938d.
What is not in this pull request