Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
251974d
feat(core): expose paired time and borrowed outbound readiness
ChristianPavilonis Nov 10, 2026
dc29607
feat(outbound): preserve request-local surrogate cache keys
ChristianPavilonis Nov 10, 2026
683d558
ci: run ordinary checks on every pull request base
ChristianPavilonis Nov 10, 2026
cec1988
test(ci): require ordinary checks on stacked PR bases
ChristianPavilonis Nov 10, 2026
c191a9c
fix(outbound): retain valid purge tags and borrow Workers cache policy
ChristianPavilonis Nov 13, 2026
dd21af8
Merge PR #499 into PR #460 for outbound compatibility stack
ChristianPavilonis Nov 13, 2026
03d192f
Merge PR #499 into PR #460 for outbound compatibility stack
aram356 Nov 14, 2026
1568f68
Merge PR #499 into PR #460 for outbound compatibility stack
aram356 Nov 16, 2026
ce94fe0
Merge PR #499 into PR #460 for outbound compatibility stack
aram356 Nov 17, 2026
5ca954c
Merge PR #499 into PR #460 for outbound compatibility stack
aram356 Nov 25, 2026
e8e1d9c
Name Fastly SDK 0.13.3 in the surrogate key and optimizer notes
aram356 Nov 25, 2026
e93f7e5
Merge PR #499 into PR #460 for outbound compatibility stack
aram356 Nov 25, 2026
d914d22
Merge PR #499 into PR #460 for outbound compatibility stack
aram356 Nov 26, 2026
cdd7c56
Merge PR #499 into PR #460 for outbound compatibility stack
aram356 Nov 26, 2026
90a1d4e
fix(outbound): reject unusable surrogate cache tags
ChristianPavilonis Nov 30, 2026
6df1b3c
Merge PR #499 into PR #460 for the identity integration chain
aram356 Dec 1, 2026
17d4227
Merge PR #499 into PR #460 for the identity integration chain
aram356 Dec 1, 2026
6e12d2a
Merge PR #499 into PR #460 for the identity integration chain
aram356 Dec 1, 2026
c291f6a
Merge PR #499 into PR #460 for the identity integration chain
aram356 Dec 3, 2026
a6126d0
Merge local PR #499 fixes into PR #460
aram356 Dec 4, 2026
0bb0ec4
Merge PR #499 into PR #460 for the identity integration chain
aram356 Dec 4, 2026
799534b
Merge PR #499 into PR #460 for the identity integration chain
aram356 Dec 4, 2026
2a9924b
Merge PR #499 into PR #460 for the identity integration chain
aram356 Dec 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
schedule:
- cron: "40 17 * * 3"

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read
Expand Down
39 changes: 23 additions & 16 deletions crates/edgezero-adapter-axum/tests/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1189,28 +1189,35 @@ async fn authority_override_changes_host_only_and_cache_bypass_adds_no_origin_he
.get(CACHE_CONTROL)
.and_then(|value| value.to_str().ok())
.unwrap_or("absent");
format!("{host}|{cache_control}")
let tag = headers.get("surrogate-key").map_or("absent", |_| "present");
format!("{host}|{cache_control}|{tag}")
}),
))
.await;
let client = HttpClient::with_client(
AxumOutboundClient::try_new(executor_handle.clone()).expect("client"),
);
let request = OutboundRequest::get(format!("{origin}/"))
.expect("request")
.host_authority_override("virtual.example:8443")
.expect("authority override")
.cache_policy(OutboundCachePolicy::Bypass);

let body = client
.send(request)
.await
.expect("response")
.into_bytes_bounded(1_024)
.await
.expect("response body");

assert_eq!(body, "virtual.example:8443|absent");
for policy in [
OutboundCachePolicy::Bypass,
OutboundCachePolicy::PlatformDefault,
OutboundCachePolicy::PlatformDefaultWithSurrogateKey(HeaderValue::from_static(
"example-all example-reader-0123",
)),
] {
let request = OutboundRequest::get(format!("{origin}/"))
.expect("request")
.host_authority_override("virtual.example.com:8443")
.expect("authority override")
.cache_policy(policy);
let body = client
.send(request)
.await
.expect("response")
.into_bytes_bounded(1_024)
.await
.expect("response body");
assert_eq!(body, "virtual.example.com:8443|absent|absent");
}
}

