Skip to content

Move send replay from Queue to ReplayManager#1338

Merged
matux merged 1 commit into
matux/leading-replayfrom
matux/move-send-to-replaymanager
Oct 1, 2025
Merged

Move send replay from Queue to ReplayManager#1338
matux merged 1 commit into
matux/leading-replayfrom
matux/move-send-to-replaymanager

Conversation

@matux

@matux matux commented Oct 1, 2025

Copy link
Copy Markdown
Contributor

Description of the change

Note

PR Description written by Copilot

This PR refactors the replay handling logic by moving responsibility for deciding whether to send or discard replays from the Queue class to the ReplayManager class. This centralization improves maintainability and separation of concerns.

  • Added a new sendOrDiscardReplay method to ReplayManager that consolidates replay eligibility checks and error handling
  • Updated Queue to delegate replay handling to ReplayManager.sendOrDiscardReplay instead of handling the logic internally
  • Comprehensively updated all test suites to reflect the new integration point and method signatures

Refactoring and Responsibility Shift:

  • Moved the replay eligibility check and send/discard logic from Queue._sendOrDiscardReplay and _canSendReplay into a new method ReplayManager.sendOrDiscardReplay, which now encapsulates all criteria and error handling for sending or discarding replays. (src/browser/replay/replayManager.js [1] src/queue.js [2]
  • Updated Queue to call ReplayManager.sendOrDiscardReplay directly instead of handling replay logic internally, simplifying Queue and improving separation of concerns. (src/queue.js src/queue.jsL118-R123)

Test Suite Updates:

  • Refactored all integration and unit tests to expect calls to ReplayManager.sendOrDiscardReplay instead of the previous direct calls to send or discard, ensuring tests accurately reflect the new flow. (test/replay/integration/queue.replayManager.test.js [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]; test/replay/unit/queue.replayManager.test.js [15]

Integration Improvements:

These changes centralize replay handling, making the codebase easier to maintain and extend, and ensure that tests accurately verify the new replay flow.

@matux matux requested review from Copilot and waltjones October 1, 2025 16:05
@matux matux self-assigned this Oct 1, 2025

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 refactors the replay handling logic by moving responsibility for deciding whether to send or discard replays from the Queue class to the ReplayManager class. This centralization improves maintainability and separation of concerns.

  • Added a new sendOrDiscardReplay method to ReplayManager that consolidates replay eligibility checks and error handling
  • Updated Queue to delegate replay handling to ReplayManager.sendOrDiscardReplay instead of handling the logic internally
  • Comprehensively updated all test suites to reflect the new integration point and method signatures

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/browser/replay/replayManager.js Added new sendOrDiscardReplay method with consolidated replay eligibility logic
src/queue.js Removed internal replay handling methods and updated to call ReplayManager.sendOrDiscardReplay
test/replay/unit/replayManager.test.js Added comprehensive unit tests for new sendOrDiscardReplay method
test/replay/unit/queue.replayManager.test.js Updated tests to expect calls to sendOrDiscardReplay instead of direct send/discard calls
test/replay/integration/sessionRecording.test.js Updated spy target from Queue to ReplayManager method
test/replay/integration/replayManager.test.js Added integration tests for sendOrDiscardReplay scenarios
test/replay/integration/queue.replayManager.test.js Updated integration tests to verify new method calls and argument passing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@matux matux merged commit 3dddb91 into matux/leading-replay Oct 1, 2025
4 checks passed
@matux matux deleted the matux/move-send-to-replaymanager branch October 1, 2025 16:16
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