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
8ac395a
Add trusted-server-adapter-axum crate skeleton with lib + bin targets
prk-Jr Apr 17, 2026
8f0be1b
Add .gitignore to exclude target/ from axum adapter crate
prk-Jr Apr 17, 2026
0e81b2a
Add Axum platform trait implementations (config/secret/backend/geo/http)
prk-Jr Apr 17, 2026
3a0bcad
Add Axum middleware: FinalizeResponseMiddleware + AuthMiddleware
prk-Jr Apr 17, 2026
450a459
Add Axum app wiring: TrustedServerApp Hooks implementation
prk-Jr Apr 17, 2026
3e3016b
Add Axum adapter integration tests: route parity + middleware
prk-Jr Apr 17, 2026
ec2f5f5
Add CI job for Axum adapter native build and test
prk-Jr Apr 17, 2026
93ec543
Update CLAUDE.md: add Axum adapter to workspace layout and build comm…
prk-Jr Apr 17, 2026
a5a7719
Fix clippy warnings: add #[must_use], Panics doc, replace eprintln wi…
prk-Jr Apr 17, 2026
ba6ca2e
Promote axum adapter to workspace member, remove global wasm32 target
prk-Jr Apr 17, 2026
a783330
Add Axum runtime environment to integration test matrix
prk-Jr Apr 17, 2026
e2b1a61
Remove unused StatusCode import from routes integration test
prk-Jr Apr 17, 2026
8b54aca
Update docs to cover Axum dev server alongside Fastly
prk-Jr Apr 17, 2026
e967133
Reorder local dev options: Fastly first, Axum second
prk-Jr Apr 17, 2026
6059de2
Fix CI: build and pass Axum binary to integration test job
prk-Jr Apr 17, 2026
75fe0d0
fix integration test
prk-Jr Apr 18, 2026
6b6c221
Address PR16 review findings: unused deps, stale lockfile, middleware…
prk-Jr Apr 21, 2026
0a15d1d
Fix fixed-port TIME_WAIT flakiness and add send_async/select divergen…
prk-Jr Apr 21, 2026
a780034
Restore request-scoped Axum HTTP client and fix dynamic-port logging
prk-Jr Apr 22, 2026
0dcc750
Resolve PR review findings
prk-Jr Apr 27, 2026
d3138fd
Merge feature/edgezero-pr15-remove-fastly-core into PR16
prk-Jr Apr 27, 2026
6d1184d
Complete PR15 merge and restructure workspace for mixed-target adapters
prk-Jr Apr 28, 2026
9a0d38c
Set default-members to fastly adapter so Viceroy can locate the binary
prk-Jr Apr 29, 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
19 changes: 15 additions & 4 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
[alias]
test_details = ["test", "--target", "aarch64-apple-darwin"]
# No global [build] target — the workspace contains adapters for multiple targets:
# trusted-server-adapter-fastly → wasm32-wasip1 (Fastly Compute)
# trusted-server-adapter-axum → native (dev server)
# Future: trusted-server-adapter-cloudflare → wasm32-unknown-unknown
#
# Both adapters are workspace members so `-p` resolves both.
# default-members = [fastly] — required so Viceroy can locate the binary via `cargo run --bin`.
# Use the aliases below to target each adapter with the correct toolchain.

[build]
target = "wasm32-wasip1"
[alias]
# Fastly adapter + shared crates (wasm32-wasip1 via Viceroy)
test-fastly = ["test", "--workspace", "--exclude", "trusted-server-adapter-axum", "--target", "wasm32-wasip1"]
# Axum dev server adapter (native)
test-axum = ["test", "-p", "trusted-server-adapter-axum"]
# CI convenience — runs both in sequence (shell aliases can't chain; use a script or CI steps)
# cargo test-fastly && cargo test-axum

