Skip to content

Migrate to the pure-Rust rs_abieos backend (cross-platform) - #2

Merged
igorls merged 1 commit into
mainfrom
feat/pure-rust-backend
May 30, 2026
Merged

Migrate to the pure-Rust rs_abieos backend (cross-platform)#2
igorls merged 1 commit into
mainfrom
feat/pure-rust-backend

Conversation

@igorls

@igorls igorls commented May 30, 2026

Copy link
Copy Markdown
Member

Summary

Switches the rs_abieos dependency to 0.5.0 with the pure-Rust rust-backend (default-features = false). The backend is API-compatible, so this is a zero-code-change migration — but it drops the C++ toolchain / clang / libclang / git build requirements and makes fleet-router build, test, and run on Linux, macOS, and Windows.

This is the change that lets fleet-router ship as a normal cross-platform crate (cargo install fleet-router now works everywhere) instead of being Linux-only.

Changes

  • Cargo.toml: rs_abieos = { version = "0.5.0", default-features = false, features = ["rust-backend"] }. Cargo.lock drops bindgen/cc/clang-sys/sys-info (−128 lines).
  • MSRV → 1.95: rs_abieos's pure-Rust backend uses if let guards, stable since Rust 1.95 (verified: 1.95 builds, 1.94 does not). Updated rust-version, the CI MSRV job, README, and CONTRIBUTING.
  • CI: replaced the single Linux job (which installed clang/libclang) with a Linux/macOS/Windows test matrix; split out fmt/clippy; bumped actions to Node 24 (checkout@v5).
  • release.yml: now builds cross-platform release binaries (linux x86_64, macOS arm64 + x86_64, windows x86_64) alongside the crates.io publish and GHCR image.
  • Dockerfile: dropped the clang/libclang install; builder is rust:1.95-bookworm (pure-Rust build).
  • Tests: locate the binary via env!("CARGO_BIN_EXE_fleet-router") so the e2e/operational suites run on Windows/macOS (not just the Unix target/debug/fleet-router path).
  • Docs: README/CONTRIBUTING/SECURITY/bug-report updated for pure-Rust, cross-platform builds; CHANGELOG entry.

Verification

  • Native Windows: cargo build --all-targets ✓ and full cargo test --workspace ✓ (12 e2e, 5 mock-integration, 3 operational, 6 conformance, 3 stress, 6 mock-ship).
  • Linux (Docker): cargo fmt --check, clippy --locked -D warnings, cargo test --workspace --locked, cargo-deny (advisories/bans/licenses/sources) — all ✓.
  • MSRV: cargo +1.95 check --locked ✓.
  • Docker: docker build ✓ (pure Rust, no clang, rust:1.95-bookworm).

Notes

  • The MSRV jump (1.85 → 1.95) comes entirely from rs_abieos using if let guards. If a lower MSRV matters, that one construct in rs_abieos's crypto.rs could be rewritten upstream to restore a lower floor. The committed Cargo.lock pins rs_abieos 0.5.0, so the MSRV won't drift unexpectedly.

Switch the rs_abieos dependency to 0.5.0 with the pure-Rust `rust-backend`
(default-features = false). The backend is API-compatible, so this needs zero
code changes — but it removes the C++ toolchain / clang / libclang / git build
requirements and makes fleet-router build and run on Linux, macOS, and Windows.

- Cargo.toml: rs_abieos = { version = "0.5.0", default-features = false,
  features = ["rust-backend"] }. MSRV raised to 1.95 (rs_abieos uses `if let`
  guards, stable since 1.95). Cargo.lock drops bindgen/cc/clang-sys/sys-info.
- CI: replace the single Linux job (which installed clang/libclang) with a
  Linux/macOS/Windows test matrix; MSRV job -> 1.95; bump actions to Node 24.
- release.yml: build cross-platform release binaries (linux x86_64, macOS
  arm64/x86_64, windows x86_64) alongside the crates.io publish and GHCR image.
- Dockerfile: drop the clang/libclang install; builder is rust:1.95-bookworm.
- tests: locate the binary via CARGO_BIN_EXE_fleet-router so the e2e and
  operational suites run on Windows/macOS too.
