Skip to content

Migrate utility layer to HTTP types (PR 11)#623

Open
prk-Jr wants to merge 115 commits intomainfrom
feature/edgezero-pr11-utility-layer-migration-v2
Open

Migrate utility layer to HTTP types (PR 11)#623
prk-Jr wants to merge 115 commits intomainfrom
feature/edgezero-pr11-utility-layer-migration-v2

Conversation

@prk-Jr
Copy link
Copy Markdown
Collaborator

@prk-Jr prk-Jr commented Apr 8, 2026

Summary

  • Migrate the PR11 utility layer off direct fastly::Request/fastly::Response usage so core helpers can operate on http::{Request, Response} and edgezero_core::Body.
  • Add a temporary compat bridge at Fastly boundaries so handlers and integrations can keep working while later migration PRs move the remaining call stack.
  • Lock in the migration with focused compat tests and a guard test that prevents the migrated utility modules from drifting back to Fastly request/response types.

Changes

File Change
Cargo.toml Add the workspace mime dependency used by migrated HTTP response helpers.
Cargo.lock Record the new mime dependency.
crates/trusted-server-adapter-fastly/src/main.rs Route forwarded-header sanitization and basic-auth response conversion through the new compat boundary.
crates/trusted-server-core/Cargo.toml Add the core crate's mime workspace dependency.
crates/trusted-server-core/src/auction/endpoints.rs Convert auction utility calls to use the HTTP request compat bridge for synthetic ID and consent handling.
crates/trusted-server-core/src/auction/formats.rs Bridge Fastly requests into migrated synthetic ID generation helpers.
crates/trusted-server-core/src/auth.rs Migrate basic-auth enforcement to http::Request/Response and update tests to HTTP builders.
crates/trusted-server-core/src/compat.rs Add Fastly↔HTTP request/response conversions plus temporary Fastly boundary shims for headers, cookies, and synthetic cookie handling.
crates/trusted-server-core/src/consent/extraction.rs Migrate consent signal extraction to http::Request<EdgeBody>.
crates/trusted-server-core/src/consent/mod.rs Move consent pipeline input types and tests onto HTTP request types.
crates/trusted-server-core/src/cookies.rs Migrate cookie parsing/forwarding and synthetic cookie response helpers to HTTP request/response types.
crates/trusted-server-core/src/http_util.rs Migrate request/response helpers to HTTP types, preserve duplicate headers, and keep request-info logic on ClientInfo.
crates/trusted-server-core/src/integrations/lockr.rs Use Fastly compat shims for header/cookie forwarding at the integration boundary.
crates/trusted-server-core/src/integrations/permutive.rs Use Fastly compat shims for custom-header forwarding at the integration boundary.
crates/trusted-server-core/src/integrations/prebid.rs Bridge request-info construction and cookie forwarding through compat conversions.
crates/trusted-server-core/src/integrations/registry.rs Use compat conversions for synthetic ID generation and synthetic cookie response handling.
crates/trusted-server-core/src/integrations/testlight.rs Bridge the migrated synthetic ID lookup into the Fastly integration path.
crates/trusted-server-core/src/lib.rs Export the compat module and add migration guard tests.
crates/trusted-server-core/src/migration_guards.rs Add a regression test preventing migrated utility modules from reintroducing direct Fastly request/response types.
crates/trusted-server-core/src/proxy.rs Bridge proxy synthetic ID reads through the migrated HTTP utility layer.
crates/trusted-server-core/src/publisher.rs Route TSJS serving, request-info extraction, consent handling, and synthetic cookie writes through compat conversions.
crates/trusted-server-core/src/request_signing/endpoints.rs Switch JSON content-type constants to mime::APPLICATION_JSON.
crates/trusted-server-core/src/synthetic.rs Migrate synthetic ID helpers and tests to http::Request<EdgeBody>.

Closes

Closes #492

Test plan

  • cargo test --workspace
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo fmt --all -- --check
  • JS tests: cd crates/js/lib && npx vitest run
  • JS format: cd crates/js/lib && npm run format
  • Docs format: cd docs && npm run format
  • WASM build: cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1
  • Manual testing via fastly compute serve
  • Other: focused Rust verification with cargo test --package trusted-server-core compat -- --nocapture, cargo test --package trusted-server-core http_util -- --nocapture, cargo test --package trusted-server-core request_signing -- --nocapture, and cargo test --package trusted-server-core migration_guards -- --nocapture
  • Other: local cd crates/js/lib && npx vitest run currently fails before test execution with ERR_REQUIRE_ESM in html-encoding-sniffer -> @exodus/bytes/encoding-lite.js; leaving CI to capture the current JS environment issue.