[target.'cfg(all(target_arch = "wasm32"))']
runner = "viceroy run -C ../../fastly.toml -- "
2 changes: 1 addition & 1 deletion .claude/agents/issue-creator.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Output the issue URL and type.
- Use issue **types**, not labels, for categorization.
- Every issue should have clear done-when / acceptance criteria.
- Use the affected area dropdown values from the templates:
- Core (synthetic IDs, cookies, GDPR)
- Core (Edge Cookies, GDPR)
- Integrations (prebid, lockr, permutive, etc.)
- HTML processing / JS injection
- Ad serving (Equativ)
Expand Down
2 changes: 1 addition & 1 deletion .claude/agents/repo-explorer.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ implementation details.

This is a Rust workspace with three crates:

- `crates/trusted-server-core/` — core library (integrations, HTML processing, synthetic IDs, GDPR)
- `crates/trusted-server-core/` — core library (integrations, HTML processing, Edge Cookies, GDPR)
- `crates/trusted-server-adapter-fastly/` — Fastly Compute entry point
- `crates/js/` — TypeScript/JS build pipeline (per-integration IIFE bundles)

Expand Down
29 changes: 26 additions & 3 deletions .github/actions/setup-integration-test-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ inputs:
description: Build the trusted-server WASM binary for integration tests.
required: false
default: "true"
build-axum:
description: Build the trusted-server-axum native binary for integration tests.
required: false
default: "true"
build-test-images:
description: Build the framework Docker images used by integration tests.
required: false
Expand Down Expand Up @@ -45,6 +49,15 @@ runs:
shell: bash
run: echo "node-version=$(grep '^nodejs ' .tool-versions | awk '{print $2}')" >> "$GITHUB_OUTPUT"

- name: Retrieve Viceroy version
id: viceroy-version
if: ${{ inputs.install-viceroy == 'true' }}
shell: bash
# `.tool-versions` is the single source of truth for the Viceroy pin.
# The pin matters because upstream Viceroy > v0.16.4 has bumped MSRV
# beyond the rustc pin in `rust-toolchain.toml`.
run: echo "viceroy-version=$(grep '^viceroy ' .tool-versions | awk '{print $2}')" >> "$GITHUB_OUTPUT"

- name: Set up Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
Expand All @@ -58,23 +71,33 @@ runs:
uses: actions/cache@v4
with:
path: ~/.cargo/bin/viceroy
key: viceroy-${{ runner.os }}-v0.16.4
key: viceroy-${{ runner.os }}-v${{ steps.viceroy-version.outputs.viceroy-version }}

- name: Install Viceroy
if: ${{ inputs.install-viceroy == 'true' && steps.cache-viceroy.outputs.cache-hit != 'true' }}
shell: bash
run: cargo install --git https://github.com/fastly/Viceroy --tag v0.16.4 viceroy
run: cargo install --git https://github.com/fastly/Viceroy --tag v${{ steps.viceroy-version.outputs.viceroy-version }} viceroy

- name: Build WASM binary
if: ${{ inputs.build-wasm == 'true' }}
shell: bash
env:
TRUSTED_SERVER__PUBLISHER__ORIGIN_URL: http://127.0.0.1:${{ inputs.origin-port }}
TRUSTED_SERVER__PUBLISHER__PROXY_SECRET: integration-test-proxy-secret
TRUSTED_SERVER__SYNTHETIC__SECRET_KEY: integration-test-secret-key
TRUSTED_SERVER__EDGE_COOKIE__SECRET_KEY: integration-test-secret-key
TRUSTED_SERVER__PROXY__CERTIFICATE_CHECK: "false"
run: cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1

- name: Build Axum native binary
if: ${{ inputs.build-axum == 'true' }}
shell: bash
env:
TRUSTED_SERVER__PUBLISHER__ORIGIN_URL: http://127.0.0.1:${{ inputs.origin-port }}
TRUSTED_SERVER__PUBLISHER__PROXY_SECRET: integration-test-proxy-secret
TRUSTED_SERVER__SYNTHETIC__SECRET_KEY: integration-test-secret-key
TRUSTED_SERVER__PROXY__CERTIFICATE_CHECK: "false"
run: cargo build -p trusted-server-adapter-axum

- name: Build WordPress test container
if: ${{ inputs.build-test-images == 'true' }}
shell: bash
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env:
ORIGIN_PORT: 8888
ARTIFACTS_DIR: /tmp/integration-test-artifacts
WASM_ARTIFACT_PATH: /tmp/integration-test-artifacts/wasm/trusted-server-adapter-fastly.wasm
AXUM_ARTIFACT_PATH: /tmp/integration-test-artifacts/axum/trusted-server-axum
DOCKER_ARTIFACT_PATH: /tmp/integration-test-artifacts/docker/test-images.tar

jobs:
Expand All @@ -32,8 +33,9 @@ jobs:

- name: Package integration test artifacts
run: |
mkdir -p "$(dirname "$WASM_ARTIFACT_PATH")" "$(dirname "$DOCKER_ARTIFACT_PATH")"
mkdir -p "$(dirname "$WASM_ARTIFACT_PATH")" "$(dirname "$AXUM_ARTIFACT_PATH")" "$(dirname "$DOCKER_ARTIFACT_PATH")"
cp target/wasm32-wasip1/release/trusted-server-adapter-fastly.wasm "$WASM_ARTIFACT_PATH"
cp target/debug/trusted-server-axum "$AXUM_ARTIFACT_PATH"
docker save \
--output "$DOCKER_ARTIFACT_PATH" \
test-wordpress:latest test-nextjs:latest
Expand Down Expand Up @@ -69,6 +71,9 @@ jobs:
name: integration-test-artifacts
path: ${{ env.ARTIFACTS_DIR }}

- name: Make binaries executable
run: chmod +x "$AXUM_ARTIFACT_PATH"

- name: Load integration test Docker images
run: docker load --input "$DOCKER_ARTIFACT_PATH"

Expand All @@ -80,6 +85,7 @@ jobs:
-- --include-ignored --skip test_wordpress_fastly --skip test_nextjs_fastly --test-threads=1
env:
WASM_BINARY_PATH: ${{ env.WASM_ARTIFACT_PATH }}
AXUM_BINARY_PATH: ${{ env.AXUM_ARTIFACT_PATH }}
INTEGRATION_ORIGIN_PORT: ${{ env.ORIGIN_PORT }}
RUST_LOG: info

Expand Down
44 changes: 36 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,58 @@ jobs:
run: echo "rust-version=$(grep '^rust ' .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT
shell: bash

- name: Retrieve Viceroy version
id: viceroy-version
# `.tool-versions` is the single source of truth so this workflow and
# `.github/actions/setup-integration-test-env/action.yml` can't drift.
# The pin matters because upstream Viceroy > v0.16.4 has bumped MSRV
# beyond the rustc pin in `rust-toolchain.toml`.
run: echo "viceroy-version=$(grep '^viceroy ' .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT
shell: bash

- name: Set up Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ steps.rust-version.outputs.rust-version }}
target: wasm32-wasip1
cache-shared-key: cargo-${{ runner.os }}

- name: Get Viceroy cache key
id: viceroy-rev
run: echo "sha=$(git ls-remote https://github.com/fastly/Viceroy HEAD | cut -f1)" >> $GITHUB_OUTPUT

- name: Cache Viceroy binary
id: cache-viceroy
uses: actions/cache@v4
with:
path: ~/.cargo/bin/viceroy
key: viceroy-${{ runner.os }}-${{ steps.viceroy-rev.outputs.sha }}
key: viceroy-${{ runner.os }}-v${{ steps.viceroy-version.outputs.viceroy-version }}

- name: Install Viceroy (from main since 0.14.3 is broken)
- name: Install Viceroy
if: steps.cache-viceroy.outputs.cache-hit != 'true'
run: cargo install --git https://github.com/fastly/Viceroy viceroy
run: cargo install --git https://github.com/fastly/Viceroy --tag v${{ steps.viceroy-version.outputs.viceroy-version }} viceroy

- name: Run tests
run: cargo test --workspace
run: cargo test-fastly

test-axum:
name: cargo test (axum native)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Retrieve Rust version
id: rust-version
run: echo "rust-version=$(grep '^rust ' .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT
shell: bash

