[codex] Structure mobile external link failures#3363
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 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: iOS file markdown bypasses boundary
- Passed onLinkPress callback (calling tryOpenExternalUrl) to SelectableMarkdownText in FileMarkdownPreview, so iOS link taps now route through the shared boundary instead of falling through to raw Linking.openURL.
Or push these changes by commenting:
@cursor push 3a0155209b
Preview (3a0155209b)
diff --git a/apps/mobile/src/features/files/FileMarkdownPreview.tsx b/apps/mobile/src/features/files/FileMarkdownPreview.tsx
--- a/apps/mobile/src/features/files/FileMarkdownPreview.tsx
+++ b/apps/mobile/src/features/files/FileMarkdownPreview.tsx
@@ -1,4 +1,4 @@
-import { useMemo } from "react";
+import { useCallback, useMemo } from "react";
import {
Markdown,
type CustomRenderers,
@@ -144,12 +144,19 @@
export function FileMarkdownPreview(props: { readonly markdown: string }) {
const styles = useMarkdownPreviewStyles();
+ const onLinkPress = useCallback((href: string) => {
+ void tryOpenExternalUrl(href, "markdown-link");
+ }, []);
return (
<ScrollView className="flex-1 bg-card" contentContainerStyle={{ padding: 18 }}>
<View className="mx-auto w-full max-w-[760px]">
{hasNativeSelectableMarkdownText() ? (
- <SelectableMarkdownText markdown={props.markdown} textStyle={styles.nativeTextStyle} />
+ <SelectableMarkdownText
+ markdown={props.markdown}
+ textStyle={styles.nativeTextStyle}
+ onLinkPress={onLinkPress}
+ />
) : (
<Markdown
options={{ gfm: true }}You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit aa8f9dc. Configure here.
ApprovabilityVerdict: Approved This PR refactors external URL opening into a centralized utility with structured error logging, replacing scattered direct You can customize Macroscope's approvability policy. Learn more. |
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate e4a3d13


Summary
Linking.openURLrejectionsValidation
vp test apps/mobile/src/lib/openExternalUrl.test.ts(2 tests)vp check(passes with 20 pre-existing warnings)vp run typecheckvp run lint:mobileOverlap
Note
Low Risk
Localized UX and logging refactor around link opening; no auth or data-model changes, with explicit tests for log redaction.
Overview
Adds
tryOpenExternalUrlas the shared mobile boundary for opening links: it wrapsLinking.openURL, returns success/failure, and on failure logs a schema-taggedExternalUrlOpenErrorwith semantic target (file-preview,markdown-link,pull-request), scheme, and host only—no full URL or raw cause in console output.File previews, markdown (including native selectable links via
onLinkPress), Safari preview, git PR controls, and the git action overlay now call this helper instead ofLinking.openURLdirectly. Open PR flows in git sheets use a fixed "Unable to open PR" alert when the helper returns false, replacing error-message-derived alerts. Unit tests cover success and sanitized failure logging.Reviewed by Cursor Bugbot for commit e4a3d13. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Structure mobile external link failures with a centralized
tryOpenExternalUrlhelpertryOpenExternalUrlin openExternalUrl.ts, a boolean-returning wrapper aroundLinking.openURLthat logs a privacy-preserving diagnostic (scheme, host, target — no URL or error message) on failure.Linking.openURLcalls across markdown preview, file preview, and PR link handlers withtryOpenExternalUrl, each passing a typedExternalUrlTargetstring for structured logging.ThreadGitControlsandGitOverviewSheetnow show a generic "Unable to open PR" alert on failure instead of surfacing raw error messages.Macroscope summarized e4a3d13.