Add ScheduledStreamCapture for extended leading replay support#1372
Merged
Conversation
Streaming leading chunks + precise end-of-window export
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements ScheduledStreamCapture to enable extended leading (post-trigger) replay captures by streaming chunks at safe intervals during long postDuration windows, preventing event loss. The implementation replaces ScheduledCapture with a streaming version that exports multiple chunks sequentially rather than a single delayed export.
- Adds
ScheduledStreamCaptureclass that streams chunks at checkout-safe intervals - Refactors
ScheduledCaptureto improve error handling and extract common patterns - Updates ReplayManager to use streaming capture for extended post-trigger replay duration
- Adds comprehensive unit tests and updates integration tests to handle the new streaming behavior
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/browser/replay/scheduledStreamCapture.js |
New streaming capture implementation with interval-based chunk export and sequential sending |
src/browser/replay/scheduledCapture.js |
Refactored with improved error handling, extracted helper methods, and consistent patterns |
src/browser/replay/replayManager.js |
Updated to use ScheduledStreamCapture and improved error logging |
test/replay/unit/scheduledCapture.test.js |
Updated tests for refactored ScheduledCapture API changes and new helper methods |
test/replay/unit/replayManager.test.js |
Updated error message expectations for improved logging |
| Multiple integration test files | Added logger initialization and updated expectations for streaming behavior |
| Test index files | Removed export statements (likely replaced by different test organization) |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
waltjones
approved these changes
Oct 13, 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
Enables extended leading (post-trigger) replay captures by streaming chunks at safe intervals to prevent event loss during long postDuration windows.
_pendingContextIfReadyand renamebufferCursortocursorin pending context #1364index.jsfrom tests #1366loggerin replay integration tests to log errors #1367sendIfReadycalls #1368ScheduledStreamCapture(streaming leading chunks + precise end-of-window export) to survive multiple rrweb checkouts #1371Sub-PRs (All Approved)
Extract LeadingCapture coordination logic
Refactored ReplayManager by extracting 150 lines of leading capture logic into dedicated LeadingCapture component using delegate pattern for coordination.
Add comprehensive unit tests for LeadingCapture
Added 38 dedicated unit tests covering scheduling, export, coordination, error handling, and state management for LeadingCapture.
Rename LeadingCapture to ScheduledCapture
Renamed to reflect generic utility nature - coordinates delayed, cursor-based captures without knowledge of "leading" vs "trailing" concepts.
Implement ScheduledStreamCapture for extended captures
Replaces ScheduledCapture with streaming implementation that exports multiple chunks at checkout-safe intervals, preventing event loss during long postDuration windows.
Key Features
Type of change
Related issues
CAT-485/extended-post-trigger-replay-duration