[codex] Preserve mobile composer draft failures#3348
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 |
ApprovabilityVerdict: Approved This PR adds structured error handling and logging for composer draft persistence failures. No functional behavior changes - only improved error visibility for debugging purposes. You can customize Macroscope's approvability policy. Learn more. |
Summary
Verification
vp test apps/mobile/src/state/use-composer-drafts.test.tsvp checkvp run typecheckvp run lint:mobileNote
Low Risk
Observability-only changes to local draft file handling; no change to user-facing draft semantics or security-sensitive flows.
Overview
Adds
ComposerDraftPersistenceError(EffectSchema.TaggedErrorClass) so mobile composer draft file I/O failures carry operation (open,read,decode,encode,write,hydrate), storage path, and the original cause.Load, debounced save, and hydration paths still fail open (empty drafts / in-memory state unchanged), but silent
catchblocks are replaced withconsole.warnthat logs the tagged error. Writes now wrap failures in the structured error before the existing best-effort save handler logs them.Reviewed by Cursor Bugbot for commit 0adc3f6. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Preserve mobile composer draft failures with structured error logging
ComposerDraftPersistenceError, a tagged error class with fields for operation, directory, fileName, and cause, thrown bywritePersistedComposerDraftson open/encode/write failures.loadPersistedComposerDraftsnow catches and wraps failures inComposerDraftPersistenceErrorand emits a console warning, still returning an empty object on failure.savePersistedComposerDraftsandensureComposerDraftsLoadedlog console warnings on failure but continue to treat persistence as best-effort and do not rethrow.Macroscope summarized 0adc3f6.