Skip to content

Commit ecde812

Browse files
prk-Jrclaude
andcommitted
Merge server-side-ad-templates-impl into feature/ts-cli-ad-templates
Reconcile the ad-template CLI + generate feature onto the commands/ module layout the base branch adopted from main (ts dev proxy, #798): - audit/ -> commands/audit/ : mod.rs is the audit namespace; the #800 draft-gen plus slot reconstruction move under commands/audit/generate/ (base's duplicate commands/audit/{analyzer,browser_collector} dropped). - config_ad_templates.rs -> commands/config/ad_templates.rs. - app_config and ad_templates support modules stay at crate root. - run.rs/lib.rs wiring merged with the new `ts dev` command. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2 parents fe198d9 + a92e7b2 commit ecde812

67 files changed

Lines changed: 9179 additions & 5897 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cargo/config.toml

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,44 +7,54 @@
77
#
88
# All adapters are workspace members so `-p` resolves each.
99
# default-members = [fastly] — required so Viceroy can locate the binary via `cargo run --bin`.
10-
# Use the aliases below to target each adapter with the correct toolchain.
10+
# The aliases below are grouped by adapter; each targets its adapter with the
11+
# correct toolchain (build / check / test / clippy).
1112

1213
[alias]
14+
# Generic: native test with an explicit host target.
1315
test_details = ["test", "--target", "aarch64-apple-darwin"]
14-
test_cli_macos = ["test", "--package", "trusted-server-cli", "--target", "aarch64-apple-darwin"]
15-
build_cli_macos = ["build", "--package", "trusted-server-cli", "--target", "aarch64-apple-darwin"]
16-
test_cli_linux = ["test", "--package", "trusted-server-cli", "--target", "x86_64-unknown-linux-gnu"]
17-
build_cli_linux = ["build", "--package", "trusted-server-cli", "--target", "x86_64-unknown-linux-gnu"]
18-
# Fastly adapter + shared crates (wasm32-wasip1 via Viceroy)
19-
# Excludes Axum (native-only), Cloudflare (wasm32-unknown-unknown), and Spin (separate wasm32-wasip1 job)
20-
test-fastly = ["test", "--workspace", "--exclude", "trusted-server-adapter-axum", "--exclude", "trusted-server-adapter-cloudflare", "--exclude", "trusted-server-adapter-spin", "--target", "wasm32-wasip1"]
21-
# Axum dev server adapter (native)
22-
test-axum = ["test", "-p", "trusted-server-adapter-axum"]
23-
# Cloudflare adapter (native host; WASM target checked separately in CI)
24-
test-cloudflare = ["test", "-p", "trusted-server-adapter-cloudflare"]
25-
# Cloudflare adapter WASM target check (wasm32-unknown-unknown requires --features cloudflare)
26-
check-cloudflare = ["check", "-p", "trusted-server-adapter-cloudflare", "--target", "wasm32-unknown-unknown", "--features", "cloudflare"]
27-
# Spin adapter (native host tests; WASM target checked separately with --features spin)
28-
test-spin = ["test", "-p", "trusted-server-adapter-spin"]
29-
check-spin = ["check", "-p", "trusted-server-adapter-spin", "--target", "wasm32-wasip1", "--features", "spin"]
3016

31-
# Clippy — target-matched to avoid cross-target compile failures
32-
clippy-fastly = ["clippy", "--workspace", "--exclude", "trusted-server-adapter-axum", "--exclude", "trusted-server-adapter-cloudflare", "--exclude", "trusted-server-adapter-spin", "--all-targets", "--all-features", "--target", "wasm32-wasip1", "--", "-D", "warnings"]
17+
# --- Fastly adapter (wasm32-wasip1, run via Viceroy) ---
18+
# Whitelist the wasm-buildable crates (the Fastly adapter + the shared crates it
19+
# builds/tests on wasm) rather than blacklisting every native crate — so adding a
20+
# native crate needs no change here. Axum (native), Cloudflare
21+
# (wasm32-unknown-unknown), Spin, the CLI (native), and integration-tests
22+
# (native) are simply not listed.
23+
build-fastly = ["build", "-p", "trusted-server-core", "-p", "trusted-server-adapter-fastly", "-p", "trusted-server-js", "-p", "trusted-server-openrtb", "--target", "wasm32-wasip1"]
24+
check-fastly = ["check", "-p", "trusted-server-core", "-p", "trusted-server-adapter-fastly", "-p", "trusted-server-js", "-p", "trusted-server-openrtb", "--target", "wasm32-wasip1"]
25+
clippy-fastly = ["clippy", "-p", "trusted-server-core", "-p", "trusted-server-adapter-fastly", "-p", "trusted-server-js", "-p", "trusted-server-openrtb", "--all-targets", "--all-features", "--target", "wasm32-wasip1", "--", "-D", "warnings"]
26+
test-fastly = ["test", "-p", "trusted-server-core", "-p", "trusted-server-adapter-fastly", "-p", "trusted-server-js", "-p", "trusted-server-openrtb", "--target", "wasm32-wasip1"]
27+
28+
# --- Axum adapter (native dev server) ---
29+
build-axum = ["build", "-p", "trusted-server-adapter-axum"]
30+
check-axum = ["check", "-p", "trusted-server-adapter-axum"]
3331
clippy-axum = ["clippy", "-p", "trusted-server-adapter-axum", "--all-targets", "--all-features", "--", "-D", "warnings"]
32+
test-axum = ["test", "-p", "trusted-server-adapter-axum"]
33+
34+
# --- Cloudflare adapter (native host + wasm32-unknown-unknown) ---
35+
# Build/check target the WASM runtime (requires the `cloudflare` feature);
36+
# tests and clippy run on the native host.
37+
build-cloudflare = ["build", "-p", "trusted-server-adapter-cloudflare", "--target", "wasm32-unknown-unknown", "--features", "cloudflare"]
38+
check-cloudflare = ["check", "-p", "trusted-server-adapter-cloudflare", "--target", "wasm32-unknown-unknown", "--features", "cloudflare"]
3439
# No --all-features: the `cloudflare` feature has a compile_error! guard on
3540
# non-wasm32 targets. WASM-feature coverage comes from `cargo check-cloudflare`.
3641
clippy-cloudflare = ["clippy", "-p", "trusted-server-adapter-cloudflare", "--all-targets", "--", "-D", "warnings"]
42+
test-cloudflare = ["test", "-p", "trusted-server-adapter-cloudflare"]
43+
44+
# --- Spin adapter (native host tests + wasm32-wasip1 target) ---
45+
check-spin = ["check", "-p", "trusted-server-adapter-spin", "--target", "wasm32-wasip1", "--features", "spin"]
3746
clippy-spin-native = ["clippy", "-p", "trusted-server-adapter-spin", "--all-targets", "--", "-D", "warnings"]
3847
clippy-spin-wasm = ["clippy", "-p", "trusted-server-adapter-spin", "--target", "wasm32-wasip1", "--features", "spin", "--lib", "--", "-D", "warnings"]
48+
test-spin = ["test", "-p", "trusted-server-adapter-spin"]
3949

40-
# Build — target-matched, same split as test/clippy
41-
build-fastly = ["build", "--workspace", "--exclude", "trusted-server-adapter-axum", "--exclude", "trusted-server-adapter-cloudflare", "--exclude", "trusted-server-adapter-spin", "--target", "wasm32-wasip1"]
42-
build-axum = ["build", "-p", "trusted-server-adapter-axum"]
43-
build-cloudflare = ["build", "-p", "trusted-server-adapter-cloudflare", "--target", "wasm32-unknown-unknown", "--features", "cloudflare"]
44-
45-
# Check — fast compile validation, same split
46-
check-fastly = ["check", "--workspace", "--exclude", "trusted-server-adapter-axum", "--exclude", "trusted-server-adapter-cloudflare", "--exclude", "trusted-server-adapter-spin", "--target", "wasm32-wasip1"]
47-
check-axum = ["check", "-p", "trusted-server-adapter-axum"]
50+
# --- ts operator CLI (native host; per-OS target overrides the wasm default) ---
51+
build_cli_linux = ["build", "--package", "trusted-server-cli", "--target", "x86_64-unknown-linux-gnu"]
52+
build_cli_macos = ["build", "--package", "trusted-server-cli", "--target", "aarch64-apple-darwin"]
53+
run_cli_linux = ["run", "--package", "trusted-server-cli", "--target", "x86_64-unknown-linux-gnu", "--"]
54+
run_cli_macos = ["run", "--package", "trusted-server-cli", "--target", "aarch64-apple-darwin", "--"]
55+
test_cli_linux = ["test", "--package", "trusted-server-cli", "--target", "x86_64-unknown-linux-gnu"]
56+
test_cli_macos = ["test", "--package", "trusted-server-cli", "--target", "aarch64-apple-darwin"]
4857

58+
# When a wasm binary IS built, run it under Viceroy.
4959
[target.'cfg(all(target_arch = "wasm32"))']
5060
runner = "viceroy run -C ../../fastly.toml -- "

.github/actions/setup-integration-test-env/action.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ inputs:
55
origin-port:
66
description: Fixed origin port baked into the WASM binary for integration tests.
77
required: true
8-
check-dependency-versions:
9-
description: Run the integration dependency version consistency check.
10-
required: false
11-
default: "true"
128
install-viceroy:
139
description: Install the Viceroy binary used by integration tests.
1410
required: false
@@ -38,11 +34,6 @@ outputs:
3834
runs:
3935
using: composite
4036
steps:
41-
- name: Check shared dependency versions
42-
if: ${{ inputs.check-dependency-versions == 'true' }}
43-
shell: bash
44-
run: ./scripts/check-integration-dependency-versions.sh
45-
4637
- name: Retrieve Rust version
4738
id: rust-version
4839
shell: bash

.github/workflows/integration-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ jobs:
6868
uses: ./.github/actions/setup-integration-test-env
6969
with:
7070
origin-port: ${{ env.ORIGIN_PORT }}
71-
check-dependency-versions: "false"
7271
install-viceroy: "true"
7372
build-wasm: "false"
7473
build-axum: "false"
@@ -128,7 +127,6 @@ jobs:
128127
uses: ./.github/actions/setup-integration-test-env
129128
with:
130129
origin-port: ${{ env.ORIGIN_PORT }}
131-
check-dependency-versions: "false"
132130
install-viceroy: "true"
133131
build-wasm: "false"
134132
build-test-images: "false"
@@ -172,7 +170,6 @@ jobs:
172170
uses: ./.github/actions/setup-integration-test-env
173171
with:
174172
origin-port: ${{ env.ORIGIN_PORT }}
175-
check-dependency-versions: "false"
176173
install-viceroy: "true"
177174
build-wasm: "false"
178175
build-test-images: "false"

.github/workflows/test.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,41 @@ jobs:
178178
- name: Clippy (parity test crate)
179179
run: cargo clippy --manifest-path crates/trusted-server-integration-tests/Cargo.toml --all-targets -- -D warnings
180180

181+
test-cli:
182+
# `trusted-server-cli` is a workspace member, but the workspace default target
183+
# is wasm32-wasip1 (see .cargo/config.toml), where the crate is an empty shell
184+
# — so the wasm workspace jobs do not exercise its real code. `ts dev proxy` is
185+
# a macOS tool (Safari/keychain/networksetup), so validate the crate on macOS
186+
# with an explicit native --target that overrides the wasm default.
187+
name: cargo test (ts CLI, native)
188+
runs-on: macos-latest
189+
steps:
190+
- uses: actions/checkout@v4
191+
192+
- name: Retrieve Rust version
193+
id: rust-version
194+
run: echo "rust-version=$(grep '^rust ' .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT
195+
shell: bash
196+
197+
- name: Set up Rust toolchain
198+
uses: actions-rust-lang/setup-rust-toolchain@v1
199+
with:
200+
toolchain: ${{ steps.rust-version.outputs.rust-version }}
201+
components: "clippy, rustfmt"
202+
cache-shared-key: cargo-cli-${{ runner.os }}
203+
204+
# No separate `cargo fmt` here: `trusted-server-cli` is a workspace member,
205+
# so the main `cargo fmt --all` job already formats it. Clippy still needs a
206+
# native run — the workspace clippy jobs are wasm/adapter-scoped and never
207+
# lint the CLI's host-only code (macOS dev proxy vs Linux audit differ by cfg).
208+
- name: cargo clippy
209+
run: |
210+
cargo clippy --manifest-path crates/trusted-server-cli/Cargo.toml --target "$(rustc -vV | sed -n 's/host: //p')" --all-targets -- -D warnings
211+
212+
- name: cargo test
213+
run: |
214+
cargo test --manifest-path crates/trusted-server-cli/Cargo.toml --target "$(rustc -vV | sed -n 's/host: //p')"
215+
181216
test-typescript:
182217
name: vitest
183218
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)