Skip to content

Sync EdgeZero PR #257 updates#761

Open
aram356 wants to merge 8 commits into
mainfrom
chore/sync-edgezero-pr-257
Open

Sync EdgeZero PR #257 updates#761
aram356 wants to merge 8 commits into
mainfrom
chore/sync-edgezero-pr-257

Conversation

@aram356

@aram356 aram356 commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Syncs this branch with the EdgeZero tooling/dependency updates and standardizes
crate naming, rebased on top of main. Since this branch was opened, main
landed its own HTTP-types migration (PR 12 / PR 13 — #624, #626) and additional
features (DataDome server-side protection #769, configurable integration proxy
paths #759, image proxy fixes, and several test-coverage additions). The
overlapping work has been reconciled in favor of main's newer architecture,
so this PR now carries only the changes that are genuinely additive over main.

EdgeZero dependency + toolchain

  • Point the edgezero-* git dependencies at the upstream main branch
    (rather than a pinned rev), so this app tracks current EdgeZero.
  • Bump fastly / log-fastly to 0.12 to match the version EdgeZero main
    pins.
  • Forward-port to the newer EdgeZero / Fastly APIs:
    • edgezero_core::body::Body::into_bytes() now returns Option<Bytes>
      (None only for streaming bodies). Buffered-body call sites use
      .unwrap_or_default(), preserving prior Bytes semantics. For
      size-bounded reads, Body::into_bytes_bounded(max) is now available.
    • Fastly 0.12's get_tls_protocol() / get_tls_cipher_openssl_name() now
      return Result<Option<&str>>; adapter call sites use .ok().flatten().
  • Update tool pins: Rust 1.91.1 → 1.95.0 (rust-toolchain.toml +
    .tool-versions), Fastly CLI 13.3.0 → 15.1.0, Viceroy 0.16.4 → 0.17.0,
    add Wasmtime 44.0.1.

Crate naming

  • Standardize every crate on the trusted-server-* prefix:
    • crates/jscrates/trusted-server-js
    • crates/openrtbcrates/trusted-server-openrtb
    • crates/openrtb-codegencrates/trusted-server-openrtb-codegen
    • crates/integration-testscrates/trusted-server-integration-tests
    • Package names, workspace members, and internal references updated to match.
  • Refresh clippy.toml to the EdgeZero-style configuration.

Reconciliation decisions (vs. the original PR intent)

  • Integration HTTP code: main's HTTP-types migration supersedes this
    branch's older fastly::-based integration code, so the conflicted files take
    main's versions (the http:: / async EdgeZero platform surface).
  • Clippy lint posture: the original branch enabled a strict
    restriction = "deny" workspace posture. That produced large, unrelated churn
    against main's current code, so the workspace lint levels stay at
    main's posture. (clippy.toml config is still refreshed; clippy -D warnings is green.)
  • Lockfiles: root Cargo.lock and the excluded
    trusted-server-integration-tests/Cargo.lock are resynced to EdgeZero main
    • Fastly 0.12 and pass --locked.

Known limitation (tracked separately)

trusted-server-core is not yet platform-agnostic: it still has an
unconditional fastly dependency, with the coupling in compat.rs (a
fastly::Requesthttp::Request bridge) and backend.rs
(fastly::backend::Backend). Only trusted-server-adapter-fastly exists today;
the workspace declares (currently unused) edgezero-adapter-axum /
edgezero-adapter-cloudflare, and there is no Spin adapter. Extracting the
Fastly coupling out of core so it can run on the other EdgeZero adapters
(Cloudflare Workers, Spin, Axum) is intentionally out of scope for this PR
and will be done separately.

Verification

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo test --workspace
  • cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1
  • cargo metadata --locked (root)
  • cargo metadata --locked (crates/trusted-server-integration-tests)
  • cargo metadata --locked (crates/trusted-server-openrtb-codegen)
  • cd crates/trusted-server-js/lib && npx vitest run
  • cd crates/trusted-server-js/lib && npm run format
  • cd docs && npm run format

References stackpop/edgezero#257

@aram356 aram356 marked this pull request as draft June 10, 2026 06:10
@aram356 aram356 self-assigned this Jun 10, 2026
@aram356 aram356 force-pushed the chore/sync-edgezero-pr-257 branch from f078d3b to 396d270 Compare June 10, 2026 06:11
Comment thread crates/trusted-server-core/src/backend.rs Fixed
Comment thread crates/trusted-server-core/src/backend.rs Fixed
Comment thread crates/trusted-server-core/src/backend.rs Fixed
Comment thread crates/trusted-server-core/src/backend.rs Fixed
@aram356 aram356 force-pushed the chore/sync-edgezero-pr-257 branch 3 times, most recently from 41e7268 to b6c4a79 Compare June 10, 2026 19:09
@aram356 aram356 force-pushed the chore/sync-edgezero-pr-257 branch from b6c4a79 to 159c731 Compare June 11, 2026 08:04
@aram356 aram356 changed the title Sync EdgeZero PR #257 strict clippy updates Sync EdgeZero PR #257 updates Jun 11, 2026
aram356 added 6 commits June 11, 2026 13:37
Point the edgezero dependencies at the upstream main branch and bump
fastly/log-fastly to 0.12 to match edgezero's pinned version. Forward-port
the body and TLS APIs to the newer surface:

- Body::into_bytes() now returns Option<Bytes>; buffered-body call sites use
  unwrap_or_default() to preserve prior semantics.
- fastly 0.12 get_tls_protocol()/get_tls_cipher_openssl_name() return
  Result<Option<&str>>; adapter call sites use .ok().flatten().

Resync the excluded integration-tests lockfile to the same versions.
@aram356 aram356 marked this pull request as ready for review June 17, 2026 01:38

@ChristianPavilonis ChristianPavilonis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review: I reviewed PR #761 against main, focusing on the EdgeZero/Fastly API update, crate/path renames, build and CI wiring, and the touched runtime code paths. CI is green and I did not find any blocking correctness, security, data-loss, authorization, or severe compatibility issues. I left one low-severity documentation/operational comment.

Comment thread crates/trusted-server-openrtb/README.md Outdated
The wrapper script lives at crates/trusted-server-openrtb/generate.sh, not in
the codegen crate. Point the example at the actual script path.

@ChristianPavilonis ChristianPavilonis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review: I reviewed PR #761 against main, focusing on the EdgeZero/Fastly API migration, Body/TLS API call sites, crate renames, CI/script path updates, lockfiles, OpenRTB regeneration paths, and touched runtime/security-sensitive code. CI is green, existing CodeQL/README feedback has already been addressed or is non-blocking, and I did not find any blocking correctness, security, data-loss, authorization, or severe compatibility issues in this pass.

@ChristianPavilonis ChristianPavilonis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

😃 Approved. I reviewed PR #761 against main, with another pass over the rename/tooling/doc fallout after the EdgeZero/Fastly sync. CI is green.

🔧 I left a few non-blocking inline doc suggestions using GitHub suggestion blocks so they can be applied directly.

📝 One additional cleanup is worth doing but could not be attached as an inline suggestion because those files are not part of the PR diff: tracked Claude helper files still reference the deleted crates/js/lib path (for example .claude/commands/check-ci.md, .claude/commands/verify.md, .claude/agents/verify-app.md, .claude/agents/build-validator.md). Please replace remaining crates/js references with crates/trusted-server-js so local/agent verification helpers keep working after the crate rename.

### 7. Provide Static Assets (If Needed)

Place any integration-specific JavaScript entrypoint under `crates/js/lib/src/integrations/` (for example, `crates/js/lib/src/integrations/testlight.ts`). The shared `npm run build` script automatically discovers every file in that directory and produces a bundle named `tsjs-<entry>.js`, which the Rust crate embeds as `/static/tsjs=tsjs-<entry>.min.js`.
Place any integration-specific JavaScript entrypoint under `crates/trusted-server-js/lib/src/integrations/` (for example, `crates/trusted-server-js/lib/src/integrations/testlight.ts`). The shared `npm run build` script automatically discovers every file in that directory and produces a bundle named `tsjs-<entry>.js`, which the Rust crate embeds as `/static/tsjs=tsjs-<entry>.min.js`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 Docs: match the actual JS entrypoint discovery shape

The build discovers integration directories with an index.ts entrypoint (crates/trusted-server-js/lib/build-all.mjs), not arbitrary .ts files directly under src/integrations. Following the current example would create testlight.ts, which is not bundled.

Suggested change
Place any integration-specific JavaScript entrypoint under `crates/trusted-server-js/lib/src/integrations/` (for example, `crates/trusted-server-js/lib/src/integrations/testlight.ts`). The shared `npm run build` script automatically discovers every file in that directory and produces a bundle named `tsjs-<entry>.js`, which the Rust crate embeds as `/static/tsjs=tsjs-<entry>.min.js`.
Place any integration-specific JavaScript entrypoint under `crates/trusted-server-js/lib/src/integrations/<integration-id>/index.ts` (for example, `crates/trusted-server-js/lib/src/integrations/testlight/index.ts`). The shared `npm run build` script automatically discovers every integration directory with an `index.ts` file and produces a bundle named `tsjs-<integration-id>.js`, which the Rust crate embeds as `/static/tsjs=tsjs-<integration-id>.min.js`.


- `crates/trusted-server-core/src/integrations/testlight.rs` - Rust implementation
- `crates/js/lib/src/integrations/testlight.ts` - TypeScript shim
- `crates/trusted-server-js/lib/src/integrations/testlight.ts` - TypeScript shim

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 Docs: point at the real Testlight TS entrypoint

testlight.ts does not exist after the directory-entrypoint build layout; the actual bundle entry is testlight/index.ts.

Suggested change
- `crates/trusted-server-js/lib/src/integrations/testlight.ts` - TypeScript shim
- `crates/trusted-server-js/lib/src/integrations/testlight/index.ts` - TypeScript shim

### Bundle Types

Each integration is built as a separate IIFE at compile time (`crates/js/lib/dist/`):
Each integration is built as a separate IIFE at compile time (`crates/trusted-server-js/lib/dist/`):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 Docs: fix the generated bundle output directory

build-all.mjs writes to the crate-level dist directory (crates/trusted-server-js/dist), not lib/dist.

Suggested change
Each integration is built as a separate IIFE at compile time (`crates/trusted-server-js/lib/dist/`):
Each integration is built as a separate IIFE at compile time (`crates/trusted-server-js/dist/`):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants