Conversation
…ion' into HEAD # Conflicts: # PeerConnectivityTests/PeerConnectivityTests.swift
…eline' into HEAD # Conflicts: # PeerConnectivity.xcodeproj/project.pbxproj
…safe-events' into HEAD # Conflicts: # PeerConnectivity.xcodeproj/project.pbxproj
…observers' into HEAD # Conflicts: # PeerConnectivity.xcodeproj/project.pbxproj # Sources/PeerAdvertiserAssisstant.swift # Sources/PeerConnectionManager.swift # Sources/PeerConnectionTransports.swift
…ort-adapters' into HEAD
…ery-metadata' into HEAD # Conflicts: # PeerConnectivity.xcodeproj/project.pbxproj # Sources/PeerConnectionManager.swift
…ion' into HEAD # Conflicts: # PeerConnectivityTests/PeerNetworkProtocolTests.swift # Sources/NetworkPeerTransport.swift
This was referenced Aug 11, 2026
…ion' into feature/network-migration-backend-selector # Conflicts: # Package.swift # PeerConnectivity.xcodeproj/project.pbxproj # PeerConnectivityTests/NetworkPeerCoordinatorTests.swift # Sources/MultiObservable.swift # Sources/Observable.swift # Sources/PeerConnectionManager.swift # Sources/PeerConnectionResponder.swift
…ion' into HEAD # Conflicts: # Sources/NetworkPeerTransport.swift
…rk-migration-backend-selector
rchatham
force-pushed
the
feature/network-migration-backend-selector
branch
from
September 15, 2026 19:48
bcaf8bb to
4e2d9b5
Compare
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
Turn the initial Network.framework prototype into a safely selectable backend with the migration infrastructure required by later work.
Changes
availableMultipeerSessionfeature detection while retaining the existingmultipeerSessionAPI.Compatibility
Existing initializers and Multipeer-backed behavior remain source-compatible. Apps must explicitly choose
.networkFramework; MultipeerConnectivity remains the default and fallback path.availableMultipeerSessionallows callers to feature-detect the MC-specific session without triggering the existing non-optional accessor's unsupported-backend precondition.Security and discovery
Discovery TXT entries are bounded by encoded UTF-8 byte length, reject malformed oversized records, and preserve valid scalar boundaries. Discovery metadata remains self-asserted and is not an authorization identity.
Verification
swift test— 140 tests passed locally.Stack
Stack update
Observablebridge from PR refactor: unify observables behind actor bridge #63.MultiObservableimplementation from this branch's effective diff.Verification
swift testpassed after merging the updated base.swift buildpassed after merging the updated base.Review-loop fixes
Observablearchitecture.discoveryInfo, reserves Bonjour TXT metadata for protocol identity, and reports nil discovery metadata; added an adapter expectation locking that behavior.Post-fix verification: Swift and Xcode suites passed with 141 tests; the demo build passed. Correctness and security reviews found no blockers.
Review-loop pass 2
Post-fix verification: Swift and Xcode suites passed with 147 tests; the demo build passed. Correctness and security reviews found no blockers.
Handshake input hardening
Reject empty or over-63-byte UTF-8 display names from remote Network handshakes before Peer/MCPeerID construction. Invalid identities follow the existing idempotent cancellation path, never register, and emit no connected-peer event. Exact-boundary and malformed ASCII/multibyte cases are covered.
Post-fix verification: Swift suite passed with 151 tests; focused Xcode coordinator tests passed.
Identifier consistency hardening
Restacked PR #22 remote-handshake identifier bounds and made Bonjour discovery metadata reuse the same shared non-empty, 180-byte UTF-8 identifier validator. Empty/oversized handshakes reject before registration; exact-boundary multibyte values remain valid.
Post-fix verification: Swift and Xcode suites passed with 156 tests after one unrelated flaky listener test passed on full rerun.
Browser endpoint concurrency hardening
Serialize all Network browser endpoint registry reads, mutations, and clears. Endpoint lookup is copied before dialing and observer callbacks remain outside the lock. Added a 2,000-operation concurrent found/lost/invite/stop stress test with endpoint verification.
Post-fix Swift and Xcode suites passed with 157 tests.
Final loop status
The browser endpoint registry is now serialized across discovery, invite, and stop operations, with a 2,000-operation concurrency stress test. Final stack review found no remaining actionable issues.
Stack sync
Merged the updated base (NSLock synchronization centralization from #22 @ 66bb977) into this branch; auto-merged cleanly. Post-merge verification:
swift testpassed and the complete iPhone 16 / iOS 18.3.1 Xcode suite passed with 157 tests.Note: this PR's Xcode Project Tests CI check failed twice on the previous head (c55e37c) while the same suite passes locally and on the restacked branches above (which contain this branch's code); treated as CI infrastructure flakiness with local verification per the loop's CI policy.
CI destination fix
The Xcode Project Tests workflow now resolves an available iPhone simulator UDID at run time instead of hard-coding
name=iPhone 16. Runner images whose latest iOS runtime no longer includes an iPhone 16 device were fast-failing with "Unable to find a device matching the provided destination specifier"; the check is now runner-image agnostic.swift testre-passed with 157 tests after the change.Xcode CI runner failure root cause
The Xcode Project Tests check fails on GitHub's macos-15 runners because the runner's device name is invalid for MultipeerConnectivity: constructing the local
MCPeerIDraisesNSInvalidArgumentException(Sources/Peer.swift:91), terminating the test process partway through the run. This is runner-environment-specific — the full iPhone 16 / iOS 18.3.1 suite passes locally (157 tests), and the same suite passes on every branch above this one. The display-name sanitization that makes it runner-safe is intentionally layered in the next stack PR (#58). The simulator-destination fix on this branch remains (it eliminates a separate runner-image fast-fail); the remaining Xcode check failure on this PR is accepted per the loop's CI policy, with local verification standing in and the fix landing in #58 immediately above.