From 8e51f7fa2b6b91726ac6c6f13dce4d352580bf67 Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Thu, 26 Nov 2026 09:40:44 +0100 Subject: [PATCH 1/3] test(verify): drop the interaction-manager scenario; RN 0.88 removed InteractionManager Co-Authored-By: Claude Opus 5.5 --- verify/scenarios/index.ts | 3 +-- verify/scenarios/interaction-manager.ts | 26 ------------------------- 2 files changed, 1 insertion(+), 28 deletions(-) delete mode 100644 verify/scenarios/interaction-manager.ts diff --git a/verify/scenarios/index.ts b/verify/scenarios/index.ts index 009cc7b..886ef19 100644 --- a/verify/scenarios/index.ts +++ b/verify/scenarios/index.ts @@ -14,7 +14,6 @@ import exportHeaders from './export-headers'; import fastRefreshIdempotent from './fast-refresh-idempotent'; import flushAfterReload from './flush-after-reload'; import handoffBasic from './handoff-basic'; -import interactionManager from './interaction-manager'; import intervalNewRoot from './interval-new-root'; import nativeInitFailure from './native-init-failure'; import nestAfterAwait from './nest-after-await'; @@ -26,4 +25,4 @@ import oddAttributes from './odd-attributes'; import richSpan from './rich-span'; import rootNoLeak from './root-no-leak'; -export const allScenarios = (): Scenario[] => [asyncGenerator, backgroundFlush, batchingSharedQueue, capturedThen, collectorDown, concurrentInterleaved, crossJsToNative, crossNativeToJs, errorInCallback, eventEmitterListener, exportHeaders, fastRefreshIdempotent, flushAfterReload, handoffBasic, interactionManager, intervalNewRoot, nativeInitFailure, nestAfterAwait, nestPromiseAllRace, nestRaf, nestTimersMicrotasks, neverSettlingPromise, oddAttributes, richSpan, rootNoLeak]; +export const allScenarios = (): Scenario[] => [asyncGenerator, backgroundFlush, batchingSharedQueue, capturedThen, collectorDown, concurrentInterleaved, crossJsToNative, crossNativeToJs, errorInCallback, eventEmitterListener, exportHeaders, fastRefreshIdempotent, flushAfterReload, handoffBasic, intervalNewRoot, nativeInitFailure, nestAfterAwait, nestPromiseAllRace, nestRaf, nestTimersMicrotasks, neverSettlingPromise, oddAttributes, richSpan, rootNoLeak]; diff --git a/verify/scenarios/interaction-manager.ts b/verify/scenarios/interaction-manager.ts deleted file mode 100644 index 2dc3c9c..0000000 --- a/verify/scenarios/interaction-manager.ts +++ /dev/null @@ -1,26 +0,0 @@ -import {scenario} from '../harness/scenario'; - -/** - * The span active when `InteractionManager.runAfterInteractions` is called parents the span started in its callback (Hermes). - * Assumes no ROOT `runAfterInteractions` is already queued: InteractionManager is a shared queue (§6.2), so with an - * earlier enqueuer the callback would run in that enqueuer's context. - */ -export default scenario( - 'interaction-manager', - async ({tracer, at}) => { - // lazy: the module list is also loaded by Jest, which has no react-native runtime - const {InteractionManager} = require('react-native') as typeof import('react-native'); - await tracer.startActiveSpan('parent', {startTime: at(0)}, async parent => { - await new Promise(done => - InteractionManager.runAfterInteractions(() => { - tracer.startSpan('after_interactions', {startTime: at(10)}).end(at(11)); - done(); - }), - ); - parent.end(at(20)); - }); - }, - // RN 0.88 (the example) removed InteractionManager from core (dev: invariant; release: undefined). Kept pending until - // an example on an RN that still ships it exists; the RN replacement, requestIdleCallback, is not in the §6.1 patch list. - {runners: ['e2e'], pending: true}, -); From 51d6e3f9d32b275f69d2cb8bf239ab10c0f0baef Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Thu, 26 Nov 2026 09:40:47 +0100 Subject: [PATCH 2/3] ci: drop the budget job; PR_BUDGET_MINUTES was never set Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38e4a2e..e026327 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -393,26 +393,3 @@ jobs: verify/e2e/.e2e/ if-no-files-found: ignore include-hidden-files: true - - budget: - needs: [static-fast, e2e-android-bare, e2e-ios-bare, e2e-android-expo, e2e-ios-expo, e2e-web] - if: always() - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - name: Check PR time budget - env: - GH_TOKEN: ${{ github.token }} - BUDGET: ${{ vars.PR_BUDGET_MINUTES }} - run: | - started=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }} --jq .run_started_at) - minutes=$(( ($(date +%s) - $(date -d "$started" +%s)) / 60 )) - echo "CI duration: ${minutes} min (budget: ${BUDGET:-unset})" - if [ -n "$BUDGET" ] && ! [[ "$BUDGET" =~ ^[0-9]+$ ]]; then - echo "::error::PR_BUDGET_MINUTES must be a whole number, got '$BUDGET'" - exit 1 - fi - if [ -n "$BUDGET" ] && [ "$minutes" -gt "$BUDGET" ]; then - echo "::error::CI took ${minutes} min, over the ${BUDGET} min budget" - exit 1 - fi From 8e18764968f32c0de434e76b7092a61eb31e3305 Mon Sep 17 00:00:00 2001 From: Adam Horodyski Date: Thu, 26 Nov 2026 09:40:50 +0100 Subject: [PATCH 3/3] docs: drop review IDs (R/X/C) that nothing defines Co-Authored-By: Claude Opus 5.5 --- ReactNativeOpenTelemetry.podspec | 2 +- .../java/com/callstack/otel/core/OtelCore.kt | 2 +- .../specs/2026-11-10-rn-otel-design.md | 20 ++++++------ example-expo/index.js | 2 +- example-expo/plugins/withOtelExample.js | 2 +- example/ios/Podfile | 2 +- .../modules/test-native/TestNative.podspec | 2 +- .../modules/test-native/android/build.gradle | 2 +- ios/Adapter/HybridOtel.swift | 2 +- ios/Adapter/JsReadableSpan.swift | 4 +-- ios/Core/OtelCore.swift | 2 +- react-native.config.js | 2 +- src/sdk/__tests__/start.test.ts | 2 +- src/sdk/shared.ts | 2 +- src/sdk/start.ts | 2 +- src/sdk/start.web.ts | 2 +- verify/VERIFY.md | 31 +++++++++---------- verify/e2e/collector-down.e2e.ts | 2 +- verify/e2e/e2e.config.ts | 2 +- verify/e2e/export-headers.e2e.ts | 2 +- verify/e2e/harness.ts | 4 +-- 21 files changed, 45 insertions(+), 48 deletions(-) diff --git a/ReactNativeOpenTelemetry.podspec b/ReactNativeOpenTelemetry.podspec index 3d761ab..069c881 100644 --- a/ReactNativeOpenTelemetry.podspec +++ b/ReactNativeOpenTelemetry.podspec @@ -2,7 +2,7 @@ require "json" package = JSON.parse(File.read(File.join(__dir__, "package.json"))) -# The Nitro adapter (Swift with C++ interop) over the pure Swift core pod (R24, spec §4.2). +# The Nitro adapter (Swift with C++ interop) over the pure Swift core pod (spec §4.2). Pod::Spec.new do |s| s.name = "ReactNativeOpenTelemetry" s.version = package["version"] diff --git a/android/src/main/java/com/callstack/otel/core/OtelCore.kt b/android/src/main/java/com/callstack/otel/core/OtelCore.kt index 99173d4..436795e 100644 --- a/android/src/main/java/com/callstack/otel/core/OtelCore.kt +++ b/android/src/main/java/com/callstack/otel/core/OtelCore.kt @@ -75,7 +75,7 @@ class OtelCore(config: CoreConfig, testMode: Boolean = false, distroVersion: Str private set /** - * Idempotent. The first result sticks, a failed one too (R16): later calls never retry. A call without config + * Idempotent. The first result sticks, a failed one too: later calls never retry. A call without config * before any init is an error but is not remembered, so the real init can still follow. */ @Synchronized fun initialize(config: CoreConfig?, testMode: Boolean = false, distroVersion: String = "unknown"): InitResult { diff --git a/docs/superpowers/specs/2026-11-10-rn-otel-design.md b/docs/superpowers/specs/2026-11-10-rn-otel-design.md index 006d4d7..4cdb42b 100644 --- a/docs/superpowers/specs/2026-11-10-rn-otel-design.md +++ b/docs/superpowers/specs/2026-11-10-rn-otel-design.md @@ -192,7 +192,7 @@ class NativeHandOffProcessor implements SpanProcessor { - iOS: the core (`ios/Core/*.swift`) takes opentelemetry-swift types only. Nitro's generated Swift structs are typealiases of C++ structs, so code using them needs C++ interop, and the core must not (below): the Nitro adapter pod builds `SpanData` from - the seam structs and hands the core `ReadableSpan`s. *(R24: the app's non-interop Swift `AppDelegate` cannot import a Nitro C++-interop module, so iOS ships + the seam structs and hands the core `ReadableSpan`s. *(The app's non-interop Swift `AppDelegate` cannot import a Nitro C++-interop module, so iOS ships two pods: pure-Swift `ReactNativeOpenTelemetryCore` (`ios/Core` + `RNOtel`) and the Nitro adapter pod that depends on it. Autolinking links one podspec per package, so apps add `pod 'ReactNativeOpenTelemetryCore', :path => '../node_modules/react-native-open-telemetry'` to their Podfile.)* @@ -514,7 +514,7 @@ ships TC39 AsyncContext (Stage 2). ## 7. Web (decided) Same `@opentelemetry/api` surface and the same ContextManager; spans live in the JS SDK and -export directly from JS. **Changed in v0 implementation (R7, pending author review):** web +export directly from JS. **Changed in v0 implementation:** web builds its own `sdk-trace` `TracerProvider` + `BatchSpanProcessor` + upstream `@opentelemetry/exporter-trace-otlp-proto` (fetch), not `startBrowserSdk`. Why: browser-sdk 0.9.1 takes no `idGenerator` (no `0a` test-mode IDs, so no exact web goldens), @@ -565,8 +565,8 @@ Sequencing (from review; council review 2026-11-21 added step 0): `nest-after-await` e2e test per platform. Proves the seam compiles, the native SDKs link, and the e2e tooling can drive the app, before parallel work builds on it. 1. **First milestone: the context patch in a real RN app** (real Hermes, RN's timers, - Promise, scheduler, `InteractionManager`) with real `sdk-trace` spans. Scenarios include - React batching, `InteractionManager`, intervals, thrown errors in callbacks, EventEmitter + Promise, scheduler) with real `sdk-trace` spans. Scenarios include + React batching, intervals, thrown errors in callbacks, EventEmitter listeners. The spike only used a stand-in Hermes host. 2. JS-only slice asserting on output with the fake collector. 3. The seam on one platform, with shared payload fixtures and an early device e2e; then @@ -601,7 +601,7 @@ tests: they don't care about internals, so internals can be rewritten freely. - **explicit timestamps**: v0 scenarios create all spans themselves, so they pass `startTime` / `end(t)` explicitly (JS and native), in whole microseconds. iOS cannot represent them exactly: opentelemetry-swift exports `Date`, a ~238–256 ns grid, so iOS times - are compared within 256 ns (R22, measured floor in verify/VERIFY.md). Clock stubs (Java `setClock`/`TestClock` in test source sets + are compared within 256 ns (measured floor in verify/VERIFY.md). Clock stubs (Java `setClock`/`TestClock` in test source sets only; Swift `with(clock:)`) are only a fallback for implicit reads. - sequential test ID generators, namespaced per side (JS `0a…01`, native `0b…01`) via upstream hooks: JS `sdk-trace` `idGenerator`, Java `setIdGenerator`, Swift @@ -755,10 +755,8 @@ Two apps cover both init paths: the bare example inits natively in fallback (also the Expo-managed path the spec promises). Both produce the same expected files, which proves the paths are equivalent. -**PR time budget:** the PR pipeline (stages 1–4) gets a fixed wall-clock budget, set from -the first full green run plus headroom, enforced with GitHub's `timeout-minutes` per job and -one final `needs:` job that checks total wall-clock time. When a PR run exceeds it, the fix is an agent task -(cache native builds, shard targets, trim slow scenarios), never dropping a target: the full +**PR time:** each job has a `timeout-minutes`. When PR runs get slow, the fix is caching +native builds, sharding targets or trimming slow scenarios, never dropping a target: the full matrix on every PR is decided. **Releases:** manual with changesets (`bun run version`, then `bun run publish`), from `main` @@ -840,7 +838,7 @@ Left out until needed: pre-`async_hooks`). - Upstream code reuse estimate: ~4% of running code is ours (~3.7k of ~89k lines). - Review: builder check + council (OTel-upstream, RN/native, skeptic) on 2026-11-10. -- CI shape (pre-commit static checks, PR time budget, release only from fully green +- CI shape (pre-commit static checks, release only from fully green commits, staged release) adapted from [Kun Chen on validation categories](https://x.com/kunchenguid/status/2122391325081579618) (2026-11-16); the full device matrix stays on every PR by decision. @@ -892,7 +890,7 @@ direct precedent was found; treat those as the highest-risk parts. | P11 | Links instead of parents for batched/multi-cause work; interval ticks as new roots (5, 6.2) | OTel spec: links represent batched operations; React notes it can't attribute batched updates without AsyncContext | [Spec: Links between spans](https://github.com/open-telemetry/opentelemetry-specification/blob/a03fa4e26b3982da42aa0010aaebcd9f694cb037/specification/overview.md#L207-L214) · [React `ReactFiberAsyncAction.js`](https://github.com/facebook/react/blob/fe719f77ba3e4b5fb3ebe13787bfbd0ed911da19/packages/react-reconciler/src/ReactFiberAsyncAction.js#L42) | | P12 | *(removed: the staleness rule was cut in council review, see 6.2)* | | | | P13 | *(removed: the pre-init buffer was cut in council review, see 4.3)* | | | -| P14 | *(Superseded by R8: upstream timing kept, no offset.)* Clock offset `Date.now() - performance.now()`, recomputed on foreground (4.3) | OTel JS derives span times from `performance.timeOrigin` + `performance.now()`; Sentry RN guards an unreliable `performance.timeOrigin` | [Sentry `timeOrigin` guard](https://github.com/getsentry/sentry-react-native/blob/794a52a9e80ca0a7c4ee005264cd9cd3ee1533de/packages/core/src/js/sdk.tsx#L76-L80) | +| P14 | *(Superseded: upstream timing kept, no offset.)* Clock offset `Date.now() - performance.now()`, recomputed on foreground (4.3) | OTel JS derives span times from `performance.timeOrigin` + `performance.now()`; Sentry RN guards an unreliable `performance.timeOrigin` | [Sentry `timeOrigin` guard](https://github.com/getsentry/sentry-react-native/blob/794a52a9e80ca0a7c4ee005264cd9cd3ee1533de/packages/core/src/js/sdk.tsx#L76-L80) | | P15 | Custom names under a reverse-domain prefix, never `otel.*` (4.5) | OTel naming guidance | [naming.md: app developers](https://github.com/open-telemetry/semantic-conventions/blob/2d91ead21027a8a58fbb7488b12d80238e7c0ac5/docs/general/naming.md#L183-L187) · [`otel.*` reserved](https://github.com/open-telemetry/semantic-conventions/blob/2d91ead21027a8a58fbb7488b12d80238e7c0ac5/docs/general/naming.md#L217-L227) | | P16 | Option names mirror `startBrowserSdk`; invalid config returns a no-op SDK instead of throwing (4.4) | OTel Browser SIG browser SDK | [browser-sdk README](https://github.com/open-telemetry/opentelemetry-browser/tree/main/packages/sdk) | | P17 | Exact expected-output files (goldens) for traces (9.1) | OTel Collector tests compare traces against golden files | [collector-contrib `pkg/golden`](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/c64840337cf400792cb684037ed998428b268197/pkg/golden) · [`ptracetest` compare options](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/c64840337cf400792cb684037ed998428b268197/pkg/pdatatest/ptracetest/options.go#L102-L149) | diff --git a/example-expo/index.js b/example-expo/index.js index 71a50c9..96fc759 100644 --- a/example-expo/index.js +++ b/example-expo/index.js @@ -4,7 +4,7 @@ import {startReactNativeSdk} from 'react-native-open-telemetry'; import {ScenariosScreen} from '../example/src/ScenariosScreen'; // JS-fallback init: no native init in this app, so this call initializes native from the config (spec §4.4). -// No serviceVersion: the test-mode resource is service.name only (R2). Same collector and headers as the bare app. +// No serviceVersion: the test-mode resource is service.name only. Same collector and headers as the bare app. startReactNativeSdk({ serviceName: 'verify', exportConfig: { diff --git a/example-expo/plugins/withOtelExample.js b/example-expo/plugins/withOtelExample.js index ce24218..0dac383 100644 --- a/example-expo/plugins/withOtelExample.js +++ b/example-expo/plugins/withOtelExample.js @@ -12,7 +12,7 @@ tasks.matching { it.name.startsWith("createBundle") }.configureEach { /** * Example-only: what the bare example's native projects carry by hand, applied at `expo prebuild`. The Core - * pod (R24) comes from the package's own plugin (`react-native-open-telemetry` in app.json), as in a real Expo app. + * pod comes from the package's own plugin (`react-native-open-telemetry` in app.json), as in a real Expo app. */ module.exports = config => { config = withAppBuildGradle(config, c => { diff --git a/example/ios/Podfile b/example/ios/Podfile index 15a976b..de414f0 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -15,7 +15,7 @@ if linkage != nil end target 'OpenTelemetryExample' do - # Autolinking links only the Nitro pod; the pure Swift core pod (RNOtel, imported by AppDelegate) is declared here (R24). + # Autolinking links only the Nitro pod; the pure Swift core pod (RNOtel, imported by AppDelegate) is declared here. pod 'ReactNativeOpenTelemetryCore', :path => '../..' config = use_native_modules! diff --git a/example/modules/test-native/TestNative.podspec b/example/modules/test-native/TestNative.podspec index b31c842..aac2e5f 100644 --- a/example/modules/test-native/TestNative.podspec +++ b/example/modules/test-native/TestNative.podspec @@ -1,4 +1,4 @@ -# Example-only Nitro module (R25): app native code using the public RNOtel API. +# Example-only Nitro module: app native code using the public RNOtel API. Pod::Spec.new do |s| s.name = "TestNative" s.version = "0.0.0" diff --git a/example/modules/test-native/android/build.gradle b/example/modules/test-native/android/build.gradle index b1d72b6..8002e79 100644 --- a/example/modules/test-native/android/build.gradle +++ b/example/modules/test-native/android/build.gradle @@ -1,4 +1,4 @@ -// Example-only Nitro module (R25). Versions follow the app (rootProject.ext), as autolinked libraries do. +// Example-only Nitro module. Versions follow the app (rootProject.ext), as autolinked libraries do. apply plugin: "com.android.library" apply plugin: "org.jetbrains.kotlin.android" apply from: "../nitrogen/generated/android/TestNative+autolinking.gradle" diff --git a/ios/Adapter/HybridOtel.swift b/ios/Adapter/HybridOtel.swift index 63cba5b..ff2d298 100644 --- a/ios/Adapter/HybridOtel.swift +++ b/ios/Adapter/HybridOtel.swift @@ -3,7 +3,7 @@ import NitroModules import ReactNativeOpenTelemetryCore /// The seam: JS spans are wrapped as otel `ReadableSpan`s here and queued in the core (pod `ReactNativeOpenTelemetryCore`, -/// R24). The core stays free of Nitro's C++-backed types, so the app's AppDelegate can import it without C++ interop. +/// spec §4.2). The core stays free of Nitro's C++-backed types, so the app's AppDelegate can import it without C++ interop. class HybridOtel: HybridOtelSpec { func initialize(config: SeamConfig?) throws -> SeamInitResult { let r = RNOtel.initialize(config.map { diff --git a/ios/Adapter/JsReadableSpan.swift b/ios/Adapter/JsReadableSpan.swift index ce74197..e501ac5 100644 --- a/ios/Adapter/JsReadableSpan.swift +++ b/ios/Adapter/JsReadableSpan.swift @@ -25,7 +25,7 @@ func attributes(of list: [SeamAttribute]) -> [String: AttributeValue] { return out } -/// OTel HrTime `[seconds, nanos]`; missing elements read as 0 (C4). R22: `Date` holds a Double of seconds, so whole µs +/// OTel HrTime `[seconds, nanos]`; missing elements read as 0. `Date` holds a Double of seconds, so whole µs /// come back on a ~256 ns grid (verify/VERIFY.md). private func date(_ t: [Double]) -> Date { Date(timeIntervalSince1970: (t.count > 0 ? t[0] : 0) + (t.count > 1 ? t[1] : 0) / 1e9) @@ -72,7 +72,7 @@ private final class FixedClock: Clock { } /** - * A finished JS span handed over the seam (R19): the frozen `ReadableSpan` the native BatchSpanProcessor queues. It + * A finished JS span handed over the seam: the frozen `ReadableSpan` the native BatchSpanProcessor queues. It * keeps Nitro's struct; only the span context is built on the JS thread (onEnd checks `sampled`), `toSpanData()` runs * on the BSP worker. SpanData has no public initializer, so it is built through the SDK's own `SpanSdk`, the public * factory upstream uses. diff --git a/ios/Core/OtelCore.swift b/ios/Core/OtelCore.swift index 4d389ec..2cf6b5d 100644 --- a/ios/Core/OtelCore.swift +++ b/ios/Core/OtelCore.swift @@ -87,7 +87,7 @@ package final class OtelCore { private static var state: InitResult? package private(set) static var instance: OtelCore? - /// Idempotent. The first result sticks, a failed one too (R16): later calls never retry. A call without config + /// Idempotent. The first result sticks, a failed one too: later calls never retry. A call without config /// before any init is an error but is not remembered, so the real init can still follow. @discardableResult package static func initialize(_ config: CoreConfig?, testMode: Bool = false, distroVersion: String = "unknown") -> InitResult { diff --git a/react-native.config.js b/react-native.config.js index 83a51ab..964ae82 100644 --- a/react-native.config.js +++ b/react-native.config.js @@ -1,6 +1,6 @@ // https://github.com/react-native-community/cli/blob/main/docs/dependencies.md // Nitro: the native code and nitrogen/generated are wired by android/build.gradle and the podspec. -// Two podspecs sit at the root; autolinking links only the Nitro adapter (apps add the Core pod, R24). podspecPath says +// Two podspecs sit at the root; autolinking links only the Nitro adapter (apps add the Core pod). podspecPath says // which; RN CLI 20.2 and Expo 58 do not read it yet (CLI: the first `*.podspec` glob hit; Expo: the first sorted, both // ReactNativeOpenTelemetry.podspec today). module.exports = { diff --git a/src/sdk/__tests__/start.test.ts b/src/sdk/__tests__/start.test.ts index 9c41f3c..06c630d 100644 --- a/src/sdk/__tests__/start.test.ts +++ b/src/sdk/__tests__/start.test.ts @@ -107,7 +107,7 @@ test('a partial config names the missing fields, not native\'s "no config"', () expect(String(err.mock.calls[0])).toMatch(/serviceName and exportConfig\.url are required/); }); -test('a failed native-first init (sticky, R16) was reported by native: no second report', () => { +test('a failed native-first init (sticky) was reported by native: no second report', () => { fakeOtel({initialized: true, error: 'invalid exportUrl'}); const h = startReactNativeSdk(); expect(err).not.toHaveBeenCalled(); diff --git a/src/sdk/shared.ts b/src/sdk/shared.ts index cddf909..1a9c25e 100644 --- a/src/sdk/shared.ts +++ b/src/sdk/shared.ts @@ -8,7 +8,7 @@ import {noopHandle} from './noop'; export const TAG = '[react-native-open-telemetry]'; -/** Stamps every tracer (C3), makes `provider` the global one, starts the probe; returns the handle. */ +/** Stamps every tracer, makes `provider` the global one, starts the probe; returns the handle. */ export function register(provider: TracerProvider): SdkHandle { const getTracer = provider.getTracer.bind(provider); provider.getTracer = (name, version, options) => stampScope(getTracer(name, version, options)); diff --git a/src/sdk/start.ts b/src/sdk/start.ts index b8f73e0..a370f9d 100644 --- a/src/sdk/start.ts +++ b/src/sdk/start.ts @@ -37,7 +37,7 @@ function start(config: SdkConfig | undefined): SdkHandle { const seam = config && toSeamConfig(config); const result = native.initialize(seam); if (result.error) { - // alreadyInitialized: a failed native-first init sticks (R16) and native already reported it, once + // alreadyInitialized: a failed native-first init sticks and native already reported it, once if (result.alreadyInitialized) return noopHandle(); if (config && !seam) { console.error(`${TAG} serviceName and exportConfig.url are required to initialize native; telemetry is off.`); diff --git a/src/sdk/start.web.ts b/src/sdk/start.web.ts index 4f4d571..8fb23b7 100644 --- a/src/sdk/start.web.ts +++ b/src/sdk/start.web.ts @@ -46,5 +46,5 @@ function start(config: SdkConfig | undefined): SdkHandle { ); } -/** Web: spans export straight from JS over OTLP/proto (§7, R7). Never throws: failures give one error and a no-op handle. */ +/** Web: spans export straight from JS over OTLP/proto (§7). Never throws: failures give one error and a no-op handle. */ export const startReactNativeSdk = (config?: SdkConfig): SdkHandle => startOnce(start, config); diff --git a/verify/VERIFY.md b/verify/VERIFY.md index 50d9fbb..a7c6539 100644 --- a/verify/VERIFY.md +++ b/verify/VERIFY.md @@ -3,7 +3,7 @@ `bun verify [stage…] [--e2e] [--update]` runs the stages in `verify/stages/`. `--e2e` adds the device stage (`e2e`), which needs release builds of `example/` in test mode: -The example bundles the package through `exports` → `lib/` (R4), so build `lib/` first: the release builds embed +The example bundles the package through `exports` → `lib/`, so build `lib/` first: the release builds embed the JS bundle, and the e2e stage cannot rebuild it. ```sh @@ -34,7 +34,7 @@ through the real seam and native core and compares against the scenario's one `< **One expected file per scenario.** JS, web, Android and iOS report the same OTLP, so each scenario has one `verify/expected/.otlp.json`. iOS differs only by two opentelemetry-swift 2.6 gaps, which the compare step (`iosView` in `harness/compare.ts`) accepts on `ios` and nowhere else: -- **Times (R22):** opentelemetry-swift keeps times as `Date` and exports `UInt64(timeIntervalSince1970 * 1e9)`, so +- **Times:** opentelemetry-swift keeps times as `Date` and exports `UInt64(timeIntervalSince1970 * 1e9)`, so whole-µs seam times come back rounded to a ~238–256 ns grid, either way (measured once over `at(0…10_000)` and `at(1_000_000_000)`: max |error| 240 ns, 314 of 10 002 exact). iOS times may be off by up to 256 ns. - **Fields its OTLP encoder (`SpanAdapter`) never writes:** span `flags` (257), span `traceState`, link `flags`, link @@ -47,7 +47,7 @@ construction and makes it the parent of every root span, even with `setNoParent( it (Xcode scheme, `SIMCTL_CHILD_TRACEPARENT`). `verify/e2e/scenarios.e2e.ts` runs one test per scenario with runner `e2e`, not `pending`, on each target it lists, -except the scenarios with their own e2e file. Each test cold-starts the app (R5). e2e is compare-only; +except the scenarios with their own e2e file. Each test cold-starts the app. e2e is compare-only; On web, `forceFlush` latency follows the OTLP exporter's own retries (about 10 s worst case), not a native flush timeout; `collector-down` allows 10 s there. `VERIFY_E2E_DRAFT=1` writes a **missing** `.otlp.json` from the run (never from iOS) and still fails the test @@ -63,12 +63,12 @@ fixture and `target` name `device`, so every `test(…)` passes `{platforms: MOB context per test; `target` is the platform, `web`). `anyTarget(title, body)` registers one body on both; e2e titles must be unique, so the web copy is `web › `. -**TestNative (R25).** `cross-*` scenarios call `ctx.native`, the example-only Nitro HybridObject in +**TestNative.** `cross-*` scenarios call `ctx.native`, the example-only Nitro HybridObject in `example/modules/test-native/` (own `nitro.json`, podspec, `build.gradle`; autolinked through `example/react-native.config.js`). It uses only the public `RNOtel` helpers. After editing its spec, regenerate with `bun run codegen` in that directory (the patched root nitrogen) and commit `nitrogen/generated`. -**iOS pods (R24).** An app's Swift `AppDelegate` cannot `import ReactNativeOpenTelemetry`: the Nitro pod is built with +**iOS pods.** An app's Swift `AppDelegate` cannot `import ReactNativeOpenTelemetry`: the Nitro pod is built with C++ interop and the app is not (`'functional' file not found` while building `NitroModules`). So iOS ships two pods: `ReactNativeOpenTelemetryCore` (pure Swift: `ios/Core` + the public `RNOtel` in `ios/RNOtel`) and the Nitro adapter `ReactNativeOpenTelemetry` (`ios/Adapter`), which depends on it and reaches the core's `package` @@ -76,7 +76,7 @@ declarations through one `-package-name`. Autolinking links only the adapter, so `pod 'ReactNativeOpenTelemetryCore', :path => '<package dir>'`. Both linkages build: the default static libraries (CI) and `USE_FRAMEWORKS=static` (checked locally, not a CI job: e2e `ios-bare` 18/18 on that build). -**`performance.timeOrigin` on Hermes (X17).** Defined on both platforms (RN 0.88.1 release, Hermes), +**`performance.timeOrigin` on Hermes.** Defined on both platforms (RN 0.88.1 release, Hermes), checked with a one-off `console.log` of `timeOrigin`, `performance.now()` and `Date.now()` at app start: Android `timeOrigin + now()` = `Date.now()` within 1 ms; **iOS simulator `timeOrigin + now()` was ~23.9 h behind `Date.now()`** (the monotonic clock under `now()` stopped while the host slept; `timeOrigin` stayed at simulator boot). @@ -95,7 +95,7 @@ app. Built locally with Xcode 27.1; the CI jobs `e2e-android-expo` / `e2e-ios-ex unproven until their first CI run. - **Init: JS fallback.** No native init. `index.js` calls `startReactNativeSdk({serviceName: 'verify', exportConfig: - {url, headers: {'x-api-key': 'test'}}})` (no `serviceVersion`, R2) before registering the bare example's + {url, headers: {'x-api-key': 'test'}}})` (no `serviceVersion`) before registering the bare example's `ScenariosScreen`, whose later `startReactNativeSdk()` calls get that first handle. Native reports `testMode` from its build flag; the config has no test fields. - **Metro:** `withOtel(mergeConfig(getDefaultConfig(__dirname), …))` with Expo's `getDefaultConfig`; same single-copy @@ -104,7 +104,7 @@ unproven until their first CI run. - **Autolinking:** Expo autolinking reads `example-expo/react-native.config.js`, which points at the repo root and at the bare example's TestNative, so the `cross-*` scenarios run on Expo too. - **Config plugins** (`app.json`): the package's own `react-native-open-telemetry` (`app.plugin.js`) adds - `pod 'ReactNativeOpenTelemetryCore', :path => '../..'` to the Podfile (R24), as in any Expo app. Expo resolves it by + `pod 'ReactNativeOpenTelemetryCore', :path => '../..'` to the Podfile, as in any Expo app. Expo resolves it by package name: `example-expo`'s `postinstall` links `node_modules/react-native-open-telemetry` to the repo root (bun cannot install the root as a `file:` dependency: it looks for the root's `patches/` relative to the app). Then the example-only `example-expo/plugins/withOtelExample.js` sets `usesCleartextTraffic` (the collector is plain HTTP), adds @@ -123,7 +123,7 @@ The `web` target is the Expo app's Metro web export (`example-expo`, `expo expor through react-native-web 0.21.4 (react-dom 19.3.0). `index.js` inits first with `startReactNativeSdk({serviceName: 'verify', exportConfig: {url: 'http://localhost:4318/v1/traces', headers: {'x-api-key': 'test'}}})`, so every scenario runs through the **web SDK** (own `TracerProvider`, `BatchSpanProcessor`, OTLP/proto -exporter, R7), not a harness provider. Metro resolves the package through its `exports` (`browser` → +exporter), not a harness provider. Metro resolves the package through its `exports` (`browser` → `lib/module/index.web.js`); on web, `metro.config.js` maps `react-native-nitro-modules` to `nitro-stub.web.ts` (no HybridObjects: no native `testMode` line, scenarios get no `native`). @@ -132,7 +132,7 @@ HybridObjects: no native `testMode` line, scenarios get no `native`). `process` both see. The e2e config builds with `OTEL_TEST_MODE=1`. - **Runner:** the `web` target (`web({browser: 'chromium'})`) starts `bun run web:e2e` in `example-expo/` (`expo export -p web` + `expo serve` on `localhost:4173`); its log is `verify/e2e/.e2e/logs/web.log`. `app.restart()` - opens a new page, the cold start (R5). The collector answers CORS (`OPTIONS` 204, `allow-headers: *`). + opens a new page, the cold start. The collector answers CORS (`OPTIONS` 204, `allow-headers: *`). - **Probe:** `babel-preset-expo` keeps native `async` on web; `example-expo/babel.config.js` adds the two async plugins for the web platform, so the bundle has no native `async`/`for await`; no `com.callstack.context.degraded` scope attribute in any web file. @@ -148,7 +148,7 @@ HybridObjects: no native `testMode` line, scenarios get no `native`). ## Failure scenarios -Each has its own e2e file (R10); the ScenariosScreen does not `forceFlush()` after `collector-down`, +Each has its own e2e file; the ScenariosScreen does not `forceFlush()` after `collector-down`, `flush-after-reload` and `background-flush`, so the test decides what exports. Test-mode-only screen controls: `flush` (a JS `forceFlush()`, shows `flush-done-<n>`), `reload` (`TestNative.reload()`) and `patch-identity`. @@ -157,11 +157,11 @@ Each has its own e2e file (R10); the ScenariosScreen does not `forceFlush()` aft `background-flush` and `flush-after-reload` would pass on the timer alone. - `collector-down`: `refuse(503, 3)` after `begin`, `scenario-done` within 2 s, then three `flush` taps (each resolves while the collector refuses); the span arrives once. Android: otel-java retries a 503 inside the export. - **iOS (X6):** opentelemetry-swift 2.6's `OtlpHttpTraceExporter` does not retry; with its default + **iOS:** opentelemetry-swift 2.6's `OtlpHttpTraceExporter` does not retry; with its default `requeueOnFailure: true` it keeps a failed batch in memory and resends it on the next `export` or `flush` (our core flush calls both). So on iOS the span arrives on the first flush after the collector is back, not by itself; its batch processor never exports an empty queue. No exception needed, no hand-rolled retry. -- `native-init-failure`: the example's native init gets `exportUrl = "not a url"`, in test-mode builds only (R26). +- `native-init-failure`: the example's native init gets `exportUrl = "not a url"`, in test-mode builds only. iOS: launch argument `--otel-export-url=not a url` (AppDelegate, `#if OTEL_TEST_MODE`; the Podfile adds the condition to the app target). Android: `Application.onCreate` cannot see launch arguments (they reach the Activity), so the test writes `/sdcard/Android/data/opentelemetry.example/files/otel-export-url` (mode 644, removed @@ -214,7 +214,7 @@ iOS: iPhone 18 Pro simulator, iOS 27.0, Xcode 27.1, agent-device 0.21.36 (T3 dev | JS reload | ✓ `agent-device metro reload` (Metro re-bundled; screen state reset). Release: native reload via TestNative | ✓ release: native reload via TestNative, e2e `flush-after-reload`. `DevSettings.reload()` is a no-op in release | | Fast refresh (dev build) | ✓ editing `ScenariosScreen.tsx` text showed on device with React state kept | ✓ e2e `fast-refresh-idempotent` on `android-dev` | | Background and back | ✓ `agent-device home`, then `open opentelemetry.example`: UIKit logged the background task end and `UIApplicationWillEnterForegroundNotification`; state kept. `appstate` still says `runningForeground` after `home` (known iOS quirk, documented by e2e), so check lifecycle in the log, not `appstate` | ✓ `device.home()` in e2e `background-flush` | -| Read logs | ✓ `agent-device logs start/stop` captures the app's unified log, `NSLog` lines included (`RNOtel handOff …`). The e2e harness reads with `xcrun simctl spawn <udid> log show --predicate 'process == "OpenTelemetryExample" …'` | ✓ via the e2e harness: `adb logcat -d -s RNOtel:I` (tracer-bullet test green; the test was later retired, R14) | +| Read logs | ✓ `agent-device logs start/stop` captures the app's unified log, `NSLog` lines included (`RNOtel handOff …`). The e2e harness reads with `xcrun simctl spawn <udid> log show --predicate 'process == "OpenTelemetryExample" …'` | ✓ via the e2e harness: `adb logcat -d -s RNOtel:I` (tracer-bullet test green; the test was later retired) | **Blocker (Android, interactive only):** the T3 device panel could not open `Pixel_9`: `Failed to allocate an emulator port for Pixel_9 … avdmanager: … Unable to locate a Java Runtime.` @@ -228,7 +228,7 @@ every platform compares against. It is drafted with `VERIFY_UPDATE=1` (or `VERIF from Android or web) and reviewed by the author. `pending` scenarios report as `todo`; un-pend a scenario once it passes. Every file uses the JS runner's resource, `service.name` only. Native test mode builds the resource from config only and -the example inits with no `serviceVersion` (R2), so native-first device runs match the same files. +the example inits with no `serviceVersion`, so native-first device runs match the same files. e2e targets are android, ios and web unless the Runners column names them. @@ -245,7 +245,6 @@ e2e targets are android, ios and web unless the Runners column names them. | `never-settling-promise` | a never-settling promise does not leak its span into later work | 10 | jest, e2e | passing | | `interval-new-root` | exception: each `setInterval` tick is a new root | 10 | jest, e2e | passing | | `batching-shared-queue` | exception: a shared queue runs work as its first enqueuer (pinned wrong parent) | 10 | jest, e2e | passing | -| `interaction-manager` | `runAfterInteractions` callback is a child of the caller's span | 13 | e2e | pending: RN 0.88 removed `InteractionManager` | | `nest-raf` | a `requestAnimationFrame` callback keeps its scheduling context | 13 | e2e | passing | | `event-emitter-listener` | a synchronous `DeviceEventEmitter` listener is a child of the emitter's span | 13 | e2e (android, ios) | passing | | `handoff-basic` | a span crosses the seam intact | 8, 15, 18 | e2e | passing | diff --git a/verify/e2e/collector-down.e2e.ts b/verify/e2e/collector-down.e2e.ts index b43e07a..1c983c9 100644 --- a/verify/e2e/collector-down.e2e.ts +++ b/verify/e2e/collector-down.e2e.ts @@ -2,7 +2,7 @@ import {anyTarget, expectScenario, platformOf, tapFlush} from './harness'; // Collector down (§9.4): the app does not block, and the span arrives exactly once when the collector is back. // Android: otel-java retries a 503 inside the export. iOS: opentelemetry-swift does not retry; it requeues the failed -// batch in memory and resends it on the next export or flush (X6), so the test flushes until the refusals are used up. +// batch in memory and resends it on the next export or flush, so the test flushes until the refusals are used up. // Web: the OTel JS exporter retries a 503 inside the export (backoff 1 s x1.5, ±20 %): three refusals take up to 5.7 s. anyTarget('collector-down', async ({app, screen, collector, target}) => { await expectScenario('collector-down', target, {app, screen, collector}, { diff --git a/verify/e2e/e2e.config.ts b/verify/e2e/e2e.config.ts index 148104f..173e0ca 100644 --- a/verify/e2e/e2e.config.ts +++ b/verify/e2e/e2e.config.ts @@ -12,7 +12,7 @@ export default { tests: '*.e2e.ts', // one collector port: targets must not run at once workers: 1, - retries: process.env.VERIFY_E2E_DRAFT === '1' ? 0 : 1, // a retry would pass against its own fresh draft (R1) + retries: process.env.VERIFY_E2E_DRAFT === '1' ? 0 : 1, // a retry would pass against its own fresh draft timeout: 180_000, launchTimeout: 120_000, actionTimeout: 90_000, // CI simulators answer installs and taps slowly diff --git a/verify/e2e/export-headers.e2e.ts b/verify/e2e/export-headers.e2e.ts index a7f1255..d4d374d 100644 --- a/verify/e2e/export-headers.e2e.ts +++ b/verify/e2e/export-headers.e2e.ts @@ -3,7 +3,7 @@ import path from 'node:path'; import {expect} from 'e2e'; import {anyTarget, expectScenario} from './harness'; -// R11: the app's init headers (x-api-key: test) reach the collector on every export request. +// the app's init headers (x-api-key: test) reach the collector on every export request. anyTarget('export-headers', async ({app, screen, collector, target}) => { await expectScenario('export-headers', target, {app, screen, collector}); const raw = path.join(import.meta.dirname, '..', 'artifacts', 'raw', `export-headers.${target.split('-')[0]}`); diff --git a/verify/e2e/harness.ts b/verify/e2e/harness.ts index e11cf15..fac72f9 100644 --- a/verify/e2e/harness.ts +++ b/verify/e2e/harness.ts @@ -108,7 +108,7 @@ export async function expectScenario( const s = allScenarios().find(x => x.name === name); if (!s) throw new Error(`unknown scenario ${name}`); test.skip(!s.targets.includes(platformOf(target)) && !s.targets.includes(target as Target), `${name} does not run on ${target}`); - // cold start per scenario (R5): no SDK state or ID counters carried over + // cold start per scenario: no SDK state or ID counters carried over await (steps.launch ? steps.launch() : app.restart()); collector.begin(name, platformOf(target)); @@ -122,7 +122,7 @@ export async function expectScenario( actual = await collector.end(); } // every app exports through the native core (bare: native-first init, Expo: JS-fallback init), so one expected - // file per scenario proves both init paths equivalent (R13). + // file per scenario proves both init paths equivalent. // VERIFY_E2E_DRAFT=1 writes a missing expected file and still fails (review it, then rerun) const r = compareToExpected(name, platformOf(target), actual, {draft: process.env.VERIFY_E2E_DRAFT === '1'}); if (!r.ok) throw new Error('\n' + r.report);