- docs: README/CONTRIBUTING/SECURITY/bug-report updated for pure-Rust,
  cross-platform builds; CHANGELOG entry.

Verified: native Windows build + full test suite; Linux fmt/clippy/test/
cargo-deny; MSRV 1.95; docker build (pure Rust, no clang).

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request transitions fleet-router to a pure-Rust implementation by upgrading rs_abieos to version 0.5.0 with the rust-backend feature enabled. This change removes the dependency on a C/C++ toolchain, clang, and libclang, allowing native builds on Linux, macOS, and Windows (x86_64 and arm64). Consequently, the Minimum Supported Rust Version (MSRV) is bumped to 1.95, and the Dockerfile, issue templates, and documentation are updated. In the integration tests, manual binary path resolution is replaced with Cargo's binary environment variables. However, the reviewer identified a critical issue where using CARGO_BIN_EXE_fleet-router will cause compilation errors because Cargo replaces dashes with underscores in target names; this needs to be updated to CARGO_BIN_EXE_fleet_router in both test files.

Comment thread tests/e2e_proxy.rs
// Cargo builds the binary before running this integration test and sets
// CARGO_BIN_EXE_<name> to its absolute path, with the platform's
// executable extension (e.g. `.exe` on Windows).
env!("CARGO_BIN_EXE_fleet-router").to_string()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Cargo replaces dashes (-) with underscores (_) in the environment variable names generated for binary targets. Therefore, CARGO_BIN_EXE_fleet-router does not exist, and using it will cause a compilation error. It should be CARGO_BIN_EXE_fleet_router instead.

Suggested change
env!("CARGO_BIN_EXE_fleet-router").to_string()
env!("CARGO_BIN_EXE_fleet_router").to_string()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

False positive — keeping CARGO_BIN_EXE_fleet-router (with the hyphen).

Cargo sets CARGO_BIN_EXE_<name> using the binary target name verbatim; the dash is not converted to an underscore. The Cargo Book example is literally CARGO_BIN_EXE_my-program. (The dash→underscore rule applies to CARGO_FEATURE_* / CARGO_CFG_*, not CARGO_BIN_EXE_*.)

Evidence: the suggested CARGO_BIN_EXE_fleet_router fails to compile —

error: environment variable `CARGO_BIN_EXE_fleet_router` not defined at compile time

whereas the hyphenated form compiles and the e2e/operational suites run on Linux, macOS, and Windows (this PR's CI is green on all three). Applying the suggestion would break the build.

Comment thread tests/operational.rs
// Cargo builds the binary before running this integration test and sets
// CARGO_BIN_EXE_<name> to its absolute path, with the platform's executable
// extension (e.g. `.exe` on Windows).
env!("CARGO_BIN_EXE_fleet-router").to_string()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Cargo replaces dashes (-) with underscores (_) in the environment variable names generated for binary targets. Therefore, CARGO_BIN_EXE_fleet-router does not exist, and using it will cause a compilation error. It should be CARGO_BIN_EXE_fleet_router instead.

Suggested change
env!("CARGO_BIN_EXE_fleet-router").to_string()
env!("CARGO_BIN_EXE_fleet_router").to_string()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

False positive — keeping CARGO_BIN_EXE_fleet-router (with the hyphen).

Cargo sets CARGO_BIN_EXE_<name> using the binary target name verbatim; the dash is not converted to an underscore. The Cargo Book example is literally CARGO_BIN_EXE_my-program. (The dash→underscore rule applies to CARGO_FEATURE_* / CARGO_CFG_*, not CARGO_BIN_EXE_*.)

Evidence: the suggested CARGO_BIN_EXE_fleet_router fails to compile —

error: environment variable `CARGO_BIN_EXE_fleet_router` not defined at compile time

whereas the hyphenated form compiles and the e2e/operational suites run on Linux, macOS, and Windows (this PR's CI is green on all three). Applying the suggestion would break the build.

@igorls
igorls merged commit f2cd2f1 into main May 30, 2026
7 checks passed
@igorls
igorls deleted the feat/pure-rust-backend branch May 30, 2026 22:43
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