Skip to content

test(publish): tolerate a closed stdin pipe when the CLI exits early - #116

Merged
duyet merged 1 commit into
mainfrom
fix/publish-test-broken-pipe
Oct 23, 2026
Merged

duyet merged 1 commit into
mainfrom
fix/publish-test-broken-pipe

Conversation

@duyet

@duyet duyet commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

main CI failed after #110 (run 39900571954): bad_visibility_is_a_usage_error panicked with BrokenPipe in run_with_stdin. The CLI rejects --visibility and 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.rs ignores it. The exit-code and stderr assertions are unchanged.

🤖 Generated with Claude Code

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 duyetbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@duyet
duyet merged commit 935d2f6 into main Oct 23, 2026
7 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

anyr size and startup

Startup is wall time for a cold anyr --version / anyr --help (median of 21 runs). Size is the stripped release binary, or the .wasm for the browser demo.

Size budget: anyr-linux-x86_64 must stay ≤ 4.0 MiB (4194304 bytes) stripped.

Asset Kind Size --version median --help median
anyr-darwin-arm64 native 3.0 MiB 2.87 ms 2.53 ms
anyr-darwin-x86_64 native 3.2 MiB 37.81 ms 34.97 ms
anyr-linux-arm64 native 3.0 MiB 0.74 ms 0.8 ms
anyr-linux-x86_64 native 3.3 MiB 0.86 ms 0.85 ms
anyr-windows-x86_64.exe native 2.8 MiB 6.06 ms 6.03 ms
anyr.wasm wasm 194.9 KiB — —

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": ""
  }
]

@duyet
duyet deleted the fix/publish-test-broken-pipe branch October 25, 2026 12:17
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.

2 participants