Skip to content

feat(session-replay-react-native)!: require explicit replay start - #1950

Merged
aliaksandr-kazarez merged 3 commits into
mainfrom
sdkrn-63-remove-autostart-getsessionreplayproperties
Aug 22, 2026
Merged

feat(session-replay-react-native)!: require explicit replay start#1950
aliaksandr-kazarez merged 3 commits into
mainfrom
sdkrn-63-remove-autostart-getsessionreplayproperties

Conversation

@aliaksandr-kazarez

@aliaksandr-kazarez aliaksandr-kazarez commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • remove autoStart from the standalone Session Replay configuration and require explicit start()
  • remove getSessionReplayProperties() across the JavaScript and native bridges
  • stop standalone and Segment plugins from stamping Session Replay properties on events
  • update the example and regression tests for the breaking API behavior

SDKRN-63

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?: Yes

Test plan

  • Build, lint, and tests for @amplitude/session-replay-react-native (54 tests)
  • Build, lint, and tests for @amplitude/segment-session-replay-plugin-react-native (15 tests)
  • Full repository build on Node 18.20.8
  • pnpm docs:check
  • Full repository lint on Node 18.20.8
  • Full aggregate tests did not terminate after completed suites left unrelated Nx executors idle
  • Example tests cannot start because jest.setup.examples.js is absent on origin/main

Posted automatically with Cursor. LLMs make mistakes — please verify before acting.


Note

High Risk
Breaking public API: recording no longer starts on init, and replay metadata is no longer attached to analytics events. Existing RN/Segment integrations that relied on autoStart or getSessionReplayProperties will stop correlating or recording until they migrate.

Overview
Breaking: init() only configures Session Replay. Callers must start() to record. autoStart is removed from SessionReplayConfig and the native setup payload (Android always constructs native SR with autoStart = false).

Also breaking: getSessionReplayProperties() is removed from JS, TurboModule spec, and iOS/Android bridges. Amplitude and Segment plugins no longer merge replay metadata onto events; they only sync session/device IDs.

Plugins still auto-start by default: SessionReplayPlugin and new SegmentSessionReplayPluginConfig.autoStart (default true) call start() after init so “add plugin and record” still works. Set autoStart: false to start later.

Example app and tests follow the new contract (init then start, no property stamping).

Reviewed by Cursor Bugbot for commit 76c31f2. Bugbot is set up for automated code reviews on this repo. Configure here.

Remove autoStart and replay-property stamping. Standalone consumers now initialize first and
explicitly start recording.

BREAKING CHANGE: SessionReplayConfig.autoStart and getSessionReplayProperties() are removed.
Events are no longer stamped with session replay properties.
@linear-code

linear-code Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

SDKRN-63

@github-actions

Copy link
Copy Markdown

size-limit report 📦

Path Size
packages/analytics-browser/lib/scripts/amplitude-min.js.gz 61.54 KB (0%)
packages/session-replay-browser/lib/scripts/session-replay-browser-min.js.gz 134.97 KB (0%)
packages/unified/lib/scripts/amplitude-min.umd.js.gz 215.58 KB (0%)
@amplitude/element-selector (gzipped esm) 2.67 KB (0%)

@aliaksandr-kazarez
aliaksandr-kazarez marked this pull request as ready for review August 21, 2026 20:49
@aliaksandr-kazarez
aliaksandr-kazarez requested a review from a team as a code owner August 21, 2026 20:49
@aliaksandr-kazarez
aliaksandr-kazarez requested review from chungdaniel and a lite review from Copilot August 21, 2026 20:49

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.

Reviewed by Cursor Bugbot for commit 9a796e4. Configure here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a breaking API change for @amplitude/session-replay-react-native so that initialization only configures Session Replay and recording begins only after an explicit start() call. It also removes the cross-bridge “session replay properties” API and stops the RN standalone plugin and Segment plugin from stamping replay-correlation properties onto events.

Changes:

  • Removed autoStart from the standalone Session Replay config path and ensured init() no longer triggers recording automatically.
  • Removed getSessionReplayProperties() from JS exports and native bridges, and removed event-enrichment/stamping logic in plugins.
  • Updated example app and unit/integration tests to reflect the new explicit-start and no-properties behavior.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
