Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion .claude/agents/build-validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Validate that the project builds correctly across all targets.

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

## Output
Expand Down
4 changes: 2 additions & 2 deletions .claude/agents/pr-creator.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Before creating the PR, verify the branch is healthy:
cargo fmt --all -- --check
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace
cd crates/js/lib && npx vitest run
cd crates/js/lib && npm run format
cd crates/trusted-server-js/lib && npx vitest run
cd crates/trusted-server-js/lib && npm run format
cd docs && npm run format
```

Expand Down
2 changes: 1 addition & 1 deletion .claude/agents/pr-reviewer.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ For each changed file, evaluate:
- Are edge cases covered (empty input, max values, error paths)?
- If config-derived regex/pattern compilation changed: are invalid enabled-config startup failures and explicit `enabled = false` bypass cases both covered?
- Rust tests: `cargo test --workspace`
- JS tests: `npx vitest run` in `crates/js/lib/`
- JS tests: `npx vitest run` in `crates/trusted-server-js/lib/`

### 5. Classify findings

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 @@ -13,7 +13,7 @@ This is a Rust workspace with three crates:

- `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)
- `crates/trusted-server-js/` — TypeScript/JS build pipeline (per-integration IIFE bundles)

Target: `wasm32-wasip1` (Fastly Compute)

Expand Down
4 changes: 2 additions & 2 deletions .claude/agents/verify-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ cargo test --workspace
### 4. JS Tests

```bash
cd crates/js/lib && npx vitest run
cd crates/trusted-server-js/lib && npx vitest run
```

### 5. JS Format

```bash
cd crates/js/lib && npm run format
cd crates/trusted-server-js/lib && npm run format
```

### 6. Docs Format
Expand Down
4 changes: 2 additions & 2 deletions .claude/commands/check-ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Run all CI checks locally, in order. Stop and report if any step fails.
1. `cargo fmt --all -- --check`
2. `cargo clippy --workspace --all-targets --all-features -- -D warnings`
3. `cargo test --workspace`
4. `cd crates/js/lib && npx vitest run`
5. `cd crates/js/lib && npm run format`
4. `cd crates/trusted-server-js/lib && npx vitest run`
5. `cd crates/trusted-server-js/lib && npm run format`
6. `cd docs && npm run format`

Report a summary of all results when done.
2 changes: 1 addition & 1 deletion .claude/commands/test-all.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cargo test --workspace
Then run JS tests:

```bash
cd crates/js/lib && npx vitest run
cd crates/trusted-server-js/lib && npx vitest run
```

Report results for both. If any test fails, investigate and suggest a fix.
2 changes: 1 addition & 1 deletion .claude/commands/test-crate.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cargo test -p $ARGUMENTS
If $ARGUMENTS is "js" or "javascript", run:

```bash
cd crates/js/lib && npx vitest run
cd crates/trusted-server-js/lib && npx vitest run
```

Report results and investigate any failures.
4 changes: 2 additions & 2 deletions .claude/commands/verify.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Full verification: build, test, and lint the entire project.
3. `cargo fmt --all -- --check`
4. `cargo clippy --workspace --all-targets --all-features -- -D warnings`
5. `cargo test --workspace`
6. `cd crates/js/lib && npx vitest run`
7. `cd crates/js/lib && npm run format`
6. `cd crates/trusted-server-js/lib && npx vitest run`
7. `cd crates/trusted-server-js/lib && npm run format`
8. `cd docs && npm run format`

Report results for each step. Stop and investigate if any step fails.
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
24 changes: 12 additions & 12 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 @@ -117,14 +117,14 @@ jobs:
- name: Run EdgeZero EC lifecycle 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
test_ec_lifecycle_fastly
-- --include-ignored --test-threads=1
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-edgezero.toml
VICEROY_CONFIG_PATH: ${{ github.workspace }}/crates/trusted-server-integration-tests/fixtures/configs/viceroy-template-edgezero.toml
# Opt into the EdgeZero entry-point canary in test_ec_lifecycle_fastly.
# Only set here, so the legacy integration-tests job runs the same
# scenarios through legacy_main without asserting the EdgeZero-only 405.
Expand Down Expand Up @@ -163,20 +163,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 @@ -186,16 +186,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 @@ -205,13 +205,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.
Loading
Loading