[codex] Structure legacy connection migration errors#3382
[codex] Structure legacy connection migration errors#3382juliusmarminge wants to merge 1 commit into
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 Straightforward error class refactor that splits a generic migration error into two specific typed errors with preserved cause chains. Changes are self-contained with corresponding unit tests added. You can customize Macroscope's approvability policy. Learn more. |
|
Superseded by the existing connection-persistence owner PR #3255, which already carries the structured migration stage and exact parse/decode causes. |
Summary
causeValidation
pnpm vp test apps/mobile/src/connection/migration.test.tspnpm vp checkpnpm vp run typecheckpnpm vp run lint:mobileNote
Low Risk
Localized error-model refactor in legacy migration with no change to successful migration behavior; callers must handle new error tags if they matched on the old type.
Overview
Replaces the single
LegacyConnectionMigrationErrorwith two tagged schema errors:LegacyConnectionDocumentParseError(invalid JSON) andLegacyConnectionDocumentDecodeError(schema validation). Each carries the underlying failure incauseviaSchema.Defect(), whilemessageis a fixed string that no longer embeds defect text (avoiding leaking raw catalog content in error strings).migrateLegacyConnectionCatalogmapsJSON.parseand decode failures to the matching error type. Tests assert tags, preserved causes, and stable messages for malformed JSON and invalidconnectionsshape.Reviewed by Cursor Bugbot for commit 2b98359. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Split legacy connection migration errors into distinct parse and decode error types
Replaces the single
LegacyConnectionMigrationErrorclass in migration.ts with two distinct tagged error classes:LegacyConnectionDocumentParseErrorfor JSON parse failures andLegacyConnectionDocumentDecodeErrorfor schema decode failures. Each class preserves the original exception as acausefield and returns a fixed message string. Behavioral Change: callers handlingLegacyConnectionMigrationErrorwill no longer match these errors and must be updated to handle the two new tags.Macroscope summarized 2b98359.