Repository navigation
Keep streamed signing and publisher ownership regressions on EdgeZero 1619078a - #1527
ChristianPavilonis wants to merge 4 commits into
Conversation
prk-Jr
left a comment
There was a problem hiding this comment.
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
- CodeQL: PASS
- Analyze (python): PASS
- Analyze (javascript-typescript): PASS
- Analyze (actions): PASS
- Analyze (rust): PASS
- Analyze (javascript-typescript): PASS
- trace runtime and browser acceptance: FAIL
- browser integration tests: FAIL
- integration tests: FAIL
- integration tests (Fastly EC lifecycle): FAIL
- cargo test (ts CLI, native) (macos-latest): FAIL
- CLAUDE.md symlink guard: PASS
- prepare integration artifacts: PASS
- format-docs: PASS
- worker-deadlines (spin): FAIL
- worker-deadlines (cloudflare): FAIL
- cargo test: FAIL
- cargo test (cross-adapter parity): FAIL
- cargo check (cloudflare native + wasm32-unknown-unknown): PASS
- format-typescript: PASS
- cargo test (ts CLI, native) (ubuntu-latest): FAIL
- docs-proposal scripts: PASS
- vitest: PASS
- ts dev lint domains (changed lines): FAIL
- CI Node pin guard: PASS
- cargo fmt: FAIL
- cargo test (axum native): FAIL
- cargo check/build/test (spin native + wasm32-wasip1): PASS
- HTML EOF runtime (Fastly): FAIL
a020dae to
d823612
Compare
dhruv8sh
left a comment
There was a problem hiding this comment.
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_BYTESonly needs crate visibility — see inline atcrates/trusted-server-core/src/proxy.rs:47
⛏ nitpick
#[path]attribute is redundant — see inline atcrates/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; |
There was a problem hiding this comment.
♻ 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.
| 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"] |
There was a problem hiding this comment.
⛏ 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.
| #[path = "owner_tests.rs"] |
| StatusCode::PAYLOAD_TOO_LARGE, | ||
| "should enforce the existing signing cap before JSON handling" | ||
| ); | ||
| assert_eq!( |
There was a problem hiding this comment.
👍 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
left a comment
There was a problem hiding this comment.
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.rseither. Every clippy alias that covers core targets wasm32, where this module is compiled out. I rancargo clippy -p trusted-server-core --lib --tests --all-featuresnatively, and it reports nothing in this file; the only warning is the existingresult_large_errattest_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_requestcreates the owner, the finalizer runs, the adapter attaches). Returning the finalized response withoutowner.attach(...)fails all three tests. - Signing test enforces the cap. In the Axum route test, raising the signing cap to
4 × SIGN_MAX_BODY_BYTESmakes 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_tests3/3, and the Axumnamed_sign_route_buffers_guarded_streamed_json_under_its_existing_cappasses. - Not run locally: Fastly, Cloudflare and Spin versions of the signing test. The
cargo testjob 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"))] |
There was a problem hiding this comment.
🔧 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(thecargo testjob) targetswasm32-wasip1, where this module is compiled out.- The native step in the same job (
Run trace emitted-script regressions) builds core forx86_64-unknown-linux-gnubut filters to twotrace_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_testsThat 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.
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.
|
Merged The only conflicts were in Passed locally on the merge: |
Summary
review/shared-async-ec(6fd71bb50), aligning the stack on EdgeZero1619078a(rc/identity),spin-sdk = "=8.0.0", andfastly = "0.13.3".45631367/EdgeZeroHttpClientport already covered in the base branch (#1506→#1614→#1525→#1526), which also brings in Axum.received_head_preparer(...)(resolving forwarding-header capture), explicitmax_response_byteslimits,proxy.certificate_check = falsedeploy rejection and runtime warning, migrated CLI/parity test consumers, and backticked`EdgeZero`in worker deadline fixtures.#1527's unique regression suites adapted to#1526's directHttpClientAPI:/first-party/signcap test (named_route_inputs.rs) wired across all four adapters (Fastly, Axum, Cloudflare, Spin), with the chunk boundary moved beforehttps://to satisfyts dev lint domains.OutboundScopeOwner+ResponseEgressEnvelopeownership regressions (publisher/tests/owner_tests.rs) coveringBuffered,Stream, andAssembleTemplatefinalizers across complete, post-EOF attempt drop, and unbegun envelope drop paths.Changes
crates/trusted-server-core/src/test_support/named_route_inputs.rs+test_support.rs+proxy.rsSIGN_MAX_BODY_BYTESand sharedassert_sign_inputsregression helper (domain-lint clean split beforehttps://).axum,cloudflare,fastly,spin)named_sign_route_buffers_guarded_streamed_json_under_its_existing_capinto each adapter's route tests.crates/trusted-server-core/src/publisher/tests/owner_tests.rs+publisher.rs+Cargo.tomlOutboundScopeOwner/ResponseEgressEnvelopeownership regressions ontoAxumOutboundExecutorand directHttpClient.Closes
Closes #1523.
Test plan
Local checks on
d82361215:cargo fmt --all -- --checkcargo 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-codegencargo test -p trusted-server-core --target x86_64-unknown-linux-gnu --lib owner_tests(3 passed)cargo test-axum,cargo test-cloudflare,cargo test-spincargo 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.shts dev lint domains --changed-vs origin/review/shared-async-ec0.22.0(cargo test-fastly,cargo test-fastly-reuse, HTML EOF) and worker-deadline runtime checks (localviceroyis0.17.0;wasm32-wasip1test binary compiles cleanly).