Skip to content

refactor: move the surface catalog's value types into a package - #13119

Closed
teamleaderleo wants to merge 1 commit into
manaflow-ai:mainfrom
teamleaderleo:refactor/surface-catalog-model-package
Closed

teamleaderleo wants to merge 1 commit into
manaflow-ai:mainfrom
teamleaderleo:refactor/surface-catalog-model-package

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Sep 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

First cut from #13108. The surface catalog's value types (SurfaceMachineID, SurfaceResourceID, SurfaceResource, SurfaceMachineInfo, SurfaceProjection, the CloudVM* state documents, VMMachineKind, and the cmux-tui snapshot parser that produces them) move from the app target into a new local package, Packages/macOS/CmuxSurfaceCatalogModel. 56 types, about 4,000 lines, depending only on CmuxCore and CMUXDebugLog. SurfaceCatalog itself stays in the app.

Why this one: these types are what holds Sources/Cloud/ (26% of all app-module edits in the last 30 days) inside the app module. About 630 of Cloud's ~1,100 references to the rest of the app are to these types. With them in a package, Cloud and Surfaces share a vocabulary that is not the app module.

What changed besides the move:

  • Declarations become public. The 27 structs that relied on the synthesized memberwise initializer get an explicit public init with the same parameters and defaults; structs that already had their own initializer are untouched.
  • CloudVMState+SnapshotComparison.swift moves too: it holds CloudVMState's ==.
  • The parser's listening-port helpers (from SurfaceCatalog+CloudPorts.swift) and SurfaceResourceID.portKey/desktopDisplayKey (from SurfaceSocketCommands.swift) move into SurfaceResourceID+Ports.swift, because the moved parser calls them. The rest of those two files stays.
  • cmuxDebugLog(...) in the parser becomes CMUXDebugLog.logDebugEvent(...), still under #if DEBUG.
  • VMMachineKind.swift was a member of both the app and the cmux-cli target, so the CLI links the package too.
  • 215 app, CLI and test files gain import CmuxSurfaceCatalogModel. The package is added to CI's package test list. scripts/check-pbxproj.sh passes.

No logic changes.

Testing

Measured on one machine (MacBook Air M5, Xcode 27.0), warm incremental xcodebuild builds, the same edits to SurfaceCatalogModel.swift with the file in the app module (a second worktree on a slightly older main) and in the package (this branch). Compare within a row.

