Skip to content

chore(cua-driver-rs)(install): install-local.sh defaults to the Rust backend - #1707

Merged
f-trycua merged 1 commit into
mainfrom
chore/install-local-default-rust
May 26, 2026
Merged

chore(cua-driver-rs)(install): install-local.sh defaults to the Rust backend#1707
f-trycua merged 1 commit into
mainfrom
chore/install-local-default-rust

Conversation

@f-trycua

@f-trycua f-trycua commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

Flip the default backend in libs/cua-driver/scripts/install-local.sh from Swift to Rust on every host. The production curl-pipe-bash install.sh is unchanged — it still keeps the Swift default on macOS until cua-driver-rs flips from experimental to stable.

Why

  • install-local.sh is the developer / checked-out-tree installer. Its audience is people working on the Rust port (across Windows / Linux / macOS) who've been typing --experimental-rust or --backend=rust reflexively for weeks.
  • The Rust port is the active dev target across all three platforms and now has the full integration-test surface attached (crates/cua-driver/tests/harness_{appkit,swiftui,wpf,winui3,…}_test.rs).
  • Flipping this default cuts a flag from every checked-out-tree install and reduces the chance of "wait, why is this building Swift?" surprise.

Flag semantics after this change

Flag Before After
(none) macOS → Swift, Linux → Rust auto Rust everywhere
--backend=swift no-op (was the default) explicit Swift opt-in (hard-errors on non-Darwin)
--backend=rust opt-in to Rust no-op (matches default)
--experimental-rust opt-in to Rust legacy alias, no-op now. Accepted so any script/doc still passing it keeps working.

Behavior verification

$ bash -x install-local.sh                          → _install-local-rust.sh
$ bash -x install-local.sh --backend=swift          → _install-local-swift.sh (macOS only)
$ bash -x install-local.sh --backend=swift (Linux)  → hard-error before helper exec
$ bash -x install-local.sh --experimental-rust      → _install-local-rust.sh (no-op alias)

bash -n clean.

What this does NOT touch

  • install.sh (production curl-pipe-bash) — Swift default on macOS stays
  • install.ps1 / install-local.ps1 (Windows) — already Rust-only on Windows
  • Either helper script (_install-local-{rust,swift}.sh) — unchanged
  • Any caller that explicitly passes --backend=swift or --backend=rust — they keep doing what they asked

Test plan

  • bash -n libs/cua-driver/scripts/install-local.sh clean
  • Verified dispatch via bash -x for the four argv shapes above
  • Try a full bash install-local.sh --release on this Mac (builds the Rust release; ~1 min)
  • Try the same on Linux to confirm nothing broke (auto-rust was already the existing Linux behavior, just no longer needs the special-case branch)
  • CodeRabbit pass

Rollback

Revert this commit. Single-file, 51-line diff. Anyone caught off-guard can pass --backend=swift to get the old behavior on macOS.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Installer now properly rejects unsupported backend configurations when requested on incompatible platforms.
    • Improved error handling with clear failure messages.
  • Documentation

    • Clarified backend availability: Swift is macOS-only; Rust is the default backend.

Review Change Stack

…backend

The local/dev installer now picks the Rust backend by default on every
host. The production curl-pipe-bash `install.sh` stays unchanged — it
keeps the Swift default on macOS until cua-driver-rs flips from
experimental to stable.

Why now: the Rust port is the active dev target across all three
platforms, has the full integration-test surface attached (crates/
cua-driver/tests/harness_*_test.rs), and devs working off `install-
local.sh` are the audience that's been using `--experimental-rust` /
`--backend=rust` reflexively for weeks. Flipping the default cuts a
flag from every checked-out-tree install.

Flag handling:
  - `--backend=swift` now sets USE_SWIFT_BACKEND=1 (was a no-op since
    Swift was the default). Errors on non-Darwin since there's no
    Swift install path there.
  - `--backend=rust` is now the no-op (matches the default).
  - `--experimental-rust` accepted as legacy alias, also no-op now.
    Kept so any script or doc passing it keeps working.

No behavior change to `install.sh`, `install.ps1`, or either
helper. Single-file edit; bash -n clean; verified dispatch:
  - bare invocation               → _install-local-rust.sh
  - `--backend=swift` on macOS    → _install-local-swift.sh
  - `--backend=swift` on Linux    → hard-error before helper exec

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vercel

vercel Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored May 26, 2026 10:19am

Request Review

@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b78184f3-309f-4b2a-a30b-ba48779ad0b4

📥 Commits

Reviewing files that changed from the base of the PR and between d7981d1 and 19c2671.

📒 Files selected for processing (1)
  • libs/cua-driver/scripts/install-local.sh

📝 Walkthrough

Walkthrough

The install-local.sh wrapper is refactored to default to the Rust backend across all platforms and to permit Swift selection only on macOS. Documentation, flag parsing, and dispatch logic are updated to enforce this behavior while maintaining backward compatibility for the legacy --experimental-rust flag.

Changes

Rust-default multi-backend installer

Layer / File(s) Summary
Backend dispatcher, flag parsing, and platform enforcement
libs/cua-driver/scripts/install-local.sh
Script header documentation is updated to explain Rust as the default backend and --experimental-rust as a legacy alias. Flag parsing is rewritten to use USE_SWIFT_BACKEND (defaulting to false), consuming --backend=swift|rust and --experimental-rust while preserving all other arguments in FORWARDED_ARGS. Dispatch logic adds a hard error when Swift is requested on non-Darwin hosts and selects _install-local-swift.sh or _install-local-rust.sh accordingly.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • trycua/cua#1538: Implements the same Rust-vs-Swift installer opt-in flag parsing and dispatch pattern in install.sh.
  • trycua/cua#1558: Applies the same multi-backend dispatch semantics driven by --backend/--experimental-rust in uninstall.sh.
  • trycua/cua#1676: Modifies the _install-local-rust.sh backend helper invoked by this wrapper's dispatch logic.

Poem

🐰 A swift choice? Only on Mac, it's true,
🦀 But Rust now leads in all we do,
The dispatcher bows, the flags align,
Legacy ways fade by design—
One shell to route them, clean and fine!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/install-local-default-rust

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@f-trycua
f-trycua marked this pull request as ready for review May 26, 2026 12:18
@f-trycua
f-trycua merged commit d5eccd0 into main May 26, 2026
6 of 7 checks passed
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