Skip to content

Bump KontextKit to 0.1.0; send network.type as null (fixes NWPathMonitor crash) - #128

Merged
JakubMrozek merged 2 commits into
mainfrom
fix/network-type-null-kontextkit-0.1.0
Jul 2, 2026
Merged

JakubMrozek merged 2 commits into
mainfrom
fix/network-type-null-kontextkit-0.1.0

Conversation

@JakubMrozek

Copy link
Copy Markdown
Member

Summary

Pulls the production crash fix into sdk-swift by bumping KontextKit 0.0.4 → 0.1.0, and stops sending network.type on the wire.

The crash (EXC_BREAKPOINT reported from Polybuzz / PolySpeak) was in KontextKit's on-device network.type detection: it bridged NWPathMonitor.pathUpdateHandler into a CheckedContinuation, but that handler is not one-shot — a second callback on a flapping/constrained network resumed the continuation twice and crashed the app. It ran inside DeviceCollector.collectAsync() on every /preload (every chat message). KontextKit 0.1.0 removes the detection entirely (kontextso/kontextkit-ios#5).

Changes

  • Package.swift + podspec: KontextKit exact 0.0.4 → 0.1.0.
  • DeviceCollector: adapts to the new NetworkInfo shape — type is now String? (nil) and detail is gone. Forwards whatever type KontextKit reports (nil today) instead of coercing to .other; drops detail.
  • NetworkDTO.type: now optional, so the request carries no network.type rather than a misleading "other". The ad server does not use network.type for ad selection (only maps it to OpenRTB connectiontype), so this is behaviourally safe. userAgent — the field the server actually consumes — is unchanged. detail field kept but always nil (no longer sourced), to keep the change minimal.
  • Version → 4.0.2 (podspec s.version + SDKInfo.sdkVersion).

Tests

Full suite green on the simulator — 464 tests. Added networkDTOOmitsNilType; updated networkDTOOmitsNilOptionalFields for the now-optional type, the version assertions in SDKInfoTests, and the NetworkDTO doc. Existing DeviceCollector/encoding tests unchanged and passing.

Rollout

Depends on KontextKit 0.1.0 (already published to CocoaPods). After merge: tag 4.0.2 + pod trunk push per RELEASING.md. This is the version Polybuzz updates to to get the crash fix.

🤖 Generated with Claude Code

JakubMrozek and others added 2 commits July 2, 2026 14:34
KontextKit 0.1.0 removes on-device network-type detection — the
`NWPathMonitor` read whose non-one-shot `pathUpdateHandler` resumed a
`CheckedContinuation` twice and crashed the app (EXC_BREAKPOINT) on
flapping/constrained networks, on every `/preload`. This bump pulls that
fix into sdk-swift.

`NetworkInfoProvider.NetworkInfo.type` is now `String?` (always nil) and
`.detail` is gone, so `DeviceCollector` is adapted: it forwards whatever
type KontextKit reports (nil today) instead of coercing to `.other`, and
no longer reads `detail`. `NetworkDTO.type` becomes optional so the wire
carries no `network.type` rather than a misleading `"other"`. The ad
server does not use `network.type` for ad selection, so this is
behaviourally safe. `userAgent` — the field the server consumes — is
unchanged.

Version bumped to 4.0.2 (podspec + SDKInfo). No public API changes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`timerAddedToCommonModeFiresDuringTracking` asserted `fireCount >= 2` off
a single `RunLoop.main.run(mode:before:)` call, but one call handles only
one run-loop pass and can return after zero or one timer fire depending
on scheduler load — so it failed intermittently on loaded CI runners
(`fireCount → 0`) while passing locally. Pump the tracking-mode run loop
in short slices until the timer has fired enough times or a deadline
passes. Same invariant, no longer timing-dependent.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@JakubMrozek
JakubMrozek merged commit 426af76 into main Jul 2, 2026
2 checks passed
@JakubMrozek
JakubMrozek deleted the fix/network-type-null-kontextkit-0.1.0 branch July 2, 2026 14:55
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