edit file in the app module file in the package
comment (no interface change) 38.5 s, 3 app files compiled 12.9 s, 0 app files
interface change: new member on SurfaceResource, sample 1 63.0 s, 193 app files 54.1 s, 199 app files
interface change, sample 2 62.1 s, 193 app files 55.8 s, 199 app files
  • I expected interface edits to get slower in a package (every importer recompiles). They do not: inside the app module the same edit already recompiles 193 files, so the package version is about the same work and a few seconds faster.
  • On this branch, rebased on main: xcodebuild -scheme cmux build (builds the CLI too): BUILD SUCCEEDED. xcodebuild -scheme cmux-unit build-for-testing: TEST BUILD SUCCEEDED (run with test: split an expression Xcode 27 cannot type-check #13073 applied locally, because main's tests do not type-check on Xcode 27 without it; not part of this PR). swift test --package-path Packages/macOS/CmuxSurfaceCatalogModel: passes (one new smoke test; the existing coverage of these types stays in cmuxTests).
  • The first test build failed on one initializer (CloudVMStateDeltaImpact, only constructed by tests); fixed here.
  • Limits: n=2 per interface row, one kind of interface edit, and the two columns are different worktrees on nearby commits. Not tested: running the app and using Cloud by hand (launching a tagged build needs dev credentials that are not on the benchmark machine); Xcode 26.x (CI covers it).

Demo Video

Not applicable: code move, no behaviour change.

Checklist

  • I tested the change locally
  • I added or updated tests for behavior changes (package test target wired into CI)
  • I updated docs/changelog if needed (package README)

🤖 Generated with Claude Code


Summary by cubic

First cut from #13108: extracts the surface catalog's value types into a new local package, CmuxSurfaceCatalogModel, so Cloud and Surfaces share a vocabulary without depending on the app module. No logic changes; SurfaceCatalog itself stays in the app.

What changed

  • Moves 56 types (~4,000 lines) that depend only on CmuxCore and CMUXDebugLog.
  • Makes declarations public, adding explicit public inits where structs relied on the synthesized memberwise initializer.
  • Moves CloudVMState's ==, the parser's port helpers, and SurfaceResourceID.portKey/desktopDisplayKey with the parser that uses them.
  • Replaces the parser's cmuxDebugLog(...) with CMUXDebugLog.logDebugEvent(...).
  • Links the package from the CLI because VMMachineKind is shared with the cmux-cli target.
  • Adds import CmuxSurfaceCatalogModel to 215 app, CLI, and test files.

Verification

  • App and CLI builds pass; the package tests run in CI.
  • On one benchmark machine, comment-only edits to the moved code no longer recompile app targets; interface edits take about the same time.

Written for commit 0c26fea. Summary will update on new commits.

Review in cubic

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 and CMUXDebugLog 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.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 15 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: manaflow-ai/cmux/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: ac49d58b-5fb9-493d-95cd-aff9d69f3a39

📥 Commits

Reviewing files that changed from the base of the PR and between 8f6d3c0 and 0c26fea.

📒 Files selected for processing (233)
  • .github/workflows/ci.yml
  • CLI/CMUXCLI+SurfaceSelection.swift
  • CLI/CMUXCLI+VMTransfer.swift
  • CLI/cmux.swift
  • Packages/macOS/CmuxSurfaceCatalogModel/Package.swift
  • Packages/macOS/CmuxSurfaceCatalogModel/README.md
  • Packages/macOS/CmuxSurfaceCatalogModel/Sources/CmuxSurfaceCatalogModel/CloudTabNameAuthority.swift
  • Packages/macOS/CmuxSurfaceCatalogModel/Sources/CmuxSurfaceCatalogModel/CloudTabNameSource.swift
  • Packages/macOS/CmuxSurfaceCatalogModel/Sources/CmuxSurfaceCatalogModel/CloudTuiTerminalProjectionTarget.swift
  • Packages/macOS/CmuxSurfaceCatalogModel/Sources/CmuxSurfaceCatalogModel/CloudVMState+SnapshotComparison.swift
  • Packages/macOS/CmuxSurfaceCatalogModel/Sources/CmuxSurfaceCatalogModel/CloudVMTabState.swift
  • Packages/macOS/CmuxSurfaceCatalogModel/Sources/CmuxSurfaceCatalogModel/CmuxTuiSnapshotParser.swift
  • Packages/macOS/CmuxSurfaceCatalogModel/Sources/CmuxSurfaceCatalogModel/SurfaceCatalogModel.swift
  • Packages/macOS/CmuxSurfaceCatalogModel/Sources/CmuxSurfaceCatalogModel/SurfaceCatalogSnapshot.swift
  • Packages/macOS/CmuxSurfaceCatalogModel/Sources/CmuxSurfaceCatalogModel/SurfaceResourceID+Ports.swift
  • Packages/macOS/CmuxSurfaceCatalogModel/Sources/CmuxSurfaceCatalogModel/SurfaceResourcePlacement.swift
  • Packages/macOS/CmuxSurfaceCatalogModel/Sources/CmuxSurfaceCatalogModel/VMMachineKind.swift
  • Packages/macOS/CmuxSurfaceCatalogModel/Tests/CmuxSurfaceCatalogModelTests/SurfaceIdentityTests.swift
  • Sources/ClosedItemHistory.swift
  • Sources/Cloud/CloudDiagnosticFailure.swift
  • Sources/Cloud/CloudMachineLink.swift
  • Sources/Cloud/CloudMachineLinkManager.swift
  • Sources/Cloud/CloudMachineRefreshCoordinator.swift
  • Sources/Cloud/CloudMachineSurfacePresentation.swift
  • Sources/Cloud/CloudNotificationPlacement.swift
  • Sources/Cloud/CloudNotificationSync.swift
  • Sources/Cloud/CloudTerminalCreationRequest.swift
  • Sources/Cloud/CloudTerminalCreationRetryResolution.swift
  • Sources/Cloud/CloudTreeDeletionPresentation.swift
  • Sources/Cloud/CloudTreeMachineResources.swift
  • Sources/Cloud/CloudTreeNode.swift
  • Sources/Cloud/CloudTreeNodeActions+WorkspaceLifecycle.swift
  • Sources/Cloud/CloudTreeNodeActions.swift
  • Sources/Cloud/CloudTreeNodeBuilder+Ports.swift
  • Sources/Cloud/CloudTreeNodeContentSnapshot.swift
  • Sources/Cloud/CloudTreeOutlineView+MachineMenu.swift
  • Sources/Cloud/CloudTreeOutlineView.swift
  • Sources/Cloud/CloudTreeRemoteWorkspaces.swift
  • Sources/Cloud/CloudTreeRowContentView.swift
  • Sources/Cloud/CloudTreeStyleGalleryWindow.swift
  • Sources/Cloud/CloudTreeTerminalNavigationCoordinator.swift
  • Sources/Cloud/CloudTuiCommandLine+Placement.swift
  • Sources/Cloud/CloudTuiCommandLine.swift
  • Sources/Cloud/CloudTuiManualMirrorSession.swift
  • Sources/Cloud/CloudTuiPersistentRequestBuilder.swift
  • Sources/Cloud/CloudTuiPersistentResourceConnection.swift
  • Sources/Cloud/CloudTuiTerminalProjectionTarget.swift
  • Sources/Cloud/MachineCreateOperation.swift
  • Sources/Cloud/MachineCreateRequest.swift
  • Sources/Cloud/MachineSnapshotBuilder.swift
  • Sources/Cloud/MachinesPanelViewModel.swift
  • Sources/Cloud/NewMachineModel.swift
  • Sources/Cloud/PortForward/CloudBrowserAccessState.swift
  • Sources/Cloud/PortForward/CloudPortRoutePlan.swift
  • Sources/Cloud/Sidebar/CloudSidebarNotificationCoordinator.swift
  • Sources/Cloud/Sidebar/CloudSidebarOrganizationStore.swift
  • Sources/Cloud/Sidebar/SurfaceCatalog+SidebarOrganization.swift
  • Sources/Cloud/Sidebar/SurfaceResource+CatalogOrdering.swift
  • Sources/Cloud/Sidebar/TerminalController+CloudSidebar.swift
  • Sources/Cloud/SurfaceResourceDragPayload.swift
  • Sources/Cloud/Tunnel/CloudTunnelBanner.swift
  • Sources/Cloud/VMClient.swift
  • Sources/Cloud/VMClientSocketCommands.swift
  • Sources/CloudTerminalCreationCoordinator.swift
  • Sources/CmuxConfig.swift
  • Sources/CmuxSSHURLRequest.swift
  • Sources/Feed/FeedButtonStyleDebugWindowController.swift
  • Sources/Feed/FeedPanelView.swift
  • Sources/Feed/FeedPreviewWindowController.swift
  • Sources/KeyboardShortcutSettingsFileStore.swift
  • Sources/Panels/BrowserPanelView.swift
  • Sources/Panels/PanelStableSurfaceIdentity.swift
  • Sources/Panels/ProjectFilesTabView.swift
  • Sources/RightSidebarChromeStyle.swift
  • Sources/SessionPersistence.swift
  • Sources/Surfaces/AppDelegate+SurfaceOwnership.swift
  • Sources/Surfaces/CloudAgentNameContext.swift
  • Sources/Surfaces/CloudPaneCreationFailure.swift
  • Sources/Surfaces/CloudPaneCreationFailureStore.swift
  • Sources/Surfaces/CloudPlacementCoordinator.swift
  • Sources/Surfaces/CloudRenameCoordinator.swift
  • Sources/Surfaces/CloudTerminalAttachmentResolver.swift
  • Sources/Surfaces/CloudTerminalLayoutCreation.swift
  • Sources/Surfaces/CloudTerminalLayoutCreationResult.swift
  • Sources/Surfaces/CloudTerminalPaneClosure.swift
  • Sources/Surfaces/CloudTerminalPaneReservation.swift
  • Sources/Surfaces/CloudVMTabState.swift
  • Sources/Surfaces/CloudWorkspaceBindingReconciliation.swift
  • Sources/Surfaces/CloudWorkspaceDeletionLedger.swift
  • Sources/Surfaces/CloudWorkspaceLayoutTranslator.swift
  • Sources/Surfaces/CloudWorkspaceProjectionCoordinator.swift
  • Sources/Surfaces/CloudWorkspaceProjectionEnvironment.swift
  • Sources/Surfaces/CloudWorkspaceProjectionPlan.swift
  • Sources/Surfaces/CloudWorkspaceRenameService+Admission.swift
  • Sources/Surfaces/CloudWorkspaceRenameService+Reconciliation.swift
  • Sources/Surfaces/CmuxTuiSnapshotParser+Placement.swift
  • Sources/Surfaces/CmuxTuiSurfaceProvider+AgentNaming.swift
  • Sources/Surfaces/CmuxTuiSurfaceProvider+CloseTerminal.swift
  • Sources/Surfaces/CmuxTuiSurfaceProvider+Environment.swift
  • Sources/Surfaces/CmuxTuiSurfaceProvider+FileDelivery.swift
  • Sources/Surfaces/CmuxTuiSurfaceProvider+GuestURL.swift
  • Sources/Surfaces/CmuxTuiSurfaceProvider+LayoutCreation.swift
  • Sources/Surfaces/CmuxTuiSurfaceProvider+ManualMirror.swift
  • Sources/Surfaces/CmuxTuiSurfaceProvider+Notifications.swift
  • Sources/Surfaces/CmuxTuiSurfaceProvider+PendingCreationRecovery.swift
  • Sources/Surfaces/CmuxTuiSurfaceProvider+PlacementSync.swift
  • Sources/Surfaces/CmuxTuiSurfaceProvider+PortForward.swift
  • Sources/Surfaces/CmuxTuiSurfaceProvider+Refresh.swift
  • Sources/Surfaces/CmuxTuiSurfaceProvider+TabRename.swift
  • Sources/Surfaces/CmuxTuiSurfaceProvider+TerminalCreation.swift
  • Sources/Surfaces/CmuxTuiSurfaceProvider+TerminalIO.swift
  • Sources/Surfaces/CmuxTuiSurfaceProvider+TerminalPrimitives.swift
  • Sources/Surfaces/CmuxTuiSurfaceProviders.swift
  • Sources/Surfaces/DockSplitStore+SurfaceOwnership.swift
  • Sources/Surfaces/LocalSurfaceProvider.swift
  • Sources/Surfaces/SurfaceCatalog+CloudBinding.swift
  • Sources/Surfaces/SurfaceCatalog+CloudDirectoryMetadata.swift
  • Sources/Surfaces/SurfaceCatalog+CloudPorts.swift
  • Sources/Surfaces/SurfaceCatalog+CloudRenameSubmission.swift
  • Sources/Surfaces/SurfaceCatalog+CloudWorkspaceProjection.swift
  • Sources/Surfaces/SurfaceCatalog+Groups.swift
  • Sources/Surfaces/SurfaceCatalog+NameAuthority.swift
  • Sources/Surfaces/SurfaceCatalog+Ownership.swift
  • Sources/Surfaces/SurfaceCatalog+ProjectionQueries.swift
  • Sources/Surfaces/SurfaceCatalog+Snapshot.swift
  • Sources/Surfaces/SurfaceCatalog+WorkspaceDeletion.swift
  • Sources/Surfaces/SurfaceCatalog+WorkspaceMembership.swift
  • Sources/Surfaces/SurfaceCatalog.swift
  • Sources/Surfaces/SurfaceCatalogQueryService.swift
  • Sources/Surfaces/SurfaceLayoutTerminalCreating.swift
  • Sources/Surfaces/SurfaceOwnershipPolicy.swift
  • Sources/Surfaces/SurfacePaneFactory+CloudManualMirror.swift
  • Sources/Surfaces/SurfacePaneFactory+ProjectionLayout.swift
  • Sources/Surfaces/SurfacePaneFactory.swift
  • Sources/Surfaces/SurfacePlacementSyncing.swift
  • Sources/Surfaces/SurfaceProjection+WorkspaceMembership.swift
  • Sources/Surfaces/SurfaceProjectionMaterialization.swift
  • Sources/Surfaces/SurfaceProjectionRestoreStore.swift
  • Sources/Surfaces/SurfaceProvider.swift
  • Sources/Surfaces/SurfaceRemotePlacement.swift
  • Sources/Surfaces/SurfaceResource+CloudTitle.swift
  • Sources/Surfaces/SurfaceSocketCommands.swift
  • Sources/Surfaces/TerminalController+CloudTerminalCreation.swift
  • Sources/Surfaces/Workspace+CloudLayoutProjection.swift
  • Sources/Surfaces/Workspace+CloudManualMirror.swift
  • Sources/Surfaces/Workspace+CloudPaneRouting.swift
  • Sources/Surfaces/Workspace+CloudPlacementFailure.swift
  • Sources/Surfaces/Workspace+CloudTerminalCreation.swift
  • Sources/Surfaces/Workspace+CloudTerminalReservation.swift
  • Sources/Surfaces/Workspace+SurfaceCatalog.swift
  • Sources/Surfaces/Workspace+SurfaceOwnership.swift
  • Sources/TaskManagerSnapshot.swift
  • Sources/TaskManagerTypes.swift
  • Sources/TerminalController+ControlSidebarContext3.swift
  • Sources/TerminalController.swift
  • Sources/Workspace+DetachedSurfaceTransfer.swift
  • Sources/Workspace.swift
  • Sources/WorkspaceCloudBindingState.swift
  • Sources/WorkspaceSurfaceResourceDrop.swift
  • Sources/cmuxApp+CloudWorkspace.swift
  • cmux.xcodeproj/project.pbxproj
  • cmuxTests/CLIExplicitSurfaceRoutingTests.swift
  • cmuxTests/CloudCatalogQueryTestProvider.swift
  • cmuxTests/CloudClosedPanelRestoreTests.swift
  • cmuxTests/CloudDirectoryLifecycleTests.swift
  • cmuxTests/CloudDirectoryTestFixture.swift
  • cmuxTests/CloudGuestURLRoutingTests.swift
  • cmuxTests/CloudInitialWorkspaceNamingTests.swift
  • cmuxTests/CloudMachineNotificationEventTests.swift
  • cmuxTests/CloudManualMirrorTransportTests.swift
  • cmuxTests/CloudNameAuthorityFixture.swift
  • cmuxTests/CloudNameAuthorityTestProvider.swift
  • cmuxTests/CloudNameAuthorityTests.swift
  • cmuxTests/CloudNativeLayoutProjectionTests.swift
  • cmuxTests/CloudNotificationDismissParityHarness.swift
  • cmuxTests/CloudNotificationDismissParityTests.swift
  • cmuxTests/CloudNotificationSyncTests.swift
  • cmuxTests/CloudOperationRecorderTests.swift
  • cmuxTests/CloudPaneCreationRetryTests.swift
  • cmuxTests/CloudPlacementCoordinatorTests.swift
  • cmuxTests/CloudPlacementTestProvider.swift
  • cmuxTests/CloudPortOpenRegressionTests.swift
  • cmuxTests/CloudPortRoutePlanTests.swift
  • cmuxTests/CloudPortsVPNAffordanceTests.swift
  • cmuxTests/CloudProviderRefreshCoordinatorTests.swift
  • cmuxTests/CloudRenameOptimismTests.swift
  • cmuxTests/CloudSidebarConsistencyTests.swift
  • cmuxTests/CloudSidebarNativeDropTests.swift
  • cmuxTests/CloudSidebarNotificationTests.swift
  • cmuxTests/CloudSidebarOrderingTests.swift
  • cmuxTests/CloudSidebarRenameFixture.swift
  • cmuxTests/CloudSidebarRenameReconciliationTests.swift
  • cmuxTests/CloudSidebarSurfaceRegressionTests.swift
  • cmuxTests/CloudSurfaceDragFeedbackTests.swift
  • cmuxTests/CloudSurfaceDragFixture.swift
  • cmuxTests/CloudSurfaceMoveOwnershipTests.swift
  • cmuxTests/CloudSurfaceOwnershipTests.swift
  • cmuxTests/CloudTerminalCreationCoordinatorTests.swift
  • cmuxTests/CloudTerminalLayoutCreationTests.swift
  • cmuxTests/CloudTerminalPaneReservationTests.swift
  • cmuxTests/CloudTreeAvailabilityTests.swift
  • cmuxTests/CloudTreeCompactLayoutTests.swift
  • cmuxTests/CloudTreeMachineMenuTests.swift
  • cmuxTests/CloudTreeMachineResourcesTests.swift
  • cmuxTests/CloudTreeNativeDragOwnershipTests.swift
  • cmuxTests/CloudTreeOneMachineManyWorkspacesTests.swift
  • cmuxTests/CloudTreeWorkspaceTitleLayoutTests.swift
  • cmuxTests/CloudVMStateSnapshotComparisonTests.swift
  • cmuxTests/CloudWorkspaceBindingRegressionTests.swift
  • cmuxTests/CloudWorkspaceDeleteOptimismTests.swift
  • cmuxTests/CloudWorkspaceDeleteTestProvider.swift
  • cmuxTests/CloudWorkspaceDeletionLedgerTests.swift
  • cmuxTests/CloudWorkspaceLayoutTranslatorTests.swift
  • cmuxTests/CloudWorkspaceLiveProjectionTests.swift
  • cmuxTests/CloudWorkspaceMembershipTests.swift
  • cmuxTests/CloudWorkspaceRenameSurfaceParityTests.swift
  • cmuxTests/CloudWorkspaceRestoreNamesTests.swift
  • cmuxTests/CmuxTuiSurfaceProviderTests.swift
  • cmuxTests/DiffViewerURLSchemeHandlerLifecycleTests.swift
  • cmuxTests/LastSurfaceClosePreferenceTests.swift
  • cmuxTests/LocalSurfaceProviderTests.swift
  • cmuxTests/MachineCreateCoordinatorTests.swift
  • cmuxTests/MachinesPanelModelTests.swift
  • cmuxTests/SetAutoTitleSocketTests+CloudSidebar.swift
  • cmuxTests/SurfaceCatalogQueryServiceTests.swift
  • cmuxTests/SurfaceCatalogTests.swift
  • cmuxTests/SurfacePaneFactoryFocusTests.swift
  • cmuxTests/SurfaceSocketCommandTests.swift
  • cmuxTests/TabManagerSessionSnapshotTests.swift
  • cmuxTests/TaskManagerResourcesTests.swift
  • cmuxTests/WorkspaceCreateInitialInputTests.swift
  • cmuxTests/WorkspaceTitleProvenanceTests.swift
  • cmuxUITests/NewMachineSheetKindUITests.swift

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.

@github-actions

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@greptile-apps

greptile-apps Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

The PR is not safe to merge until the UI-test module linkage is corrected and the explicit repository rule against public static helper namespaces is satisfied.

Findings

  1. P1 UI Test Target Cannot Compile ▶
  2. P2 Public Static Namespaces Violate Rule ▶

Summary

This PR extracts the surface catalog’s shared value model and snapshot parser into a new local Swift package, updates app, CLI, and test imports, and wires the package into CI and the principal Xcode targets.

  • Adds CmuxSurfaceCatalogModel with the moved model, parser, port helpers, and focused identity test.
  • Makes the cross-module model API public and supplies explicit public memberwise initializers.
  • Links the app, CLI, and unit-test targets to the package.
  • Leaves the UI-test target unlinked despite adding a direct module import.
  • Exposes static helper namespaces contrary to the repository’s ambient-global API rule.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    P[CmuxSurfaceCatalogModel]
    A[cmux app]
    C[cmux-cli]
    T[cmuxTests]
    U[cmuxUITests]

    P --> A
    P --> C
    P --> T
    P -. missing linkage .-> U
Loading

Reviews (1) · Last reviewed commit: "refactor: move the surface catalog's val..."

@@ -1,3 +1,4 @@
import CmuxSurfaceCatalogModel

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 UI Test Target Cannot Compile

This file now imports CmuxSurfaceCatalogModel, but the cmuxUITests target has neither a package product dependency nor a framework entry for that module. Building the UI-test target therefore fails with no such module 'CmuxSurfaceCatalogModel'. Link the package to cmuxUITests, or remove the unused import.

/// Relationship changes can move many resources at once. These use the authoritative full
/// rebuild path instead of risking a partial placement update.
var requiresFullResourceRebuild = false
public var requiresFullResourceRebuild = false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Public Static Namespaces Violate Rule

Moving these helpers into the package exposes CmuxTuiSnapshotParser as a public, static-only namespace. CloudWireNumber in SurfaceCatalogModel.swift is likewise exposed as a public enum containing only static conversion functions. This violates the repository directive against widening static helper namespaces merely to cross a module boundary; the behavior must instead belong to an appropriately scoped, constructable type. This repository requirement must be satisfied before merging.

Rule Used: Flag new ambient global state in production Swift: a top-level (file-scope) func used as API, a top-level mutable var or a stub class/struct holding a global flag/once-token, a caseless enum/empty struct used purely as a static func/static let namesp... (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Continued in #13135 (in-org branch).

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