Skip to content

Keep streamed signing and publisher ownership regressions on EdgeZero 1619078a - #1527

Open
ChristianPavilonis wants to merge 4 commits into
review/shared-async-ecfrom
review/edgezero-compatibility
Open

ChristianPavilonis wants to merge 4 commits into
review/shared-async-ecfrom
review/edgezero-compatibility

Conversation

@ChristianPavilonis

@ChristianPavilonis ChristianPavilonis commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Rebased onto current review/shared-async-ec (6fd71bb50), aligning the stack on EdgeZero 1619078a (rc/identity), spin-sdk = "=8.0.0", and fastly = "0.13.3".
  • Drops the superseded 45631367 / EdgeZeroHttpClient port already covered in the base branch (#1506 → #1614 → #1525 → #1526), which also brings in Axum .received_head_preparer(...) (resolving forwarding-header capture), explicit max_response_bytes limits, proxy.certificate_check = false deploy rejection and runtime warning, migrated CLI/parity test consumers, and backticked `EdgeZero` in worker deadline fixtures.
  • Retains #1527's unique regression suites adapted to #1526's direct HttpClient API:
    • Shared streamed JSON /first-party/sign cap test (named_route_inputs.rs) wired across all four adapters (Fastly, Axum, Cloudflare, Spin), with the chunk boundary moved before https:// to satisfy ts dev lint domains.
    • Native publisher OutboundScopeOwner + ResponseEgressEnvelope ownership regressions (publisher/tests/owner_tests.rs) covering Buffered, Stream, and AssembleTemplate finalizers across complete, post-EOF attempt drop, and unbegun envelope drop paths.

Changes

Area Change
crates/trusted-server-core/src/test_support/named_route_inputs.rs + test_support.rs + proxy.rs Export SIGN_MAX_BODY_BYTES and shared assert_sign_inputs regression helper (domain-lint clean split before https://).
Four adapters (axum, cloudflare, fastly, spin) Wire named_sign_route_buffers_guarded_streamed_json_under_its_existing_cap into each adapter's route tests.
crates/trusted-server-core/src/publisher/tests/owner_tests.rs + publisher.rs + Cargo.toml Port the 3 native OutboundScopeOwner / ResponseEgressEnvelope ownership regressions onto AxumOutboundExecutor and direct HttpClient.

Closes

Closes #1523.

Test plan

Local checks on d82361215:

  • cargo fmt --all -- --check
  • cargo clippy-fastly && cargo clippy-axum && cargo clippy-cloudflare && cargo clippy-cloudflare-wasm && cargo clippy-spin-native && cargo clippy-spin-wasm && cargo clippy-cli && cargo clippy-codegen
  • cargo test -p trusted-server-core --target x86_64-unknown-linux-gnu --lib owner_tests (3 passed)
  • cargo test-axum, cargo test-cloudflare, cargo test-spin
  • cargo test --manifest-path crates/trusted-server-integration-tests/Cargo.toml --test parity (33 passed)
  • cargo test -p trusted-server-cli --target x86_64-unknown-linux-gnu --test proxy_trusted_server (4 passed)
  • scripts/lint-wasm-clock.sh
  • ts dev lint domains --changed-vs origin/review/shared-async-ec
  • Hosted CI Fastly Viceroy 0.22.0 (cargo test-fastly, cargo test-fastly-reuse, HTML EOF) and worker-deadline runtime checks (local viceroy is 0.17.0; wasm32-wasip1 test binary compiles cleanly).

@prk-Jr prk-Jr 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.

Verdict: REQUEST_CHANGES

Reviewed a020daeec30ceae29ae023b7941853cad8bef8de against base e529e5576c1052f0d2fb40a4f9920f0428e6e633. Six actionable findings are attached inline. All corrections are prose proposals; no one-click suggestions are included.

🔧 Additional runtime blockers: Fastly HTML EOF hangs, assembled winning bids are missing, and browser/integration checks fail. Their root causes remain unresolved; I have not attributed them to the inline findings.

Evidence combines exact pinned SDK source and current-head CI logs. Local Rust formatting passed. No full local suite or fresh runtime reproduction was performed; the forwarding, response-cap, and TLS conclusions are source-established.

CI status

Comment thread Cargo.toml Resolved
@aram356

aram356 commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

CREATOR: From the server-side identity plan (#1559, c7dc9de77): Proposed closure, for the author to decide: #1527 once its tests move (DEC-1).

@ChristianPavilonis
ChristianPavilonis force-pushed the review/edgezero-compatibility branch from a020dae to d823612 Compare December 1, 2026 20:00
@ChristianPavilonis ChristianPavilonis changed the title Use request-scoped EdgeZero HTTP and body ownership Keep streamed signing and publisher ownership regressions on EdgeZero 1619078a Dec 1, 2026

@dhruv8sh dhruv8sh 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.

Summary

This PR adds tests only. It adds a shared regression for streamed input on POST /first-party/sign and runs it from all four adapter suites (Fastly, Axum, Cloudflare, Spin). It also adds native ownership tests for publisher finalizers. Those tests use real loopback origin and probe exchanges through edgezero-adapter-axum's outbound client and check that the owner scope stays open until managed egress terminates. No production behaviour changes. The only non-test change makes SIGN_MAX_BODY_BYTES public, which is wider than the new test helper needs. Static review found nothing blocking.

2 of the inline comments below carry a one-click GitHub suggestion — use Commit suggestion (or Add suggestion to batch for several at once) to apply them as commits on the PR branch.

Non-blocking

♻ refactor

  • SIGN_MAX_BODY_BYTES only needs crate visibility — see inline at crates/trusted-server-core/src/proxy.rs:47

⛏ nitpick

  • #[path] attribute is redundant — see inline at crates/trusted-server-core/src/publisher.rs:8161

👍 praise

  • The overflow test checks frame-level short-circuiting, not just the 413 status — see inline at crates/trusted-server-core/src/test_support/named_route_inputs.rs:150


const SIGN_MAX_BODY_BYTES: usize = 65536;
/// Maximum request body size accepted by `POST /first-party/sign`.
pub const SIGN_MAX_BODY_BYTES: usize = 65536;

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.

♻ refactor — proxy is a pub mod in lib.rs, so this change makes SIGN_MAX_BODY_BYTES part of trusted-server-core's public API. Its only new consumer is crate::test_support::named_route_inputs, which lives in the same crate. The adapters never name this constant; they call assert_sign_inputs. pub(crate) is enough and keeps the cap private, so it can change later without breaking the public API.

Suggested change
pub const SIGN_MAX_BODY_BYTES: usize = 65536;
pub(crate) const SIGN_MAX_BODY_BYTES: usize = 65536;

(Static review only, not compile-checked. Please run the clippy-* / test-* aliases after applying.)

use std::sync::Arc;

#[cfg(not(target_arch = "wasm32"))]
#[path = "owner_tests.rs"]

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.

⛏ nitpick — mod owner_tests; sits inside the inline mod tests of the non-mod-rs file publisher.rs, so Rust already resolves it to src/publisher/tests/owner_tests.rs. The #[path] attribute points at that same file, so it can go. Without it, the next reader doesn't have to work out where the path is relative to.

Suggested change
#[path = "owner_tests.rs"]

StatusCode::PAYLOAD_TOO_LARGE,
"should enforce the existing signing cap before JSON handling"
);
assert_eq!(

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.

👍 praise — The inspect counter on the oversized stream proves the cap stops reading at the first overflowing frame, not only that the response is 413. Sharing one helper across all four adapters, with a prepare hook for Fastly's entry-point extensions, also keeps the adapters in parity without copying the fixture four times.

@prk-Jr prk-Jr 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.

Summary

Follow-up to my review at a020daeec. All six earlier findings are resolved by the rebase onto review/shared-async-ec (6fd71bb50): the PR no longer touches those files, and at this head the base has the forwarding capture (received_head_preparer), explicit response caps, the certificate_check = false rejection, the backticked deadline fixtures, and the signing fixture split before https://. All 25 hosted checks pass at 6578d1835, including the ones that failed before.

What remains is test-only, and both suites are sound locally. One blocking problem: the native ownership suite never runs in CI.

Blocking

🔧 wrench

  • No CI job runs the three publisher ownership tests — see inline at crates/trusted-server-core/src/publisher.rs:8160. The fix is a one-step workflow addition.

Non-blocking

dhruv8sh's two open suggestions (SIGN_MAX_BODY_BYTES as pub(crate), and dropping the redundant #[path]) are both correct; I'm not repeating them.

📝 note

  • Native clippy doesn't see owner_tests.rs either. Every clippy alias that covers core targets wasm32, where this module is compiled out. I ran cargo clippy -p trusted-server-core --lib --tests --all-features natively, and it reports nothing in this file; the only warning is the existing result_large_err at test_support.rs:172. Not asking for a change here, because adding a native core clippy gate would first need that warning fixed.

What I checked

  • Ownership suite reaches the real contract. It runs real loopback origin and probe exchanges through AxumOutboundClient, and its fixture mirrors production (handle_publisher_request creates the owner, the finalizer runs, the adapter attaches). Returning the finalized response without owner.attach(...) fails all three tests.
  • Signing test enforces the cap. In the Axum route test, raising the signing cap to 4 × SIGN_MAX_BODY_BYTES makes the 413 assertion fail. The read-count assertion separately pins reading stopping at the first frame over the cap.
  • Ran locally (native, rustc 1.98.1): owner_tests 3/3, and the Axum named_sign_route_buffers_guarded_streamed_json_under_its_existing_cap passes.
  • Not run locally: Fastly, Cloudflare and Spin versions of the signing test. The cargo test job log shows the Fastly one passing under Viceroy.

CI Status

All 25 checks reported for 6578d1835 pass: cargo test, cargo test (axum native), cargo test (cross-adapter parity), cargo fmt, cargo check (cloudflare native + wasm32-unknown-unknown), cargo check/build/test (spin native + wasm32-wasip1), cargo test (ts CLI, native) on ubuntu and macos, worker-deadlines (cloudflare, spin), HTML EOF runtime (Fastly), integration tests, integration tests (Fastly EC lifecycle), browser integration tests, trace runtime and browser acceptance, ts dev lint domains (changed lines), vitest, format-typescript, format-docs, docs-proposal scripts, release scripts, prepare integration artifacts, Fastly response diff script, CI Node pin guard, CLAUDE.md symlink guard. The cargo fmt job also runs the clippy aliases.

use http::{Method, Request as HttpRequest, StatusCode, header};
use std::sync::Arc;

#[cfg(not(target_arch = "wasm32"))]

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.

🔧 wrench — No CI job runs these three ownership tests.

They are cfg(not(target_arch = "wasm32")), so they only exist in a native build of core. CI compiles core's lib tests two ways:

  • cargo test-fastly (the cargo test job) targets wasm32-wasip1, where this module is compiled out.
  • The native step in the same job (Run trace emitted-script regressions) builds core for x86_64-unknown-linux-gnu but filters to two trace_document_* tests, so these are built and then skipped.

cargo test-axum, cargo test-cloudflare and cargo test-spin test only the adapter crates, not core's unit tests. The cargo test job log at 6578d1835 has no owner_tests line. So the publisher-ownership regressions this PR exists to keep (#1523) would not catch anything in CI: a change that closes the owner scope at handler return would still merge green.

Locally they do discriminate. Returning finalized without owner.attach(...) fails all three at the assert_scope_open check.

Proposed fix (apply manually — the workflow is outside this diff): run them next to the other native core regressions in .github/workflows/test.yml.

      # Native-only (`cfg(not(target_arch = "wasm32"))`): `cargo test-fastly`
      # compiles core for wasm32-wasip1, where these tests do not exist.
      - name: Run native publisher ownership regressions
        run: cargo test -p trusted-server-core --target x86_64-unknown-linux-gnu --lib publisher::tests::owner_tests

That job already compiles core's lib tests natively for the trace step, so the extra cost is the run itself. Locally the filter selects exactly the three tests, and actionlint passes on the workflow.

prk-Jr and others added 2 commits December 2, 2026 14:37
The owner tests are native-only, and the cargo test job compiles core
for wasm32-wasip1, so no CI step executed them. Run them in the same
job as the other native core regressions.
@aram356

aram356 commented Dec 5, 2026

Copy link
Copy Markdown
Collaborator

Merged review/shared-async-ec (66a59abbd) into this branch to clear the merge conflict (merge commit 18d68eb1c, fast-forward, no force-push).

The only conflicts were in crates/trusted-server-adapter-cloudflare/tests/routes.rs and crates/trusted-server-adapter-spin/tests/routes.rs, where both sides added a test at the end of the file. I kept both: this PR's named_sign_route_buffers_guarded_streamed_json_under_its_existing_cap first, then the test from the base. Nothing else changed.

Passed locally on the merge: cargo fmt --check, clippy for all six adapter targets, test-fastly, test-fastly-reuse, test-axum, test-cloudflare, test-spin.

This branch has not been deployed

No deployments
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.

Extract the demo's request-scoped SDK compatibility port

4 participants