Skip to content

feat(bindings): add C12 telemetry lifecycle stubs to consumer-check apps - #750

Merged
bahdotsh merged 3 commits into
mainfrom
feat/consumer-check-telemetry-lifecycle
Nov 17, 2026
Merged

bahdotsh merged 3 commits into
mainfrom
feat/consumer-check-telemetry-lifecycle

Conversation

@Ankush523

@Ankush523 Ankush523 commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Why this PR exists

C12 requires native hosts (not RN/Flutter) to fill telemetry platform fields and forward foreground/background app state. Swift/Kotlin/C# consumer-check apps had engine wiring but no copy-paste lifecycle pattern for telemetry.

This PR adds commented, compile-checked stubs in iOS/Android Kotlin and C# consumer-check, plus telemetry doc pointers.

Stack: base feat/integration-testing-matrix (#749).


What this changes (reviewer lens)

Audience Before After
Native Maven/SPM integrators Read telemetry.md alone Runnable stubs in consumer-check + doc section
Android consumer-check README JNI/import prose only Table + C12 lifecycle in Use.kt
Maintainers No pin consumer_check_telemetry_lifecycle_is_documented

Wire / FFI: unchanged; stubs are samples, not library API.


What we changed (technical)

  • bindings/kotlin/consumer-check/.../Use.kt — Android lifecycle observer sketch → engine app-state notifications.
  • bindings/swift/consumer-check/.../Use.swift — parallel iOS pattern.
  • bindings/csharp/consumer-check/Program.cs — lifecycle forward note.
  • bindings/kotlin/consumer-check/README.md — paths table merged with JNI doc link.
  • docs/telemetry.md — consumer-check as reference for C12.
  • crates/offline-protocol-uniffi — guard over three consumer-check paths + telemetry doc needles.

Commits on branch (vs #749): feature + rustfmt guard.


Risk / why it’s safe to merge

  • Blast radius: Low — consumer-check and docs; stubs marked “never run” / illustrative where applicable.
  • Rollback: Revert stubs + guard.

Test plan

  • cargo test -p offline-protocol-uniffi consumer_check_telemetry_lifecycle_is_documented
  • Optional: consumer-check release builds on CI jobs for Kotlin/Swift/C#

Merge order: after #749.

@bahdotsh
bahdotsh added this pull request to stack #753 November 16, 2026 14:26
@Ankush523
Ankush523 force-pushed the feat/consumer-check-telemetry-lifecycle branch from dcb3139 to e93e65a Compare November 16, 2026 22:12
@bahdotsh
bahdotsh force-pushed the feat/consumer-check-telemetry-lifecycle branch 4 times, most recently from 63a1837 to 361aa40 Compare November 17, 2026 07:29
Base automatically changed from feat/integration-testing-matrix to main November 17, 2026 09:41
@bahdotsh
bahdotsh force-pushed the feat/consumer-check-telemetry-lifecycle branch from 361aa40 to 2556758 Compare November 17, 2026 09:41
… apps

The Swift and Kotlin stubs called notifyAppState(background) then
notifyAppState(active) back to back. Copied as telemetry.md told
integrators to, that rotates a session on the spot and closes none when
the app actually backgrounds.

Both now carry a TelemetryLifecycleForwarder that mirrors the React
Native module, which is not in either native package:

- Swift: UIApplication background/foreground notifications, the
  background edge and a three-second flush inside a background task,
  both edges on one serial queue, enable seeded from applicationState.
- Kotlin: an Application.ActivityLifecycleCallbacks watcher registered in
  Application.onCreate, started activities held by identity, the
  background edge gated on isChangingConfigurations, every exception
  from notifyAppState caught, enable seeded from the watcher.

The config helpers take the api key and app version instead of
hard-coding an empty key the engine refuses.

Also: drop the Kotlin consumer-check README row naming a Gradle task
that does not exist; reword the C# comment, whose calls run with
telemetry off; point telemetry.md's C# row at CS5; and make the guard pin
the C12 obligations rather than helper names, so a back-to-back stub no
longer passes it.
@bahdotsh
bahdotsh merged commit 8eb6f56 into main Nov 17, 2026
44 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants