Skip to content

Tighten rrweb checkout control with watchdog#1421

Merged
matux merged 6 commits into
masterfrom
matux/checkout-control
Nov 10, 2025
Merged

Tighten rrweb checkout control with watchdog#1421
matux merged 6 commits into
masterfrom
matux/checkout-control

Conversation

@matux

@matux matux commented Nov 10, 2025

Copy link
Copy Markdown
Contributor

Description of the change

  • Extracted the idle-checkout enforcement logic from Recorder into CheckoutWatchdog, so recorder simply notifies checkouts and the helper handles timers/forced snapshots.
  • Added dedicated watchdog unit tests and reran all recorder/replay suites to confirm behavior parity.

Other

  • Recorder now requires rrweb stubs via a single stubRecordFn() used across browser/unit/integration suites, preventing divergence and guaranteeing takeFullSnapshot availability.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Maintenance
  • New release

Related issues

Fixes: CAT-496

@matux matux requested a review from Copilot November 10, 2025 13:34
@matux matux self-assigned this Nov 10, 2025
@linear

linear Bot commented Nov 10, 2025

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ensure takeFullSnapshot availability 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.

Comment thread src/browser/replay/checkoutWatchdog.js Outdated
Comment thread test/replay/util/mockRecordFn.js
@matux matux marked this pull request as ready for review November 10, 2025 16:17
@matux matux merged commit f49a385 into master Nov 10, 2025
6 checks passed
@matux matux deleted the matux/checkout-control branch November 10, 2025 16:18
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.

3 participants