Skip to content

fix(desktop): capture self weakly in the outer closure so main compiles under Xcode 27 - #14322

Merged
Git-on-my-level merged 2 commits into
mainfrom
fix/desktop-xcode27-capture-ownership
Sep 17, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
fix/desktop-xcode27-capture-ownership

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Summary

main does not compile under Xcode 27 (Swift 6.3). Three call sites put [weak self] on an inner closure while the enclosing escaping closure captured self strongly, which the newer compiler rejects:

error: 'weak' ownership of capture 'self' differs from implicitly-captured strong reference in outer scope
  • AppState+Transcription.swift — the microphone and system-audio onAudioChunk handlers.
  • FloatingControlBar/NetworkReachability.swift — NWPathMonitor.pathUpdateHandler.

The fix moves [weak self] to the outer closure at each site. That is also what the code already meant: with a strong capture in the outer closure the inner weak protected nothing. Both objects live for the app's lifetime, so runtime behaviour does not change.

The CI-pinned Xcode 26.6 accepts the old form, so every lane was green while local builds on the newer toolchain failed. The new form is valid on both.

Failure-Class: new

Product invariants affected

  • INV-CHAT-1

Cited only because NetworkReachability.swift lives under desktop/macos/Desktop/Sources/FloatingControlBar/**, which that invariant locks. The change is a capture list on a reachability callback; it does not touch transcript ownership, the chat shell, or any rendered surface.

Evidence

  • Xcode 27.0 (27A266a), this branch: xcrun swift build -c debug --build-tests --package-path Desktop → Build complete! (318.84 sec). On origin/main @ 492c62f the same command fails at the sites above (first in AppState+Transcription.swift:546 and :601, then NetworkReachability.swift:42 once those compile).
  • Xcode 26.6 (the CI pin): not available on this machine; this PR's Desktop Swift CI run is the verdict for that toolchain.

Layer measured: compilation of app and test targets only. No tests were run locally and no app was launched.

🤖 Generated with Claude Code

Review in cubic

Git-on-my-level and others added 2 commits September 17, 2026 15:16
…es under Xcode 27

Three sites wrote [weak self] only on an inner closure while the enclosing
escaping closure captured self strongly. Swift 6.3 rejects the mismatch; the
CI-pinned Xcode 26.6 accepts it, so CI stayed green while local builds on the
newer toolchain failed. Move the capture list to the outer closure.

Failure-Class: new

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 9a7a85c into main Sep 17, 2026
41 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/desktop-xcode27-capture-ownership branch September 17, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant