Skip to content

Conversation

@lewgordon-amplitude
Copy link
Collaborator

@lewgordon-amplitude lewgordon-amplitude commented Nov 7, 2025

Summary

Force disable session replay capture when remote configuration is not available, regardless of whether the fetch failed or returned no session replay configuration. This ensures the remote config acts as a proper kill switch mechanism.

Previously, capture could remain enabled if remote config fetch succeeded but returned no session replay configuration, defeating the kill switch purpose.

Checklist

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

Note

Force-disable Session Replay capture when remote config is unresolved or lacks session replay config; update tests to reflect new kill-switch behavior.

  • Config join logic (packages/session-replay-browser/src/config/joined-config.ts):
    • Add remoteConfigFailed tracking and disable config.captureEnabled when remote config is null or lacks sessionReplay config.
    • Emit warnings distinguishing unresolved remote config vs. missing session replay configuration.
    • Preserve existing merge behavior when valid sr_* configs are present.
  • Tests:
    • Update unit tests (test/config/joined-config.test.ts) to expect captureEnabled: false when remote config is null or missing sessionReplay and adjust cases for ignoring improper keys.
    • Update integration tests (test/integration/sampling.test.ts) to ensure no capture or sampling checks when remote config cannot be resolved, and validate sampling behavior when remote config only sets capture_enabled.

Written by Cursor Bugbot for commit 05e91e8. Configure here.

@lewgordon-amplitude
Copy link
Collaborator Author

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Comment @cursor review or bugbot run to trigger another review on this PR

sessionReplayRemoteConfig.sr_targeting_config = targetingConfig;
}
}
} else {
Copy link

Choose a reason for hiding this comment

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

Bug: Config Glitch Disables Session Replay

The condition for populating sessionReplayRemoteConfig only checks samplingConfig, privacyConfig, and targetingConfig, but ignores sr_interaction_config and sr_logging_config which are also valid session replay configurations. When remote config contains only sr_interaction_config or sr_logging_config, sessionReplayRemoteConfig remains undefined, triggering the kill switch to disable capture even though valid remote config was received. This incorrectly disables capture when interaction or logging configs are present.

Fix in Cursor Fix in Web

@promptless
Copy link

promptless bot commented Nov 7, 2025

📝 Documentation updates detected!

New suggestion: Clarify Session Replay remote config kill switch behavior

…ilable

Force disable session replay capture when remote configuration is not
available, regardless of whether the fetch failed or returned no session
replay configuration. This ensures the remote config acts as a proper
kill switch mechanism.

Previously, capture could remain enabled if remote config fetch succeeded
but returned no session replay configuration, defeating the kill switch
purpose.

Changes:
- Always set captureEnabled=false when sessionReplayRemoteConfig is undefined
- Add distinct warning messages for fetch failure vs missing configuration
- Update tests to verify both failure scenarios
- Add test case for successful fetch with no SR configuration

Fixes SR-2083
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.

2 participants