From 180471eda711a2065b76c22bd2a705ed4f20d0da Mon Sep 17 00:00:00 2001 From: prk-Jr Date: Wed, 18 Mar 2026 16:54:17 +0530 Subject: [PATCH] Rename crates to trusted-server-core and trusted-server-adapter-fastly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename crates/common β†’ crates/trusted-server-core and crates/fastly β†’ crates/trusted-server-adapter-fastly following the EdgeZero naming convention. Add EdgeZero workspace dependencies pinned to rev 170b74b. Update all references across docs, CI workflows, scripts, agent files, and configuration. --- .claude/agents/build-validator.md | 4 +- .claude/agents/pr-creator.md | 2 +- .claude/agents/pr-reviewer.md | 8 +- .claude/agents/repo-explorer.md | 4 +- .claude/agents/verify-app.md | 4 +- .claude/commands/check-ci.md | 2 +- .claude/commands/verify.md | 4 +- .../setup-integration-test-env/action.yml | 2 +- .github/pull_request_template.md | 4 +- .github/workflows/format.yml | 2 +- .github/workflows/integration-tests.yml | 4 +- AGENTS.md | 2 +- CLAUDE.md | 26 +- Cargo.lock | 260 ++++++++++++++++-- Cargo.toml | 14 +- OPTIMIZATION.md | 10 +- PUBLISHER_IDS_AUDIT.md | 8 +- README.md | 2 +- .../integration-tests/browser/global-setup.ts | 2 +- .../integration-tests/tests/common/runtime.rs | 2 +- .../google_tag_manager/script_guard.ts | 2 +- .../Cargo.toml | 5 +- .../src/error.rs | 2 +- .../src/main.rs | 28 +- .../tests/kv_store/counter_store.json | 0 .../tests/kv_store/opid_store.json | 0 .../Cargo.toml | 3 +- .../{common => trusted-server-core}/README.md | 4 +- .../{common => trusted-server-core}/build.rs | 0 .../src/auction/README.md | 4 +- .../src/auction/config.rs | 0 .../src/auction/context.rs | 0 .../src/auction/endpoints.rs | 0 .../src/auction/formats.rs | 0 .../src/auction/mod.rs | 0 .../src/auction/orchestrator.rs | 0 .../src/auction/provider.rs | 0 .../src/auction/types.rs | 0 .../src/auction_config_types.rs | 0 .../src/auth.rs | 0 .../src/backend.rs | 0 .../src/constants.rs | 0 .../src/cookies.rs | 0 .../src/creative.rs | 0 .../src/error.rs | 0 .../src/fastly_storage.rs | 0 .../src/geo.rs | 0 .../src/host_rewrite.rs | 0 .../src/html_processor.rs | 0 .../src/html_processor.test.html | 0 .../src/http_util.rs | 0 .../src/integrations/adserver_mock.rs | 0 .../src/integrations/aps.rs | 0 .../src/integrations/datadome.rs | 0 .../src/integrations/didomi.rs | 0 .../src/integrations/google_tag_manager.rs | 0 .../src/integrations/gpt.rs | 0 .../src/integrations/lockr.rs | 0 .../src/integrations/mod.rs | 0 .../nextjs/fixtures/inlined-data-escaped.html | 0 .../nextjs/fixtures/inlined-data-nonce.html | 0 .../integrations/nextjs/html_post_process.rs | 0 .../src/integrations/nextjs/mod.rs | 0 .../src/integrations/nextjs/rsc.rs | 0 .../integrations/nextjs/rsc_placeholders.rs | 0 .../integrations/nextjs/script_rewriter.rs | 0 .../src/integrations/nextjs/shared.rs | 0 .../src/integrations/permutive.rs | 0 .../src/integrations/prebid.rs | 0 .../src/integrations/registry.rs | 0 .../src/integrations/testlight.rs | 0 .../src/lib.rs | 0 .../src/models.rs | 0 .../src/openrtb.rs | 0 .../src/proxy.rs | 0 .../src/publisher.rs | 0 .../src/request_signing/discovery.rs | 0 .../src/request_signing/endpoints.rs | 0 .../src/request_signing/jwks.rs | 0 .../src/request_signing/mod.rs | 0 .../src/request_signing/rotation.rs | 0 .../src/request_signing/signing.rs | 0 .../src/rsc_flight.rs | 0 .../src/settings.rs | 10 +- .../src/settings_data.rs | 0 .../src/streaming_processor.rs | 0 .../src/streaming_replacer.rs | 0 .../src/synthetic.rs | 0 .../src/test_support.rs | 0 .../src/tsjs.rs | 0 docs/guide/architecture.md | 4 +- docs/guide/auction-orchestration.md | 16 +- docs/guide/configuration.md | 2 +- docs/guide/error-reference.md | 4 +- docs/guide/integration-guide.md | 36 +-- docs/guide/integrations/aps.md | 8 +- docs/guide/integrations/didomi.md | 2 +- docs/guide/integrations/google_tag_manager.md | 2 +- docs/guide/integrations/gpt.md | 2 +- docs/guide/integrations/lockr.md | 2 +- docs/guide/integrations/nextjs.md | 6 +- docs/guide/integrations/permutive.md | 2 +- docs/guide/integrations/prebid.md | 2 +- docs/guide/key-rotation.md | 4 +- docs/guide/onboarding.md | 16 +- docs/guide/request-signing.md | 4 +- docs/guide/rsc-hydration.md | 4 +- docs/guide/testing.md | 16 +- fastly.toml | 4 +- scripts/integration-tests-browser.sh | 4 +- scripts/integration-tests.sh | 4 +- 111 files changed, 387 insertions(+), 181 deletions(-) rename crates/{fastly => trusted-server-adapter-fastly}/Cargo.toml (73%) rename crates/{fastly => trusted-server-adapter-fastly}/src/error.rs (89%) rename crates/{fastly => trusted-server-adapter-fastly}/src/main.rs (90%) rename crates/{fastly => trusted-server-adapter-fastly}/tests/kv_store/counter_store.json (100%) rename crates/{fastly => trusted-server-adapter-fastly}/tests/kv_store/opid_store.json (100%) rename crates/{common => trusted-server-core}/Cargo.toml (96%) rename crates/{common => trusted-server-core}/README.md (96%) rename crates/{common => trusted-server-core}/build.rs (100%) rename crates/{common => trusted-server-core}/src/auction/README.md (99%) rename crates/{common => trusted-server-core}/src/auction/config.rs (100%) rename crates/{common => trusted-server-core}/src/auction/context.rs (100%) rename crates/{common => trusted-server-core}/src/auction/endpoints.rs (100%) rename crates/{common => trusted-server-core}/src/auction/formats.rs (100%) rename crates/{common => trusted-server-core}/src/auction/mod.rs (100%) rename crates/{common => trusted-server-core}/src/auction/orchestrator.rs (100%) rename crates/{common => trusted-server-core}/src/auction/provider.rs (100%) rename crates/{common => trusted-server-core}/src/auction/types.rs (100%) rename crates/{common => trusted-server-core}/src/auction_config_types.rs (100%) rename crates/{common => trusted-server-core}/src/auth.rs (100%) rename crates/{common => trusted-server-core}/src/backend.rs (100%) rename crates/{common => trusted-server-core}/src/constants.rs (100%) rename crates/{common => trusted-server-core}/src/cookies.rs (100%) rename crates/{common => trusted-server-core}/src/creative.rs (100%) rename crates/{common => trusted-server-core}/src/error.rs (100%) rename crates/{common => trusted-server-core}/src/fastly_storage.rs (100%) rename crates/{common => trusted-server-core}/src/geo.rs (100%) rename crates/{common => trusted-server-core}/src/host_rewrite.rs (100%) rename crates/{common => trusted-server-core}/src/html_processor.rs (100%) rename crates/{common => trusted-server-core}/src/html_processor.test.html (100%) rename crates/{common => trusted-server-core}/src/http_util.rs (100%) rename crates/{common => trusted-server-core}/src/integrations/adserver_mock.rs (100%) rename crates/{common => trusted-server-core}/src/integrations/aps.rs (100%) rename crates/{common => trusted-server-core}/src/integrations/datadome.rs (100%) rename crates/{common => trusted-server-core}/src/integrations/didomi.rs (100%) rename crates/{common => trusted-server-core}/src/integrations/google_tag_manager.rs (100%) rename crates/{common => trusted-server-core}/src/integrations/gpt.rs (100%) rename crates/{common => trusted-server-core}/src/integrations/lockr.rs (100%) rename crates/{common => trusted-server-core}/src/integrations/mod.rs (100%) rename crates/{common => trusted-server-core}/src/integrations/nextjs/fixtures/inlined-data-escaped.html (100%) rename crates/{common => trusted-server-core}/src/integrations/nextjs/fixtures/inlined-data-nonce.html (100%) rename crates/{common => trusted-server-core}/src/integrations/nextjs/html_post_process.rs (100%) rename crates/{common => trusted-server-core}/src/integrations/nextjs/mod.rs (100%) rename crates/{common => trusted-server-core}/src/integrations/nextjs/rsc.rs (100%) rename crates/{common => trusted-server-core}/src/integrations/nextjs/rsc_placeholders.rs (100%) rename crates/{common => trusted-server-core}/src/integrations/nextjs/script_rewriter.rs (100%) rename crates/{common => trusted-server-core}/src/integrations/nextjs/shared.rs (100%) rename crates/{common => trusted-server-core}/src/integrations/permutive.rs (100%) rename crates/{common => trusted-server-core}/src/integrations/prebid.rs (100%) rename crates/{common => trusted-server-core}/src/integrations/registry.rs (100%) rename crates/{common => trusted-server-core}/src/integrations/testlight.rs (100%) rename crates/{common => trusted-server-core}/src/lib.rs (100%) rename crates/{common => trusted-server-core}/src/models.rs (100%) rename crates/{common => trusted-server-core}/src/openrtb.rs (100%) rename crates/{common => trusted-server-core}/src/proxy.rs (100%) rename crates/{common => trusted-server-core}/src/publisher.rs (100%) rename crates/{common => trusted-server-core}/src/request_signing/discovery.rs (100%) rename crates/{common => trusted-server-core}/src/request_signing/endpoints.rs (100%) rename crates/{common => trusted-server-core}/src/request_signing/jwks.rs (100%) rename crates/{common => trusted-server-core}/src/request_signing/mod.rs (100%) rename crates/{common => trusted-server-core}/src/request_signing/rotation.rs (100%) rename crates/{common => trusted-server-core}/src/request_signing/signing.rs (100%) rename crates/{common => trusted-server-core}/src/rsc_flight.rs (100%) rename crates/{common => trusted-server-core}/src/settings.rs (99%) rename crates/{common => trusted-server-core}/src/settings_data.rs (100%) rename crates/{common => trusted-server-core}/src/streaming_processor.rs (100%) rename crates/{common => trusted-server-core}/src/streaming_replacer.rs (100%) rename crates/{common => trusted-server-core}/src/synthetic.rs (100%) rename crates/{common => trusted-server-core}/src/test_support.rs (100%) rename crates/{common => trusted-server-core}/src/tsjs.rs (100%) diff --git a/.claude/agents/build-validator.md b/.claude/agents/build-validator.md index e559e506..a35b2824 100644 --- a/.claude/agents/build-validator.md +++ b/.claude/agents/build-validator.md @@ -17,13 +17,13 @@ Validate that the project builds correctly across all targets. 2. **WASM build** (production target) ```bash - cargo build --bin trusted-server-fastly --release --target wasm32-wasip1 + cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1 ``` 3. **Clippy** ```bash - cargo clippy --all-targets --all-features -- -D warnings + cargo clippy --workspace --all-targets --all-features -- -D warnings ``` 4. **Format check** diff --git a/.claude/agents/pr-creator.md b/.claude/agents/pr-creator.md index 1ac4c337..9825ec08 100644 --- a/.claude/agents/pr-creator.md +++ b/.claude/agents/pr-creator.md @@ -21,7 +21,7 @@ Before creating the PR, verify the branch is healthy: ``` cargo fmt --all -- --check -cargo clippy --all-targets --all-features -- -D warnings +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 diff --git a/.claude/agents/pr-reviewer.md b/.claude/agents/pr-reviewer.md index 0a596f41..c771aa03 100644 --- a/.claude/agents/pr-reviewer.md +++ b/.claude/agents/pr-reviewer.md @@ -70,8 +70,8 @@ For each changed file, evaluate: #### WASM compatibility - Target is `wasm32-wasip1` β€” no std::net, std::thread, or OS-specific APIs -- No Tokio or runtime-specific deps in `crates/common` -- Fastly-specific APIs only in `crates/fastly` +- No Tokio or runtime-specific deps in `crates/trusted-server-core` +- Fastly-specific APIs only in `crates/trusted-server-adapter-fastly` #### Convention compliance (from CLAUDE.md) @@ -177,7 +177,7 @@ comment. Use the file's **current line number** (not diff position) with the ````json { - "path": "crates/common/src/publisher.rs", + "path": "crates/trusted-server-core/src/publisher.rs", "line": 166, "side": "RIGHT", "body": "πŸ”§ **wrench** β€” Race condition: Description of the issue...\n\n**Fix**:\n```rust\n// suggested code\n```" @@ -288,6 +288,6 @@ Output: - Do not include any byline, "Generated with" footer, `Co-Authored-By` trailer, or self-referential titles (e.g., "Staff Engineer Review") in review comments or the review body. -- If the diff is very large (>50 files), prioritize `crates/common/` changes +- If the diff is very large (>50 files), prioritize `crates/trusted-server-core/` changes and new files over mechanical changes (Cargo.lock, generated code). - Never submit a review without explicit user approval of the findings. diff --git a/.claude/agents/repo-explorer.md b/.claude/agents/repo-explorer.md index e7fa3114..570686f8 100644 --- a/.claude/agents/repo-explorer.md +++ b/.claude/agents/repo-explorer.md @@ -11,8 +11,8 @@ implementation details. This is a Rust workspace with three crates: -- `crates/common/` β€” core library (integrations, HTML processing, synthetic IDs, GDPR) -- `crates/fastly/` β€” Fastly Compute entry point +- `crates/trusted-server-core/` β€” core library (integrations, HTML processing, synthetic IDs, GDPR) +- `crates/trusted-server-adapter-fastly/` β€” Fastly Compute entry point - `crates/js/` β€” TypeScript/JS build pipeline (per-integration IIFE bundles) Target: `wasm32-wasip1` (Fastly Compute) diff --git a/.claude/agents/verify-app.md b/.claude/agents/verify-app.md index c6ac995b..5d26c679 100644 --- a/.claude/agents/verify-app.md +++ b/.claude/agents/verify-app.md @@ -19,7 +19,7 @@ cargo fmt --all -- --check ### 2. Clippy ```bash -cargo clippy --all-targets --all-features -- -D warnings +cargo clippy --workspace --all-targets --all-features -- -D warnings ``` ### 3. Rust Tests @@ -49,7 +49,7 @@ cd docs && npm run format ### 7. WASM Build ```bash -cargo build --bin trusted-server-fastly --release --target wasm32-wasip1 +cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1 ``` ## Output diff --git a/.claude/commands/check-ci.md b/.claude/commands/check-ci.md index c6b2d942..dc4a63c0 100644 --- a/.claude/commands/check-ci.md +++ b/.claude/commands/check-ci.md @@ -1,7 +1,7 @@ Run all CI checks locally, in order. Stop and report if any step fails. 1. `cargo fmt --all -- --check` -2. `cargo clippy --all-targets --all-features -- -D warnings` +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` diff --git a/.claude/commands/verify.md b/.claude/commands/verify.md index f6764efc..04fc8931 100644 --- a/.claude/commands/verify.md +++ b/.claude/commands/verify.md @@ -1,9 +1,9 @@ Full verification: build, test, and lint the entire project. 1. `cargo build --workspace` -2. `cargo build --bin trusted-server-fastly --release --target wasm32-wasip1` +2. `cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1` 3. `cargo fmt --all -- --check` -4. `cargo clippy --all-targets --all-features -- -D warnings` +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` diff --git a/.github/actions/setup-integration-test-env/action.yml b/.github/actions/setup-integration-test-env/action.yml index 103f022f..aa89e1ef 100644 --- a/.github/actions/setup-integration-test-env/action.yml +++ b/.github/actions/setup-integration-test-env/action.yml @@ -71,7 +71,7 @@ runs: env: TRUSTED_SERVER__PUBLISHER__ORIGIN_URL: http://127.0.0.1:${{ inputs.origin-port }} TRUSTED_SERVER__PROXY__CERTIFICATE_CHECK: "false" - run: cargo build --bin trusted-server-fastly --release --target wasm32-wasip1 + run: cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1 - name: Build WordPress test container if: ${{ inputs.build-test-images == 'true' }} diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 8fba567c..fbe95847 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -24,12 +24,12 @@ Closes # - [ ] `cargo test --workspace` -- [ ] `cargo clippy --all-targets --all-features -- -D warnings` +- [ ] `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` - [ ] Docs format: `cd docs && npm run format` -- [ ] WASM build: `cargo build --bin trusted-server-fastly --release --target wasm32-wasip1` +- [ ] WASM build: `cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1` - [ ] Manual testing via `fastly compute serve` - [ ] Other: diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 223601b1..b6aba137 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -33,7 +33,7 @@ jobs: uses: actions-rust-lang/rustfmt@v1 - name: Run cargo clippy - run: cargo clippy --all-targets --all-features -- -D warnings + run: cargo clippy --workspace --all-targets --all-features -- -D warnings format-typescript: runs-on: ubuntu-latest diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 92bdfd74..da467583 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -13,7 +13,7 @@ on: env: ORIGIN_PORT: 8888 ARTIFACTS_DIR: /tmp/integration-test-artifacts - WASM_ARTIFACT_PATH: /tmp/integration-test-artifacts/wasm/trusted-server-fastly.wasm + WASM_ARTIFACT_PATH: /tmp/integration-test-artifacts/wasm/trusted-server-adapter-fastly.wasm DOCKER_ARTIFACT_PATH: /tmp/integration-test-artifacts/docker/test-images.tar jobs: @@ -33,7 +33,7 @@ jobs: - name: Package integration test artifacts run: | mkdir -p "$(dirname "$WASM_ARTIFACT_PATH")" "$(dirname "$DOCKER_ARTIFACT_PATH")" - cp target/wasm32-wasip1/release/trusted-server-fastly.wasm "$WASM_ARTIFACT_PATH" + cp target/wasm32-wasip1/release/trusted-server-adapter-fastly.wasm "$WASM_ARTIFACT_PATH" docker save \ --output "$DOCKER_ARTIFACT_PATH" \ test-wordpress:latest test-nextjs:latest diff --git a/AGENTS.md b/AGENTS.md index 17b51b88..b1f457f2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -18,7 +18,7 @@ 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. -4. Run `cargo fmt --all -- --check` and `cargo clippy --all-targets --all-features -- -D warnings`. +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`) for error handling β€” not anyhow, eyre, or thiserror. 7. Use `tracing` macros (not `println!`) and `expect("should ...")` (not `unwrap()`). diff --git a/CLAUDE.md b/CLAUDE.md index 9ad1845c..0411d36f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -13,8 +13,8 @@ real-time bidding integration, and publisher-side JavaScript injection. ``` crates/ - common/ # Core library β€” shared logic, integrations, HTML processing - fastly/ # Fastly Compute entry point (wasm32-wasip1 binary) + 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 lib/ # TS source, Vitest tests, esbuild pipeline ``` @@ -42,7 +42,7 @@ Supporting files: `fastly.toml`, `trusted-server.toml`, `.env.dev`, cargo build # Production build for Fastly -cargo build --bin trusted-server-fastly --release --target wasm32-wasip1 +cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1 # Run locally with Fastly simulator fastly compute serve @@ -61,7 +61,7 @@ cargo test --workspace cargo fmt --all -- --check # Lint -cargo clippy --all-targets --all-features -- -D warnings +cargo clippy --workspace --all-targets --all-features -- -D warnings # Check compilation cargo check @@ -268,7 +268,7 @@ IntegrationRegistration::builder(ID) Every PR must pass: 1. `cargo fmt --all -- --check` -2. `cargo clippy --all-targets --all-features -- -D warnings` +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`) @@ -362,14 +362,14 @@ both runtime behavior and build/tooling changes. | File | Purpose | | -------------------------------------------- | ------------------------------------------------- | -| `crates/common/src/integrations/registry.rs` | IntegrationRegistry, `js_module_ids()` | -| `crates/common/src/tsjs.rs` | Script tag generation with module IDs | -| `crates/common/src/html_processor.rs` | Injects `