packages/session-replay-react-native/test/session-replay.test.ts Updates integration workflow test to require explicit start() and removes properties assertions.
packages/session-replay-react-native/test/plugin-session-replay.test.ts Updates plugin tests for explicit start semantics and removes event stamping expectations.
packages/session-replay-react-native/test/index.test.ts Updates public export tests to ensure getSessionReplayProperties is no longer exported and autoStart isn’t forwarded.
packages/session-replay-react-native/test/mocks/react-native.ts Removes mocked native getSessionReplayProperties.
packages/session-replay-react-native/src/specs/NativeAmpSessionReplay.ts Removes TurboModule spec method getSessionReplayProperties().
packages/session-replay-react-native/src/session-replay.ts Updates init/start docs and removes JS-side getSessionReplayProperties() implementation.
packages/session-replay-react-native/src/session-replay-config.ts Removes standalone autoStart config and default.
packages/session-replay-react-native/src/plugin-session-replay.ts Removes event stamping and switches plugin autoStart to call start() explicitly after setup.
packages/session-replay-react-native/src/native-module.ts Removes native config/property types related to autoStart and properties API.
packages/session-replay-react-native/src/index.tsx Removes getSessionReplayProperties from public exports.
packages/session-replay-react-native/ios/NativeSessionReplay.swift Removes parsing/behavior for autoStart and removes native getSessionReplayProperties method.
packages/session-replay-react-native/ios/AMPNativeSessionReplay.mm Removes exported ObjC bridge method for getSessionReplayProperties.
packages/session-replay-react-native/example/App.tsx Updates example to call start() explicitly and removes properties usage/UI.
packages/session-replay-react-native/android/src/oldarch/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativeSpec.kt Removes old-arch spec method getSessionReplayProperties.
packages/session-replay-react-native/android/src/main/java/com/amplitude/sessionreplayreactnative/SessionReplayReactNativeModule.kt Removes properties bridge and forces autoStart = false on native setup.
packages/segment-session-replay-plugin-react-native/test/segment-session-replay-plugin.test.ts Updates tests to stop expecting replay-property stamping.
packages/segment-session-replay-plugin-react-native/src/segment-session-replay-plugin.ts Removes call to getSessionReplayProperties() so events are no longer enriched.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/session-replay-react-native/test/index.test.ts Outdated
Comment thread packages/session-replay-react-native/test/session-replay.test.ts Outdated
Comment thread packages/session-replay-react-native/test/plugin-session-replay.test.ts Outdated
Comment thread packages/session-replay-react-native/test/plugin-session-replay.test.ts Outdated
Comment thread packages/session-replay-react-native/src/session-replay.ts
Comment thread packages/session-replay-react-native/ios/NativeSessionReplay.swift
…onfigure

The standalone SDK no longer auto-starts, so adding this plugin left
recording off. Restore the previous behavior with a plugin-owned
`autoStart` option (default true) that calls `start()` after `init()`.

`autoStart` is stripped before `init()` so it is not forwarded across the
native bridge, and the README no longer claims the plugin enriches events.

Co-authored-by: Cursor <cursoragent@cursor.com>
@crleona

crleona commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

why are we removing autostart?

Copy link
Copy Markdown
Contributor Author

Standalone SDK on iOS and Flutter does not have autostart. Only android have this on standalone SDK, which historically been an outlier for the API parity.

Autostart property remains unchanged on Segment and Amplitude SR plugins that are consuming the package.

Since RN SR Standalone is in beta - there is no breaking change. I would make sure the Documentation is updated along with the GA

@crleona

crleona commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Standalone SDK on iOS and Flutter does not have autostart. Only android have this on standalone SDK, which historically been an outlier for the API parity.

Autostart property remains unchanged on Segment and Amplitude SR plugins that are consuming the package.

Since RN SR Standalone is in beta - there is no breaking change. I would make sure the Documentation is updated along with the GA

Ah that makes sense 👍, thanks!

Assert autoStart is omitted from native setup args, make the
uninitialized plugin test skip setup, document that init() does not
throw, and check the Segment plugin's execute() return value.

Co-authored-by: Cursor <cursoragent@cursor.com>
@aliaksandr-kazarez
aliaksandr-kazarez merged commit 6deb062 into main Aug 22, 2026
17 checks passed
@aliaksandr-kazarez
aliaksandr-kazarez deleted the sdkrn-63-remove-autostart-getsessionreplayproperties branch August 22, 2026 00:27
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.

4 participants