base red: the per-machine network policy queue moves to CmuxNextCloud as an instance (#28270 global_mutable_statics)

Merged
LA
6d ago
+82-24

Summary

Base red, priority zero (TIP RED 1442 follow-up). arch-ratchet refuses the feat-cmux-next tip over 2a5cdb20f8b7: [global_mutable_statics] +1 (CmuxNextApp +1) at CmuxNextApp/Handlers/CloudNetworkAccessActions.swift:42, private static var tails. The repo rule, run on commit 886a8b6d36f (#28270, "Internet Access… sets a Cloud machine's network level") alone, refuses the same row. The commit has no exception entry.

Takes back #28270: its per-machine queue was a static var in CmuxNextApp (a global mutable static that the arch ratchet refuses). This PR moves the queue, with the same behavior, into an instance that CmuxNextCloud owns. Nothing the person sees changes.

Fix forward with a move (no exception row):

  • CloudNetworkAccessQueue (new, CmuxNextCloud, @MainActor final class) has the same serialized(_:_:): one read-then-write per machine at a time, and the tail ends with its run.
  • CloudService owns the one instance (cloud.networkAccess). CloudNetworkAccessActions.set reaches it through its AppActionContext (context.services.cloud.networkAccess).

Testing

arch-ratchet at the head (684247155ea):

  • before, the culprit alone (--base 886a8b6d36f^ --head 886a8b6d36f): [global_mutable_statics] +1 ... push refused.
  • --base origin/feat-cmux-next --head HEAD: global_mutable_statics -1, app_lines -20, no architecture count rises.
  • Over the watcher's range (--base 2a5cdb20f8b7 --head HEAD, which includes the merged #29365 and #29375): app_lines -15, no architecture count rises.

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

Tests (CloudNetworkAccessTests):

  • runsOnOneMachineReadAfterTheEarlierWrite (existing): now uses its own queue, and also checks that the tail ends with its run.
  • runsOnDifferentMachinesDoNotWaitForEachOther (new): a run on another machine completes while the first machine's run is still open.
  • aFailedRunDoesNotHoldTheNextOne (new): a run that throws ends its tail, and the next run on that machine starts.

Observed / Not run

Observed:

  • The arch-ratchet runs and the prepush gate above.
  • Fleet compile: cmux-ci compile-check --ref 684247155ea75e73e491712a310cb57f07b1e252 --app, job 5e3d6f93a1a41ca931905db7: compile check app: passed (58 s).
  • Fleet tests: package-test-lane.sh suite Packages/macOS/CmuxNext CloudNetworkAccessTests, step 1d48a3c5e47fe377691322da on aws-m4pro-2: 14 of 14 passed, including runsOnOneMachineReadAfterTheEarlierWrite, runsOnDifferentMachinesDoNotWaitForEachOther and aFailedRunDoesNotHoldTheNextOne.
  • The head 07132c3ded0 is only cmux-bot's merge of feat-cmux-next on top of 684247155ea; the PR's own files are unchanged by it.
    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 queue moves from a static in the App to an instance that the cloud service owns.