[codex] Structure desktop Clerk bridge failures#3308
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 classes for Clerk bridge initialization and cleanup failures, improving error diagnostics without changing core behavior. The changes are self-contained with comprehensive test coverage. You can customize Macroscope's approvability policy. Learn more. |
Summary
makevalueVerification
vp test apps/desktop/src/app/DesktopClerk.test.tsvp check(passes with 20 pre-existing warnings)vp run typecheckOpen PR overlap audit
The exact source and test files are also touched by unrelated local-auth startup PR #3252. This PR is a focused error-boundary change and does not overlap the active Effect/error audit series.
Note
Medium Risk
Touches desktop Clerk startup/teardown on the auth path; behavior on success is unchanged, but init failures are now typed and cleanup failures become defects via orDie.
Overview
Wraps desktop Clerk bridge acquire/release in
Effect.tryand maps SDK throws to two new Schema tagged errors—DesktopClerkBridgeInitializationErrorandDesktopClerkBridgeCleanupError—each carryingstateDir,isDevelopment, and the originalcause.Initialization failures surface as typed layer errors; cleanup failures are still structured then passed through
Effect.orDieon the release finalizer.makeis exported for tests.Tests add a shared layer helper, per-test mock resets, and layer lifecycle cases that assert message text and cause preservation for both failure paths.
Reviewed by Cursor Bugbot for commit 96a7ff0. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add structured error types for desktop Clerk bridge initialization and cleanup failures
DesktopClerkBridgeInitializationErrorandDesktopClerkBridgeCleanupErrortagged error classes inDesktopClerk.ts, each carryingstateDir,isDevelopment, andcausefields.DesktopClerk.makelayer factory to wrap bridge creation inEffect.try, surfacing init failures as typed errors, and wrapsbridge.cleanupsimilarly, converting cleanup failures to defects viaEffect.orDie.DesktopClerk.test.tscovering both failure paths, with abeforeEachmock reset to prevent cross-test interference.DesktopClerkBridgeInitializationErrorinstead of an unstructured exception; cleanup failures now terminate the process as a defect rather than being silently swallowed.Macroscope summarized 96a7ff0.