Skip to content

[codex] Structure mobile file rendering errors#3397

Closed
juliusmarminge wants to merge 2 commits into
mainfrom
codex/mobile-file-rendering-errors
Closed

[codex] Structure mobile file rendering errors#3397
juliusmarminge wants to merge 2 commits into
mainfrom
codex/mobile-file-rendering-errors

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary\n\n- convert mobile source-highlighting and image-prefetch failures to Schema errors\n- attach source path/theme context without retaining file contents\n- preserve exact native highlighter and image-prefetch causes\n- replace schema-error instanceof checks with exported Schema.is predicates\n\n## Validation\n\n- pnpm vp test apps/mobile/src/features/files/sourceHighlightingState.test.ts apps/mobile/src/features/files/workspace-file-image-cache.test.ts\n- pnpm vp check\n- pnpm vp run typecheck\n- pnpm vp run lint:mobile


Note

Low Risk
Localized refactor of error types and catch handling in two mobile file-rendering caches, with expanded unit tests and no auth or data-path changes.

Overview
Mobile source highlighting and workspace image prefetch failures now use Schema.TaggedErrorClass instead of Data.TaggedError, with validated fields and user-facing message getters.

SourceHighlightError carries path, theme, and cause (file contents are not stored on the error). WorkspaceImagePrefetchError carries uri and an optional cause; a false prefetch result still fails with uri only. Catch paths use exported Schema.is guards (isSourceHighlightError, isWorkspaceImagePrefetchError) instead of instanceof.

Tests assert the structured error shape via Cause.findErrorOption, including separate cases for boolean prefetch failure vs thrown native errors.

Reviewed by Cursor Bugbot for commit 1cb9811. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Structure mobile file rendering errors with typed SourceHighlightError and WorkspaceImagePrefetchError

  • Replaces Data.TaggedError with Schema.TaggedErrorClass for SourceHighlightError and WorkspaceImagePrefetchError, adding structured fields (path, theme, uri) and an optional defect cause to each.
  • Exports isSourceHighlightError and isWorkspaceImagePrefetchError type guards via Schema.is to replace instanceof checks.
  • Error messages now include contextual metadata (path/theme for highlight errors, uri for image prefetch errors).
  • Tests are updated to extract failures via Cause.findErrorOption and assert error shape and preserved cause using the new type guards.

Macroscope summarized 1cb9811.

Co-authored-by: codex <codex@users.noreply.github.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 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 refactors error classes to use Schema-based definitions with better structure and contextual information. The changes are mechanical - error throwing logic remains the same, only the error structure is enhanced. Tests verify the new error format.

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 15:25

Dismissing prior approval to re-evaluate 1cb9811

@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: 91638194-cfd7-497f-99dd-968ec918e69b

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/mobile-file-rendering-errors

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

@juliusmarminge

Copy link
Copy Markdown
Member Author

Superseded by #3287, which preserves the same source-highlight context while modeling native prefetch unavailability and rejected prefetches as distinct Schema errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 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