cmux-cloud-start-core: the Cloud start's harness login decision in Rust over the app FFI (step A)

Merged
TE
3d ago
+684-2

Leo: "But why are there so many tests in Swift? It's Cloud code. Why is it not in Rust?" and "Why are there so many of these tests in the first place?"

What

Step A of a two-step app FFI move: the NEXT Cloud start's harness login decision moves to Rust.

  • New pure crate cmux-tui/crates/cmux-cloud-start-core (harness_login): the step and reason a cloud.startChat start takes about its machine's Claude login, readsMachine, guestTakesLogin, skippedTeamMachine, the one-line record for the log and cloud.machines, the harness-family-to-provider map, and the guest /etc/cmux/vm-kind probe and its parse. A 1:1 port of the app's CloudHarnessLoginDecision and CloudStartChat.loginProvider.
  • cmux-layout-reducer-ffi's JSON channel serves it as cloud_harness_login, cloud_harness_login_provider, cloud_guest_kind and cloud_guest_kind_probe.
  • Wiring: workspace member, the cmux-app-ffi lock entry, the app FFI release push path, the app crate license gate's first-party list (and its test), and the swift job route.

Step B (next PR, after the FFI release this merge publishes): re-pin CCmuxAppFFI, make CloudHarnessLoginDecision a thin caller of these ops, and delete the Swift copy and the decision cases in CloudStartChatLoginTests (6 of its 8 tests; the 2 kept test the build gate's UserDefaults read, which stays in Swift). No app behavior change in this PR.

check the app FFI pin is expected red here: the FFI sources change without a new pin, as in every step A (#31945, #32055).

Tests

Ran on the fleet (cmux-ci test, run 41449956072, at 119ca3223258):

  • cargo test -p cmux-cloud-start-core: 10 passed (every case of the Swift CloudStartChatLoginTests decision tests, plus the wire shape and the probe run under sh).
  • cargo test --test cloud_harness_login in cmux-layout-reducer-ffi: 4 passed (the ops through the C ABI).
  • cargo clippy --all-targets -D warnings on both crates: clean.
  • python3 -m unittest tests.test_app_crate_licenses, scripts/cmux-next/tests/app-ffi-release-paths.test.sh: pass.

Changelog

none

šŸ¤– Generated with Claude Code

Agent session: agent session


Summary by cubic

Moves the NEXT Cloud start's harness login decision from Swift to a new Rust crate (cmux-cloud-start-core), served to the app over cmux-layout-reducer-ffi's JSON channel. This is step A of a two-step migration: no app behavior changes here.

  • New pure crate ports the app's CloudHarnessLoginDecision and CloudStartChat.loginProvider (1:1), including the step, reason, machine-reading flags, log record, harness-to-provider map, and guest /etc/cmux/vm-kind probe.
  • cmux-layout-reducer-ffi exposes it as cloud_harness_login, cloud_harness_login_provider, cloud_guest_kind, and cloud_guest_kind_probe ops.
  • Wires the crate into the workspace, app FFI lock, release push path, license gate, and swift job route.

Migration

Step B (next PR): re-pin CCmuxAppFFI, make the Swift CloudHarnessLoginDecision call these ops, and delete the Swift copy plus 6 of CloudStartChatLoginTests' 8 test cases. check the app FFI pin is expected red here.