Skip to content

[codex] Structure mobile file-processing failures#3287

Merged
juliusmarminge merged 4 commits into
codex/redact-dpop-request-targetfrom
codex/mobile-image-prefetch-errors
Jun 20, 2026
Merged

[codex] Structure mobile file-processing failures#3287
juliusmarminge merged 4 commits into
codex/redact-dpop-request-targetfrom
codex/mobile-image-prefetch-errors

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • distinguish native image-prefetch rejection from a completed prefetch that did not cache the image
  • preserve exact prefetch and source-highlighting causes with structured context
  • keep signed asset URIs only in the internal cache key and return value; errors and atom labels retain only a stable hash, protocol, and input length
  • derive URL fields through the shared diagnostics policy without retaining raw paths or tokens

Stack dependency

Validation

  • vp test run apps/mobile/src/features/files/workspace-file-image-cache.test.ts apps/mobile/src/features/files/sourceHighlightingState.test.ts (8 tests)
  • vp check (passes with 20 pre-existing warnings)
  • vp run typecheck
  • vp run lint:mobile

Note

Medium Risk
Changes error shapes and removes raw URIs from failure paths (good for security), but any caller matching the old prefetch error type must be updated; behavior on success is unchanged.

Overview
Replaces loose tagged errors in mobile source highlighting and workspace image prefetch with Effect Schema.TaggedErrorClass types that carry structured context while avoiding leaking signed asset URLs in errors, messages, or atom labels.

Source highlighting now surfaces SourceHighlightError with path, theme, and the original cause (exported for callers/tests).

Image prefetch splits the old single WorkspaceImagePrefetchError into WorkspaceImagePrefetchUnavailableError (prefetch returned false) and WorkspaceImagePrefetchFailedError (rejected prefetch with cause). Both use uriHash, uriLength, and uriProtocol from new shared getUrlDiagnostics; workspace image atom labels use a base-36 hash instead of the full URI. Successful atoms still return the real URI internally.

Shared adds @t3tools/shared/urlDiagnostics and redactDpopRequestTarget (scheme/host/port/path only; invalid → "<invalid-url>") with tests—supporting safer diagnostics outside mobile file cache.

Breaking: code matching the previous WorkspaceImagePrefetchError type must handle the two new variants (union exported as WorkspaceImagePrefetchError).

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

Note

Structure mobile file-processing failures with URI-safe, typed error classes

  • Replaces Data.TaggedError with Schema.TaggedErrorClass for SourceHighlightError, adding path and theme fields to failed highlight operations in sourceHighlightingState.ts.
  • Introduces two new error classes in workspace-file-image-cache.ts: WorkspaceImagePrefetchUnavailableError (prefetch returned false) and WorkspaceImagePrefetchFailedError (prefetch rejected), both carrying URI diagnostics (uriHash, uriLength, uriProtocol) without the raw URI.
  • Atom labels in the image cache now use a base36 URI hash instead of the full URI, preventing sensitive data from leaking into labels or error messages.
  • Behavioral Change: error shapes and messages for highlight and image prefetch failures change; consumers inspecting these errors directly will need to update.

Macroscope summarized e0369ec.

@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
@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: 82d7d83d-bf25-4d32-9bbf-19fa006083b7

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-image-prefetch-errors

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

@juliusmarminge juliusmarminge changed the title [codex] Structure mobile image prefetch failures [codex] Structure mobile file-processing failures 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 for mobile file processing to be more structured and security-conscious (avoiding exposure of signed URIs in errors). No runtime behavior changes beyond error construction, with comprehensive tests verifying the new structure.

You can customize Macroscope's approvability policy. Learn more.

@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 16:08

Dismissing prior approval to re-evaluate a93500e

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
juliusmarminge and others added 4 commits June 20, 2026 09:15
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
@juliusmarminge juliusmarminge force-pushed the codex/mobile-image-prefetch-errors branch from a93500e to e0369ec Compare June 20, 2026 16:18
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 16:18

Dismissing prior approval to re-evaluate e0369ec

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Jun 20, 2026
@juliusmarminge juliusmarminge changed the base branch from main to codex/redact-dpop-request-target June 20, 2026 16:18
@juliusmarminge juliusmarminge merged commit a3eb6ec into codex/redact-dpop-request-target Jun 20, 2026
16 checks passed
@juliusmarminge juliusmarminge deleted the codex/mobile-image-prefetch-errors branch June 20, 2026 18:13
juliusmarminge added a commit that referenced this pull request Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
juliusmarminge added a commit that referenced this pull request Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
juliusmarminge added a commit that referenced this pull request Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
juliusmarminge added a commit that referenced this pull request Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
juliusmarminge added a commit that referenced this pull request Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
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