#[tokio::test]
Expand Down
117 changes: 104 additions & 13 deletions crates/edgezero-adapter-cloudflare/src/outbound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use edgezero_core::error::{BadGatewayReason, BudgetSource};
all(feature = "cloudflare", target_arch = "wasm32"),
feature = "test-utils"
))]
use edgezero_core::outbound::OutboundRequest;
use edgezero_core::outbound::{OutboundCachePolicy, OutboundRequest};
#[cfg(feature = "test-utils")]
use edgezero_core::outbound::{OutboundSendMode, validate_for_dispatch};

Expand Down Expand Up @@ -341,7 +341,8 @@ mod worker_impl {
let worker_body =
request_body(body, max_request_body_bytes, budget, time.clone()).await?;
let url = uri.to_string();
let request = build_worker_request(&method, &url, &headers, worker_body, cache_policy)?;
let request =
build_worker_request(&method, &url, &headers, worker_body, &cache_policy)?;
let (response, abort_guard) = raw_fetch(
request,
budget,
Expand Down Expand Up @@ -581,13 +582,13 @@ mod worker_impl {
url: &str,
headers: &HeaderMap,
request_body: Option<JsValue>,
cache_policy: OutboundCachePolicy,
cache_policy: &OutboundCachePolicy,
) -> Result<WorkerRequest, EdgeError> {
let mut init = RequestInit::new();
init.with_headers(build_headers(headers)?)
.with_method(worker_method(method))
.with_redirect(RequestRedirect::Manual);
if cache_policy == OutboundCachePolicy::Bypass {
if matches!(cache_policy, OutboundCachePolicy::Bypass) {
Comment thread
ChristianPavilonis marked this conversation as resolved.
Resolved
init.with_cache(CacheMode::NoStore);
}
if let Some(worker_body) = request_body {
Expand Down Expand Up @@ -1899,6 +1900,65 @@ mod worker_impl {
assert!(results.slots().iter().all(|slot| matches!(slot, OutboundCollectedSlot::Resolved(result) if result.outcome.is_ok())));
}

#[wasm_bindgen_test]
async fn tagged_default_is_rejected_before_body_poll_or_fetch() {
let _timers = NumericTimeoutGuard::install();
let (probe, _restore) = fetch_probe(false);
let client = HttpClient::with_client(CloudflareOutboundClient::new());
let polls = Rc::new(Cell::new(0_usize));
let tagged = || {
OutboundRequest::get("https://fixture.invalid/tagged")
.expect("request")
.cache_policy(OutboundCachePolicy::PlatformDefaultWithSurrogateKey(
HeaderValue::from_static("example-all"),
))
};
let streamed = || {
let observed = Rc::clone(&polls);
tagged().body(Body::from_stream(stream::poll_fn(move |_cx| {
observed.set(observed.get().saturating_add(1));
Poll::Ready(None)
})))
};
let check = |error: &EdgeError| {
assert_eq!(error.status(), StatusCode::BAD_REQUEST);
assert!(error.message().contains("surrogate keys"));
assert!(error.message().contains("cloudflare"));
};

check(&client.send(streamed()).await.expect_err("tagged send"));
check(&client.begin(streamed()).await.expect_err("tagged begin"));
let results = client
.send_all_until(
vec![
tagged(),
OutboundRequest::get("https://fixture.invalid/untagged").expect("request"),
],
Deadline::after(Duration::from_secs(1)),
)
.await
.expect("batch outcomes");
check(
resolved_slot(&results.slots()[0])
.outcome
.as_ref()
.expect_err("tagged batch slot"),
);
let untagged = resolved_slot(&results.slots()[1])
.outcome
.as_ref()
.expect("untagged batch slot");
assert_eq!(untagged.status(), StatusCode::OK);
assert_eq!(polls.get(), 0);
assert_eq!(
Reflect::get(&probe, &JsValue::from_str("calls"))
.expect("calls")
.as_f64(),
Some(1.0_f64),
"only the untagged batch slot should fetch"
);
}

#[wasm_bindgen_test]
async fn begin_dispatches_without_collection_and_drop_aborts() {
let _timers = NumericTimeoutGuard::install();
Expand Down Expand Up @@ -2232,22 +2292,29 @@ mod worker_impl {
}

#[wasm_bindgen_test]
fn only_bypass_requests_the_no_store_fetch_cache_mode() {
fn untagged_cache_policies_keep_worker_default_and_no_store_modes() {
for (policy, expected) in [
(OutboundCachePolicy::Bypass, "no-store"),
(OutboundCachePolicy::PlatformDefault, "default"),
(OutboundCachePolicy::Bypass, "no-store"),
] {
let request = build_worker_request(
&Method::GET,
"https://example.com/",
"https://origin.example.com/resource",
&HeaderMap::new(),
None,
policy,
&policy,
)
.expect("Workers request");
let cache = Reflect::get(request.inner(), &JsValue::from_str("cache"))
.expect("request cache mode");
assert_eq!(cache.as_string().as_deref(), Some(expected), "{policy:?}");
let mode = Reflect::get(request.inner().as_ref(), &JsValue::from_str("cache"))
.expect("cache mode");
assert_eq!(mode.as_string().as_deref(), Some(expected));
assert!(
request
.headers()
.get("surrogate-key")
.expect("header")
.is_none()
);
}
}

Expand Down Expand Up @@ -2282,7 +2349,7 @@ mod worker_impl {
"https://example.com/?token=provider-secret-token",
&HeaderMap::new(),
Some(JsValue::from_str("body")),
OutboundCachePolicy::PlatformDefault,
&OutboundCachePolicy::PlatformDefault,
)
.expect_err("GET body rejection");
assert_eq!(
Expand Down Expand Up @@ -2379,7 +2446,7 @@ mod worker_impl {
"https://example.com/?token=provider-secret-token",
&HeaderMap::new(),
None,
OutboundCachePolicy::PlatformDefault,
&OutboundCachePolicy::PlatformDefault,
)
.expect("valid request");
let start = MonotonicInstant::now();
Expand Down Expand Up @@ -3828,6 +3895,14 @@ fn validate_supported_options(request: &OutboundRequest) -> Result<(), EdgeError
"image_optimizer is not supported by cloudflare",
)));
}
if matches!(
request.cache_policy_setting(),
OutboundCachePolicy::PlatformDefaultWithSurrogateKey(_)
) {
return Err(EdgeError::bad_request(
"outbound cache surrogate keys are not supported by cloudflare",
));
}
Comment on lines +3898 to +3905

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.

😃 This follows the existing Image Optimizer rejection, and prepare runs it before validate_for_dispatch, so a tagged request fails with the clearer Cloudflare-specific message even when its list is also malformed. I checked this by disabling the condition: tagged_default_is_unsupported_in_batch_preflight then fails, so the test really depends on this check.

Ok(())
}

Expand Down Expand Up @@ -3866,6 +3941,22 @@ mod header_bridge_tests {

use super::*;

#[cfg(feature = "test-utils")]
#[test]
fn tagged_default_is_unsupported_in_batch_preflight() {
let request = OutboundRequest::get("https://origin.example.com/resource")
.expect("request")
.cache_policy(
edgezero_core::OutboundCachePolicy::PlatformDefaultWithSurrogateKey(
HeaderValue::from_static("example-all"),
),
);
let error = validate_batch_request_for_test(&request).expect_err("tagged request");
assert!(matches!(error, EdgeError::BadRequest { .. }));
assert!(error.message().contains("surrogate keys"));
assert!(error.message().contains("cloudflare"));
}

#[derive(Default)]
struct AppendSink(BTreeMap<String, Vec<String>>);

Expand Down
Loading
Loading