[codex] Structure browser recording failures - #3330
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Approved This PR refactors error handling in browser recording by replacing generic errors with structured, typed error classes. The core recording logic and behavior remain unchanged - only the error reporting is improved for better debugging. You can customize Macroscope's approvability policy. Learn more. |
Summary
Verification
vp test apps/web/src/browser(9 tests)vp check(passes with 20 pre-existing warnings)vp run typecheckNote
Low Risk
Localized error-handling refactor in preview recording; behavior is clearer on failure paths with no auth or data-model changes.
Overview
Replaces generic
Errorthrows inbrowserRecording.tswith Effect Schema tagged errors so callers can distinguish unavailable bridge, tab conflict, missing canvas, and per-step operation failures (withtabId, dimensions, oroperation+ underlyingcause).startBrowserRecordingnow wraps MediaRecorder setup, frame subscription, recorder start, and screencast start in separate try/catch blocks; failed screencast start runs recorder cleanup and may surface anAggregateErrorwhen both start and cleanup fail.stopBrowserRecordingruns stop screencast → stop recorder → save artifact as labeled steps, then always attempts cleanup/clear infinally; primary failures can be combined with cleanup failures viaBrowserRecordingOperationErrorwithoperation: "cleanup"andAggregateError.Reviewed by Cursor Bugbot for commit d9e431c. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add structured error classes to browser recording operations
browserRecording.ts:BrowserRecordingUnavailableError,BrowserRecordingConflictError,BrowserRecordingCanvasUnavailableError, andBrowserRecordingOperationError, all usingSchema.TaggedErrorClass.startBrowserRecordingnow throws specific error types per failure stage (unavailable bridge, tab conflict, missing canvas context, recorder init, frame subscription, screencast start) and only sets the active tab atom after a successful screencast start.stopBrowserRecordingsequences stop-screencast, stop-media-recorder, and save-artifact in separate try/catch blocks, each throwing a scopedBrowserRecordingOperationError.AggregateErrorcombining both causes is wrapped inBrowserRecordingOperationError('cleanup').Errorinstances will now receive typed error objects; combined failure paths surfaceAggregateErrorinstead of a single error.Macroscope summarized d9e431c.