Skip to content

fix(discovery): strip interface scope from resolved IP addresses#11

Merged
teancom merged 1 commit intomainfrom
fix/discovery-one-shot-resolve
Apr 15, 2026
Merged

fix(discovery): strip interface scope from resolved IP addresses#11
teancom merged 1 commit intomainfrom
fix/discovery-one-shot-resolve

Conversation

@teancom
Copy link
Copy Markdown
Contributor

@teancom teancom commented Apr 15, 2026

NWEndpoint's debugDescription includes an interface scope suffix (e.g. "192.168.1.181%en0") which contains a raw % character. URL(string:) rejects this as invalid per RFC 3986, so extractServerInfo silently discarded every resolved server — making mDNS discovery return zero results on all networks.

Strip the scope suffix before constructing the WebSocket URL.

NWEndpoint's debugDescription includes an interface scope suffix
(e.g. "192.168.1.181%en0") which contains a raw % character. URL(string:)
rejects this as invalid per RFC 3986, so extractServerInfo silently
discarded every resolved server — making mDNS discovery return zero
results on all networks.

Strip the scope suffix before constructing the WebSocket URL.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Test Coverage Report

Line Coverage: 61.98% · Function Coverage: 59.07%

Detailed Coverage Report
Filename                                                                                           Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
.build/arm64-apple-macosx/debug/SendspinKitPackageTests.derived/runner.swift                             9                 1    88.89%           2                 0   100.00%          17                 3    82.35%           0                 0         -
.build/arm64-apple-macosx/debug/Starscream.build/DerivedSources/resource_bundle_accessor.swift           5                 5     0.00%           3                 3     0.00%          15                15     0.00%           0                 0         -
.build/checkouts/Starscream/Sources/Compression/WSCompression.swift                                    108               108     0.00%          39                39     0.00%         234               234     0.00%           0                 0         -
.build/checkouts/Starscream/Sources/DataBytes/Data+Extensions.swift                                      8                 8     0.00%           4                 4     0.00%          32                32     0.00%           0                 0         -
.build/checkouts/Starscream/Sources/Engine/NativeEngine.swift                                           34                34     0.00%          18                18     0.00%         105               105     0.00%           0                 0         -
.build/checkouts/Starscream/Sources/Engine/WSEngine.swift                                               79                79     0.00%          30                30     0.00%         230               230     0.00%           0                 0         -
.build/checkouts/Starscream/Sources/Framer/FoundationHTTPHandler.swift                                  43                43     0.00%           9                 9     0.00%          88                88     0.00%           0                 0         -
.build/checkouts/Starscream/Sources/Framer/FoundationHTTPServerHandler.swift                            29                29     0.00%           7                 7     0.00%          58                58     0.00%           0                 0         -
.build/checkouts/Starscream/Sources/Framer/FrameCollector.swift                                         34                34     0.00%           9                 9     0.00%          68                68     0.00%           0                 0         -
.build/checkouts/Starscream/Sources/Framer/Framer.swift                                                124               124     0.00%          37                37     0.00%         267               267     0.00%           0                 0         -
.build/checkouts/Starscream/Sources/Framer/HTTPHandler.swift                                            28                28     0.00%           7                 7     0.00%          63                63     0.00%           0                 0         -
.build/checkouts/Starscream/Sources/Framer/StringHTTPHandler.swift                                      51                51     0.00%          10                10     0.00%         110               110     0.00%           0                 0         -
.build/checkouts/Starscream/Sources/Security/FoundationSecurity.swift                                   25                25     0.00%           9                 9     0.00%          60                60     0.00%           0                 0         -
.build/checkouts/Starscream/Sources/Server/WebSocketServer.swift                                        58                58     0.00%          21                21     0.00%         149               149     0.00%           0                 0         -
.build/checkouts/Starscream/Sources/Starscream/WebSocket.swift                                          31                31     0.00%          22                22     0.00%          82                82     0.00%           0                 0         -
.build/checkouts/Starscream/Sources/Transport/FoundationTransport.swift                                 68                68     0.00%          16                16     0.00%         184               184     0.00%           0                 0         -
.build/checkouts/Starscream/Sources/Transport/TCPTransport.swift                                        53                53     0.00%          20                20     0.00%         193               193     0.00%           0                 0         -
.build/checkouts/swift-opus/Sources/Opus/AVAudioFormat+Extensions.swift                                 33                21    36.36%           3                 1    66.67%          48                27    43.75%           0                 0         -
.build/checkouts/swift-opus/Sources/Opus/Opus.Application.swift                                          3                 1    66.67%           3                 1    66.67%           9                 3    66.67%           0                 0         -
.build/checkouts/swift-opus/Sources/Opus/Opus.Decoder.swift                                             36                15    58.33%           8                 2    75.00%          90                28    68.89%           0                 0         -
.build/checkouts/swift-opus/Sources/Opus/Opus.Encoder.swift                                             36                36     0.00%          11                11     0.00%          86                86     0.00%           0                 0         -
.build/checkouts/swift-opus/Sources/Opus/Opus.Error.swift                                                3                 1    66.67%           3                 1    66.67%           9                 3    66.67%           0                 0         -
Sources/SendspinKit/Audio/AudioDecoder.swift                                                           110                66    40.00%          26                 9    65.38%         390               182    53.33%           0                 0         -
Sources/SendspinKit/Audio/AudioPlayer.swift                                                            142                54    61.97%          57                10    82.46%         615               153    75.12%           0                 0         -
Sources/SendspinKit/Audio/AudioScheduler.swift                                                          51                 6    88.24%          22                 0   100.00%         173                13    92.49%           0                 0         -
Sources/SendspinKit/Audio/PCMRingBuffer.swift                                                           27                 4    85.19%          14                 1    92.86%          81                 1    98.77%           0                 0         -
Sources/SendspinKit/Audio/SyncCorrection.swift                                                          26                 4    84.62%          12                 3    75.00%          65                 4    93.85%           0                 0         -
Sources/SendspinKit/Audio/VolumeController.swift                                                        52                35    32.69%          15                 8    46.67%         129                73    43.41%           0                 0         -
Sources/SendspinKit/Client/ArtworkConfiguration.swift                                                    5                 2    60.00%           1                 0   100.00%           5                 0   100.00%           0                 0         -
Sources/SendspinKit/Client/ClientTypes.swift                                                            12                 6    50.00%           4                 2    50.00%          25                13    48.00%           0                 0         -
Sources/SendspinKit/Client/ConnectionState.swift                                                        12                12     0.00%           2                 2     0.00%          20                20     0.00%           0                 0         -
Sources/SendspinKit/Client/PlayerConfiguration.swift                                                     7                 3    57.14%           1                 0   100.00%          14                 1    92.86%           0                 0         -
Sources/SendspinKit/Client/SendspinClient+Commands.swift                                                49                37    24.49%          21                15    28.57%          93                72    22.58%           0                 0         -
Sources/SendspinKit/Client/SendspinClient+MessageHandling.swift                                        164               125    23.78%          49                41    16.33%         450               316    29.78%           0                 0         -
Sources/SendspinKit/Client/SendspinClient.swift                                                        182                79    56.59%          55                18    67.27%         596               235    60.57%           0                 0         -
Sources/SendspinKit/ConfigurationError.swift                                                            17                 9    47.06%           1                 0   100.00%          32                 9    71.88%           0                 0         -
Sources/SendspinKit/Discovery/ClientAdvertiser.swift                                                    54                36    33.33%          27                16    40.74%         170                93    45.29%           0                 0         -
Sources/SendspinKit/Discovery/DiscoveredServer.swift                                                     2                 2     0.00%           2                 2     0.00%          10                10     0.00%           0                 0         -
Sources/SendspinKit/Discovery/ServerDiscovery.swift                                                    113                93    17.70%          42                30    28.57%         313               267    14.70%           0                 0         -
Sources/SendspinKit/Models/ArtworkModels.swift                                                          27                 1    96.30%           5                 1    80.00%          46                 1    97.83%           0                 0         -
Sources/SendspinKit/Models/AudioFormatSpec.swift                                                        25                 1    96.00%           7                 1    85.71%          42                 1    97.62%           0                 0         -
Sources/SendspinKit/Models/BinaryMessage.swift                                                          14                 0   100.00%           4                 0   100.00%          42                 0   100.00%           0                 0         -
Sources/SendspinKit/Models/ClientRole.swift                                                             27                 5    81.48%          16                 5    68.75%          56                 5    91.07%           0                 0         -
Sources/SendspinKit/Models/SendspinMessage.swift                                                       157                86    45.22%          48                25    47.92%         218               128    41.28%           0                 0         -
Sources/SendspinKit/SendspinKit.swift                                                                    2                 0   100.00%           2                 0   100.00%           6                 0   100.00%           0                 0         -
Sources/SendspinKit/Synchronization/ClockSynchronizer.swift                                             18                 3    83.33%          10                 0   100.00%          65                 6    90.77%           0                 0         -
Sources/SendspinKit/Synchronization/MonotonicClock.swift                                                 6                 1    83.33%           6                 1    83.33%          21                 1    95.24%           0                 0         -
Sources/SendspinKit/Synchronization/SendspinTimeFilter.swift                                            37                 1    97.30%          18                 1    94.44%         132                 1    99.24%           0                 0         -
Sources/SendspinKit/Synchronization/TimeFilterSnapshot.swift                                             6                 0   100.00%           2                 0   100.00%          13                 0   100.00%           0                 0         -
Sources/SendspinKit/Transport/NWWebSocketTransport.swift                                                54                54     0.00%          24                24     0.00%         214               214     0.00%           0                 0         -
Sources/SendspinKit/Transport/SendspinEncoding.swift                                                     1                 0   100.00%           1                 0   100.00%           5                 0   100.00%           0                 0         -
Sources/SendspinKit/Transport/WebSocketTransport.swift                                                  48                43    10.42%          24                19    20.83%         176               158    10.23%           0                 0         -
Tests/SendspinKitTests/Audio/AudioPlayerTests.swift                                                     21                 0   100.00%           8                 0   100.00%          92                 0   100.00%           0                 0         -
Tests/SendspinKitTests/Audio/AudioProcessCallbackTests.swift                                            70                 3    95.71%          34                 0   100.00%         252                 3    98.81%           0                 0         -
Tests/SendspinKitTests/Audio/FLACDecoderTests.swift                                                      6                 0   100.00%           3                 0   100.00%          34                 0   100.00%           0                 0         -
Tests/SendspinKitTests/Audio/OpusDecoderTests.swift                                                     16                 2    87.50%          10                 2    80.00%          43                 2    95.35%           0                 0         -
Tests/SendspinKitTests/Audio/PCMRingBufferTests.swift                                                   23                 0   100.00%          21                 0   100.00%         187                 0   100.00%           0                 0         -
Tests/SendspinKitTests/Audio/SyncCorrectionTests.swift                                                  13                 0   100.00%          13                 0   100.00%          77                 0   100.00%           0                 0         -
Tests/SendspinKitTests/Audio/VolumeControlTests.swift                                                   49                 5    89.80%          23                 0   100.00%         151                 0   100.00%           0                 0         -
Tests/SendspinKitTests/AudioSchedulerTests.swift                                                        84                 2    97.62%          74                 0   100.00%         292                 2    99.32%           0                 0         -
Tests/SendspinKitTests/Client/SendspinClientTests.swift                                                 18                 0   100.00%           6                 0   100.00%          81                 0   100.00%           0                 0         -
Tests/SendspinKitTests/Discovery/ClientAdvertiserTests.swift                                            23                 0   100.00%          12                 0   100.00%         125                 0   100.00%           0                 0         -
Tests/SendspinKitTests/Discovery/ServerDiscoveryTests.swift                                             17                 1    94.12%          13                 0   100.00%          79                 1    98.73%           0                 0         -
Tests/SendspinKitTests/Helpers/MockTransport.swift                                                      25                 4    84.00%          15                 1    93.33%          47                 6    87.23%           0                 0         -
Tests/SendspinKitTests/Integration/AudioPipelineIntegrationTests.swift                                  29                 0   100.00%          11                 0   100.00%         167                 0   100.00%           0                 0         -
Tests/SendspinKitTests/Integration/BinaryMessageIntegrationTests.swift                                  38                 0   100.00%          17                 0   100.00%         228                 0   100.00%           0                 0         -
Tests/SendspinKitTests/Integration/ClientIntegrationTests.swift                                        107                 8    92.52%          33                 3    90.91%         435                10    97.70%           0                 0         -
Tests/SendspinKitTests/Integration/ClockSyncIntegrationTests.swift                                      13                 0   100.00%           4                 0   100.00%         123                 0   100.00%           0                 0         -
Tests/SendspinKitTests/Integration/MessageRoundTripTests.swift                                          15                 0   100.00%           3                 0   100.00%         122                 0   100.00%           0                 0         -
Tests/SendspinKitTests/Models/ArtworkModelTests.swift                                                   94                 0   100.00%          30                 0   100.00%         456                 0   100.00%           0                 0         -
Tests/SendspinKitTests/Models/AudioFormatSpecTests.swift                                                52                 0   100.00%          22                 0   100.00%         181                 0   100.00%           0                 0         -
Tests/SendspinKitTests/Models/BinaryMessageTests.swift                                                  28                 0   100.00%          20                 0   100.00%         145                 0   100.00%           0                 0         -
Tests/SendspinKitTests/Models/MessageEncodingTests.swift                                                49                 0   100.00%          13                 0   100.00%         206                 0   100.00%           0                 0         -
Tests/SendspinKitTests/Models/StreamMessageTests.swift                                                   3                 0   100.00%           1                 0   100.00%          28                 0   100.00%           0                 0         -
Tests/SendspinKitTests/Models/VersionedRoleTests.swift                                                  31                 0   100.00%          21                 0   100.00%         134                 0   100.00%           0                 0         -
Tests/SendspinKitTests/Synchronization/ClockSynchronizerTests.swift                                     10                 0   100.00%           5                 0   100.00%         125                 0   100.00%           0                 0         -
Tests/SendspinKitTests/Synchronization/MonotonicClockTests.swift                                         7                 0   100.00%           6                 0   100.00%          46                 0   100.00%           0                 0         -
Tests/SendspinKitTests/Synchronization/SendspinTimeFilterTests.swift                                    52                 0   100.00%          22                 0   100.00%         316                 0   100.00%           0                 0         -
Tests/SendspinKitTests/Synchronization/TimeFilterSnapshotTests.swift                                    27                 0   100.00%          13                 0   100.00%         159                 0   100.00%           0                 0         -
Tests/SendspinKitTests/Transport/WebSocketTransportTests.swift                                           2                 0   100.00%           1                 0   100.00%          11                 0   100.00%           0                 0         -
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                                                                 3267              1646    49.62%        1263               517    59.07%       10756              4089    61.98%           0                 0         -

@teancom
Copy link
Copy Markdown
Contributor Author

teancom commented Apr 15, 2026

Discovered that sometime near the end of the marathon that was #6, I apparently broke mDNS discovery. This fixes it.

@teancom teancom merged commit a1c4c6d into main Apr 15, 2026
2 checks passed
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