Skip to content

fix: guard the Network import in DebugClient with canImport(Network) - #246

Draft
cristim wants to merge 2 commits into
OpenSwiftUIProject:mainfrom
cristim:fix/debugclient-network-guard
Draft

cristim wants to merge 2 commits into
OpenSwiftUIProject:mainfrom
cristim:fix/debugclient-network-guard

Conversation

@cristim

@cristim cristim commented Nov 4, 2026 •

Copy link
Copy Markdown

DebugClient.swift is gated on canImport(Darwin) but imports Network, which is not present in every Darwin-targeting SDK. Building for an arm64-apple-macosx target whose SDK has no Network.framework fails with no such module 'Network'.

This widens the guard to canImport(Darwin) && canImport(Network), the modules the file needs. One line. On SDKs that have Network.framework the condition is unchanged.

Testing: not built. There is no Swift toolchain on the machine where this was prepared, so the change was checked by reading only.

DebugClient's TCP client is gated on canImport(Darwin), but it imports
Network, which is not present on every Darwin-targeting SDK. Building for
an arm64-apple-macosx target whose SDK has no Network.framework fails with
"no such module 'Network'" before any of the debug code is reached.

Widen the guard to the module the file actually needs.

(cherry picked from commit 23d0ca0)
The test target compiles DebugClient.swift through a symlink and uses
DebugClient, which now compiles out when Network is unavailable. Use the
same guard in the test file so the target still builds on such SDKs.
@cristim

cristim commented Nov 4, 2026

Copy link
Copy Markdown
Author

Review verdict for head 55cd87b: the cold review found that the test target compiles DebugClient.swift through a symlink and DebugServerTests.swift had only the Darwin guard. Fixed in a follow-up commit (same guard on the test file). Guard structure balances, no behavior change on SDKs with Network.framework. Not built: no Swift toolchain available.

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