- name: Set up Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ steps.rust-version.outputs.rust-version }}
cache-shared-key: cargo-${{ runner.os }}

- name: Build Axum adapter
run: cargo build -p trusted-server-adapter-axum

- name: Run Axum adapter tests
run: cargo test-axum

test-typescript:
name: vitest
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
/bin
/pkg
/target

# EdgeZero local KV store (created by axum dev server)
.edgezero/
/crates/integration-tests/target

# env
Expand Down
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
fastly 13.3.0
rust 1.91.1
nodejs 24.12.0
viceroy 0.16.4
5 changes: 4 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ If you cannot read `CLAUDE.md`, follow these rules:

1. Present a plan and get approval before coding.
2. Keep changes minimal — do not refactor unrelated code.
3. Run `cargo test --workspace` after every code change.
3. Run tests after every code change — use the workspace aliases defined in `.cargo/config.toml`:
- `cargo test-fastly` — Fastly adapter + core (wasm32-wasip1 via Viceroy)
- `cargo test-axum` — Axum dev server adapter (native)
Do NOT use bare `cargo test --workspace` — it will attempt to compile the Fastly adapter for the host target.
4. Run `cargo fmt --all -- --check` and `cargo clippy --workspace --all-targets --all-features -- -D warnings`.
5. Run JS tests with `cd crates/js/lib && npx vitest run` when touching JS/TS code.
6. Use `error-stack` (`Report<E>`) for error handling — not anyhow, eyre, or thiserror.
Expand Down
17 changes: 13 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## Project Overview

Rust-based edge computing application targeting **Fastly Compute**. Handles
privacy-preserving synthetic ID generation, ad serving with GDPR compliance,
privacy-preserving Edge Cookie (EC) ID generation, ad serving with GDPR compliance,
real-time bidding integration, and publisher-side JavaScript injection.

## Workspace Layout
Expand All @@ -15,6 +15,7 @@ real-time bidding integration, and publisher-side JavaScript injection.
crates/
trusted-server-core/ # Core library — shared logic, integrations, HTML processing
trusted-server-adapter-fastly/ # Fastly Compute entry point (wasm32-wasip1 binary)
trusted-server-adapter-axum/ # Axum dev server entry point (native binary)
js/ # TypeScript/JS build — per-integration IIFE bundles
lib/ # TS source, Vitest tests, esbuild pipeline
```
Expand Down Expand Up @@ -49,13 +50,21 @@ fastly compute serve

# Deploy to Fastly
fastly compute publish

# Run Axum dev server (native — no Viceroy)
cargo run -p trusted-server-adapter-axum

# Test Axum adapter only
cargo test-axum
```

### Testing & Quality

```bash
# Run all Rust tests (uses viceroy)
cargo test --workspace
# Run all Rust tests — use workspace aliases (see .cargo/config.toml)
# default-members = [fastly] so Viceroy can locate the binary via `cargo run --bin`.
cargo test-fastly # Fastly adapter + core (wasm32-wasip1 via Viceroy)
cargo test-axum # Axum dev server adapter (native)

# Format
cargo fmt --all -- --check
Expand Down Expand Up @@ -366,7 +375,7 @@ both runtime behavior and build/tooling changes.
| `crates/trusted-server-core/src/tsjs.rs` | Script tag generation with module IDs |
| `crates/trusted-server-core/src/html_processor.rs` | Injects `<script>` at `<head>` start |
| `crates/trusted-server-core/src/publisher.rs` | `/static/tsjs=` handler, concatenates modules |
| `crates/trusted-server-core/src/synthetic.rs` | Synthetic ID generation |
| `crates/trusted-server-core/src/edge_cookie.rs` | Edge Cookie (EC) ID generation |
| `crates/trusted-server-core/src/cookies.rs` | Cookie handling |
| `crates/trusted-server-core/src/consent/mod.rs` | GDPR and broader consent management |
| `crates/trusted-server-core/src/http_util.rs` | HTTP abstractions and request utilities |
Expand Down
Loading