Tighten rrweb checkout control with watchdog#1421
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a CheckoutWatchdog to enforce rrweb checkout intervals, preventing replay buffers from exceeding the configured pre-duration when rrweb skips natural checkouts during idle periods. The recorder now delegates checkout enforcement to the watchdog, which monitors idle time and triggers forced snapshots when needed.
Key changes:
- Extracted checkout enforcement logic from Recorder into a dedicated CheckoutWatchdog class
- Standardized test stubs with
stubRecordFn()to ensuretakeFullSnapshotavailability across all test suites - Added comprehensive watchdog unit tests and integration tests for the checkout resilience behavior
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/browser/replay/checkoutWatchdog.js | New watchdog class that schedules forced checkouts when recorder is idle beyond the configured interval |
| src/browser/replay/recorder.js | Integrated CheckoutWatchdog, added validation for recordFn.takeFullSnapshot, and notifies watchdog on checkout events |
| test/replay/util/mockRecordFn.js | Added stubRecordFn() factory and takeFullSnapshot support to mock rrweb behavior |
| test/replay/unit/checkoutWatchdog.test.js | New unit tests for watchdog timer behavior and checkout forcing |
| test/replay/unit/recorder.test.js | Updated to use stubRecordFn() |
| test/replay/unit/recorder.collectEvents.test.js | Updated to use stubRecordFn() |
| test/browser.replay.recorder.test.js | Updated to use stubRecordFn() and added integration tests for watchdog behavior |
| test/replay/integration/replay.bufferIndex.test.js | Updated to use stubRecordFn() |
| test/replay/integration/replay.bufferIndex.checkoutResilience.test.js | Updated to use stubRecordFn() |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
waltjones
approved these changes
Nov 10, 2025
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.
Description of the change
Other
Type of change
Related issues
Fixes: CAT-496