Skip to content

feat(browser): error-triggered session replay (replay.onErrorSampleRate) - #1154

Merged
Makisuo merged 3 commits into
feat/browser-sdk-reactfrom
feat/browser-sdk-error-replay
Sep 29, 2026
Merged

Makisuo merged 3 commits into
feat/browser-sdk-reactfrom
feat/browser-sdk-error-replay

Merge branch 'feat/browser-sdk-react' into feat/browser-sdk-error-replay

648a5ca
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Sep 29, 2026 in 1m 29s

Confidence 4/5 · No issues found

Confidence 4/5 · likely safe to merge
The reviewed delta is a two-line regex-state fix with a regression test; nothing else changed since the last review.
quality 100/100 · no findings · tests covered · risk medium

Adds replay.onErrorSampleRate: unsampled sessions buffer the last minute of rrweb in memory and upload it, then stream, when an error is recorded. The delta since the last review is the error-filter regex fix, which is correct and tested.

  • matches resets RegExp.lastIndex before test, so a g/y filter drops every matching error
  • claimReplayMode rolls a persisted record / buffer / off per session
  • startBufferedRecording holds the last two snapshot segments until drain() uploads them
  • trigger() drains the buffer, streams the rest and re-announces the session as recorded
What was checked
  • pattern.lastIndex = 0 precedes every test; the other regex uses, FRAME_URL.exec (error-filters.ts:48) and EXTENSION_URL.test (:79), carry no g flag
  • The new test (error-filters.test.ts:83) calls the real shouldCapture and fails before the fix, where a gi regex keeps lastIndex
  • ignore, denyUrls and allowUrls all reach test through matches, so all three lists get the reset

648a5ca · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple to ask about one.