base red: move #26770's GitHub connection logic into CmuxNextAccounts (tip arch red from 8219b5769870)

Merged
LA
2d ago
+92-72

Summary

The feat-cmux-next tip 152c5059d1c7 is red in arch-ratchet: [app_lines] CmuxNextApp Swift lines: +79 (CmuxNextApp +79), 14 allowed by the exceptions this push adds, judged over the last green arch tip 44647965b353. #28410 brings +14 and its own exception covers it. #26770 (8219b5769870) brings the other +65.

This PR moves the App-side logic of #26770 into CmuxNextAccounts, which already owns GitHubConnections. Behavior does not change: the code moves as it is.

  • GitHubConnections+Live.swift (new): signedInScope and live(auth:ownerAPI:preview:), the owner-API call (bearer token, x-cmux-team, idempotency key, refusal versus retryable status), and the open through LinkRouter. They were an extension at the end of AccountsService.swift.
  • GitHubConnections+Entrypoints.swift (new): connectResult(), the accounts.githubConnect action result that was AccountsHandlers.githubConnectResult; accountsPageState(_:) and runAccountsPage(_:accounts:), the Settings Accounts page state and gestures (GitHub gestures, then AccountsPageAction, then the GitHub refresh after refresh, focus or a team switch) that were inline in PageFactory.
  • The App now only binds them: one lazy var github line in AccountsService, the action bind in AccountsHandlers, and two provider lines in PageFactory.
  • CmuxNextAccounts now depends on CmuxNextActions (core) and CmuxNextPages (ui), for ActionResultValue/ActionWorkFailure, PageError and LinkRouter. There is no cycle, and no layer row goes up. The comment that lists the package graph is updated to match.
  • GitHubConnectionsTests calls model.connectResult() in place of AccountsHandlers.githubConnectResult(model). The test stays in CmuxNextAppTests (its other subjects did not move).

No accounts owner is listed in plans/cmux-next/OWNERS.md.

Testing

Arch ratchet, run as tip-watcher.py runs it (python3 -I scripts/cmux-next/arch-ratchet.py --repo WT --base B --head H):

RangeBefore (tip 152c5059d1c7)After (head)
44647965b353..H (the watcher's range)app_lines +79, 14 allowed: push refusedapp_lines -18 (with the 14 of #28410's exception counted): no architecture count rises
8219b5769870^..H (#26770 alone)app_lines +65: push refusedno architecture count rises (App lines 158008, the same as at 3a4a117c97f4)
152c5059d1c7..H (this PR)n/aapp_lines -65: no architecture count rises

--audit at the head: app_lines 158008 (tip 158073, last green 158026); blocking_allow_escapes 1 and observer_sites 354, the same as the tip and the last green tip. No other row goes up.

python3 scripts/cmux-next/prepush-gate.py: no new violations. risk_tier.py classify: normal.

Fleet, at the head:

  • Compile: cmux-ci compile-check --app --package CmuxNext --recipe-version 2, job 4038af54fb5e1d866f96108e: passed (CmuxNext 261 s, app 34 s, cmux-tui 14 s)
  • Tests: scripts/ci/package-test-lane.sh suite Packages/macOS/CmuxNext GitHubConnectionsTests, job 5b978e985761487ae9057a8c (class light, aws-m4pro-9): "Test run with 19 tests in 1 suite passed", exit 0

Observed / Not run

Observed: the arch ratchet ranges and the audit above, the prepush gate, the risk classifier, and the fleet compile and test jobs above.
Not run: a tagged build, and a live GitHub connect from Settings. The change moves code and does not change behavior, so the fleet compile and the existing GitHubConnectionsTests are the evidence.

Changelog

none

Proof

No capture: the code moves out of the App, and the UI does not change.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Moves #26770's GitHub connection logic from the App into CmuxNextAccounts, fixing the architecture-ratchet violation that made the feat-cmux-next tip red. Behavior does not change; the code moves as-is.

  • New GitHubConnections+Live.swift and GitHubConnections+Entrypoints.swift hold the live connection factory, the accounts.githubConnect result, and the Settings Accounts page state and gestures.
  • The App now binds them only: one lazy var github line, one action bind, and two provider lines in PageFactory.
  • CmuxNextAccounts now depends on CmuxNextActions and CmuxNextPages; no cycles and no layer counts rise.
  • GitHubConnectionsTests calls model.connectResult() and stays in CmuxNextAppTests.