Conversation
…ort-adapters' into HEAD
There was a problem hiding this comment.
Pull request overview
Adds Bonjour TXT-record discovery metadata to the internal Network transport so NWBrowser results can be mapped to stable, framework-neutral PeerIdentity values and later resolved back to NWEndpoint for connection attempts.
Changes:
- Introduces
PeerNetworkDiscoveryInfoto encode/decode identity + protocol version into Bonjour TXT records. - Advertises local discovery metadata from
NetworkPeerListenerand parses it inNetworkPeerBrowserTransport. - Adds/updates XCTest coverage for discovery TXT record behavior and browser adapter behavior (including self-discovery ignore).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Sources/PeerNetworkProtocol.swift | Adds PeerNetworkDiscoveryInfo TXT record encode/decode and validation logic. |
| Sources/NetworkPeerTransportAdapters.swift | Parses Bonjour metadata from NWBrowser.Result, ignores self results, and maps PeerIdentity to NWEndpoint for invitePeer. |
| Sources/NetworkPeerTransport.swift | Advertises discovery TXT record via NWListener.Service(..., txtRecord:) when identity is provided. |
| PeerConnectivityTests/PeerNetworkProtocolTests.swift | Adds round-trip / validation tests for discovery TXT records. |
| PeerConnectivityTests/NetworkPeerTransportAdapterTests.swift | Updates browser transport tests to use explicit identities and adds self-ignore coverage. |
Suppressed comments (1)
Sources/PeerNetworkProtocol.swift:65
- Discovery TXT record validation currently checks
String.countfor identifier/displayName length. Since the advertised values are constrained in UTF-8 bytes, the validation should also useutf8.countto avoid accepting values that will exceed DNS-SD TXT byte limits (especially for non-ASCII display names).
protocolVersion == PeerNetworkHandshake.currentProtocolVersion,
!identifier.isEmpty,
!displayName.isEmpty,
identifier.count <= PeerNetworkDiscoveryInfo.maxIdentifierLength,
displayName.count <= PeerNetworkDiscoveryInfo.maxDisplayNameLength else { return nil }
💡 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 #29. 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 Bonjour discovery identity metadata for the Network transport stack so discovered Network browser results can map to framework-neutral
PeerIdentityvalues and endpoints.Changes
PeerNetworkDiscoveryInfofor TXT record encode/decode.NetworkPeerListener.NWBrowser.ResultBonjour metadata inNetworkPeerBrowserTransport.PeerIdentity -> NWEndpointmappings for laterinvitePeerconnection attempts.Non-goals
Verification
swift test— 88 tests passedxcodebuild test -project PeerConnectivity.xcodeproj -scheme PeerConnectivity -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.3.1' -configuration Debug— 88 tests passedStack context
Stacked on PR #27 (
feature/network-migration-transport-adapters). This is the discovery metadata slice in the Network migration stack.