test(relay): behavioral coverage for request streaming, cancel, and error paths - #47
Open
duyet wants to merge 1 commit into
Open
test(relay): behavioral coverage for request streaming, cancel, and error paths#47duyet wants to merge 1 commit into
duyet wants to merge 1 commit into
Conversation
…rror paths Drive handle_request against a loopback HTTP stub. Cover Head/Chunk/Done, non-2xx relay, unreachable Error frames, cancel-before-stream, and UTF-8 reassembly of a multibyte body. Closes #23 Co-authored-by: Duyet Le <me@duyet.net> Co-authored-by: duyetbot <bot@duyet.net>
Contributor
anyr size and startupStartup is wall time for a cold Size budget:
Budget check: ok raw timings[
{
"asset": "anyr-darwin-arm64",
"kind": "native",
"path": "/Users/runner/work/cli/cli/anyr-darwin-arm64",
"bytes": 2905320,
"size": "2.8 MiB",
"version": "0.1.11 (built 2026-09-03 18:07:13)",
"target": "aarch64-apple-darwin",
"os": "macos-latest",
"startup_version": {
"n": 21,
"min_ms": 3.5,
"median_ms": 5.13,
"p95_ms": 10.46,
"mean_ms": 6.14
},
"startup_help": {
"n": 21,
"min_ms": 3.29,
"median_ms": 3.72,
"p95_ms": 4.25,
"mean_ms": 3.71
}
},
{
"asset": "anyr-darwin-x86_64",
"kind": "native",
"path": "/Users/runner/work/cli/cli/anyr-darwin-x86_64",
"bytes": 3119656,
"size": "3.0 MiB",
"version": "0.1.11 (built 2026-09-03 18:07:19)",
"target": "x86_64-apple-darwin",
"os": "macos-latest",
"startup_version": {
"n": 21,
"min_ms": 33.97,
"median_ms": 42.44,
"p95_ms": 47.51,
"mean_ms": 42.53
},
"startup_help": {
"n": 21,
"min_ms": 35.67,
"median_ms": 42.37,
"p95_ms": 54.79,
"mean_ms": 43.01
}
},
{
"asset": "anyr-linux-arm64",
"kind": "native",
"path": "/home/runner/work/cli/cli/anyr-linux-arm64",
"bytes": 2888744,
"size": "2.8 MiB",
"version": "0.1.11 (built 2026-09-03 18:06:31)",
"target": "aarch64-unknown-linux-gnu",
"os": "ubuntu-24.04-arm",
"startup_version": {
"n": 21,
"min_ms": 0.81,
"median_ms": 0.84,
"p95_ms": 0.9,
"mean_ms": 0.85
},
"startup_help": {
"n": 21,
"min_ms": 0.78,
"median_ms": 0.84,
"p95_ms": 0.92,
"mean_ms": 0.85
}
},
{
"asset": "anyr-linux-x86_64",
"kind": "native",
"path": "/home/runner/work/cli/cli/anyr-linux-x86_64",
"bytes": 3216904,
"size": "3.1 MiB",
"version": "0.1.11 (built 2026-09-03 18:06:30)",
"target": "x86_64-unknown-linux-gnu",
"os": "ubuntu-latest",
"startup_version": {
"n": 21,
"min_ms": 0.61,
"median_ms": 0.63,
"p95_ms": 0.68,
"mean_ms": 0.64
},
"startup_help": {
"n": 21,
"min_ms": 0.6,
"median_ms": 0.62,
"p95_ms": 0.84,
"mean_ms": 0.66
}
},
{
"asset": "anyr-windows-x86_64.exe",
"kind": "native",
"path": "D:\\a\\cli\\cli\\anyr-windows-x86_64.exe",
"bytes": 2665984,
"size": "2.5 MiB",
"version": "0.1.11 (built 2026-09-03T18:07:55Z)",
"target": "x86_64-pc-windows-msvc",
"os": "windows-latest",
"startup_version": {
"n": 21,
"min_ms": 9.53,
"median_ms": 9.79,
"p95_ms": 11.95,
"mean_ms": 10.06
},
"startup_help": {
"n": 21,
"min_ms": 9.89,
"median_ms": 10.33,
"p95_ms": 11.46,
"mean_ms": 10.58
}
},
{
"asset": "anyr.wasm",
"kind": "wasm",
"path": "/home/runner/work/cli/cli/target/wasm-pkg/anyr_cli_bg.wasm",
"bytes": 180713,
"size": "176.5 KiB",
"version": "wasm",
"target": "wasm32-unknown-unknown",
"os": ""
}
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #23 (Plan 008).
Why
The relay streams local HTTP responses back over WebSocket as Head/Chunk/Done. Existing tests covered frame parsing and config only. A refactor could break forwarding, cancel, or UTF-8 splitting with green CI.
Scope
src/relay.rstests only. A loopback HTTP stub plus fivehandle_requesttests.streams_local_response_back_as_head_chunk_donenon_2xx_from_target_relays_status_and_bodyunreachable_target_produces_error_framecancel_flag_stops_streamingutf8_split_body_round_tripshandle_requestdirectly, which is the serving core.Out of scope:
tests/cli.rs, fixing production bugs (none found).Tradeoffs
Cancel-before-call still POSTs, then returns after Head. The test allows Head and forbids Chunk/Done, matching the live
handle_requestloop.Blast radius
Test-only. CI time grows by a loopback accept plus one 1 MiB stub body. No user-facing change.
Verification
cargo test --locked --lib relay::tests— 19 passed, including the five new names--test-threads=1— all passedcargo test --locked --all-targets— 186 lib + 68 cli + 7 release_lock passedgit diffis +216 lines inside#[cfg(test)]onlyChecklist