Repository navigation
fix: use weak var instead of weak let for macOS 26 / Swift 6 compat - #9653
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Repository: manaflow-ai/cmux/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughFour test weak-reference bindings changed from ChangesWeak reference binding fixes
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 25✅ Passed checks (25 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
A weak reference can become nil at runtime when the referenced object is deallocated, so its storage must be mutable. Newer Swift toolchains (e.g. the macOS 26 SDK) enforce this and reject weak let: error: 'weak' must be a mutable variable, because it may change at runtime CI's macOS 15.7.4 still accepts weak let, so this is latent there; on macOS 26 it aborts the test-target compile (e.g. cmuxTests/AppDelegateEqualizeSplitsShortcutTests.swift:4922). Replaces weak let with weak var at all five sites. None are reassigned, so this is a compile-time correctness fix with no behavioral change. No regression test: the difference is only observable on a newer SDK than CI's, where the code already compiles.
2ce8a8f to
a7fb822
Compare
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Rebased onto latest |
|
Thanks for this! We checked the |
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document v2.2 and I hereby sign the CLA |
|
Thank! Sorry there was a delay XD |
|
Review: The four weak-reference declarations are the required Swift 6 compile fix and preserve test intent. Fixed: no additional changes needed. Left: required CI is still blocked/pending. |
|
Taking this: updating the reviewed weak-reference compile fix with main and checking the remaining package test sites.
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merge receipt for
Labeled |
|
Thanks @XueyanZhang. I updated this with main. Three package lifetime tests still need your
|
644fd5e Remove inline Open in cmux action from port rows (manaflow-ai#16350) 59821f4 fix: use weak var instead of weak let for macOS 26 / Swift 6 compat (manaflow-ai#9653) e7a4e0a fix(cmux-tui): satisfy reconnect clippy lint (manaflow-ai#16758) ee61823 fix(cloud): name the first machine workspace workspace-1 (manaflow-ai#16754) 8f28c09 test: isolate fake-socket CLI tests from the launching cmux shell (manaflow-ai#16562) 22d59ac Fix Return key for machine deletion confirmation (manaflow-ai#16683) 5049234 Cloud: 5 VMs per seat (4 vCPU/8 GB), Max 16 vCPU/32 GB, no free machines (manaflow-ai#16207) 13d77d6 fix: make dashboard team switching finish before refresh (manaflow-ai#16680) 3952ab3 Fix initial Cloud workspace layout restore (manaflow-ai#16690) 4ac2ec4 Fix optimistic selection for Cloud workspace creation (manaflow-ai#16672) b34697f Remove Cloud agent star button (manaflow-ai#16700) # Conflicts: # .github/workflows/ci-guards.yml
Closes #9652
Summary
weak letis rejected by the Swift compiler on newer toolchains (e.g. the macOS 26 SDK): aweakreference can becomenilat runtime when the referenced object is deallocated, so its storage must be mutable. The compiler error isCI runs on macOS 15.7.4 where these still compile, so this is latent there — it only surfaces on macOS 26, where it blocks the test-target compile (e.g.
cmuxTests/AppDelegateEqualizeSplitsShortcutTests.swift:4922fails first and aborts the wholecmux-unitbuild).Changes
Replaces
weak letwithweak varat the four remaining sites. None of the variables are reassigned, so the change is purely a compile-time correctness fix with no behavioral difference:cmuxTests/AppDelegateEqualizeSplitsShortcutTests.swiftweakRemovablePanelPackages/macOS/CmuxCommandPalette/Tests/.../CommandPaletteInteractionMonitorTests.swiftweakMonitorPackages/macOS/CmuxSimulator/Tests/.../SimulatorWorkerClientContainmentTests.swiftweakClientPackages/iOS/CmuxMobileShell/Tests/.../MobileMacConnectionPoolTests.swiftweakShellThe fifth site originally reported (
Packages/iOS/CmuxMobileSupport/Sources/.../ComposerDictationController.swift) was already fixed onmain(nowweak var), so this PR covers the remainder.Why no regression test
Compile-time fix only. On CI's macOS 15.7.4 the code already compiles, so there is no observable runtime behavior to assert; a "test" would just duplicate a compile that already passes. Per the project's test-quality policy, no fake regression test is added.
Test plan
swift build --build-testsforCmuxCommandPaletteon macOS 26 — its test target (containing one of theweak varsites) compiles clean.weak let→weak var, the exact form the compiler error mandates; none of the variables are reassigned.weak let).Summary by CodeRabbit