Skip to content

pbit: portability matrix, installers and npm wrapper (no publish) - #5

Closed
BitmapAsset wants to merge 3 commits into
mainfrom
r22-portability-matrix
Closed

BitmapAsset wants to merge 3 commits into
mainfrom
r22-portability-matrix

Conversation

@BitmapAsset

@BitmapAsset BitmapAsset commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

Draft. Nothing is tagged, released or published, and no Rust source changed (manifests gained metadata lines only).

What this adds

  • .github/workflows/bench.yml: builds, tests and measures pbit on ubuntu-latest, macos-latest and windows-latest (plus macos-15-intel on request), with static musl and cross builds, a wasm32-wasip1 check and minimum-Rust probes. It runs on pushes to this branch or by hand, never on pull_request or main, standard runners only.
  • scripts/bench/: the matrix harness (one JSON per platform, N = 5), the table renderer, local-server tests for the installers and the npm wrapper, and the results of 2026-10-01.
  • BENCHMARK-MATRIX.md (numbers per platform) and PORTABILITY.md (targets, linking, toolchain lines, MSRV, WASM, installers, findings).
  • install.sh (POSIX sh) and install.ps1 (Windows PowerShell 5.1 and PowerShell 7): fetch the release archive, verify its .sha256, install without sudo or administrator rights.
  • npm/: the pbit npm package. Postinstall fetches the binary and verifies its SHA-256; exit codes pass through; the binary is fetched on first run if install scripts are off. Not published.
  • docs/agents.md and examples/node/decide.mjs: calling pbit from a shell, Python, Node, PowerShell and agent harnesses.
  • release.yml (packaging step only): archives also carry examples/, python/ and docs/.
  • Crate manifests: readme, keywords, categories.

Evidence

  • Bench run 36969399069 (run 1: Linux, macOS arm64, Windows, macOS Intel, static and cross builds) and run 36970631022 (run 2, same source). Run 36971913160 (run 3, this head): every bench and cross job passed, including install.ps1 and the PowerShell recipes under Windows PowerShell 5.1 through cmd; as is, 5.1 still exits 2. Its Windows cargo test failed one wall-clock bound (acc1_tv_le_001_within_10ms: p50 10.37 ms against a 10 ms limit); the other 126 tests passed.
  • ci.yml on this PR (run 36971967219): green on ubuntu, macOS and Windows.
  • cargo test --release --workspace --no-fail-fast (run 2): 127 passed, 1 ignored on Linux, macOS arm64 and Windows.
  • install.sh: 15 runs on Linux, macOS arm64 and macOS Intel (sh, bash, dash) plus the local M4. install.ps1: PowerShell 7.6. npm wrapper: Linux, Windows and the local M4.
  • Static builds: x86_64-unknown-linux-musl is static-pie; aarch64-unknown-linux-musl is static and passed a smoke test under qemu. MSRV is 1.73 for the source and 1.78 with the committed lockfile. wasm32-wasip1: cargo check passes.

Findings for the source, test and release lanes (not changed here)

  1. pbit rejects a UTF-8 byte-order mark on stdin (exit 2). Windows PowerShell 5.1 adds one to every pipe into a native program, because the runner's [Console]::InputEncoding is UTF-8 with a BOM. So pbit demo | pbit decide fails there. Stripping a leading U+FEFF in read_stdin() would fix it. Run 3 found a second workaround besides cmd /c: setting [Console]::InputEncoding = [System.Text.UTF8Encoding]::new($false) in 5.1 makes the pipe exit 0. It is worth documenting next round; it is not in docs/agents.md yet.
  2. The Linux release binary needs glibc >= 2.34 (built on Ubuntu 24.04). The static musl build measured here runs anywhere and was within 4-7% of it.
  3. The Windows binary imports VCRUNTIME140.dll; +crt-static would remove the dependency.
  4. Wall-clock test bounds fail on shared runners: acc1_tv_le_001_within_10ms failed on Windows in 2 of 3 bench runs (p50 13.14 ms and 10.37 ms against 10 ms), and run_deadline_ms_bounds_the_whole_call failed on the Intel runner (990 ms against a 900 ms bound).
  5. --deadline-ms 600 took 990 ms on the Intel runner.
  6. bench/decide_threads.py fails on Windows; bench/portable_vs_native.py needs extensionless binaries there.
  7. crates.io: pbit-ir, pbit-decide and pbit-cli need version = "0.2.0" on their path dependencies before a dry run can pass. Publish order: core, ir, decide, cli. All five names (pbit, pbit-*) are free on crates.io, and pbit is free on npm.

Not done

No npm publish, no cargo publish, no tags or releases. The WSL2 (RTX 4070) and VirtualBox rows are pending because those machines are offline.

- .github/workflows/bench.yml: build, test and measure pbit on the
  ubuntu, macOS arm64, Windows and macOS Intel runners, plus static musl
  and cross builds, a wasm32-wasip1 check and minimum-Rust probes. Runs
  on pushes to this branch and by hand only.
- scripts/bench/: matrix_bench.py (one JSON per platform, N = 5) and
  local-server tests for the installers and the npm wrapper.
- install.sh and install.ps1: fetch a release archive, verify its
  SHA-256, install without sudo or administrator rights.
- npm/: the `pbit` package (postinstall fetch with checksum, exit codes
  passed through, fetch on first run when install scripts are off).
  Not published.
- docs/agents.md and examples/node/decide.mjs: calling pbit from a
  shell, Python, Node, PowerShell and agent harnesses.
- release.yml: archives also carry examples/, python/ and docs/.
- Crate manifests: readme, keywords, categories.
…un 1 results

- docs/agents.md, install.ps1, scripts/bench/*.ps1: Windows PowerShell
  5.1 on the windows-latest image pipes text into native commands with a
  UTF-8 byte-order mark, which pbit 0.2.0 rejects (exit 2). Document and
  test $OutputEncoding = [System.Text.UTF8Encoding]::new($false).
- scripts/bench/serve.py: the installer tests' local server, without the
  reverse-DNS lookup that stalled http.server ~35 s per start on macOS.
- bench.yml: the macOS Intel row runs only when asked (a tag in the
  pushed commit message, or the intel input of a manual run); cargo test
  runs with --no-fail-fast so every test binary reports.
- scripts/bench/results/2026-10-01: bench run 36969399069 (four runner
  rows, static and cross builds, tests) and the local M4 row.
- scripts/bench/render_matrix.py: renders the matrix tables from those
  files.
… via cmd

- BENCHMARK-MATRIX.md: per-platform tables rendered from the JSON results
  by scripts/bench/render_matrix.py, with what they support and what they
  do not.
- PORTABILITY.md: targets built and tested, what each binary links,
  toolchain lines, minimum Rust version, the wasm32-wasip1 probe, the
  installers, and findings that need a source, test or release change.
- Windows PowerShell 5.1 adds a byte-order mark to text it pipes into a
  program even with $OutputEncoding at us-ascii, so the $OutputEncoding
  workaround did not help there: docs/agents.md, install.ps1 and the
  PowerShell test scripts now route its pipes through cmd.
- scripts/bench/results/2026-10-01: bench run 36970631022.
@BitmapAsset

Copy link
Copy Markdown
Owner Author

Landed on main as one squashed commit, b17150b (review: manifests only, 0 Rust source, tree scan clean, cargo check ok). Closing.

@BitmapAsset BitmapAsset closed this Oct 2, 2026
@BitmapAsset
BitmapAsset deleted the r22-portability-matrix branch October 2, 2026 06:25
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.

1 participant