Hardening note

This PR does not add any new config-derived regex or pattern compilation paths. Basic auth still surfaces invalid enabled handler regex configuration as an error rather than panicking, covered by auth::tests::returns_error_for_invalid_handler_regex_without_panicking alongside the existing settings startup validation tests.

Checklist

  • Changes follow CLAUDE.md conventions
  • No unwrap() in production code — use expect("should ...")
  • Uses project logging macros (not println!)
  • New code has tests
  • No secrets or credentials committed

prk-Jr and others added 30 commits March 18, 2026 16:54
Rename crates/common → crates/trusted-server-core and crates/fastly →
crates/trusted-server-adapter-fastly following the EdgeZero naming
convention. Add EdgeZero workspace dependencies pinned to rev 170b74b.
Update all references across docs, CI workflows, scripts, agent files,
and configuration.
Introduces trusted-server-core::platform with PlatformConfigStore,
PlatformSecretStore, PlatformKvStore, PlatformBackend, PlatformHttpClient,
and PlatformGeo traits alongside ClientInfo, PlatformError, and
RuntimeServices. Wires the Fastly adapter implementations and threads
RuntimeServices into route_request. Moves GeoInfo to platform/types as
platform-neutral data and adds geo_from_fastly for field mapping.
- Defer KV store opening: replace early error return with a local
  UnavailableKvStore fallback so routes that do not need synthetic ID
  access succeed when the KV store is missing or temporarily unavailable
- Use ConfigStore::try_open + try_get and SecretStore::try_get throughout
  FastlyPlatformConfigStore and FastlyPlatformSecretStore to honour the
  Result contract instead of panicking on open/lookup failure
- Encapsulate RuntimeServices service fields as pub(crate) with public
  getter methods (config_store, secret_store, backend, http_client, geo)
  and a pub new() constructor; adapter updated to use new()
- Reference #487 in FastlyPlatformHttpClient stub (PR 6 implements it)
- Remove unused KvPage re-export from platform/mod.rs
- Use super::KvHandle shorthand in RuntimeServices::kv_handle()
- Split fastly_storage.rs into storage/{config_store,secret_store,api_client,mod}.rs
- Add PlatformConfigStore read path via FastlyPlatformConfigStore::get using ConfigStore::try_open/try_get
- Add PlatformError::NotImplemented variant; stub write methods on FastlyPlatformConfigStore and FastlyPlatformSecretStore
- Add StoreName/StoreId newtypes with From<String>, From<&str>, AsRef<str>
- Add UnavailableKvStore to core platform module
- Add RuntimeServicesBuilder replacing 7-arg constructor
- Migrate get_active_jwks and handle_trusted_server_discovery to use &RuntimeServices
- Update call sites in signing.rs, rotation.rs, main.rs
- Add success-path test for handle_trusted_server_discovery using StubJwksConfigStore
- Fix test_parse_cookies_to_jar_empty typo (was emtpy)
- Make StoreName and StoreId inner fields private; From/AsRef provide all
  needed construction and access
- Add #[deprecated] to GeoInfo::from_request with #[allow(deprecated)] at
  the three legacy call sites to track migration progress
- Enumerate the six platform traits in the platform module doc comment
- Extract backend_config_from_spec helper to remove duplicate BackendConfig
  construction in predict_name and ensure
- Replace .into_iter().collect() with .to_vec() on secret plaintext bytes
- Remove unused bytes dependency from trusted-server-adapter-fastly
- Add comment on SecretStore::open clarifying it already returns Result
  (unlike ConfigStore::open which panics)
Copy link
Copy Markdown
Collaborator

@aram356 aram356 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Prior blocking findings (duplicate-header drops in to_fastly_request and copy_custom_headers) are both fixed in 2817761, with round-trip regression tests added. CI is green. Approving; non-blocking observations below.

Non-blocking

