[codex] Structure cross-client clipboard failures#3361
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 adds structured error classes and consistent error handling for clipboard operations across mobile and web apps. The changes are additive, well-tested, and don't alter core clipboard functionality—only how failures are reported. You can customize Macroscope's approvability policy. Learn more. |
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate ba7a9ce
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate fa91438
Summary
Verification
vp test apps/mobile/src/lib/copyTextWithHaptic.test.ts apps/web/src/hooks/useCopyToClipboard.test.tsvp check(passes with existing warnings)vp run typecheckvp run lint:mobileNote
Low Risk
UX-focused clipboard error handling and logging; no auth, data persistence, or security-sensitive logic changes beyond avoiding sensitive text in diagnostics.
Overview
Adds structured clipboard/haptic errors on mobile and web so failures carry a stable
targetlabel and underlyingcause, without ever putting copied text in error messages.On mobile,
copyTextWithHapticnow accepts optionaltargetandfeedback(light-impactvsselection), logsCopyTextClipboardWriteError/CopyTextHapticFeedbackError, and still runs clipboard and haptics in parallel. Connection trace-ID copy sites passconnection-trace-id; thread work rows usethread-work-row+ selection haptics via the shared helper instead of direct Expo clipboard/haptics.On web,
writeTextToClipboardcentralizes clipboard writes withClipboardApiUnavailableErrorandClipboardWriteError.useCopyToClipboardtakes atarget, alwaysconsole.errors failures, then optionalonError. Call sites tag copies asplan,trace ID, orerror-message; diagnostics trace-ID copy drops hand-rollednavigator.clipboardin favor of the hook.New unit tests cover failure shape and the no-contents-in-messages rule on both clients.
Reviewed by Cursor Bugbot for commit fa91438. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add structured error logging to clipboard operations across mobile and web
CopyTextClipboardWriteError,CopyTextHapticFeedbackError,ClipboardApiUnavailableError, andClipboardWriteErroras Schema-basedTaggedErrorclasses with safe messages and target context, so clipboard failures never leak copied content in logs.copyTextWithHapticto accepttargetandfeedbackoptions, anduseCopyToClipboardto accept atargetoption; both now route failures through structured errors logged viaconsole.error.targettags ("connection-trace-id","thread-work-row","plan","error-message") across all call sites on mobile and web.useCopyToClipboardare now treated as no-ops and do not set the copied state.Macroscope summarized fa91438.