Verify Network backend local loopback - #31
Closed
rchatham wants to merge 2 commits into
Closed
Conversation
rchatham
force-pushed
the
feature/network-migration-local-loopback
branch
from
August 6, 2026 21:11
e260287 to
83edcbb
Compare
…d-selector' into HEAD # Conflicts: # PeerConnectivity.xcodeproj/project.pbxproj # PeerConnectivityDemo/ViewController.swift # Sources/NetworkPeerCoordinator.swift # Sources/PeerConnectionManager.swift
There was a problem hiding this comment.
Pull request overview
Adds an initial end-to-end loopback verification path for the experimental Network.framework backend, while addressing discovery/identity mapping and a coordinator observer reentrancy crash encountered during simulator/local Network.framework debugging.
Changes:
- Update Network browsing to request Bonjour TXT records and adjust Network-backed peer identity to avoid TXT truncation/self-discovery confusion.
- Prevent coordinator queue reentrancy crashes by emitting observer events outside the coordinator’s serial queue; switch experimental Network parameters to TCP.
- Add Network backend loopback XCTest coverage and document/demo runtime switches (including explicit plaintext/unauthenticated warnings).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Sources/PeerConnectionManager.swift | Adds explicit warnings about Network backend security properties and uses a Network-specific peer identity initializer when backend is .networkFramework. |
| Sources/Peer.swift | Introduces a Network-specific local peer initializer using a UUID-backed PeerIdentity identifier. |
| Sources/NetworkPeerTransport.swift | Switches Network transport parameters to TCP and uses bonjourWithTXTRecord for discovery metadata. |
| Sources/NetworkPeerCoordinator.swift | Avoids observer delivery while holding the coordinator serial queue by emitting events after the synchronized state update. |
| README.md | Documents the experimental Network backend and clearly warns about current lack of encryption/authentication. |
| PeerConnectivityTests/NetworkPeerLoopbackTests.swift | Adds a first e2e loopback test for Network-backed managers (discovery, connect, typed message exchange, stop). |
| PeerConnectivityDemo/ViewController.swift | Adds launch-argument support for Network backend selection, auto-start, and explicit display name for simulator debugging. |
| PeerConnectivity.xcodeproj/project.pbxproj | Registers the new loopback test file in the Xcode test target. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Owner
Author
|
Superseded by consolidated PR #42. No commits were discarded; this branch is preserved as a recovery and reference point. Addressed review findings were replied to and resolved before consolidation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the first end-to-end Network backend loopback verification and fixes the issues found while debugging discovery/connectivity on simulator/local Network.framework runs.
Changes
NWBrowser.Descriptor.bonjourWithTXTRecordso browser results include the discovery TXT metadata needed to map endpoints toPeerIdentity.MCPeerIDidentifiers, avoiding TXT-record truncation and self-discovery confusion..networkFrameworkis unencrypted/unauthenticated and not for sensitive data until hardening lands.NetworkPeerLoopbackTeststhat verifies two Network-backed managers can:PeerMessagePCNetworkBackendPCAutoStartPCDisplayName <name>Debug findings
metadata: <none>because the browser descriptor was not requesting TXT records.NWErrorinternal TLS errors when using bare TLS options without an identity/trust configuration.dispatch_sync called on queue already owned by current thread; coordinator events now leave the serial queue before notifying observers.Verification
swift test— 95 tests passedxcodebuild test -project PeerConnectivity.xcodeproj -scheme PeerConnectivity -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.3.1' -configuration Debug— 95 tests passedswift test --filter NetworkPeerLoopbackTestsafter doc updates — passedPeerConnectivityDemofor iOS SimulatorLimitations / follow-ups
Stack context
Stacked on PR #29 (
feature/network-migration-backend-selector). This is the local loopback verification slice of the Network migration stack.