🤔 thinking

  • from_fastly_request_ref silently drops body (crates/trusted-server-core/src/compat.rs:54): docs note the body is empty, but the name doesn't signal it. Footgun if a future caller passes a POST expecting body access. Consider renaming to from_fastly_headers_ref or adding a debug_assert! when the source request has a non-empty body. All current callers only read headers, so not a bug today.
  • Double conversion on the auction hot path: auction/endpoints.rs:50 builds http_req once, but auction/formats.rs:93 (convert_tsjs_to_auction_request) re-converts the same underlying fastly::Request again via from_fastly_request_ref. Each conversion iterates all headers — two copies per auction request. Acceptable for a temporary bridge (PR 15 removes it), but worth a comment referencing PR 15 so the duplication doesn't get frozen.
  • forward_cookie_header uses insert, not append (crates/trusted-server-core/src/cookies.rs:167,175,184): fine for HTTP/1 where Cookie is a single semicolon-joined value, but HTTP/2 (RFC 7540 §8.1.2.5) allows splitting across multiple headers and only the first would be forwarded. Matches pre-migration behavior and Fastly concatenates HTTP/2 cookie headers upstream, so likely not a live bug — worth documenting the assumption.

🌱 seedling

  • Migration guard scope is "utility modules only" (crates/trusted-server-core/src/migration_guards.rs:27-37): guards 6 files. Handler/integration files (publisher.rs, proxy.rs, registry.rs, integrations/*.rs, auction/*.rs) still use fastly::Request by design. PR 12–14 should extend the banned-patterns list as files are migrated.

⛏ nitpick

  • Dead case check in copy_fastly_custom_headers (crates/trusted-server-core/src/compat.rs:144): checks both "x-" and "X-" though fastly::Request normalizes to lowercase. Not worth a commit in temporary code — trim on the next touch.

CI Status

  • integration tests: PASS
  • browser integration tests: PASS
  • prepare integration artifacts: PASS

prk-Jr added 7 commits April 15, 2026 12:06
- Revert proxy.rs merge artifact: restore per-request allowed_domains
  at both redirect_is_permitted call sites; remove dead_code allow and
  stale comment — integration proxies defaulting to &[] get open mode
  again as documented
- Drop unused trusted-server-js dep from adapter Cargo.toml
- Fix check_response: gate body read behind error branch so 2xx paths
  do not buffer and discard the response body
- Remove self-referential SECRET_UPSERT_METHOD test
- Reorder write-cost doc so outbound HTTPS round-trip leads; handle-open
  caching noted as negligible
- Refactor make_request to take fastly::http::Method; drop string match
  and unreachable arm; remove SECRET_UPSERT_METHOD const
- Add SigningStoreIds named struct in endpoints.rs; update both call
  sites to destructure by name
Copy link
Copy Markdown
Collaborator

@aram356 aram356 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

PR introduces compat.rs as a temporary Fastly↔http bridge and migrates six utility modules (auth, cookies, synthetic, http_util, consent/extraction, consent/mod) off fastly::Request/fastly::Response. Prior approvals (2026-04-14) predate the latest commit ae402ff (2026-04-15), which renamed from_fastly_request_reffrom_fastly_headers_ref, dropped a redundant case check in copy_fastly_custom_headers, and switched forward_cookie_header to get_all + append. The round-2 fixes for duplicate-header preservation are clean, but a few concerns remain — notably a new runtime-panic surface at the edge and unused compat helpers that arrived before their callers.

Blocking

🔧 wrench

  • New edge-wide panic surface on URL parsing: compat::build_http_request calls .parse().expect(...) on every bridged request. http::Uri is stricter than Fastly's internal url::Url, so a URL Fastly accepts but http::Uri rejects panics the entire edge handler before auth can run. Previously enforce_basic_auth used req.get_path() with no re-parse. (crates/trusted-server-core/src/compat.rs:14-31)

Non-blocking

🤔 thinking

  • Redundant compat conversion on the prebid hot path: request_bids (prebid.rs:1012) and to_openrtb (prebid.rs:713) both convert the same context.request in the same auction flow — pull up once and thread through.

♻️ refactor

  • Three compat functions ship without callers: from_fastly_request, to_fastly_request, and from_fastly_response are only referenced from their own tests. CLAUDE.md says "Don't design for hypothetical future requirements. No half-finished implementations either." Ship in the PR that uses them. (crates/trusted-server-core/src/compat.rs:40, 61, 90)

🌱 seedling / 📌 out of scope / ⛏ nitpick

  • 📌 Redundant conversion at the auction boundary: acknowledged by TODO at auction/formats.rs:93-95; accepted cost of incremental migration.
  • 🌱 sanitize_fastly_forwarded_headers get-then-remove: remove_header is idempotent; the get_header guard exists only for the debug log. (compat.rs:129-136)
  • forward_cookie_header panics on HeaderValue::from_str: fires only on already-validated input, but a try_from + skip keeps failure local to the function. (cookies.rs:156-186)

CI Status

  • fmt: PASS
  • clippy: PASS
  • rust tests: PASS (841/841)
  • browser integration / integration / artifacts (GitHub Actions): PASS

Comment thread crates/trusted-server-core/src/compat.rs Outdated
Comment thread crates/trusted-server-core/src/integrations/prebid.rs Outdated
Comment thread crates/trusted-server-core/src/compat.rs Outdated
Comment thread crates/trusted-server-core/src/auction/formats.rs Outdated
Comment thread crates/trusted-server-core/src/compat.rs
Comment thread crates/trusted-server-core/src/cookies.rs Outdated
prk-Jr and others added 7 commits April 25, 2026 19:37
…into feature/edgezero-pr10-abstract-logging-initialization
…into feature/edgezero-pr11-utility-layer-migration-v2

Resolve conflicts by adopting PR10's ec_id naming throughout. cookies.rs
set_ec_cookie/expire_ec_cookie retain Response<EdgeBody> types to satisfy
migration_guards; Fastly-typed callers route through compat bridge. Remove
synthetic.rs (deleted in PR10) and its migration_guards entry.
cookies.rs set_ec_cookie/expire_ec_cookie now take Response<EdgeBody> to
satisfy the migration_guards invariant. registry.rs and publisher.rs call
the Fastly-typed equivalents in compat instead. Remove synthetic.rs entry
from migration_guards (file deleted in PR10).
…into feature/edgezero-pr11-utility-layer-migration-v2
@prk-Jr prk-Jr requested a review from aram356 April 27, 2026 14:08
Copy link
Copy Markdown
Collaborator

@aram356 aram356 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

PR 11 of the EdgeZero migration: lifts the utility layer (auth, cookies, http_util, consent) off fastly::{Request, Response} onto http::{Request, Response}<EdgeBody>, with a compat bridge module that lets non-migrated callers keep working. The shape of the migration is sound and the new migration_guards test is a strong regression backstop. The principal concerns are CI (clippy fails when run against main) and a migrated-but-untested code path that will silently change behavior in the next PR.

Blocking

🔧 wrench

  • Clippy fails: cookies::set_ec_cookie missing # Panics (crates/trusted-server-core/src/cookies.rs:258)
  • Clippy fails: cookies::expire_ec_cookie missing # Panics (crates/trusted-server-core/src/cookies.rs:277)
  • Migrated cookies::forward_cookie_header has no callers and no tests — semantics diverge from compat::forward_fastly_cookie_header (get_all vs first-only) (crates/trusted-server-core/src/cookies.rs:152)

CI didn't catch the clippy regressions because format.yml only triggers on PRs whose base is main. PR 623's base is the PR 10 feature branch, so the clippy + fmt gate was bypassed entirely.

Non-blocking

🤔 thinking

  • compat is pub mod compat — exposed as public API despite being PR 15 removal scaffolding (crates/trusted-server-core/src/lib.rs:38)
  • from_fastly_headers_ref # Panics doc is inaccurate — claims URL parse panics but uses unwrap_or_else fallback (crates/trusted-server-core/src/compat.rs:46)
  • to_fastly_response silently truncates EdgeBody::Stream — latent risk as more callers migrate (crates/trusted-server-core/src/compat.rs:65)

♻️ refactor

  • compat::expire_fastly_synthetic_cookie hardcodes cookie attributes instead of reusing cookies::ec_cookie_attributes — DRY drift on security-sensitive code (crates/trusted-server-core/src/compat.rs:145)
  • compat uses old "synthetic" naming instead of "ec" — inconsistent with the recent EC rename (crates/trusted-server-core/src/compat.rs:118)

⛏ nitpick

  • from_fastly_headers_ref URI fallback to "/" swallows malformed URLs silently — at minimum log a warning (crates/trusted-server-core/src/compat.rs:17)

👍 praise

  • migration_guards.rs — concise regression test with well-justified limitations
  • PrebidAuctionProvider::to_openrtb request_info refactor — single source of truth, real readability win

CI Status

  • fmt: PASS (cargo fmt --all -- --check)
  • clippy: FAIL — 2 errors (missing_panics_doc on set_ec_cookie / expire_ec_cookie), bypassed by base branch routing
  • rust tests: PASS (cargo test --workspace)
  • integration tests (GitHub Actions): PASS (3/3)

Comment thread crates/trusted-server-core/src/cookies.rs
Comment thread crates/trusted-server-core/src/cookies.rs
Comment thread crates/trusted-server-core/src/cookies.rs
Comment thread crates/trusted-server-core/src/lib.rs
Comment thread crates/trusted-server-core/src/compat.rs
Comment thread crates/trusted-server-core/src/compat.rs Outdated
Comment thread crates/trusted-server-core/src/compat.rs
Comment thread crates/trusted-server-core/src/compat.rs Outdated
Comment thread crates/trusted-server-core/src/migration_guards.rs
Comment thread crates/trusted-server-core/src/integrations/prebid.rs
@prk-Jr prk-Jr changed the base branch from feature/edgezero-pr10-abstract-logging-initialization to main April 30, 2026 02:18
@prk-Jr prk-Jr requested a review from aram356 May 3, 2026 15:54
Copy link
Copy Markdown
Collaborator

@aram356 aram356 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

PR 11 of the EdgeZero migration: lifts six utility modules (auth, cookies, http_util, consent/extraction, consent/mod, plus the JSON content-type in request_signing/endpoints) off fastly::{Request, Response} onto http::{Request, Response}<EdgeBody> with a compat bridge for non-migrated callers. CI is green across all 13 jobs and clippy is clean against main locally. All blocking findings from the prior CHANGES_REQUESTED reviews are resolved — set_ec_cookie/expire_ec_cookie panics docs added, forward_cookie_header now has dedicated tests for the multi-Cookie and non-UTF-8 paths, and the *_synthetic_cookie*_ec_cookie rename keeps the EC terminology consistent. Filing non-blocking observations only; a clean approve will follow.

Non-blocking

🤔 thinking

  • forward_cookie_header source/target divergence: source-side get_all vs get_header is tested, but target-side append vs set is unflagged and would change behavior for any future caller that seeds to with a pre-existing Cookie header (crates/trusted-server-core/src/cookies.rs:169).
  • TSJS path allocates the response body twice through the serve_static_with_etagcompat::to_fastly_response round-trip; disappears in PR 13/14 (crates/trusted-server-core/src/publisher.rs:140).

🌱 seedling

  • Double http::Request build per request in handle_publisher_request and handle_auction — both build http_req explicitly, then pass &req (fastly) to get_or_generate_ec_id, which rebuilds it inside get_ec_id (crates/trusted-server-core/src/edge_cookie.rs:120).
  • compat::set_fastly_ec_cookie duplicates the validate-then-build control flow of cookies::set_ec_cookie. A cookies::try_build_ec_cookie_value helper would dedupe both append-paths (crates/trusted-server-core/src/compat.rs:156).

📝 note

  • PR description "Changes" table is out of sync with the diff: lists auction/formats.rs, integrations/testlight.rs, proxy.rs, synthetic.rs which aren't in git diff main...HEAD (folded into PR 9/10 merges). Update before merge for accuracy.

👍 praise

  • All 9 prior findings addressed correctly — panics docs, EC rename, attribute reuse, #[doc(hidden)], debug_assert! on stream truncation, URI parse warning, plus comprehensive tests for the divergent code paths.
  • migration_guards ban list extension to fastly::mime::APPLICATION_JSON keeps the regression net tight (crates/trusted-server-core/src/migration_guards.rs:42).
  • PrebidAuctionProvider::to_openrtb request_info refactor — lifts RequestInfo::from_request to prepare_request, eliminating a duplicate construction (crates/trusted-server-core/src/integrations/prebid.rs:1007).

CI Status

  • fmt: PASS
  • clippy: PASS (verified locally with --workspace --all-targets --all-features -- -D warnings)
  • rust tests: PASS
  • vitest: PASS
  • browser integration tests: PASS
  • format-typescript / format-docs: PASS

let stripped = strip_cookies(s, CONSENT_COOKIE_NAMES);
if !stripped.is_empty() {
if let Ok(value) = http::HeaderValue::from_str(&stripped) {
to.headers_mut().append(header::COOKIE, value);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 thinkingcookies::forward_cookie_header and compat::forward_fastly_cookie_header diverge on two axes, only one of which is tested.

The prior review flagged the source-side divergence (compat reads first Cookie header via get_header; this reads get_all) and the new test test_forward_cookie_header_multiple_cookie_headers_appended locks that in — good.

The target-side divergence is unflagged: this function uses headers_mut().append(header::COOKIE, …) (preserves any pre-existing Cookie on to); the compat shim uses to.set_header(header::COOKIE, …) (replaces). For a to that already carries a Cookie header, the two functions produce different output. No current caller does that, but PR 12+ will swap callers from compat to this; if a future caller seeds to from a request template that already has cookies, behavior changes silently.

Suggested fix: either

  1. Add a defensive test like forward_cookie_header_appends_to_existing_target_cookies that documents the chosen contract, or
  2. Add a one-line doc note on the function: "existing Cookie headers on to are preserved; source values are appended after them."

Non-blocking — flagging now so PR 12/13 callers know to look.

let body = trusted_server_js::concatenate_modules(&module_ids);
let mut resp = serve_static_with_etag(&body, req, "application/javascript; charset=utf-8");
let http_resp =
serve_static_with_etag(&body, &http_req, "application/javascript; charset=utf-8");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 thinking — TSJS path now allocates the response body twice.

serve_static_with_etag returns Response<EdgeBody::Once(Bytes)>, then compat::to_fastly_response calls bytes.to_vec() (compat.rs:70) producing a fresh allocation. For the unified TSJS bundle this is a real per-request copy that didn't exist before the migration.

Not blocking — disappears when publisher migrates fully in PR 13/14 — but worth noting since /static/tsjs=* is one of the highest-RPS endpoints in the service.

}

match handle_request_cookies(req)? {
let http_req = compat::from_fastly_headers_ref(req);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌱 seedling — Double http::Request build per request.

Callers in publisher.rs:460 and auction/endpoints.rs:50 already build http_req = compat::from_fastly_headers_ref(&req) before invoking get_or_generate_ec_id, which then transitively calls into here and builds a second copy. Each rebuild clones every header.

Resolves naturally when get_ec_id migrates to take &Request<EdgeBody> in a later PR. Worth tracking as a follow-up so the duplication doesn't linger silently after compat is gone.

header::SET_COOKIE,
crate::cookies::create_ec_cookie(settings, ec_id),
);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌱 seedlingcompat::set_fastly_ec_cookie and cookies::set_ec_cookie share validation (ec_cookie_value_is_safe) and assembly (create_ec_cookie), but the if !is_safe { warn!; return; } control flow is duplicated between them.

A cookies::try_build_ec_cookie_value(settings, ec_id) -> Option<String> helper would let both append-paths collapse to one if let Some(v) = … { append(SET_COOKIE, v) }. Acceptable scaffolding cost for now; flagging for the same PR 15 cleanup window.

"fastly::Response",
"fastly::http::Method",
"fastly::http::StatusCode",
"fastly::mime::APPLICATION_JSON",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 praise — Extending the ban list to fastly::mime::APPLICATION_JSON is a nice touch. The migration_guards file now backstops both the request/response migration and the JSON content-type migration in request_signing/endpoints.rs with a single test, keeping the regression net tight without scattering assertions across modules.

assert_eq!(all_cookies.len(), 2, "should append all Cookie headers");
assert!(all_cookies.iter().any(|v| v.contains("session=abc123")));
assert!(all_cookies.iter().any(|v| v.contains("theme=dark")));
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 praise — Test coverage on forward_cookie_header is now thorough: strip-on, strip-empty-result, no-strip, non-UTF-8 forwarding, and multi-Cookie append. Directly closes the prior reviewer's "behavior diverges silently" concern.

log::info!("Prebid: requesting bids for {} slots", request.slots.len());

let http_req = compat::from_fastly_headers_ref(context.request);
let request_info = RequestInfo::from_request(&http_req, context.client_info);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 praise — Lifting RequestInfo::from_request to prepare_request and threading it through to_openrtb eliminates the duplicate construction that previously sat inside to_openrtb. Net correctness/readability win, not just a mechanical type swap.

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.

Utility layer type migration + compat adapter

3 participants