Add trusted-server-adapter-axum native dev server (PR 16)#643
Conversation
Move trusted-server-adapter-axum from workspace exclude to members list. Remove the global `target = "wasm32-wasip1"` build override from .cargo/config.toml (which forced the axum crate out of the workspace) and pass --target wasm32-wasip1 explicitly only for Fastly CI commands. Delete the now-redundant crate-local .cargo/config.toml. Update CI test-rust job to exclude the axum crate and pass the explicit target; test-axum job runs from the workspace root with -p flag. Add .edgezero/ to .gitignore to exclude the local KV store file.
Register AxumDevServer alongside FastlyViceroy in RUNTIME_ENVIRONMENTS so the full framework x runtime scenario matrix (WordPress, Next.js) runs against both platforms. AxumDevServer spawns the native trusted-server-axum binary (no WASM or Viceroy), binds to the fixed port 8787 (baked into axum.toml at compile time), and polls for any HTTP response as readiness (root returns 403 in test env). Binary path defaults to target/debug/trusted-server-axum, overridable via AXUM_BINARY_PATH. Settings are baked in at build time via TRUSTED_SERVER__* env vars, same as Fastly. The integration-tests.sh script now builds both the WASM and the native Axum binary with test-specific overrides (origin=127.0.0.1:8888). Add test_wordpress_axum and test_nextjs_axum individual test functions. Ignore .edgezero/ at workspace root (local KV store from the dev server).
- README: update Quick Start and Development commands for both runtimes - getting-started: add Axum as Option A (no Fastly CLI needed) - architecture: add trusted-server-adapter-axum to Core Components; add Runtime Targets table - testing: fix cargo test commands; add Axum adapter section; split Local Server Testing into Axum vs Fastly; restore clippy step in CI/CD workflow example alongside new test-axum job
The integration test matrix includes AxumDevServer which requires the native trusted-server-axum binary. Add build-axum step to the shared setup action, package the binary alongside the WASM artifact, and pass AXUM_BINARY_PATH to the integration test run step.
aram356
left a comment
There was a problem hiding this comment.
Summary
Introduces a native Axum dev-server adapter that runs the full trusted-server pipeline locally without Fastly Compute or Viceroy, promotes the crate to a workspace member, and extends the integration-test matrix to cover both runtimes. Requesting changes for a handful of small but concrete issues: unused deps, stale lockfile, doc/code drift, and a middleware bypass on the startup-error path.
Blocking
🔧 wrench
- Unused direct dependencies:
serde_jsonandtrusted-server-jsdeclared incrates/trusted-server-adapter-axum/Cargo.tomlbut never referenced insrc/ortests/. See inline. - Stale crate-local
Cargo.lock: ~100 KB file that cargo now silently ignores (crate is a workspace member). Delete it to avoid lockfile drift. CLAUDE.mdcomment contradicts the PR: says "excluded from workspace" at line 14 while the PR makes it a workspace member. See inline.- Log text references a non-existent
NoopKvStore: the code usesUnavailableKvStore(src/platform.rs:367vs :379). See inline. - Startup-error router bypasses middleware:
startup_error_router()has noFinalizeResponseMiddleware/AuthMiddleware, breaking the "every response has X-Geo-Info-Available" invariant and bypassing operator headers + basic auth on startup-failure responses. See inline onsrc/app.rs:134.
Non-blocking
🤔 thinking
send_async/selectdiverges from Fastly (eager execution changes error-surface timing and ordering). Trade-off is documented, but consider a breadcrumb log or realtokio::spawnfan-out. See inline.Body::Streamoutbound body silently truncated to empty on axum. See inline.- Env-var namespace collisions possible due to
-/./→_normalization. See inline. - Fixed port 8787 baked at compile time can TIME_WAIT-flake across sequential integration tests. See inline.
♻️ refactor
reqwest::Clientrebuilt per request — defeats connection pool. Move to sharedArc<AxumPlatformHttpClient>inAppState. See inline.- Env-var tests not isolated — use
temp-env(already a workspace dep). See inline. bytes::Bytes→Vec<u8>round-trip on request/response bodies is wasted allocation. See inline.tests/routes.rsuses.unwrap()instead of.expect("should ...")— CLAUDE.md applies to test code. See inline.
🌱 seedling
- No
/healthendpoint —AxumDevServer::health_check_path()returns/healthbut the app never registers it; tests work around withwait_for_any_response. See inline.
⛏ nitpick
- Crate-local
.gitignoreis redundant with the workspace.gitignore. See inline. build_per_request_servicesis a no-op wrapper aroundbuild_runtime_services. See inline.
📝 note
test-axumCI job runs withoutTRUSTED_SERVER__*env vars — every request goes through the startup-error path. Smoke tests still pass, but not a great signal. See inline.
CI Status
- fmt: PASS (verified locally,
cargo fmt --all -- --check) - clippy (axum crate, host target): PASS with zero warnings
cargo test -p trusted-server-adapter-axum: 18 tests PASS- GitHub CI on
75fe0d01: prepare artifacts + integration tests + browser tests all PASS
… bypass, refactors
Blocking:
- Remove unused serde_json and trusted-server-js from Cargo.toml
- Delete crate-local Cargo.lock (now silently ignored as workspace member)
- Fix CLAUDE.md workspace layout comment (drop "excluded from workspace")
- Fix log message naming NoopKvStore → UnavailableKvStore in build_runtime_services
- Wrap startup_error_router with FinalizeResponseMiddleware(Settings::default()) so
startup-error responses carry X-Geo-Info-Available and operator response_headers
Refactor:
- Move AxumPlatformHttpClient to AppState; share Arc across requests via
build_runtime_services(ctx, Arc::clone(&state.http_client)) to preserve
the reqwest connection pool
- Remove build_per_request_services no-op wrapper; inline at call sites
- Use temp_env::with_var in config/secret store tests for proper isolation
- Replace .unwrap() with .expect("should ...") throughout test code per CLAUDE.md
Nitpick:
- Delete redundant crate-local .gitignore (covered by workspace .gitignore)
…ce breadcrumbs Port fix: - main.rs reads PORT env var at startup; when set, uses AxumDevServer::with_config with a dynamic SocketAddr instead of the run_app default (hardcoded 8787) - Integration test spawner (axum.rs) now calls find_available_port() and passes PORT=<port> to the child process, matching the Fastly env's dynamic-port pattern - Fallback to AXUM_DEFAULT_PORT=8787 if find_available_port fails (offline runner) Divergence breadcrumbs: - send_async: debug log noting that execution is eager and errors surface immediately, not at select() time as they do on Fastly - select: debug log noting that index 0 is popped unconditionally (sequential, not first-to-complete) — any fan-out ordering tests should use the Fastly runtime
ChristianPavilonis
left a comment
There was a problem hiding this comment.
Summary
Nice addition overall — the Axum adapter is headed in a useful direction. I found a few correctness gaps in the platform shim plus a couple of documentation mismatches around what the Axum runtime can currently support.
Conflict resolutions: - Cargo.lock: regenerated after adding futures dep - docs/guide/testing.md: kept Axum adapter test command (PR16) and EC ID rename + specific-test example (PR15) - .cargo/config.toml: kept PR16 version (no WASM default target) because trusted-server-adapter-axum is now a workspace member and tokio/reqwest cannot compile to wasm32-wasip1 - AGENTS.md: updated cargo test instruction to document both required commands now that the workspace contains both WASM-only and native-only crates API breakage from PR15 (handle_publisher_request now returns PublisherResponse): - Add resolve_publisher_response() helper mirroring the Fastly adapter pattern (Buffered / Stream / PassThrough -> Response) - Drop the removed None arg from handle_auction and handle_publisher_request call sites
PR15 merge — modifications to existing files not captured in the merge commit: - Fastly adapter: migrate to EdgeZero router/middleware, rewrite management API, update platform/compat/logging/backend to new EdgeZero abstractions - Core: remove KV-backed consent layer (consent/kv.rs deleted), update auction orchestrator and integrations to new API surface, refactor html_processor, cookies, and error types - Delete stale Fastly KV store test fixtures (counter_store.json, opid_store.json) - Update fastly.toml, trusted-server.toml, and integration test config to match PR16 workspace restructuring: - Add both adapters to workspace members; set default-members=[core, axum] so bare `cargo test` runs natively without WASM target conflicts - Replace test-wasm alias with test-fastly (--workspace --exclude axum --target wasm32-wasip1) and keep test-axum (-p trusted-server-adapter-axum) - Update CI: cargo test-fastly in the Fastly job, cargo test-axum in native job - Axum admin routes (/admin/keys/rotate, /admin/keys/deactivate) return 501 instead of falling through to an error handler - Update CLAUDE.md, AGENTS.md, README, and all guide docs to use new aliases
Viceroy internally runs `cargo run --bin trusted-server-adapter-fastly` against the default-run packages. With core + axum as defaults, Cargo fails to find the binary. Restricting default-members to the fastly adapter fixes the lookup. Updated stale comments in CLAUDE.md and .cargo/config.toml to reflect the new setup.
aram356
left a comment
There was a problem hiding this comment.
Summary
Re-review of the Axum dev-server adapter against main. Most prior feedback (aram356, ChristianPavilonis) has been addressed, and the latest commit even fixed the auction fan-out concern via real tokio::spawn + select_all. Deep verification finds five blocking CI/correctness issues plus several non-blocking refactor and documentation items.
A compounding factor: this PR targets feature/edgezero-pr15-remove-fastly-core, not main. The Run Tests and Run Format workflows only trigger on PRs to main, so no CI run on this PR has actually exercised fmt/clippy/test-fastly/test-axum. Only Integration Tests runs. The fmt/clippy failures below would surface for the first time when this lands on main.
Blocking
🔧 wrench
cargo fmt --all -- --checkfails oncrates/trusted-server-adapter-axum/src/app.rs:217-225(auction handlerOk(...)block). See inline.cargo clippy ... -- -D warningsfails oncrates/trusted-server-adapter-axum/src/platform.rs:194-196withclippy::type_complexity. See inline.TRUSTED_SERVER__SYNTHETIC__SECRET_KEYis dead — should beTRUSTED_SERVER__EDGE_COOKIE__SECRET_KEYafter PR15's rename. Two locations:scripts/integration-tests.sh:63and.github/actions/setup-integration-test-env/action.yml:97. Effect: Axum CI integration tests run with the placeholder secret. See inline.- CLAUDE.md self-contradicts —
CLAUDE.mdlines 67-69 (Build & Test Commands, modified in this PR) saycargo test-fastly/cargo test-axum; the CI Gates section near line 256 (unchanged) still says3. `cargo test --workspace`, which AGENTS.md (also updated in this PR) explicitly forbids: "Do NOT use barecargo test --workspace— it will attempt to compile the Fastly adapter for the host target." Update CI Gates item 3 to list both aliases. (Body-level because the affected line wasn't part of this PR's diff.) cargo clippy --workspace --all-targets --all-features -- -D warningswill fail post-merge to main. Removing[build] target = "wasm32-wasip1"from.cargo/config.tomlmeansformat.yml's clippy step now targets host, where thefastlycrate's wasm-only APIs don't compile. TheRun Formatworkflow doesn't trigger on PRs to feature branches, so this is hidden until rebase onto main. Fix options: add--target wasm32-wasip1to the clippy CI step (excluding axum), or split intoclippy-fastly/clippy-axumaliases analogous to the test aliases.
Non-blocking
🤔 thinking
- Fan-out parity isn't actually tested —
send_async× 2 +selecthas no unit coverage. See inline onplatform.rs:309. Body::Streamis silently buffered intoVec<u8>with no log emission; large-payload divergence vs Fastly will not surface in test output. See inline onplatform.rs:247.
♻️ refactor
startup_error_router's closure-of-closure (make) is convoluted. See inline onapp.rs:134.rotate_handler/deactivate_handlerare aliases for the same closure. See inline onapp.rs:211.
🌱 seedling / 📌 out of scope
health_check_path()returns/healthbutTrustedServerApp::routes()never registers it. See inline onenvironments/axum.rs:71.- Per-request
reqwest::Clientrevert masks a likely keep-alive bug in the empty-body branch (if !body_bytes.is_empty() { builder = builder.body(...) }). Worth a follow-up issue. See inline onplatform.rs:456. fastly.toml:42-48adds an[local_server.config_stores.trusted_server_config]config store withedgezero_enabled = "true". That's the EdgeZero gate, not the Axum adapter — likely a merge-resolution remnant from theMerge feature/edgezero-pr15-remove-fastly-core into PR16commit. Confirm it belongs here or rebase it out.
📝 note
test-axumCI job runs with noTRUSTED_SERVER__*env vars; every request flows throughstartup_error_router. The 8 route tests only assertstatus != 404and< 500, both satisfied by 401/501 — pre-existing finding (aram356), deferred. See inline ontest.yml:75.
CI Status
- fmt: FAIL (verified locally — diff in
app.rs:217) - clippy: FAIL (verified locally —
type_complexityinplatform.rs:194) cargo test-axum(host target): PASS (18 tests)- Integration Tests workflow on
9a0d38c: not yet run for the latest commit (last green run wasa780034) - Run Tests / Run Format workflows: not exercised — this PR doesn't target
main
aram356
left a comment
There was a problem hiding this comment.
Summary
Re-review of the Axum dev-server adapter. The PR head (9a0d38c, 2026-04-29) predates the previous review (2026-04-30), so none of the prior blocking findings have been picked up yet. I verified all five remain present, and added new findings from a deep pass: a CLAUDE.md self-contradiction introduced by this PR's own edits, three sibling agent docs that drifted from the new test aliases, and a few smaller refactor/seedling items.
A compounding factor: this PR targets feature/edgezero-pr15-remove-fastly-core, not main. Both Run Tests and Run Format workflows are PR-to-main only, so fmt / clippy / test-fastly / test-axum have never run on this PR. The fmt and clippy failures below will surface for the first time on retarget.
Blocking
🔧 wrench
-
fmt fails on the
Ok(...)block incrates/trusted-server-adapter-axum/src/app.rs:217-225— see inline. -
clippy
type_complexityfails oncrates/trusted-server-adapter-axum/src/platform.rs:194-196— see inline. -
TRUSTED_SERVER__SYNTHETIC__SECRET_KEYis dead after PR15's rename — Axum integration-test builds run with the placeholder secret. Two locations:scripts/integration-tests.sh:63and.github/actions/setup-integration-test-env/action.yml:97. See inline. -
CLAUDE.mdself-contradicts: this PR rewrites the "Build & Test Commands" block (lines 58, 66, 67) to usecargo test-fastly/cargo test-axumand addsAGENTS.md:23saying "Do NOT use barecargo test --workspace." ButCLAUDE.mdstill has two stale references:- line 281 (CI Gates):
3. `cargo test --workspace` - line 294 (Standard Workflow):
4. **Test after every change** — `cargo test --workspace`.
Body-level because the affected lines weren't part of this PR's diff.
- line 281 (CI Gates):
-
cargo clippy --workspaceno longer covers thewasm32-wasip1target. Removing[build] target = "wasm32-wasip1"from.cargo/config.tomlmeansformat.yml:36andREADME.md:48now lint host-target only. On macOS host thefastlycrate happens to compile cleanly — so this isn't the hard failure I predicted earlier — but lint coverage for the wasm-only paths is silently dropped. Recommend adding--target wasm32-wasip1to the Fastly clippy step (excluding axum), or splitting intoclippy-fastly/clippy-axumaliases mirroring the test aliases.
Non-blocking
♻️ refactor
- 9 handler closures share the same
Arc<AppState> → build_runtime_services → ctx.into_request → handle_X(...)boilerplate incrates/trusted-server-adapter-axum/src/app.rs:169-353. A smallmake_handlermacro or a generic helper would cut ~150 lines. Not required for this PR — worth a follow-up.
📝 note
.claude/agents/pr-reviewer.md:111,.claude/agents/verify-app.md:28,.claude/agents/pr-creator.md:25still referencecargo test --workspace. Same root cause as the CLAUDE.md contradiction above. The PR did updateissue-creator.mdandrepo-explorer.md, so the author was aware some agents needed touching; these three were missed.
CI Status (verified locally on macOS)
- fmt: FAIL (verified — diff in
app.rs:217) - clippy: FAIL (verified —
type_complexityinplatform.rs:194) cargo test -p trusted-server-adapter-axum --target $host: PASS (8 routes + middleware/platform unit tests)Run Tests/Run Formatworkflows on PR head: not exercised (workflows trigger only on PRs tomain)Integration Testsworkflow: no checks reported on9a0d38c
Blocking fixes:
- Fix cargo fmt failure in auction handler Ok() block (app.rs)
- Extract SpawnedRequestResult type alias to fix clippy::type_complexity (platform.rs)
- Rename TRUSTED_SERVER__SYNTHETIC__SECRET_KEY to TRUSTED_SERVER__EDGE_COOKIE__SECRET_KEY
in scripts/integration-tests.sh and setup-integration-test-env/action.yml (PR15 rename miss)
- Update CLAUDE.md CI Gates to reference cargo test-fastly && cargo test-axum
- Add clippy-fastly/clippy-axum cargo aliases; split format.yml clippy into two target-matched
steps so wasm32-wasip1 paths are linted in CI
Non-blocking:
- Refactor startup_error_router: rename make closure to make_handler (one indirection level)
- Remove redundant rotate_handler/deactivate_handler aliases; pass admin_not_supported directly
- Log warn on invalid PORT env var value instead of silently falling back
- Log debug when buffering Body::Stream to Vec<u8> for outbound requests
- Move simple_logger to workspace dependencies
- Update agent docs (pr-reviewer, verify-app, pr-creator) to use cargo test-fastly/clippy-fastly
- Emit "Listening on http://{addr}" at startup for both PORT and run_app paths
- Format docs markdown tables with Prettier
Resolved conflicts across 22 files. Key decisions: - Core files: took PR15's renames (get_or_generate_ec_id_from_http_request, ec_cookie_value_is_safe, collect_response_bounded, ec_cookie_attributes) and all new tests PR15 added - Fastly adapter: kept PR15's HandlerOutcome, edgezero_main, OwnedProcessResponseParams, HEADER_X_TS_FINALIZED sentinel, and named route table pattern - fastly.toml: took PR15's edgezero_enabled = "false" (EdgeZero not yet at parity) - docs/guide/testing.md: took PR15's version - Cargo.lock: regenerated post-resolution - Removed stale DEFAULT_FIRST_BYTE_TIMEOUT import from proxy.rs (superseded by platform)
…dy in platform/mod.rs
ChristianPavilonis
left a comment
There was a problem hiding this comment.
Summary
Thanks for adding the Axum dev-server adapter and target-specific workspace checks. I found one runtime parity issue where the Axum router does not currently accept the same publisher-fallback HTTP methods as the Fastly adapter. The stale clippy command documentation finding could not be attached inline because those unchanged context lines were not accepted by the review API, so I am folding it into the body: CLAUDE.md:73, README.md:48, and AGENTS.md:24 still point contributors at cargo clippy --workspace --all-targets --all-features -- -D warnings; these should point at cargo clippy-fastly && cargo clippy-axum to match CI and avoid drift from the mixed-target setup.
…ppy docs Register HEAD/OPTIONS/PUT/PATCH/DELETE on publisher fallback paths and non-primary methods on named routes so the Axum router matches the Fastly adapter's publisher_fallback_methods coverage. Unify get_fallback/post_fallback into a single general_fallback handler shared across all methods. Update startup_error_router to loop over all seven fallback methods consistently. Fix stale `cargo clippy --workspace` command in CLAUDE.md, README.md, and AGENTS.md — replace with `cargo clippy-fastly && cargo clippy-axum` to match CI and the mixed-target workspace setup.
ChristianPavilonis
left a comment
There was a problem hiding this comment.
Summary
Reviewed the Axum native dev server PR. I found a couple of Axum/Fastly parity issues worth addressing and several mixed-target workspace documentation updates. CI checks visible from gh pr checks are passing.
Body-only findings
Proxy response finalization repeats metadata and image heuristics
- Severity: P2
- File:
crates/trusted-server-core/src/proxy.rs - Line: 200-405
- Description:
finalize_proxied_response()andfinalize_proxied_response_streaming()duplicate response metadata extraction/logging and the image/pixel heuristic block. The only meaningful differences are content-encoding processing and the streaming log prefix, so changes to image handling or origin-response logging now require parallel edits. - Suggestion: Extract small helpers such as
origin_response_metadata(req, &response)andapply_image_passthrough_metadata(req, target_url, &ct, &mut response, log_prefix), then keep only the HTML/CSS processing branch in the buffered finalizer.
Related stale-build-doc locations that may not be commentable inline: CLAUDE.md:42-43 also still shows bare cargo build.
| #[must_use] | ||
| pub fn new() -> Self { | ||
| Self { | ||
| client: reqwest::Client::builder() |
There was a problem hiding this comment.
Disable automatic redirects in the Axum HTTP client
reqwest::Client follows redirects by default. Core proxy code enforces redirect limits and settings.proxy.allowed_domains itself, but Axum will follow Location internally before core can validate the next host. This can bypass first-party proxy redirect allowlist checks and diverge from Fastly behavior.
Suggestion: Disable reqwest redirects so core receives 3xx responses and applies its own policy:
client: reqwest::Client::builder()
.connect_timeout(Duration::from_secs(5))
.timeout(Duration::from_secs(30))
.redirect(reqwest::redirect::Policy::none())
.build()
.expect("should build reqwest client"),| }) | ||
| .collect(); | ||
|
|
||
| let (status, headers, body) = result.map_err(|e| { |
There was a problem hiding this comment.
Return ready request failures through PlatformSelectResult::ready
select() converts a failed ready request into Err(...) for the whole select call. The platform trait expects per-request failures to be returned as PlatformSelectResult { ready: Err(...), remaining }; the auction orchestrator treats select() errors as fatal and aborts the whole auction. On Axum, one failed provider can therefore fail the entire auction instead of logging that provider failure and continuing with remaining responses.
Suggestion: Always return Ok(PlatformSelectResult { ready, remaining }) after a task is selected, mapping join/request errors into ready: Err(...).
| } | ||
| }; | ||
|
|
||
| // /.well-known/trusted-server.json |
There was a problem hiding this comment.
Axum route registration duplicates handler boilerplate and route metadata
TrustedServerApp::routes() defines one closure per primary route, then repeats the same route list again in named_routes and again in the router builder. Each handler repeats Arc<AppState> -> build_runtime_services -> ctx.into_request -> handle_* -> http_error. The Fastly adapter now uses a route table plus named_route_handler() to avoid this drift; keeping Axum manual means every new route or method change must be updated in multiple places.
Suggestion: Mirror the Fastly pattern in crates/trusted-server-adapter-fastly/src/app.rs: add an Axum NamedRouteHandler enum/table, a shared execute_handler(), and register routes from the table. Keep the Axum-only admin 501 behavior as one enum arm.
| /// Mirrors the Fastly adapter's `resolve_publisher_response`: buffers streaming | ||
| /// and pass-through variants in memory (acceptable for a dev server) so the | ||
| /// Axum handler can return a single `Response`. | ||
| fn resolve_publisher_response( |
There was a problem hiding this comment.
Duplicate buffered publisher-response conversion across adapters
resolve_publisher_response() here and resolve_publisher_response_buffered() in the Fastly adapter are effectively the same implementation: handle Buffered, buffer Stream via stream_publisher_body, set Content-Length, and reattach PassThrough bodies. Since both operate on the same PublisherResponse and edgezero_core response/body types, future changes to buffering semantics must be duplicated.
Suggestion: Move this into trusted_server_core::publisher, e.g. buffer_publisher_response(publisher_response, settings, registry), and have both adapters call it.
| @@ -25,10 +25,16 @@ See the [Getting Started guide](https://iabtechlab.github.io/trusted-server/guid | |||
| # Build | |||
| cargo build | |||
There was a problem hiding this comment.
Bare cargo build docs are stale for the mixed-target workspace
This still tells users to run bare cargo build, but this PR removes the global wasm32-wasip1 target while keeping the Fastly adapter as the default member. Bare cargo build now targets the Fastly binary for the host and can fail at link time.
Suggestion: Replace with target-specific build commands, e.g. cargo build -p trusted-server-adapter-axum for native dev and cargo build -p trusted-server-adapter-fastly --target wasm32-wasip1 for Fastly.
|
|
||
| ```bash | ||
| fastly compute serve | ||
| cargo build |
There was a problem hiding this comment.
Bare cargo build docs are stale for the mixed-target workspace
This still tells users to run bare cargo build, but this PR removes the global wasm32-wasip1 target while keeping the Fastly adapter as the default member. Bare cargo build now targets the Fastly binary for the host and can fail at link time.
Suggestion: Replace with target-specific build commands, e.g. cargo build -p trusted-server-adapter-axum for native dev and cargo build -p trusted-server-adapter-fastly --target wasm32-wasip1 for Fastly.
| cargo test-axum | ||
|
|
||
| # Run specific test by name | ||
| cargo test test_generate_ec_id |
There was a problem hiding this comment.
Testing guide still documents obsolete bare test commands
The guide still recommends bare cargo test ... commands. In the new mixed-target workspace, contributors need the target-matched aliases; the documented commands either target the wrong runtime or skip the intended wasm/native split.
Suggestion: Update these examples to use cargo test-fastly / cargo test-axum, or for specific tests show alias/package-qualified examples such as cargo test-fastly test_generate_ec_id or cargo test -p trusted-server-core test_generate_ec_id.
| run: cargo test-fastly | ||
| - name: Run clippy | ||
| run: cargo clippy --workspace --all-targets --all-features -- -D warnings | ||
| run: cargo clippy --workspace --exclude trusted-server-adapter-axum --target wasm32-wasip1 -- -D warnings |
There was a problem hiding this comment.
Testing guide still documents obsolete clippy commands
The guide still recommends a raw cargo clippy --workspace ... command. In the mixed-target workspace, contributors need the target-matched aliases so wasm and native paths are linted in the same shape as CI.
Suggestion: Update these examples to use cargo clippy-fastly and cargo clippy-axum.
| @@ -0,0 +1,3 @@ | |||
| pub mod app; | |||
There was a problem hiding this comment.
Public Axum modules lack docs
The new public library exports app, middleware, and platform without module-level documentation, despite the project convention that each public item has a doc comment.
Suggestion: Add a crate summary and module docs, or make the modules non-public if they are not intended as public API. For example: //! Native Axum adapter for local Trusted Server development. and /// Application routing for the Axum dev server.
| ``` | ||
|
|
||
| ### Start Local Server | ||
| The server will be available at `http://localhost:8787`. |
There was a problem hiding this comment.
PORT override is not documented in user-facing Axum docs
The Axum binary now supports a PORT environment variable override, but the guide only documents the default localhost:8787 address.
Suggestion: Add a short note: Set PORT=<port> before cargo run -p trusted-server-adapter-axum to bind the dev server to a different local port.
Summary
trusted-server-adapter-axumas a native (non-WASM) dev server so the full trusted-server pipeline can be run and tested locally without Fastly Compute or Viceroytarget = "wasm32-wasip1"override from.cargo/config.toml; Fastly-specific commands now pass--target wasm32-wasip1explicitlyChanges
crates/trusted-server-adapter-axum/src/platform.rsPlatformConfigStore,PlatformSecretStore,PlatformBackend,PlatformGeo,PlatformHttpClient— env-var-backed implementationscrates/trusted-server-adapter-axum/src/middleware.rsFinalizeResponseMiddleware+AuthMiddleware— mirrors Fastly adapter, always emitsX-Geo-Info-Available: falsecrates/trusted-server-adapter-axum/src/app.rsTrustedServerAppimplementingHookswith all 11 routes wiredcrates/trusted-server-adapter-axum/src/main.rs+axum.tomlcrates/trusted-server-adapter-axum/tests/routes.rsEdgeZeroAxumService(no live TCP server)crates/integration-tests/tests/environments/axum.rsAxumDevServerruntime environment added to the matrixcrates/integration-tests/tests/environments/mod.rsAxumDevServeralongsideFastlyViceroycrates/integration-tests/tests/integration.rstest_wordpress_axum+test_nextjs_axumindividual test functionsscripts/integration-tests.sh.cargo/config.tomltarget = "wasm32-wasip1"; keep only the viceroy runnerCargo.tomltrusted-server-adapter-axumfrom[exclude]to[members]crates/trusted-server-adapter-axum/Cargo.toml.github/workflows/test.ymltest-axumCI job;test-rustnow passes--target wasm32-wasip1explicitlyCLAUDE.md.gitignore(root + adapter).edgezero/(local KV store created by dev server)Closes
Closes #497
Test plan
cargo test --workspace(Fastly/WASM crates via Viceroy)cargo test -p trusted-server-adapter-axum(8 route + middleware tests)cargo clippy --workspace --all-targets --all-features -- -D warningscargo fmt --all -- --checkcd crates/js/lib && npx vitest run(282 tests)test_wordpress_fastly,test_nextjs_fastly,test_wordpress_axum,test_nextjs_axumall passcargo run -p trusted-server-adapter-axumstarts on port 8787Checklist
unwrap()in production code — useexpect("should ...")logmacros (notprintln!)