Skip to content

[codex] Structure mobile notification setting failures#3391

Merged
juliusmarminge merged 3 commits into
mainfrom
codex/mobile-notification-permission-errors
Jun 20, 2026
Merged

[codex] Structure mobile notification setting failures#3391
juliusmarminge merged 3 commits into
mainfrom
codex/mobile-notification-permission-errors

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

Mobile agent-awareness settings exposed raw unknown failures from three native or persistence boundaries: reading notification permission, requesting notification permission, and saving the Live Activity updates setting. Downstream settings commands could not reliably identify which operation failed, and the preference write discarded the requested setting value.

This change introduces distinct Schema errors for reading and requesting notification permissions. Both record the iOS platform and preserve the exact native cause. Live Activity preference persistence now has its own Schema error carrying the requested enabled value and exact storage cause. Messages are derived from those fields without reason switches, cause-derived text, or constructor wrappers.

No behavior tests were added for the pure error-model refactors; the existing Live Activity preference suite still passes.

Validation

  • pnpm vp test apps/mobile/src/features/agent-awareness/liveActivityPreferences.test.ts (4 tests)
  • pnpm vp check (passes with existing repository warnings)
  • pnpm vp run typecheck
  • pnpm vp run lint:mobile

Note

Low Risk
Pure error-model refactor on settings paths; success paths and UI handling via existing failure squashing are unchanged.

Overview
Replaces raw unknown failures on mobile agent-awareness settings with Effect Schema tagged errors, so callers can distinguish which boundary failed and inspect structured fields.

Notification permissions (notificationPermissions.ts): requestAgentNotificationPermission now fails with NotificationPermissionReadError or NotificationPermissionRequestError instead of unknown, each wrapping the native cause via Schema.Defect() and a fixed iOS-oriented message.

Live Activity preference (liveActivityPreferences.ts): savePreferencesPatch failures map to LiveActivityPreferenceSaveError, which carries the requested enabled value plus the storage cause.

Runtime behavior of permission checks and preference saves is unchanged; only the error channel typing and failure payloads change.

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

Note

Structure mobile notification and live activity preference failures as typed errors

  • Wraps live activity preference save failures in a new LiveActivityPreferenceSaveError tagged error class (with enabled flag and original cause) in liveActivityPreferences.ts
  • Wraps iOS notification permission failures in NotificationPermissionReadError or NotificationPermissionRequestError tagged error classes in notificationPermissions.ts
  • Both changes replace raw unknown errors with structured Effect error types, making failure handling explicit and type-safe.

Macroscope summarized 0f03667.

Co-authored-by: codex <codex@users.noreply.github.com>
@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: ef1e7365-1c1a-4466-874f-d8681e158109

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-notification-permission-errors

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

@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
@juliusmarminge juliusmarminge changed the title [codex] Structure notification permission failures [codex] Structure mobile notification setting failures Jun 20, 2026

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Effect service review: one convention finding on the new tagged errors. The errors otherwise follow conventions well — namespace imports (effect/Effect, effect/Schema), Schema.TaggedErrorClass, separate tags for the distinct read vs. request failures, a real cause preserved via Schema.Defect(), and a message derived from a structural attribute rather than from cause.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/mobile/src/features/agent-awareness/notificationPermissions.ts Outdated
Comment thread apps/mobile/src/features/agent-awareness/notificationPermissions.ts Outdated
Co-authored-by: codex <codex@users.noreply.github.com>
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This PR adds structured error classes for notification permission and live activity preference failures, replacing generic error catches with typed errors. The changes are purely about error typing/structure with no runtime behavior impact beyond improved error messages.

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

@juliusmarminge juliusmarminge merged commit f7867ad into main Jun 20, 2026
16 checks passed
@juliusmarminge juliusmarminge deleted the codex/mobile-notification-permission-errors branch June 20, 2026 17:58
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