base red: Session Info's Remote Control is injected, not a singleton (#28981 stateful_singletons, assume_isolated)

Merged
LA
6d ago
+62-39

Summary

Base red, priority zero (TIP RED 1442 follow-up, third part). Stacked on #29364: its diff shows #29364's commit until #29364 merges, then only this commit (8e0c83b8eef).

By the repo rule for commit aa59bc63cfc (#28981) alone, that commit adds three rows: app_lines +34 (fixed by #29364), plus two rows in CmuxNextAgentPane that this PR fixes:

  • stateful_singletons +1: AgentPaneRemoteControl.shared.
  • assume_isolated_outside_adapters +1: its nonisolated deinit's MainActor.assumeIsolated.

Fix (injection, no exception row):

  • The iPhone host owns the one AgentPaneRemoteControl (IPhoneHostService.remoteControl) and wires it as #29364 does. The App gives it to every chat page's model (AgentPaneModel.remoteControl), set in makeView with readAloud and cloudMachines.
  • The page host, the legacy bridge and pane.setRemoteControl read the model's control. A model with none sends null (no row) and writes nothing.
  • No deinit: the instance lives as long as the app, and follow()'s task holds it weakly.
  • PairingQRCode (the Mobile Pairing page's QR code, pure CoreImage) moves to CmuxNextMobileHost, next to the pairing invite. Because of this move, the injection's 3 App lines do not raise app_lines: CmuxNextApp -29 in this commit.

No behavior change for a person. Every chat page the App makes gets the same instance that the old singleton was.

Testing

arch-ratchet at the head (8e0c83b8eef):

  • --base origin/base-red/remote-control-app-lines (this commit): stateful_singletons -1, assume_isolated_outside_adapters -1, app_lines -29, no architecture count rises.
  • This branch merged locally with #29365's branch and origin/feat-cmux-next, over the watcher's range from 2a5cdb20f8b7: app_lines -20, no architecture count rises. The tip check is green once all three land.

prepush-gate.py (pre-push): no new violations.

Observed / Not run

Observed:

  • The arch-ratchet runs and the prepush gate above.
  • Fleet compile: cmux-ci compile-check --ref 8e0c83b8eef2e6d09658717a738250bb5e3aba7c --app: compile check app: passed (56 s).
  • Fleet tests: package-test-lane.sh suite Packages/macOS/CmuxNext AgentPaneRemoteControlTests,IPhoneHostRemoteControlTests,IPhoneHostChiefTests, step 6b46b4a792f44aa541bf20e8 on aws-m4pro-3: 6 of 6 (with the new no-switch case), 1 of 1 and 2 of 2 passed.
    Not run: no local Swift build or test (fleet only). No tagged build: no behavior change.

Changelog

none

Proof

No capture: no visible change; the same control reaches each page by injection instead of a singleton.

Takes back #28981: moves the code #28981 added (no behavior change) so the arch ratchet on feat-cmux-next is green again; #28981 raised app_lines, stateful_singletons and assume_isolated_outside_adapters (TIP RED 1442).