fix(replay): wait for new config before recording decision#3128
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
3f7b2e6 to
4ab2dc8
Compare
4ab2dc8 to
f7a17a7
Compare
|
Size Change: +778 B (+0.01%) Total Size: 6.69 MB
ℹ️ View Unchanged
|
| // If still buffering (waiting for remote config), discard the buffer | ||
| // Better to lose this data than record incorrectly. |
There was a problem hiding this comment.
misleading comment - at this point, remote config has already been received (otherwise the lazy recorder wouldn't exist). BUFFERING here means waiting for a URL/event trigger to match, not waiting for remote config. The guard against starting before remote config is in session-recording.ts:78.
| // If still buffering (waiting for remote config), discard the buffer | |
| // Better to lose this data than record incorrectly. | |
| // If still buffering (waiting for URL/event trigger), discard the buffer | |
| // Better to lose this data than record incorrectly. |
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/browser/src/extensions/replay/external/lazy-loaded-session-recorder.ts
Line: 1337-1338
Comment:
misleading comment - at this point, remote config has already been received (otherwise the lazy recorder wouldn't exist). `BUFFERING` here means waiting for a URL/event trigger to match, not waiting for remote config. The guard against starting before remote config is in `session-recording.ts:78`.
```suggestion
// If still buffering (waiting for URL/event trigger), discard the buffer
// Better to lose this data than record incorrectly.
```
How can I resolve this? If you propose a fix, please make it concise.| expect(sessionRecording.status).toBe('active') | ||
| }) | ||
|
|
||
| it('discards buffer on beforeunload if remote config not yet loaded', () => { |
There was a problem hiding this comment.
test name is misleading - remote config IS loaded on line 417. The test actually verifies that the buffer is cleared when in BUFFERING status (waiting for URL trigger) during beforeunload.
| it('discards buffer on beforeunload if remote config not yet loaded', () => { | |
| it('discards buffer on beforeunload when waiting for url trigger to match', () => { |
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/browser/src/__tests__/extensions/replay/sessionRecording-onRemoteConfig.test.ts
Line: 407
Comment:
test name is misleading - remote config IS loaded on line 417. The test actually verifies that the buffer is cleared when in `BUFFERING` status (waiting for URL trigger) during `beforeunload`.
```suggestion
it('discards buffer on beforeunload when waiting for url trigger to match', () => {
```
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
@ksvat Claude also flagged this for me when reviewing the branch. We will buffer while waiting for a url trigger to match and with this PR we'll now discard that buffer on beforeunload. Doesn't seem like what we want?
There was a problem hiding this comment.
yeah i think this is leftover from before we added the new "waiting for config" state, when BUFFERING also handled that state --- thanks for the catch!!
packages/browser/src/extensions/replay/external/lazy-loaded-session-recorder.ts
Show resolved
Hide resolved
6271f85 to
97001f2
Compare
97001f2 to
91f0965
Compare
91f0965 to
ff3bd62
Compare
ff3bd62 to
cce08f8
Compare
packages/browser/src/extensions/replay/external/lazy-loaded-session-recorder.ts
Show resolved
Hide resolved
410ff88 to
640f9aa
Compare
640f9aa to
d0711dc
Compare
d0711dc to
ecb8269
Compare
packages/browser/src/extensions/replay/external/lazy-loaded-session-recorder.ts
Outdated
Show resolved
Hide resolved
ecb8269 to
4acb34b
Compare
packages/browser/playwright/mocked/session-recording/triggerMatch-type.spec.ts
Show resolved
Hide resolved
4acb34b to
766a8de
Compare
766a8de to
5e37cd6
Compare

Problem
had a couple tickets recently where it seems like recording is starting based on a Null config even though later receiving a config that indicates a recording SHOULDNT have started.
Changes
wait for remote config before deciding to record or not
if unload before receiving commit, clear hte buffer rather than flush it
Release info Sub-libraries affected
Libraries affected
Checklist
If releasing new changes
pnpm changesetto generate a changeset file