refactor: extract BrowserSystemProxyMirror and RemoteTmuxNotificationOSCFilter into packages

Merged
TE
2mo ago
+18-24

Moves two self-contained value types out of the app module into the packages that already own their area. Pure move + access-level pass; no behavior change.

typefromtoapp-host tests unblocked
BrowserSystemProxyMirrorSources/Panels/CmuxBrowser/Sources/CmuxBrowser/Proxy/30
RemoteTmuxNotificationOSCFilterSources/CmuxRemoteSession/Sources/CmuxRemoteSession/RemoteTmux/20

Both have zero app-target references (Foundation / CFNetwork / Network only), and every call site already imports the destination package, so no app file needed a new import:

  • Sources/Panels/BrowserPanel.swift already import CmuxBrowser
  • Sources/RemoteTmuxSessionMirror.swift, Sources/RemoteTmuxSessionMirror+OutputRouting.swift already import CmuxRemoteSession

This is the type-extraction half of RFC #13108 applied to the test-placement problem in #13519. The tests are not moved here — the two existing cmuxTests files just gain the package import so they keep compiling. Relocating the suites into CmuxBrowserTests / CmuxRemoteSessionTests is a follow-up.

Why these two: the leverage ranking

Re-derived from the app-host test audit's per-suite placement data (a Swift-tokenizer symbol index over 1,308 cmuxTests suites resolved against 179 package targets and the app target). 1,148 tests in 209 suites are blocked only by app types that are not host-coupled — class "(b) movable after a small extraction". Ranking each suite by the tests unblocked once its whole app-type closure is extracted:

teststypes to extractsuitedestination
381 member (dragged)SidebarWorkspaceDropPlannerTestsCmuxSidebarProviderKit
301 typeBrowserSystemProxyMirrorTestsCmuxBrowser — this PR
287 types (+10 members)CloudTunnelCoordinatorTestsnew/none
271 member (surfaceUUID)FeedEventClassificationTestsnone
222 membersClaudeHookLifecycleCleanupTestsnone
201 member (maxTitleLength)AutoNamingEngineTestsnone
201 typeRemoteTmuxNotificationOSCFilterTestsCmuxRemoteSession — this PR
205 types (+10 members)CloudEnvDeliveryTestsnew/none
193 types (+10 members)TabManagerSurfaceCreationTestsnone
183 types (+7 members)AgentNotificationGateTestsCmuxSettings
171 type + 1 free fnDebugDogfoodCredentialResolverTestsnone (#if DEBUG)
161 free fnBrowserSimpleUserGesturePopupRetargetingTestsCmuxBrowser
161 memberSidebarBranchOrderingTestsCmuxSidebar
155 types (+3 members)PhonePushSerialDeliveryQueueTestsCmuxPhonePush

The two in this PR are the only entries at the top of that list whose entire closure is one file with no app references and an existing destination package — i.e. the whole cut is a git mv plus public. The 38-test and 27-test rows above are single members (app-only extensions on package types), a different and smaller kind of move; the larger rows need multi-type clusters and a new package.

Correction to the audit's "247 tests behind RestorableAgentSessionIndex"

Worth recording, because it redirects the next slice. Simulating the cut — de-host a type and drop its edges into host-coupled types, then reclassify every suite — gives 0 newly movable tests for RestorableAgentSessionIndex's three host neighbours individually:

      0  CmuxTopProcessSnapshot
      0  SessionIndexStore
      0  AgentHibernationController

The 247 counted tests standing behind the edge, not tests the cut frees: those suites reach host code by several routes, so removing one route changes nothing. RestorableAgentSessionIndex is also a 2,655-line struct spread over ~10 extension files (sqlite, Codex/Claude/OpenCode transcript scanning, process census) — not a reviewable slice, and not the cheap one.

Where the entangled 1,097 actually unblock, greedily (same simulation, marginal tests per cut):

step1  +AuthEnvironment                      113
step2  +RemoteInteractiveShellBootstrapBuilder  213
step3  +ManagedFileTransferPolicy            286
step4  +GhosttyConfig                        345
step5  +RemoteTmuxController                 397
step6  +BrowserHistoryStore                  442

AuthEnvironment is the single highest-leverage seam in the app module for this purpose (113 tests on its own), not the session-index cluster.

Blocked by in-flight work

AgentNotificationGate (18 tests, destination CmuxSettings) is a clean extraction except that Sources/TerminalController.swift is one of its three call sites and would need the new import. That file belongs to an in-flight PR, so it is left for a follow-up. Same for KeyboardShortcutSettingsFileStore (13 tests) via Sources/KeyboardShortcutSettings.swift.

Checks

  • swift test in Packages/macOS/CmuxBrowser — 308 tests in 45 suites, pass
  • swift test in Packages/macOS/CmuxRemoteSession — 181 tests in 29 suites, pass
  • Access-level pass verified by compiling a throwaway cross-module probe against each package's public surface (== on the synthesized Equatable, Proxy cases, implicitExclusions, proxyConfigurations(), filter(_:onNotification:), maxBufferedBytes), then removed
  • python3 scripts/normalize-pbxproj.py, python3 tests/test_normalize_pbxproj.py, ./scripts/check-pbxproj.sh
  • ./tests/test_ci_pbxproj_test_wiring.sh, python3 scripts/check-workspace-package-groups.py --check
  • python3 scripts/ci/validate_test_execution_registry.py (no registry change: no test files added)

Related: #13108, #13519.

🤖 Generated with Claude Code


Summary by cubic

Moves BrowserSystemProxyMirror into CmuxBrowser and RemoteTmuxNotificationOSCFilter into CmuxRemoteSession so their app-host tests can move out of cmuxTests later. Pure relocation plus an access-level pass; no behavior change.

  • Both types had zero app-target references, and their call sites already imported the destination packages.
  • Public signatures now use public import Foundation and public import Network; CFNetwork stays internal.
  • The two cmuxTests suites gain the package import to keep compiling; moving the test suites themselves is a follow-up.