Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 3 additions & 5 deletions .github/actions/setup-integration-test-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ runs:
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
Expand All @@ -72,7 +70,7 @@ runs:
- 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 v${{ steps.viceroy-version.outputs.viceroy-version }} viceroy
run: cargo install viceroy --version "${{ steps.viceroy-version.outputs.viceroy-version }}" --locked --force

- name: Build WASM binary
if: ${{ inputs.build-wasm == 'true' }}
Expand All @@ -91,7 +89,7 @@ runs:
shell: bash
run: |
docker build -t test-wordpress:latest \
crates/integration-tests/fixtures/frameworks/wordpress/
crates/trusted-server-integration-tests/fixtures/frameworks/wordpress/

- name: Build Next.js test container
if: ${{ inputs.build-test-images == 'true' }}
Expand All @@ -100,4 +98,4 @@ runs:
docker build \
--build-arg NODE_VERSION=${{ steps.node-version.outputs.node-version }} \
-t test-nextjs:latest \
crates/integration-tests/fixtures/frameworks/nextjs/
crates/trusted-server-integration-tests/fixtures/frameworks/nextjs/
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ updates:
interval: "weekly"

- package-ecosystem: "npm" # See documentation for possible values
directory: "crates/js/lib/" # Location of package manifests
directory: "crates/trusted-server-js/lib/" # Location of package manifests
schedule:
interval: "weekly"

Expand Down
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Closes #
- [ ] `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`
- [ ] JS tests: `cd crates/trusted-server-js/lib && npx vitest run`
- [ ] JS format: `cd crates/trusted-server-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`
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: crates/js/lib
working-directory: crates/trusted-server-js/lib

steps:
- uses: actions/checkout@v4
Expand All @@ -55,7 +55,7 @@ jobs:
with:
node-version: ${{ steps.node-version.outputs.node-version }}
cache: "npm"
cache-dependency-path: crates/js/lib/package.json
cache-dependency-path: crates/trusted-server-js/lib/package.json

- name: Install dependencies
run: npm ci
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
- name: Run integration tests
run: >-
cargo test
--manifest-path crates/integration-tests/Cargo.toml
--manifest-path crates/trusted-server-integration-tests/Cargo.toml
--target x86_64-unknown-linux-gnu
-- --include-ignored --skip test_wordpress_fastly --skip test_nextjs_fastly --test-threads=1
env:
Expand Down Expand Up @@ -115,20 +115,20 @@ jobs:
with:
node-version: ${{ steps.shared-setup.outputs.node-version }}
cache: npm
cache-dependency-path: crates/integration-tests/browser/package-lock.json
cache-dependency-path: crates/trusted-server-integration-tests/browser/package-lock.json

- name: Install Playwright
working-directory: crates/integration-tests/browser
working-directory: crates/trusted-server-integration-tests/browser
run: |
npm ci
npx playwright install --with-deps chromium

- name: Run browser tests (Next.js)
working-directory: crates/integration-tests/browser
working-directory: crates/trusted-server-integration-tests/browser
env:
WASM_BINARY_PATH: ${{ env.WASM_ARTIFACT_PATH }}
INTEGRATION_ORIGIN_PORT: ${{ env.ORIGIN_PORT }}
VICEROY_CONFIG_PATH: ${{ github.workspace }}/crates/integration-tests/fixtures/configs/viceroy-template.toml
VICEROY_CONFIG_PATH: ${{ github.workspace }}/crates/trusted-server-integration-tests/fixtures/configs/viceroy-template.toml
TEST_FRAMEWORK: nextjs
PLAYWRIGHT_HTML_REPORT: playwright-report-nextjs
run: npx playwright test
Expand All @@ -138,16 +138,16 @@ jobs:
if: always()
with:
name: playwright-report-nextjs
path: crates/integration-tests/browser/playwright-report-nextjs/
path: crates/trusted-server-integration-tests/browser/playwright-report-nextjs/
retention-days: 7

- name: Run browser tests (WordPress)
if: always()
working-directory: crates/integration-tests/browser
working-directory: crates/trusted-server-integration-tests/browser
env:
WASM_BINARY_PATH: ${{ env.WASM_ARTIFACT_PATH }}
INTEGRATION_ORIGIN_PORT: ${{ env.ORIGIN_PORT }}
VICEROY_CONFIG_PATH: ${{ github.workspace }}/crates/integration-tests/fixtures/configs/viceroy-template.toml
VICEROY_CONFIG_PATH: ${{ github.workspace }}/crates/trusted-server-integration-tests/fixtures/configs/viceroy-template.toml
TEST_FRAMEWORK: wordpress
PLAYWRIGHT_HTML_REPORT: playwright-report-wordpress
run: npx playwright test
Expand All @@ -157,13 +157,13 @@ jobs:
if: always()
with:
name: playwright-report-wordpress
path: crates/integration-tests/browser/playwright-report-wordpress/
path: crates/trusted-server-integration-tests/browser/playwright-report-wordpress/
retention-days: 7

- name: Upload Playwright traces and screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-traces
path: crates/integration-tests/browser/test-results/
path: crates/trusted-server-integration-tests/browser/test-results/
retention-days: 7
8 changes: 3 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ jobs:
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

Expand All @@ -46,7 +44,7 @@ jobs:

- name: Install Viceroy
if: steps.cache-viceroy.outputs.cache-hit != 'true'
run: cargo install --git https://github.com/fastly/Viceroy --tag v${{ steps.viceroy-version.outputs.viceroy-version }} viceroy
run: cargo install viceroy --version "${{ steps.viceroy-version.outputs.viceroy-version }}" --locked --force

