Skip to content

v0 [5/7]: iOS — Swift core, Nitro adapter, two pods, Expo config plugin - #23

Merged
adhorodyski merged 7 commits into
v0from
stack/3-ios
Nov 25, 2026
Merged

adhorodyski merged 7 commits into
v0from
stack/3-ios

Conversation

@adhorodyski

@adhorodyski adhorodyski commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

What

  • Core (ios/Core): takes opentelemetry-swift types only (ReadableSpan, attributes); config, endpoint + headers (envVarHeaders, gzip), explicit parenting, sticky init (R16)
  • Adapter (ios/Adapter, C++ interop): HybridOtel and JsReadableSpan, which builds SpanData straight from Nitro's seam structs (they are C++-backed, so the core can't touch them). Public RNOtel helpers live in the core pod
  • Two pods (R24): ReactNativeOpenTelemetryCore + the Nitro adapter; app.plugin.js adds the Core pod line for Expo
  • *.ios.otlp.json expected files, compared by the device e2e in v0 [6/7]: example apps (bare, Expo) and device and web e2e #24. No host-side Swift tests: Package.swift and ios/CoreTests are removed
  • static: Swift packageVersion must match package.json

Verified locally

bun verify static fast-js: 36 + 47 tests green. On top of #24: bare example release build in test mode, then E2E_TARGET=ios-bare bun verify --e2e e2e: 24 passed, 3 skipped.

Not in this PR

Pod install / app build of the adapter is first proven in #24.

Decisions for you (defaults applied; override with spec: comments)

  1. iOS output gaps:
    • The opentelemetry-swift 2.6 encoder never writes span and link flags or traceState, or the scope schemaUrl. This is recorded as a limitation; the encoder is not reimplemented.
    • Times are quantized to about 240 ns.
    • An iOS TRACEPARENT environment variable becomes the parent of every root span (upstream behaviour).
  2. Two pods (R24). Apps add pod 'ReactNativeOpenTelemetryCore' to their Podfile; Expo apps get the line from app.plugin.js.
    • This conflicts with the spec rule "nothing essential may depend on a config plugin".
    • Autolinking picks between the two root podspecs by sort order, because RN CLI 20.2 and Expo 58 ignore podspecPath.
    • The alternative is to move the Core podspec out of the package root.
  3. Supported platforms: RN 0.79 doesn't build for iOS on Xcode 27 (an fmt compile error). The README says only Xcode 27 with RN 0.88.1 is verified. Should the iOS minimum RN go up?
  4. Expected files: the *.ios.otlp.json files need your review.
  5. Background flush trigger: the flush starts on willResignActive, not didEnterBackground (second commit). Spec §9.4 says "when the app goes to background". willResignActive comes earlier and also fires for transient interruptions such as Control Center or a call; the extra flush there is harmless.

Part of the v0 stack that replaces #20 for review, bottom-up: #21 context → #26 SDK → #27 JS scenarios → #22 Android → #23 iOS → #24 examples + e2e → #25 ops. Review fixes land as new commits on the layer they belong to, and the layers above are rebased. History before the split: v0-impl / #20. Nothing publishes: release runs only after CI on main, and the npm environment does not exist yet.

🤖 Generated with Claude Code

@adhorodyski adhorodyski changed the title v0 [3/5]: iOS — Swift core, Nitro adapter, two pods, Expo config plugin v0 [5/7]: iOS — Swift core, Nitro adapter, two pods, Expo config plugin Nov 25, 2026
@adhorodyski
adhorodyski added this pull request to stack #28 November 25, 2026 18:49
@adhorodyski
adhorodyski force-pushed the stack/3-ios branch 3 times, most recently from 7a648cb to 217103a Compare November 25, 2026 19:22
@adhorodyski
adhorodyski force-pushed the stack/3-ios branch 2 times, most recently from 63617f0 to 35234f6 Compare November 25, 2026 20:10
Base automatically changed from stack/2-android to v0 November 25, 2026 20:41
…ds and the Expo config plugin

Layer 3 of the v0 stack (squashed from v0-impl, PR #20):
- core (ios/Core): seam spans built into SpanData, config, endpoint and headers (envVarHeaders, gzip), explicit parenting, sticky init (R16)
- adapter: HybridOtel and the public RNOtel helpers (RNOtel.start native-first init)
- ReactNativeOpenTelemetryCore pod + the Nitro adapter pod (R24); app.plugin.js adds the Core pod line for Expo
- Package.swift + verify stage fast-swift: every hand-off fixture through the Swift core, compared to *.ios.otlp.json
- static: the Swift packageVersion must match package.json

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
adhorodyski and others added 6 commits November 25, 2026 21:41
Under CPU load a backgrounded app can be starved for ~15 s despite its background task: the export request stalls
until the app is reopened, which is the background-flush e2e failure on CI. Reproduced locally under load (about half
of first attempts failed, 14.8 s stalls); with willResignActive 12 of 12 passed first try.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drops `tracesUrl` and its test, matching JS and Android: `export.url` goes to the OTLP exporter unchanged. The
fixture replay passes the collector's `/v1/traces` URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mirrors the Android cleanup: AttributesTests keeps the beyond-long and 2^63 bounds, the short-HrTime guard and the
SpanKind mapping (the rest is pinned by the replayed odd-attributes and rich-span fixtures); ParentingTests is one
round trip plus the non-remote check, with no upstream tracer; InitTests drops the null-config-after-init case.
TimeRoundTripTests is removed: it measured opentelemetry-swift's `Date` precision, not our code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Package.swift existed only to run ios/CoreTests with `swift test` on the host; apps build ios/Core through the
ReactNativeOpenTelemetryCore pod. The device e2e on ios-bare and ios-expo compares against the same `.ios.otlp.json`
files. Also drops it from the npm `files`, the pack check and .gitignore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eam copy in the core

The core pod can't touch Nitro's Swift structs (they are typealiases of C++ structs and need C++ interop, which the
app's AppDelegate does not have), but the adapter pod can. JsReadableSpan and the number rule move into the
adapter and read Nitro's SeamSpan directly; the core's `handOff` takes otel `ReadableSpan`s and CoreConfig takes
otel attributes. SeamModel.swift (the hand-kept copy of the seam types) and HybridOtel's 1:1 mapping are gone.
The adapter pod declares opentelemetry-swift-core too, since it now imports the SDK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adhorodyski
adhorodyski marked this pull request as ready for review November 25, 2026 20:47
@adhorodyski
adhorodyski merged commit 51ef350 into v0 Nov 25, 2026
@adhorodyski
adhorodyski deleted the stack/3-ios branch November 25, 2026 20:48
@adhorodyski adhorodyski added this to the Alpha milestone Nov 26, 2026
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