Skip to content

Complete Cloudflare geo and add pinned Spin KV lookup - #514

Open
prk-Jr wants to merge 10 commits into
feature/kv-geoipfrom
feature/480-cloudflare-spin-geo
Open

prk-Jr wants to merge 10 commits into
feature/kv-geoipfrom
feature/480-cloudflare-spin-geo

Conversation

@prk-Jr

@prk-Jr prk-Jr commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Complete portable ctx.geo() coverage with Cloudflare request metadata and Spin lookup against an explicitly pinned KV dataset.
  • Admit one authenticated visitor-IP assertion on Spin, strip private headers before callbacks, and bound request-local preparation and lookup without retaining host handles.
  • Provide a separate operator loader that publishes the existing binary artifacts into Spin KV, verifies them, and stops its temporary loopback runtime.

Stacked on #454 (feature/kv-geoip), which already includes #502. The portable KV reader and Axum foundation are supplied by those parents.

Integration note: a current git merge-tree comparison with #496 reports conflicts in Axum response conversion, Cloudflare/Spin contracts, and core error/extractor code. These siblings need reconciliation when integrated.

Changes

Crate / File Change
edgezero-adapter-spin Manifest/environment selection, authenticated IP admission, pinned async lookup, request-local resources, private immutable geography, and native/WASM contracts
edgezero-core Spin geo configuration placement, bounded configuration namespace inspection, and authenticated-IP provenance
edgezero-adapter-axum Reject Spin-only credential settings on native geo selection
Cloudflare contracts and adapter guides Positive managed-entrypoint metadata coverage, country-only/absence behavior, and forged-header resistance
examples/geo-kv-prototype Expose the existing artifact/publication code to operator consumers without native backend features
examples/geo-spin-loader Separate binary dataset publisher, ephemeral credential, fixed diagnostic categories, finite deadlines, and tested child cleanup
CI and technical documentation Maintain loader checks, admit only their exact standalone unittest command, and document deployment, publication, cold-request cost, and trust boundaries

Spin defaults to off. KV selection requires a declared store, generation/hash pin, authenticated-header reader mode, and a Spin credential-variable name. A trusted proxy must replace and authenticate the original visitor IP; it does not need to supply geography. Both roots and the selected path are verified on each request. Geo errors remain application policy inputs and do not independently grant permission or select HTTP status. No automatic fallback is added.

Closes

closes #480
closes #486

This PR targets feature/kv-geoip, so merging it into that branch does not automatically close the linked issue(s); close them manually or upon default-branch integration.

Test plan

Historical author-reported local verification below (original head unrecorded unless an explicit SHA is given). These results, counts, timings and negative controls were not rerun in this audit, and their underlying local logs were unavailable; checked boxes retain the original report. At the current head ec0b912b, all 29 reported hosted checks are passing.

  • cargo test --workspace --all-targets (3,058 passed; nine ignored)
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo fmt --all -- --check
  • cargo check --workspace --all-targets --features "fastly cloudflare spin"
  • Fastly, Spin and Cloudflare WASM builds, strict lint and maintained suites (Fastly 362; Spin 39 contracts + 25 SDK; Cloudflare 142 library + 31 contracts)
  • examples/app-demo (68 tests + three WASM checks), 32 native feature combinations, 199 tooling tests, generated consumer, and isolated serial harness (679 passed; four ignored)
  • Docs lint, formatting and VitePress build
  • Native and WASM positive KV lookup, duplicate/spoof rejection, admission ordering, original head budgets, pending-work cancellation and aggregate timeout tests
  • Deliberately broken lookup, authentication and IP-removal controls fail their expected assertions; restored geo tests pass
  • Fresh Rust 1.98.1 / Spin 4.1 / SDK 8 runtime: 34 serving, 12 configuration, 13 fault/snapshot cases; fresh binary publication, identical replay and unchanged serving-store snapshots
  • Fresh Cloudflare Worker: 15 real workerd cases with source/artifact identity checks
  • Axum: actual manifest/environment-selected listener returns CloudFront US/CA without a Trusted Server boot profile
  • Operator publisher/loader tests, standalone strict lint and WASM compilation; five runner lifecycle tests including total timeout during a dripping response

Additional diagnostic: native cargo build --workspace --all-targets --all-features cannot link Fastly SDK host imports on ARM64. The same failure is reproduced on unchanged base 925fe019; the supported Fastly WASM suite passes all 362 tests using the prescribed CI runner.

  • Deploy-action tool-policy contract and ten exception-boundary regressions; modified shell/workflow lint

Checklist

  • Changes follow CLAUDE.md conventions
  • No Tokio dependencies added to core or adapter crates
  • Route parameters use {id} syntax
  • Application HTTP types come from edgezero_core
  • Serving store wiring uses the declared KvRegistry
  • New behavior has meaningful tests
  • No secrets, licensed datasets or credentials committed

Local synthetic runtime evidence does not qualify hosted proxy protection, external backend permissions/propagation, geography accuracy or production capacity. Spin SDK reads materialize values before core validates size; guest deadlines do not certify host-side cancellation. The request-local cache repeats manifest/root reads, so operators must qualify backend latency and capacity. Publication assumes one operator per generation; ordinary read-before-write is not a distributed lock.

@prk-Jr prk-Jr self-assigned this Nov 18, 2026
@prk-Jr prk-Jr changed the title Add authenticated Spin geo and verify Cloudflare context Complete Cloudflare geo and add pinned Spin KV lookup Nov 18, 2026
@prk-Jr
prk-Jr changed the base branch from spec/482-axum-geo-manifest-binding to feature/kv-geoip November 18, 2026 14:25
@prk-Jr
prk-Jr marked this pull request as ready for review November 18, 2026 15:50
aram356 added a commit that referenced this pull request Nov 19, 2026
#517 (10ed380) tops ChristianPavilonis's line on #439:
- #510, the KvStore record contract with DynamoDB and celld providers on
  Axum (#472, #473);
- #454, portable KV-backed geo;
- #514, country and region through ctx.geo() on Cloudflare and Spin (#480,
  #486);
- #517, the portable ClientInfo contract with its Fastly, Axum, Cloudflare and
  Spin mappings (#475, #90, #91, #92, #485).

#517 also merged #469 and #502 itself, so its tree contains everything this
branch had. The only conflicts were JA4 lines that #517 refactors on top of
#469; this merge takes #517's version, and its tree is identical to #517's.
Bring in main's Fastly SDK 0.13.3 upgrade (#529) with Viceroy 0.22.0
and the Fastly CLI 17.2.0 upgrade (#531), with PR #275's exact pins at
0.13.3 and url 2.5.9, its Viceroy readiness repair on 0.22.0 and its
typed Image Optimizer unavailability check for SDK 0.13.3.
The workspace now pins url =2.5.9 for main's Fastly SDK 0.13.3 upgrade
(#529), and this loader resolves edgezero-core from the workspace, so
its lockfile no longer satisfied the manifests after the merge. A
targeted `cargo update -p url --precise 2.5.9` moves url to 2.5.9 and
form_urlencoded to 1.2.3, matching the v0.0.12 lockfiles.
Bring in PR #275's installation of the wasm32-unknown-unknown target
before the Viceroy 0.22.0 readiness repair builds, which the fastly
wasm tests and Portable record contracts (Fastly) jobs need.
@aram356

aram356 commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#495), I pushed 521ad02f, f53d4508 and 49d16cd4.

Bring in PR #275's atomic conditional KV insert in the Viceroy readiness
repair, and the production hosting tests' held port reservations and
spawn-token respawn from PR #406 up, with each later PR's tests reading
the live host's address.
@aram356

aram356 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#495), I pushed 251074eb, a merge of #454's new head that brings #275's 41cdf035, which makes conditional KV inserts atomic in the Viceroy readiness repair, as the Fastly record contract's native race needs, and the production hosting tests' held port reservations and spawn-token respawn from #406 up, with each later PR's tests reading the live host's address. It had no conflicts.

Bring in PR #275's batch cutoff test fix, which advances the test clock
when the request arms its own deadline instead of after dispatch, and
the AWS emulator proofs' readiness markers from PRs #414 and #510, now
published by rename.
@aram356 aram356 mentioned this pull request Nov 26, 2026
15 of 17 tasks
@aram356

aram356 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

For the identity integration branch (#495), I pushed c12fd631, a merge of #454's new head that brings #275's 0e2a58ae, which fixes an intermittent failure of the batch cutoff test by advancing its clock when the request arms its deadline timer, and the AWS emulator proofs' readiness markers from #414 and #510, now published by rename. It had no conflicts.

aram356 added a commit that referenced this pull request Nov 27, 2026
PR #524 (outbound mTLS client identities, #523) belongs to no identity
epic, and PR #522 (portable DynamoDB and celld record providers on
Fastly, #474) is still a draft. #524 is stacked on #522, so both leave
together.

This commit reverts their net changes. Its tree is rc/identity as it
was before #522 (654f546) merged with the current tips of #519, #515,
#502, #469 and #536, the branch's remaining lines. #514 and #517 are
already inside them. The rebuild merges without conflicts, and the
change touches only the 113 paths that #522 and #524 changed against
#517.

Three files differed from a plain reverse of the two PRs because of the
conflict resolutions in 7616c85 and b3a45df. Each keeps the other
lines' code and drops only #522's or #524's:

- crates/edgezero-adapter-axum/src/cli.rs keeps the capability matrix
  test's lint expectation and drops #524's client identity test.
- crates/edgezero-adapter-fastly/src/request.rs keeps the after-response
  handle and wrapper and drops #522's deferred portable KV registry.
- crates/edgezero-store-aws/src/dynamodb_records_tests.rs drops imports
  used only by #522's tests.

Merging a later tip of #522 or #524 will not restore this code, because
git treats their earlier commits as already merged. Bringing them back
needs a revert of this commit first.

@dhruv8sh dhruv8sh left a comment

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 PR does two things:

  • Cloudflare: managed dispatch now exposes cf metadata through ctx.geo(). A per-request test covers all three entrypoints, including the XX/T1 placeholder values, spoofed headers and country-only cases.
  • Spin: adds a pinned KV geo lookup, gated on an authenticated visitor-IP header. The private headers are stripped after their original bytes are counted toward head limits, so admission callbacks and handlers never see them. The credential is read only after admission, with a 128-byte bound, and compared in constant time. The KV lookup shares one aggregate deadline with the admitted request deadline and drops pending futures when it times out.

Configuration is validated in several places:

  • Unknown override keys are rejected.
  • Axum rejects credential_variable.
  • Spin rejects Axum-only fields.
  • provider = "off" cannot carry leftover source settings.

dispatch_app and run_app both resolve the selection through SpinKvGeo::from_config. The tests cover:

  • token and IP parsing edge cases, including duplicates, ports, zone identifiers and IPv4-mapped IPv6 addresses
  • that serving never writes to KV
  • the aggregate budget
  • dropping pending work on timeout
  • no secret read before admission

Non-blocking points:

  • Per-request config check: from_config runs on every dispatch_app call, so a bad configuration shows up as a per-request assembly error rather than failing at startup.
  • Per-request cost: each authenticated request re-reads the manifest, both roots and the secret. The docs say this, but it is worth load-testing before production.
  • CI exception: the deploy-core test that admits one Python command in CI is narrowly scoped and has negative tests.

I found nothing that blocks merging. I could not run the CI gates because this review has read-only access. I only skimmed the loader example and the plan/spec docs.

@dhruv8sh dhruv8sh left a comment

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.

PR Review

Summary

This PR does four things: it finishes Cloudflare managed geo coverage across all three entrypoints, adds an opt-in Spin KV geo provider gated on a pinned dataset and an authenticated visitor-IP header, adds a separate operator loader (Rust component plus Python runner), and allows the runner's unit tests through the CI tool policy. The trust model and deadline handling are careful and well tested. I found no blocking issues. The findings below are small hardening and documentation-accuracy points.

😃 Praise

  • In dispatch_ingress_stream_with_timer_and, head limits are checked against the original header bytes before the private x-edgezero-geo-* headers are captured and stripped. Admission callbacks therefore never see the credential, and the private headers still count toward the limits. Tests cover both properties (private_geo_headers_count_toward_original_head_limits, configured_geo_does_not_read_secrets_before_admission).
  • SpinKvGeo::resolve takes one absolute KV deadline, capped by the admitted read deadline, and doesn't reset it between stages. The AdvancingKv test (four reads of 80 ms against a 250 ms budget) and the pending-read drop test show this precisely.
  • from_config rejects unknown EDGEZERO__ADAPTER__GEO__* keys through the new value-free EnvConfig::keys_below, so a typo fails loudly and nothing leaks into diagnostics.
  • The Cloudflare contract matrix runs the same metadata and spoofed-header cases through CloudflareService, run_app and dispatch_app.

Findings

Blocking

None.

Non-blocking

  • 🤔 Token comparison short-circuits on length: subtle's slice ct_eq returns early when lengths differ, which leaks the secret's length (crates/edgezero-adapter-spin/src/geo.rs:280).
  • 🤔 The runner may send its token to a local process that grabbed the port first: the port is reserved and then released before spin up binds it, and the readiness probe accepts any listener (examples/geo-spin-loader/load.py:36).
  • 🤔 The stripping claim in the docs is broader than the code: the public unmanaged into_core_request converter does not remove the private geo headers (docs/guide/adapters/spin.md:425).
  • 🌱 Geo is resolved eagerly on every authenticated request: every admitted request with a token pays for one secret read and about four KV reads, whether or not the route uses ctx.geo() (crates/edgezero-adapter-spin/src/request.rs:444).
  • ⛏ urllib.error is used but never imported: it only works because urllib.request happens to import it (examples/geo-spin-loader/load.py:148).

📌 Out of Scope

  • The new run.sh exception narrowly admits one exact python3 -m unittest command in test.yml, and tests show variants are still rejected. Maintainers may still want to confirm they accept a Python runtime in the CI tool policy.

CI Status

  • Not run: this review was static.

let Some(expected) = read_value.filter(|value| ingress::valid_token(value)) else {
return failure();
};
if !bool::from(token.as_ref().ct_eq(expected.as_ref())) {

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.

🤔 Length leak in constant-time compare: <[u8] as ConstantTimeEq>::ct_eq returns 0 immediately when the lengths differ. Timing can therefore reveal the expected credential's length (a value from 32 to 128) even though the content comparison is constant-time. The impact is small, but you can remove it cheaply by comparing fixed-size digests, or by padding both sides to 128 bytes and checking the lengths with ct_eq too:

let mut a = [0u8; 128];
let mut b = [0u8; 128];
a[..token.len()].copy_from_slice(&token);
b[..expected.len()].copy_from_slice(&expected);
let same = a.ct_eq(&b) & (token.len() as u64).ct_eq(&(expected.len() as u64));
if !bool::from(same) { return untrusted(); }

The same pattern appears in examples/geo-spin-loader/src/lib.rs (authenticated).

raise ValueError("runtime configuration must explicitly define the selected store")
if binding.get("type") == "spin" and not Path(binding.get("path", "")).is_absolute():
raise ValueError("local Spin storage requires an absolute database path")
with socket.socket() as listener:

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.

🤔 Port-reservation race can send the token to another local listener: the socket is bound and then closed before spin up starts. In that window, any local process can bind the same port. The readiness loop accepts any TCP accept, and the POST then sends x-edgezero-loader-token to whoever is listening. The token is ephemeral, but in that case the publication goes to the wrong process.

One way to narrow this: after readiness, check that process.poll() is None and require the loader to identify itself, for example a GET /ready that returns a nonce passed through a second Spin variable. Alternatively, retry with a fresh port if spin up exits early with an address-in-use error. At minimum, document the assumption that the host is single-tenant.

- A valid dataset gap: `NoMatch`; a source country unsupported by core: `UnsupportedGeography`.
- A country without subdivision remains country-only.

The adapter strips both private headers before admission, middleware and handlers,

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.

🤔 The stripping guarantee is broader than the code: only the managed path (dispatch_ingress_stream_with_timer_and) calls capture_inputs. The public unmanaged request::into_core_request converter still passes x-edgezero-geo-token and x-edgezero-geo-ip through to handler code. Please either scope this sentence to managed dispatch (run_app / run_app_with_platform / dispatch_app), or also strip the headers in into_core_request so a handler using the low-level converter can't accidentally log the credential.

return Ok(deliver(egress)?);
}
};
let geo = match stores.geo.as_ref() {

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.

🌱 Eager resolution on every authenticated request: when geo is configured, every admitted request that carries a valid-syntax token performs one secret read plus a manifest read, two root checks and the lookup. This happens before routing, whether or not the handler ever calls ctx.geo(). It also spends part of the admitted body-read budget. The docs cover this, so it doesn't block the PR. A later improvement could resolve lazily on first ctx.geo() access, or let routes opt in, so health checks and static routes don't pay for the KV reads.

raise SystemExit(130) from None
except TimeoutError:
parser.exit(1, "loader readiness or publication deadline exceeded\n")
except urllib.error.HTTPError as error:

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.

⛏ Implicit urllib.error import: urllib.error.HTTPError resolves only because urllib.request imports urllib.error internally. Please add import urllib.error at the top so the dependency is explicit.

@ChristianPavilonis ChristianPavilonis left a comment

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.

Reviewed this PR's delta against feature/kv-geoip at 7580806a, excluding the inherited #502 work. Please address R1 and R2 before shipping the operator loader: its timeout does not own the real Spin process tree, and TCP readiness does not establish that the authenticated POST reaches its own listener. The other inline findings are follow-ups.

The focused native geo tests, Spin and Cloudflare guest contracts, loader and publisher tests, and all ten new deploy-action assertions passed. The deploy-action suite's remaining Fastly failure also reproduced on the base. The Spin guest and fake-runtime tests do not qualify real loader cleanup or a deployed proxy.

expired.set()
if process.poll() is None:
try:
process.kill()

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.

R1 · P1: Publication timeout can leave Spin running. This kills only the spin up PID. Spin 4.1 spawns the HTTP trigger separately, so a hard kill can leave the trigger listening or publishing after the runner returns a timeout. Spin also stages its own copy of the mounted files outside the runner's cleanup directory. The single-process fake only proves the launcher exits. Please supervise an owned process group through shutdown and escalation, put the Spin working directory under the runner's temp root, and check listener and artifact cleanup.

headers={"x-edgezero-loader-token": token},
)
# The secret stays in process memory/environment, never argv or a log.
opener = urllib.request.build_opener(urllib.request.ProxyHandler({}))

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.

R2 · P1: The loader does not verify that it owns the listener. The runner gives up the reserved port before Spin binds. A successful TCP connection then counts as readiness, so a different local listener can receive the credential and its JSON response can be mistaken for a publication report. The default opener also follows redirects with the custom header. Please use port zero and read Spin's actual bound address from the child, reject redirects, and validate the report's count and pin fields.

resolver.lookup(ip).await
};
let lookup_remaining = deadline.instant().saturating_duration_since(clock.now());
match select(Box::pin(lookup), Box::pin(make_timer(lookup_remaining))).await {

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.

R3 · P2: The KV lookup can start another read after its deadline. select polls lookup first. A pending read that becomes ready after expiry can resume the resolver and start another root or path read before the final clock check. The aggregate test checks that late results are rejected, not that no new read starts. Arm the timer before polling lookup and check the same absolute deadline before each new backend read. This does not require host-side cancellation.

executable = shutil.which(spin)
if executable is None:
raise ValueError("Spin executable not found")
spin = str(Path(executable).resolve())

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.

R4 · P2: Resolving the executable breaks PATH shims. Following a symlink-based shim here can replace the Spin entry point with a dispatcher that relies on the invoked name. The temporary cwd in Popen can also lose project-local version selection. The relative executable test exercises a regular file. Make the selected path absolute without dereferencing it, and keep the caller's cwd when launching with the already absolute manifest and config paths.

pub receipt: Receipt,
pub inventory: Vec<InventoryEntry>,
#[cfg(any(test, feature = "celld", feature = "dynamodb"))]
#[cfg(any(test, feature = "publisher", feature = "celld", feature = "dynamodb"))]

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.

R5 · Architecture: Keep the validated artifact immutable. The new library exports a mutable receipt and inventory, while Artifact::open validates a separate private snapshot. A consumer can remove entries after validation and publish can write the manifest without all its descendants. The current loader does not mutate it. Please make the fields private with read-only accessors, and format the loader's pin from the verified generation and digest rather than splitting the storage key. This preserves both on-disk formats.

.map(|provider| match provider {
ManifestGeoProvider::Kv => "kv",
ManifestGeoProvider::Off => "off",
ManifestGeoProvider::CloudFront | _ => "unsupported",

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.

R12 · Maintenance: Keep the typed provider through config merge. Parse the environment override once, keep the manifest enum as the fallback, and match the merged enum. This removes string round-tripping and the "unsupported" sentinel without changing precedence.

secret: Option<Bytes>,
reads: Option<Arc<AtomicUsize>>,
) -> anyhow::Result<ResponseEgressEnvelope> {
dispatch_request_with_geo_stores(app, req, secret, reads, None).await

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.

R13 · Maintenance: Remove the forwarding test helper. This only calls dispatch_request_with_geo_stores with a final None. The two callers can use the store-aware helper directly without losing any injection coverage.

fn validate_manifest_adapter_geo(geo: &ManifestAdapterGeo) -> Result<(), ValidationError> {
let assertion = geo.alb_peer_cidrs.is_some() || geo.origin_credential_header_name.is_some();
let kv = geo.has_kv_fields();
let kv = geo.has_kv_fields() || geo.credential_variable.is_some();

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.

R14 · Style: The Spin off-policy diagnostic points to Axum. The message immediately below names [adapters.axum.geo] even when Spin's table is the one rejected. Make it adapter-neutral and retain the current error code and rejection.

}

#[cfg(test)]
#[path = "geo/kv_tests.rs"]

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.

R15 · Style: The Spin geo unit tests depart from the same-file convention. CLAUDE.md:159 calls for inline unit tests. Inline these tests or document a deliberate exception for the large fixture. The public contract tests are unaffected.

Ok(report) => response(StatusCode::OK, report.to_string()),
Err(_) => response(
StatusCode::INTERNAL_SERVER_ERROR,
"{\"error\":\"publication failed\"}".into(),

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.

R16 · Style: Use structured JSON for the loader errors. The 401 and 500 bodies are ordinary JSON, not serialization fallbacks. Use the same serde_json::json! convention as the success response, keeping the fixed messages and status codes.

Suggested change
"{\"error\":\"publication failed\"}".into(),
serde_json::json!({"error": "publication failed"}).to_string(),

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.

Geo with country and region through ctx.geo() on Spin Geo with country and region through ctx.geo() on Cloudflare

4 participants