[codex] Structure mobile file-processing failures#3287
Conversation
|
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 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. |
Dismissing prior approval to re-evaluate a93500e
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>
a93500e to
e0369ec
Compare
Dismissing prior approval to re-evaluate e0369ec
a3eb6ec
into
codex/redact-dpop-request-target
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>
Co-authored-by: codex <codex@users.noreply.github.com>
Summary
Stack dependency
@t3tools/shared/urlDiagnostics.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 typecheckvp run lint:mobileNote
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.TaggedErrorClasstypes that carry structured context while avoiding leaking signed asset URLs in errors, messages, or atom labels.Source highlighting now surfaces
SourceHighlightErrorwithpath,theme, and the originalcause(exported for callers/tests).Image prefetch splits the old single
WorkspaceImagePrefetchErrorintoWorkspaceImagePrefetchUnavailableError(prefetch returnedfalse) andWorkspaceImagePrefetchFailedError(rejected prefetch withcause). Both useuriHash,uriLength, anduriProtocolfrom new sharedgetUrlDiagnostics; 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/urlDiagnosticsandredactDpopRequestTarget(scheme/host/port/path only; invalid →"<invalid-url>") with tests—supporting safer diagnostics outside mobile file cache.Breaking: code matching the previous
WorkspaceImagePrefetchErrortype must handle the two new variants (union exported asWorkspaceImagePrefetchError).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
Data.TaggedErrorwithSchema.TaggedErrorClassforSourceHighlightError, addingpathandthemefields to failed highlight operations in sourceHighlightingState.ts.WorkspaceImagePrefetchUnavailableError(prefetch returned false) andWorkspaceImagePrefetchFailedError(prefetch rejected), both carrying URI diagnostics (uriHash,uriLength,uriProtocol) without the raw URI.Macroscope summarized e0369ec.