Skip to content

[codex] Structure cross-client clipboard failures#3361

Merged
juliusmarminge merged 3 commits into
mainfrom
codex/cross-client-clipboard-errors
Jun 20, 2026
Merged

[codex] Structure cross-client clipboard failures#3361
juliusmarminge merged 3 commits into
mainfrom
codex/cross-client-clipboard-errors

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • add structured clipboard API, write, and haptic feedback errors with stable operation/target context
  • retain exact underlying causes without including copied contents in diagnostics
  • preserve mobile best-effort copy feedback, including thread work-row selection haptics
  • add focused cross-client coverage for failure structure and behavior

Verification

  • vp test apps/mobile/src/lib/copyTextWithHaptic.test.ts apps/web/src/hooks/useCopyToClipboard.test.ts
  • vp check (passes with existing warnings)
  • vp run typecheck
  • vp run lint:mobile

Note

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 target label and underlying cause, without ever putting copied text in error messages.

On mobile, copyTextWithHaptic now accepts optional target and feedback (light-impact vs selection), logs CopyTextClipboardWriteError / CopyTextHapticFeedbackError, and still runs clipboard and haptics in parallel. Connection trace-ID copy sites pass connection-trace-id; thread work rows use thread-work-row + selection haptics via the shared helper instead of direct Expo clipboard/haptics.

On web, writeTextToClipboard centralizes clipboard writes with ClipboardApiUnavailableError and ClipboardWriteError. useCopyToClipboard takes a target, always console.errors failures, then optional onError. Call sites tag copies as plan, trace ID, or error-message; diagnostics trace-ID copy drops hand-rolled navigator.clipboard in 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

  • Introduces CopyTextClipboardWriteError, CopyTextHapticFeedbackError, ClipboardApiUnavailableError, and ClipboardWriteError as Schema-based TaggedError classes with safe messages and target context, so clipboard failures never leak copied content in logs.
  • Updates copyTextWithHaptic to accept target and feedback options, and useCopyToClipboard to accept a target option; both now route failures through structured errors logged via console.error.
  • Propagates target tags ("connection-trace-id", "thread-work-row", "plan", "error-message") across all call sites on mobile and web.
  • Adds test coverage for structured error behavior, selection haptic mode, and empty-value no-ops.
  • Behavioral Change: empty values passed to useCopyToClipboard are now treated as no-ops and do not set the copied state.

Macroscope summarized fa91438.

Co-authored-by: codex <codex@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 113622ad-1953-4ced-8d6e-a0de250a64d6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/cross-client-clipboard-errors

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jun 20, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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>
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 13:20

Dismissing prior approval to re-evaluate ba7a9ce

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 15:04

Dismissing prior approval to re-evaluate fa91438

@juliusmarminge juliusmarminge merged commit b888735 into main Jun 20, 2026
16 checks passed
@juliusmarminge juliusmarminge deleted the codex/cross-client-clipboard-errors branch June 20, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant