Skip to content

feat(amp-semantic): add context and visibility capture - #2113

Draft
jxiwang wants to merge 1 commit into
mainfrom
codex/semantic-context-visibility
Draft

jxiwang wants to merge 1 commit into
mainfrom
codex/semantic-context-visibility

Conversation

@jxiwang

@jxiwang jxiwang commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Introduce the first independently mergeable amp-semantic increment: opt-in amp-semantic/context and amp-semantic/visibility events in the existing rrweb stream. Context is emitted after accepted full snapshots; visibility reports deduplicated hidden/visible transitions. Capture is disabled by default and supports local/remote family controls, additional sampling, per-session caps, and tab/document identity.

The package has separate context and visibility recorders behind an injectable host/runtime boundary. Session Replay and its analytics plugin supply configuration and transport. This increment adds no DOM observer, click hook, navigation observer, or semantic lifecycle events. Dialog/notice and the remaining families remain in #2082 for subsequent increments.

Include a two-family wire schema, documentation, a local-only replay fixture, and unit/browser tests. No prerelease version history or unrelated changes from #2082 are included.

Validation

  • Node 24; install and frozen-lockfile verification passed.
  • Full workspace build, documentation check, lint, dependency checks, and bundle-size checks passed.
  • pnpm test --concurrency=2: 4,831 tests / 269 suites passed across 32 projects. The initial default-concurrency run hit two timing assertions in unchanged Autocapture long-task tests; the isolated file and reduced-concurrency full run passed.
  • All affected packages have 100% statements, branches, functions and lines coverage: amp-semantic (29 tests), session-replay-browser (1,112), and plugin-session-replay-browser (65).
  • Six Chromium browser tests passed through real replay transport, including timestamps, identity, disabled/sampled-out capture, remote kill switch, and stop/resume. Visibility notification inputs are controlled in these automated tests; native tab timing remains browser-dependent.
  • Existing bundle limits remain unchanged: standalone replay 144.16 kB gzip; Unified 232.29 kB gzip.
  • Existing repository blocker: pnpm test:examples cannot start because its configured jest.setup.examples.js is absent from main. This PR does not alter the example-test setup.

Checklist

  • PR title follows the conventional commit format.
  • Breaking change: No stable API is removed; semantic capture is new and opt-in.

@github-actions

Copy link
Copy Markdown

size-limit report 📦

Path Size
packages/analytics-browser/lib/scripts/amplitude-min.js.gz 68.33 KB (0%)
packages/session-replay-browser/lib/scripts/session-replay-browser-min.js.gz 140.78 KB (+1.85% 🔺)
packages/unified/lib/scripts/amplitude-min.umd.js.gz 226.86 KB (+1.15% 🔺)
@amplitude/element-selector (gzipped esm) 3.48 KB (0%)
@amplitude/analytics-browser/lite (gzipped esm) 21.75 KB (0%)

@github-actions

Copy link
Copy Markdown

Session Replay Browser E2E Results

passed  157 passed

Details

stats  157 tests across 18 suites
duration  4 minutes, 27 seconds
commit  152ea3c

This branch has not been deployed

No deployments
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.

1 participant