Skip to content

feat(amp-semantic): capture replay-driven notices and dialogs - #2156

Open
jxiwang wants to merge 31 commits into
codex/semantic-resource-errorsfrom
codex/semantic-feedback-events
Open

jxiwang wants to merge 31 commits into
codex/semantic-resource-errorsfrom
codex/semantic-feedback-events

Conversation

@jxiwang

@jxiwang jxiwang commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add amp-semantic/notice and amp-semantic/dialog from accepted rrweb snapshots and mutations, including privacy-aware text/name, open/close state, visibility, and recent click correlation.
  • Resolve relevant rrweb node IDs through the recorder mirror. The feedback recorder does bounded work per animation frame and adds no MutationObserver or full-page DOM scan.
  • Extend schema, local inspector, browser replay test, and unit/pressure tests. Supersedes the notice/dialog portion of older draft feat(amp-semantic): capture page state and UI feedback #2081.

Stack

Base: #2155. Merge after #2128 and #2150–#2155.

Validation

  • pnpm --filter @amplitude/session-replay-browser... build
  • pnpm --filter @amplitude/amp-semantic test: 182 passed, 100% coverage
  • pnpm --filter @amplitude/session-replay-browser test: 1,185 passed, 100% coverage
  • pnpm --filter @amplitude/amp-semantic test:playwright: 14 passed
  • pnpm lint, pnpm lint:deps, pnpm test:examples

The full workspace build stalls in the unchanged Segment Session Replay Rollup step, and the full workspace test run has two existing analytics-react-native failures, as documented in earlier stack drafts.

Linear: SRAI-61, SRAI-62.


Note

Medium Risk
New semantic payloads include live-region text and dialog names with privacy rules, and replay DOM forwarding adds integration surface area beyond existing interaction recorders.

Overview
Adds amp-semantic/notice and amp-semantic/dialog so session replay can emit live-region messages and dialog open/close transitions from accepted rrweb snapshots and mutations, without a separate MutationObserver or full-page DOM scan.

A new feedbackRecorder listens on a dom host signal, resolves only relevant rrweb node IDs via getNode, applies privacy-aware text/names and optional click correlation (subscribe), and processes work on a bounded per-frame budget (300 events per family). The capture runtime gains hasCapacity and subscribe; helpers now use ownerDocument for iframe-safe name/text resolution.

Session Replay wires this through ReplaySemanticAdapter, which forwards full snapshots and mutation increments (with startup queuing capped at 128), and supplies the rrweb mirror’s getNode. Schema, README, local test harness, Playwright e2e, and extensive unit/pressure tests cover the new families and gates.

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

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

size-limit report 📦

Path Size
packages/analytics-browser/lib/scripts/amplitude-min.js.gz 68.78 KB (0%)
packages/session-replay-browser/lib/scripts/session-replay-browser-min.js.gz 142.42 KB (+0.11% 🔺)
packages/unified/lib/scripts/amplitude-min.umd.js.gz 229.41 KB (+0.08% 🔺)
@amplitude/element-selector (gzipped esm) 3.48 KB (0%)
@amplitude/analytics-browser/lite (gzipped CDN bundle) 21.44 KB (0%)

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Session Replay Browser E2E Results

passed  178 passed
flaky  2 flaky

Details

stats  180 tests across 20 suites
duration  6 minutes, 45 seconds
commit  ea91392

Flaky tests

chromium › e2e/shadow-dom.spec.ts › captureAdoptedStyleSheets option › SDK initializes without error and captures shadow host with default (true)
chromium › e2e/shadow-dom.spec.ts › captureAdoptedStyleSheets option › SDK initializes without error and captures shadow host with captureAdoptedStyleSheets=false

@jxiwang
jxiwang marked this pull request as ready for review November 17, 2026 22:12
@jxiwang
jxiwang requested a review from a team as a code owner November 17, 2026 22:12

@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.

Stale Bugbot comment from a previous run.

Comment thread packages/amp-semantic/schema.json Resolved

@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.

Stale Bugbot comment from a previous run.

@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.

Stale Bugbot comment from a previous run.

@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.

Stale Bugbot comment from a previous run.

@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 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 6775d09. Configure here.

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