Repository navigation
feat(session-replay): integrate semantic context capture - #2127
Merged
Merged
Conversation
…context-visibility-events
This was referenced Nov 4, 2026
Session Replay Browser E2E ResultsDetails
|
size-limit report 📦
|
# Conflicts: # packages/amp-semantic/README.md # packages/amp-semantic/package.json
Collaborator
Author
|
bugbot run |
Collaborator
Author
|
bugbot run |
jxiwang
marked this pull request as ready for review
November 10, 2026 17:14
Contributor
Collaborator
Author
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 5 total unresolved issues (including 4 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2c4773f. Configure here.
bravecod
approved these changes
Nov 10, 2026
bravecod
approved these changes
Nov 10, 2026
This was referenced Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Connect semantic context capture to Session Replay through a locally supplied implementation. Applications opt in with:
Session Replay has no production dependency or public declaration dependency on
amp-semantic. It defines a small structural callback, host, and controller contract; the semantic package remains a development-only dependency for compatibility tests. Without a localcreateCapturecallback, capture stays inactive even when remote configuration enables it. Remote config can change enabled, sampling, and family controls, but cannot replace the callback. The analytics plugin forwards the local callback unchanged.The adapter waits for rrweb readiness, forwards accepted full snapshots, resets sampling and caps for a new session, and stops capture with recording. Replacing the callback stops its previous runtime; an initialization error does not abort replay setup. The replay host owns tab/document identity using its existing core UUID helper. A bounded startup queue does not import recorder-specific caps.
Context travels through existing rrweb type-5 custom events. Include the local-only playground and Chromium tests for actual transport, capture gates, and stop/resume. This increment enables only context; visibility follows in #2128.
Review fixes
[0, 1]are retained.Stack
Base:
main(runtime #2120 and context #2126 are merged). Visibility (#2128) remains stacked on this branch.Validation
Updated against
mainon November 9, 2026, including the publishedamp-semantic@0.3.0package. The merge conflict is resolved; the resulting PR diff contains only integration work.createCapturewith remote capture enabled.amp-semanticmodules. Emitted replay declarations and JS contain no imports from that package.pnpm test:examplescannot start becausejest.setup.examples.jsis absent on main.Note
Medium Risk
Changes run on the replay recording path and attach privacy/configuration context to the stream, but capture is off by default, requires a local factory, and semantic failures are isolated from rrweb teardown.
Overview
Wires opt-in semantic context into Session Replay via a local
createCapturecallback (no production dependency on@amplitude/amp-semantic). Apps enablesemanticCapture: { enabled: true, createCapture: createSemanticCapture }; without the factory, capture stays inert even when remote config turns it on.Session Replay adds a structural host/adapter (
ReplaySemanticAdapter) that waits for rrweb readiness, triggers capture on accepted full snapshots, emitsamp-semantic/contextas type-5 custom events, and tears down on stop/reinit/session changes without blocking normal recording. Tab/document identity is allocated lazily with sessionStorage when available. Remotesr_semantic_configcan adjust enabled, sample rate, and families; the localcreateCapturecallback is preserved and invalid remote sample rates warn and force0.The analytics Session Replay plugin forwards
semanticCaptureand reports active autocapture families assemanticAnalyticsContext. Documentation, a local vite harness (sr-semantic-test), and Playwright e2e plus unit/integration tests cover transport, gates, lifecycle, and joined-config behavior.Reviewed by Cursor Bugbot for commit e55359f. Bugbot is set up for automated code reviews on this repo. Configure here.