[codex] Structure desktop backend settings read errors#3379
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 Refactors error handling to use structured error classes with better context for debugging. Runtime behavior is preserved - read failures still gracefully return empty settings. Original file author with comprehensive test coverage. You can customize Macroscope's approvability policy. Learn more. |
Summary
Verification
vp test apps/desktop/src/backend/DesktopBackendConfiguration.test.ts(5 passed)vp check(passes; 20 existing warnings)vp run typecheckNote
Low Risk
Localized desktop bootstrap config read path; behavior on missing files is unchanged and failures still degrade to defaults with better observability.
Overview
Desktop backend config now loads persisted OTLP settings with a single
readFileStringinstead ofexistsplus read, avoiding a race when the file appears or disappears between checks.Missing settings are handled only when the read fails with
NotFound; other filesystem errors (e.g. permission denied) emit a structuredDesktopBackendObservabilitySettingsReadErrorviaEffect.logWarningwithcomponent,settingsPath, and the platform cause, then still fall back to empty observability defaults so startup is unchanged.A new test asserts that behavior on read failure: bootstrap URLs stay undefined and the logged error matches the path and cause.
Reviewed by Cursor Bugbot for commit fc020f5. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Structure desktop backend observability settings read errors with
DesktopBackendObservabilitySettingsReadErrorDesktopBackendObservabilitySettingsReadErrorSchema tagged error class in DesktopBackendConfiguration.ts withsettingsPathandcausefields, replacing the previous generic string warning log.NotFounderrors (e.g.PermissionDenied) now log a structured warning annotated withcomponent: desktop-backend-configuration;NotFounderrors return empty settings silently.FileSystem.existspre-check, instead attemptingreadFileStringdirectly and branching on the error reason tag.FileSystemlayer and asserts the structured error is logged with the expected fields.Macroscope summarized fc020f5.