fix(radio): Preserve mode-lifecycle error causes for Sentry
Summary
Diagnostic fix for RADIO-26 (operation=loadModeLifecycle, generic AppError / UNEXPECTED_ERROR, no mode tag, empty breadcrumbs, radio@0.7.2, Firefox desktop, 2026-10-30).
This does not claim to resolve the original production failure. The captured event lost the underlying rejection, so the incident cause remains unknown. This PR only makes the same failure shape diagnosable next time and locks in regression coverage.
What RADIO-26 shows
- Stack is the Radios effect catch around dynamic
mode-lifecycle-requestsimport +synchronizeMode, thencaptureError→toAppError→AppError. - Tags:
operation=loadModeLifecycle,surface=ui, nomodetag → import-failure path, notsynchronizeMode’sreportFailure(which always tagsmode). - Reported value is the generic safe message, so the original rejection was not an
Error(or was already a cause-lessAppError);captureErroronly forwardedcause instanceof Errorto Sentry.
What is reproducible today
| Path | Behavior before | After |
|---|---|---|
Non-Error rejection into captureError | Sentry gets only generic AppError | Promoted NonErrorRejection Error with safe summary + original on cause |
| Lifecycle module load failure | loadModeLifecycle without mode | Same operation, mode tagged |
Synthetic synchronizeMode activation rejection | Already owned by synchronizeMode + mode | Unchanged (regression proves ownership) |
No functional playback/orchestration bug was demonstrated from the single production event; stream/provider issues are out of scope.
Red → green
Red (before implementation):
reporting policy > reports a non-Error rejection as a reportable Error that keeps the causereporting policy > does not put object rejection bodies into the reportable Error messagerunModeLifecycleSynchronization > tags mode when the lifecycle module fails to load- (pass already) synthetic
synchronizeModerejection keepsoperation=synchronizeMode
Green after the changes: those three + full suites below.
Changed files
packages/error/src/index.ts— promote non-Error causes for Sentry without JSON-serializing objectspackages/error/src/index.test.ts— RADIO-26-shaped capture regressionsapps/radio/src/lib/mode-lifecycle-boot.ts— extract load+sync with mode-tagged import failuresapps/radio/src/lib/mode-lifecycle-boot.test.ts— import vs synchronizeMode ownershipapps/radio/src/components/radio/index.tsx— use the boot helper
Validation
bun run checkbun run typecheckbun run --filter @avoid.quest/error testbun test packages/error/src/index.test.ts apps/radio/src/lib/mode-lifecycle-boot.test.ts apps/radio/src/lib/mode-lifecycle-requests.test.ts
Not verified: reproducing the exact Firefox 0.7.2 production rejection value (unavailable from the event).
Base: 7f7ed3bf52672df71a5514591af0b3a866708d0b
Not using Fixes RADIO-26 — observability only; original incident unexplained.


Summary by cubic
Makes mode-lifecycle load failures diagnosable in Sentry by preserving non-Error rejection causes and tagging the mode on import failures, without claiming to fix the original production incident (RADIO-26).
- Non-Error rejections are promoted to a
NonErrorRejectionError for reporting, keeping the original value oncause; object bodies are summarized as "Object" to avoid leaking private data. loadModeLifecycleerrors now carry amodetag;synchronizeModekeeps ownership of its own failure reporting.