Repository navigation
test(publish): tolerate a closed stdin pipe when the CLI exits early - #116
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Duyet Le <me@duyet.net> Co-authored-by: duyetbot <bot@duyet.net>
duyetbot
left a comment
There was a problem hiding this comment.
Reviewed the diff and full tests/publish.rs. The change only tolerates a BrokenPipe on the stdin write and still panics on any other write error.
No test can pass if the CLI ignores stdin. Every stdin-driven test asserts on something the CLI must produce from the input: the server request body (publish_from_stdin, api_data_reads_stdin), the exit code and stderr/stdout text (invalid_document, non_json_input, unknown_app, public_needs_yes, bad_visibility, dry-run issues), or the idempotency key, which would be identical for every document if the body were empty (idempotency test, assert_ne). Success-path tests also assert code 0 and the exact URL or POST body. Tests that expect a nonzero exit assert the specific message or code, so an early exit that skipped stdin still has to produce that output.
Ok to merge.
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": 3195688,
"size": "3.0 MiB",
"version": "0.1.21 (built 2026-10-23 04:33:54)",
"target": "aarch64-apple-darwin",
"os": "macos-latest",
"startup_version": {
"n": 21,
"min_ms": 2.73,
"median_ms": 2.87,
"p95_ms": 3.33,
"mean_ms": 2.98
},
"startup_help": {
"n": 21,
"min_ms": 2.49,
"median_ms": 2.53,
"p95_ms": 2.7,
"mean_ms": 2.57
}
},
{
"asset": "anyr-darwin-x86_64",
"kind": "native",
"path": "/Users/runner/work/cli/cli/anyr-darwin-x86_64",
"bytes": 3403480,
"size": "3.2 MiB",
"version": "0.1.21 (built 2026-10-23 04:35:07)",
"target": "x86_64-apple-darwin",
"os": "macos-latest",
"startup_version": {
"n": 21,
"min_ms": 30.39,
"median_ms": 37.81,
"p95_ms": 42.92,
"mean_ms": 37.18
},
"startup_help": {
"n": 21,
"min_ms": 31.62,
"median_ms": 34.97,
"p95_ms": 43.65,
"mean_ms": 36.59
}
},
{
"asset": "anyr-linux-arm64",
"kind": "native",
"path": "/home/runner/work/cli/cli/anyr-linux-arm64",
"bytes": 3151016,
"size": "3.0 MiB",
"version": "0.1.21 (built 2026-10-23 04:33:07)",
"target": "aarch64-unknown-linux-gnu",
"os": "ubuntu-24.04-arm",
"startup_version": {
"n": 21,
"min_ms": 0.68,
"median_ms": 0.74,
"p95_ms": 0.89,
"mean_ms": 0.76
},
"startup_help": {
"n": 21,
"min_ms": 0.71,
"median_ms": 0.8,
"p95_ms": 0.83,
"mean_ms": 0.8
}
},
{
"asset": "anyr-linux-x86_64",
"kind": "native",
"path": "/home/runner/work/cli/cli/anyr-linux-x86_64",
"bytes": 3497512,
"size": "3.3 MiB",
"version": "0.1.21 (built 2026-10-23 04:32:59)",
"target": "x86_64-unknown-linux-gnu",
"os": "ubuntu-latest",
"startup_version": {
"n": 21,
"min_ms": 0.8,
"median_ms": 0.86,
"p95_ms": 0.92,
"mean_ms": 0.85
},
"startup_help": {
"n": 21,
"min_ms": 0.8,
"median_ms": 0.85,
"p95_ms": 0.91,
"mean_ms": 0.85
}
},
{
"asset": "anyr-windows-x86_64.exe",
"kind": "native",
"path": "D:\\a\\cli\\cli\\anyr-windows-x86_64.exe",
"bytes": 2915840,
"size": "2.8 MiB",
"version": "0.1.21 (built 2026-10-23T04:33:56Z)",
"target": "x86_64-pc-windows-msvc",
"os": "windows-latest",
"startup_version": {
"n": 21,
"min_ms": 5.8,
"median_ms": 6.06,
"p95_ms": 6.38,
"mean_ms": 6.1
},
"startup_help": {
"n": 21,
"min_ms": 5.79,
"median_ms": 6.03,
"p95_ms": 6.32,
"mean_ms": 6.03
}
},
{
"asset": "anyr.wasm",
"kind": "wasm",
"path": "/home/runner/work/cli/cli/target/wasm-pkg/anyr_cli_bg.wasm",
"bytes": 199628,
"size": "194.9 KiB",
"version": "wasm",
"target": "wasm32-unknown-unknown",
"os": ""
}
] |
main CI failed after #110 (run 39900571954):
bad_visibility_is_a_usage_errorpanicked with BrokenPipe inrun_with_stdin. The CLI rejects--visibilityand exits before reading stdin, so the test's write races the child's exit.The helper now accepts BrokenPipe on that write (other write errors still fail), the same way
tests/byok.rsignores it. The exit-code and stderr assertions are unchanged.🤖 Generated with Claude Code