[codex] Structure preview automation boundary failures - #3436
Conversation
|
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 |
Co-authored-by: codex <codex@users.noreply.github.com>
2489dcc to
b4ba73d
Compare
ApprovabilityVerdict: Approved Refactors error handling by extracting error classes to a dedicated file and adding a structured error boundary that wraps all exceptions with context for consistent serialization. The existing operation logic is unchanged; tests verify sensitive information is not leaked in error responses. You can customize Macroscope's approvability policy. Learn more. |
Summary
causewhile returning only attribute-derived messages and bounded structural detail to the remote callerString(error)Why
Unexpected preview automation failures previously escaped as raw errors. The response serializer could expose their messages while dropping the request context needed to correlate the failure. This keeps the diagnostic chain locally and sends a predictable, non-cause-derived response upstream.
Validation
vp test run src/components/preview/previewAutomationRequestConsumer.test.ts --project unit(fromapps/web)vp checkvp run typecheckNote
Medium Risk
Changes how automation errors are surfaced to remote callers; behavior is intentional sanitization but affects debugging and any consumers expecting raw error text.
Overview
Preview automation failures are centralized in
previewAutomationErrors.ts, with tagged errors, aPreviewAutomationOperationErrorwrapper, andserializePreviewAutomationOwnerErrorso remote responses use stable tags/messages and boundeddetailwithout leakingcause.PreviewAutomationOwnerwraps the request handler in try/catch, trackstabIdthrough operations, and rethrows viaPreviewAutomationOperationError.fromCause(known tagged errors pass through). The request consumer now takesenvironmentIdand serializes failures with full operation context instead of inferring from rawErrornames/messages.Reviewed by Cursor Bugbot for commit b4ba73d. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Standardize preview automation boundary failures into structured tagged errors
PreviewAutomationOverlayTimeoutError,PreviewAutomationNavigationTimeoutError,PreviewAutomationStaleOwnerError,PreviewAutomationTargetUnavailableError,PreviewAutomationRecordingNotActiveError) into previewAutomationErrors.ts with rich contextual fields (requestId, environmentId, threadId, tabId).PreviewAutomationOperationErroras a catch-all wrapper for unexpected failures, with a staticfromCausethat preserves known owner errors or wraps unknown ones, and aserializePreviewAutomationOwnerErrorfunction that converts errors to safe response payloads.PreviewAutomationOwner.handleRequestin PreviewAutomationOwner.tsx to wrap all operation branches in a try/catch and rethrow viaPreviewAutomationOperationError.fromCause, and consistently awaits async calls.serializePreviewAutomationErrorin previewAutomationRequestConsumer.ts to accept operation context and always produce a standardized, sanitized error response.createPreviewAutomationRequestConsumerAtomnow requiresenvironmentId; all error responses include structured context and raw causes are never leaked.Macroscope summarized b4ba73d.