Skip to content

tests: the selectable transport order is H1-first, matching the SDK - #334

Merged
Ryanmello07 merged 1 commit into
mainfrom
fix/transport-order-tests
Aug 22, 2026
Merged

tests: the selectable transport order is H1-first, matching the SDK#334
Ryanmello07 merged 1 commit into
mainfrom
fix/transport-order-tests

Conversation

@Ryanmello07

Copy link
Copy Markdown
Contributor

The two TransportStatsTests failures on main are wrong expectations, not a
product bug. Fixing them makes the suite green.

What was wrong

Four assertions expected [.h3, .h1, .dns, .dnsPump] for values that are read
from the SDK. The SDK is H1-first and says so explicitly:

// SelectableTransportModes returns the modes a policy can select ...
// in the default H1-first preference order.
return []TransportMode{H1, H3, Dns, DnsPump}

Its own Go test asserts that exact sequence, and DefaultTransportModePriority
is H1=1, H3=2, Dns=3, DnsPump=4.

This repo already agreed. TransportSettingsStore.swift documents
selectable as "the SDK's default preference order (h1, h3, dns, then dns
pump)"
. Only the test expectations disagreed with both.

The four corrected lines all read arrays built by TransportType.fromSdk():

test value
settingsSnapshotFollowsTheSdkPolicy autoTransports, enabledTransports
selectableTransportsAreTheSdkDefaultOrder TransportType.selectable

Two other [.h3, .h1] assertions are deliberately untouched

  • :44distribution.used is usage order from a mock's byte counts, not
    the selectable order. h3 genuinely is used more there.
  • :267constrainedTransports is a Set<TransportType>, so the literal's
    order is never compared. It passes either way.

Neither was failing. Changing them would have implied an ordering rule that does
not exist.

Scope

No non-test code assumed H3-first. The only other H3-first ordering in the app is
TransportType.allCases, which is the enum's stable declaration order — a
separate concept from the SDK's preference order, and correct as it stands.

These were presumably red for a while: this repo had no CI until #333, so nothing
ever ran them.

For the reviewer

Worth a second opinion on one thing: I concluded the SDK's H1-first order is the
intended product behaviour, on the strength of the SDK's comment, its Go test,
its priority table, and this repo's own doc comment all agreeing. If the product
intent is actually H3-first, then the fix belongs in the SDK instead and this PR
should be closed.

TransportStatsTests asserted [.h3, .h1, .dns, .dnsPump] in four places
that read their value from the SDK. The SDK's order is H1-first, and it
is explicit about it:

  // SelectableTransportModes returns the modes a policy can select ...
  // in the default H1-first preference order.
  return []TransportMode{H1, H3, Dns, DnsPump}

Its own Go test asserts exactly that sequence, and
DefaultTransportModePriority is H1=1, H3=2, Dns=3, DnsPump=4. This file's
own source agrees too -- TransportSettingsStore.swift documents
`selectable` as "the SDK's default preference order (h1, h3, dns, then
dns pump)". Only the expectations disagreed.

The four corrected assertions all read arrays built by
TransportType.fromSdk():
  settingsSnapshotFollowsTheSdkPolicy      autoTransports, enabledTransports
  selectableTransportsAreTheSdkDefaultOrder  TransportType.selectable

TWO OTHER [.h3, .h1] ASSERTIONS ARE LEFT ALONE, deliberately:
  :44   distribution.used -- usage order from a mock's byte counts, not
        the selectable order. h3 really is used more there.
  :267  constrainedTransports is a Set<TransportType>, so the literal's
        order is not compared at all. It passes either way.

Neither was failing, and changing them would have implied a rule that
does not exist.

Nothing in the app's non-test code assumed H3-first: the only other
H3-first ordering is TransportType's own `allCases`, which is the enum's
stable declaration order and a separate concept from the SDK's
preference order.

These have presumably been red for a while. urnetwork/apple had no CI
until #333, so nothing ever ran them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MAXFxG1EK4jTxQ1iW73BUr
@Ryanmello07
Ryanmello07 marked this pull request as ready for review August 22, 2026 05:45
@Ryanmello07
Ryanmello07 merged commit 9a8a7b2 into main Aug 22, 2026
4 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