refactor: move the cloud tui transport into a CmuxCloudTui package - #14198
Conversation
Redone from current main instead of rebasing manaflow-ai#13135 (1.8k commits behind, with main-side edits to the moved files and ~100 new consumers). SurfaceMachineID, SurfaceResourceID, SurfaceResource, the CloudVM state documents and the cmux-tui snapshot parser are pure values that the Cloud sidebar, SurfaceCatalog, the socket commands and the CLI all share. They move from the app target into Packages/macOS/CmuxSurfaceCatalogModel (depends on CmuxCore, CMUXDebugLog and CMUXMobileCore only). SurfaceCatalog, the owner, stays in the app. Besides the move: declarations become public, structs that relied on the synthesized memberwise initializer get an explicit public init with the same parameters, cmuxDebugLog becomes CMUXDebugLog.logDebugEvent, and the parser's port helpers and SurfaceResourceID.portKey move out of two larger app files because the parser calls them. VMMachineKind.swift was also a member of the cmux-cli target, so the CLI links the package. Since manaflow-ai#13135 was cut, main split SurfaceMachineID, SurfaceDeviceInstanceID and SurfaceDevicePresence out of SurfaceCatalogModel.swift; they move too (hence the CMUXMobileCore dependency, for cmxCanonicalDeviceID). Main's new fields (agent, device workspace detail/unread/pin, machine presence, displayCreationMachines, displayPorts) are public and in the explicit inits. CmuxTuiSnapshotParser.mergingDisplays stays in the app's +Displays extension, where main moved it. 303 app, CLI and test files gain `import CmuxSurfaceCatalogModel`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The iOS/package conventions lint rejects public all-static types in packages. CmuxTuiSnapshotParser, CloudWireNumber and CloudVMEventFeedRecoveryDecision were internal static namespaces in the app and moved unchanged; reshaping them is a separate change, so each carries the lint's inline lint:allow justification. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Next slice of the package-extraction RFC (manaflow-ai#13108), picked by edit frequency: Sources/Cloud gets about a quarter of 30-day app source touches, and every PR compile recompiles the whole app target, so moving hot Cloud code out of the target is what shortens edit-build loops. Twenty files move from Sources/Cloud to Packages/macOS/CmuxCloudTui: the cmux-tui request and argv builders, the manual-IO socket (frame, decoder, command, connection, descriptor lease, grid, input router, resize scheduler), the manual-mirror deadlines, phase, request kind and watchdog, the remote colors document, the resolved-surface result and the client paths. The package depends on CmuxSurfaceCatalogModel (from manaflow-ai#13135, which this branch is stacked on), CmuxTerminal, CmuxCloudImagePaste and CmuxFoundation; no app imports. Staying in the app: CloudTuiManualMirrorSession (binds a TerminalSurface) and the three files that speak CloudMachineLink.LinkError (CommandRunning, DaemonAnswer, PersistentResourceConnection). Besides the move: declarations become public, four structs that relied on the synthesized initializer get an explicit public init, and the resize scheduler's private(set) state is publicly readable. 62 app and test files gain a top-level `import CmuxCloudTui`. The cloud command deadline fixture, the CLI hostname test and the deadline workflow's path filter follow the files; CI's package list gains CmuxCloudTui. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
All contributors have signed the CLA ✍️ ✅ |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: manaflow-ai/cmux/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughAdds the ChangesCmuxCloudTui package
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Refactor Merge Risk: ⚪ Minimal · up to No actionable merge-blocking issue is established; proceed with the normal build and test checks. Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 1 warning)
✅ Passed checks (23 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 65.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 122 functions across 49 files. (1 skipped: 1 unsupported.) Full details: Cmux Swiftpm LockfilesExplanation The PR adds the
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
The package conventions lint rejects public all-static types in packages. CloudTuiCommandLine and CloudTuiRequests were internal static namespaces in the app and moved unchanged, so each carries the lint's inline lint:allow justification, matching the catalog package. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-package' into wt/cloudtui
CmuxCloudTui depends on CmuxTerminal, which links the GhosttyKit binary target, so its swift test needs the prebuilt framework and the same tolerated binaryTarget diagnostic as the terminal packages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
The import sat inside #if canImport(cmux_DEV), so the file would not compile when the host module is cmux. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # cmuxTests/CloudNotificationSyncTests.swift
…loudTuiTests cmuxTests now links CmuxCloudTui, which depends on CmuxTerminal, so Xcode builds CmuxTerminal and CmuxTerminalCore as shared package frameworks instead of static code inside the app. The test bundle then no longer finds their symbols through the host app; link both directly, as it already does for every other package it shares with the app. CmuxCloudTuiTests links CmuxTerminal, whose libghostty calls SwiftPM cannot satisfy from the GhosttyKit archive. Vend CmuxTerminal's existing GhosttyRuntimeTestStubs target as a product and depend on it, the same way CmuxTerminalTests does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # Sources/Cloud/VMTunnelManager.swift
…t into cmuxTests Linking CmuxCloudTui into cmuxTests made Xcode build CmuxTerminal and CmuxTerminalCore as shared package frameworks. CmuxTerminalCore then carried its own copy of libghostty, so the app called ghostty_config_serialize in a copy it never initialized and crashed at launch (CI run 35993531179). cmuxTests already reaches CmuxTerminal through the host app without linking it; do the same for CmuxCloudTui and drop the direct terminal links. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
d37a348 ci: route unpinned E2E runs by the pull request pool rule, 12vcpu first (manaflow-ai#14225) f016250 fix(ssh): keep legacy relay configurations off the cmux-tui path (manaflow-ai#14216) 066eaf1 refactor: move the cloud tui transport into a CmuxCloudTui package (manaflow-ai#14198) acd8850 Pin one workspace.list for a workspace ref in workspace loading (manaflow-ai#14219) ae81635 ci: pick one macOS pool per pull request run by preference and live queue depth (manaflow-ai#14205) # Conflicts: # .github/workflows/ci-guards.yml # .github/workflows/ci-macos.yml # .github/workflows/ci-queue-janitor.yml # .github/workflows/ci.yml # .github/workflows/cli-pipe-regressions.yml # .github/workflows/cloud-command-deadlines.yml # .github/workflows/remote-daemon.yml # .github/workflows/test-e2e.yml # .github/workflows/test-macos-suite.yml
Next slice of the package-extraction RFC #13108 (after #13107 and #13135).
#13135 has landed; this branch now contains only this change.
Why this slice
PR compile admission recompiles every
cmuxapp Swift task even on a DerivedData seed hit, so app-target size sets compile time. Picked by edit frequency: over 30 days, and leaving out bulk commits (>25 files),Sources/Cloud/got 25% of app source touches.I trial-compiled the hot Cloud clusters as standalone packages to find one that leaves cleanly:
What moves
20 files from
Sources/Cloud/toPackages/macOS/CmuxCloudTui: the cmux-tui request and argv builders, the manual-IO socket (frame, decoder, command, connection, descriptor lease, grid, input router, resize scheduler), the manual-mirror deadlines, phase, request kind and watchdog, remote colors, resolved surface, and client paths. Dependencies:CmuxSurfaceCatalogModel,CmuxTerminal,CmuxCloudImagePaste,CmuxFoundation. No app imports.Staying in the app:
CloudTuiManualMirrorSession: it binds aTerminalSurface.CloudTuiCommandRunning,CloudTuiDaemonAnswer,CloudTuiPersistentResourceConnection: they useCloudMachineLink.LinkError, which is nested in the app's 900-lineCloudMachineLink. The next step for them is movingLinkErrorout.Changes besides the move
public. Four structs that relied on the synthesized initializer get an explicitpublic initwith the same parameters. The resize scheduler'sprivate(set)state is now publicly readable, because the app tests read it.import CmuxCloudTui. None go inside the#if canImport(cmux_DEV)blocks, and none go intocmuxUITests. No@_exported import.cmuxonly (see below for cmuxTests). None of the moved files belonged tocmux-cli. The workspace group comes fromcheck-workspace-package-groups.py --write, andCmuxCloudTuiis added to the CI package list.tests/run_cloud_command_deadline_tests.sh, which also stripsimport CmuxCloudTuifrom copies, andtests/test_cli_cloud_hostname.py. The same applies to the path filter incloud-command-deadlines.yml.String(localized:).Changes after review
CloudTuiCommandLineandCloudTuiRequestscarry the conventions lint'slint:allow namespace-typejustification, like the catalog package's moved namespaces.GhosttyRuntimeTestStubstarget as a product soCmuxCloudTuiTestscan link without libghostty, and the package-test job provisions GhosttyKit for CmuxCloudTui.Verification
swift buildandswift test --package-path Packages/macOS/CmuxCloudTuipass locally: 4 new public-surface tests, and no warnings from the package's own sources.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Extracts the cloud TUI transport from the app target into a new
CmuxCloudTuipackage so hot Cloud code stops recompiling with every app build. Built on #13135, which moved the shared surface-catalog value types intoCmuxSurfaceCatalogModel(since squashed into this branch); the branch also carries merges of current main.Refactors
Sources/Cloud/: the request and argv builders, the manual-IO socket (frame, decoder, command, connection, descriptor lease, grid, input router, resize scheduler), the manual-mirror deadlines, phase, request kind and watchdog, remote colors, resolved surface, and client paths.CmuxSurfaceCatalogModel,CmuxTerminal,CmuxCloudImagePaste, andCmuxFoundation; no app imports.public; four structs get explicitpublic init, in the resize scheduler theprivate(set)state is readable so app tests can keep reading it, and the two static namespaces carry the package lint's inlinelint:allowjustification.CloudTuiManualMirrorSession(binds aTerminalSurface) and the files speakingCloudMachineLink.LinkErrorstay in the app.import CmuxCloudTui; the CI package list, warning budget, and cloud-command-deadline paths follow the move.CmuxSurfaceCatalogModelimport sits outside itscmux_DEVblock so the file compiles when the host module is cmux.cmuxTestsresolvesCmuxCloudTuithrough the host app instead of linking it, since linking pullsCmuxTerminalin as shared frameworks whose duplicated libghostty crashed launch; CI prebuilds GhosttyKit, andCmuxCloudTuiTestsstubs libghostty throughCmuxTerminal's newGhosttyRuntimeTestStubsproduct.Written for commit 280279d. Summary will update on new commits.
Summary by CodeRabbit