- name: Run tests
run: cargo test --workspace
Expand All @@ -64,7 +62,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: crates/js/lib
working-directory: crates/trusted-server-js/lib
steps:
- uses: actions/checkout@v4

Expand All @@ -79,7 +77,7 @@ jobs:
with:
node-version: ${{ steps.node-version.outputs.node-version }}
cache: "npm"
cache-dependency-path: crates/js/lib/package.json
cache-dependency-path: crates/trusted-server-js/lib/package.json

- name: Install dependencies
run: npm ci
Expand Down
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/bin
/pkg
/target
/crates/integration-tests/target
/crates/trusted-server-integration-tests/target

# env
.env*
Expand Down Expand Up @@ -32,7 +32,7 @@ src/*.html
/benchmark-results/**

# Playwright browser tests
/crates/integration-tests/browser/node_modules/
/crates/integration-tests/browser/test-results/
/crates/integration-tests/browser/playwright-report/
/crates/integration-tests/browser/.browser-test-state.json
/crates/trusted-server-integration-tests/browser/node_modules/
/crates/trusted-server-integration-tests/browser/test-results/
/crates/trusted-server-integration-tests/browser/playwright-report/
/crates/trusted-server-integration-tests/browser/.browser-test-state.json
7 changes: 4 additions & 3 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
fastly 13.3.0
rust 1.91.1
fastly 15.1.0
rust 1.95.0
nodejs 24.12.0
viceroy 0.16.4
viceroy 0.17.0
wasmtime 44.0.1
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If you cannot read `CLAUDE.md`, follow these rules:
2. Keep changes minimal — do not refactor unrelated code.
3. Run `cargo test --workspace` after every code change.
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.
5. Run JS tests with `cd crates/trusted-server-js/lib && npx vitest run` when touching JS/TS code.
6. Use `error-stack` (`Report<E>`) for error handling — not anyhow, eyre, or thiserror.
7. Use `log` macros (not `println!`) and `expect("should ...")` (not `unwrap()`).
8. Target is `wasm32-wasip1` — no Tokio or OS-specific dependencies in core crates.
28 changes: 15 additions & 13 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +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)
js/ # TypeScript/JS build — per-integration IIFE bundles
trusted-server-js/ # TypeScript/JS build — per-integration IIFE bundles
lib/ # TS source, Vitest tests, esbuild pipeline
```

Expand All @@ -26,10 +26,12 @@ Supporting files: `fastly.toml`, `trusted-server.toml`, `.env.dev`,

| Tool | Version / Target |
| ----------- | ---------------------------------------- |
| Rust | 1.91.1 (pinned in `rust-toolchain.toml`) |
| Rust | 1.95.0 (pinned in `rust-toolchain.toml`) |
| WASM target | `wasm32-wasip1` |
| Node | LTS (for JS build) |
| Viceroy | Latest (Fastly local simulator) |
| Node | 24.12.0 (from `.tool-versions`) |
| Fastly CLI | 15.1.0 (from `.tool-versions`) |
| Viceroy | 0.17.0 (from `.tool-versions`) |
| Wasmtime | 44.0.1 (from `.tool-versions`) |

---

Expand Down Expand Up @@ -67,22 +69,22 @@ cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo check

# JS tests
cd crates/js/lib && npx vitest run
cd crates/trusted-server-js/lib && npx vitest run

# JS format
cd crates/js/lib && npm run format
cd crates/trusted-server-js/lib && npm run format

# Docs format
cd docs && npm run format

# JS build
cd crates/js/lib && node build-all.mjs
cd crates/trusted-server-js/lib && node build-all.mjs
```

### Install prerequisites

```bash
cargo install viceroy # Fastly local test runtime
cargo install viceroy --version 0.17.0 --locked --force
```

---
Expand Down Expand Up @@ -266,7 +268,7 @@ IntegrationRegistration::builder(ID)
| --------------------- | ---------------------------------------------------------- |
| `fastly.toml` | Fastly service configuration and build settings |
| `trusted-server.toml` | Application settings (ad servers, KV stores, ID templates) |
| `rust-toolchain.toml` | Pins Rust version to 1.91.1 |
| `rust-toolchain.toml` | Pins Rust version to 1.95.0 |
| `.env.dev` | Local development environment variables |

---
Expand All @@ -278,8 +280,8 @@ Every PR must pass:
1. `cargo fmt --all -- --check`
2. `cargo clippy --workspace --all-targets --all-features -- -D warnings`
3. `cargo test --workspace`
4. JS build and test (`cd crates/js/lib && npx vitest run`)
5. JS format (`cd crates/js/lib && npm run format`)
4. JS build and test (`cd crates/trusted-server-js/lib && npx vitest run`)
5. JS format (`cd crates/trusted-server-js/lib && npm run format`)
6. Docs format (`cd docs && npm run format`)

---
Expand Down Expand Up @@ -378,8 +380,8 @@ both runtime behavior and build/tooling changes.
| `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 |
| `crates/js/build.rs` | Discovers dist files, generates `tsjs_modules.rs` |
| `crates/js/src/bundle.rs` | Module map, concatenation, hashing |
| `crates/trusted-server-js/build.rs` | Discovers dist files, generates `tsjs_modules.rs` |
| `crates/trusted-server-js/src/bundle.rs` | Module map, concatenation, hashing |

---

Expand Down
Loading