[codex] Structure server settings failures#3376
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 refactors error handling to use structured fields instead of free-form detail strings, improving error machine-readability. Changes are self-contained to error construction and formatting, with no impact on core business logic. You can customize Macroscope's approvability policy. Learn more. |
Summary
Validation
vp test apps/server/src/serverSettings.test.tsvp checkvp run typecheckNote
Medium Risk
The error shape is a contract change (removes
detail) and paths that materialize provider secrets now expose structured failure context; impact is limited to server settings and its callers.Overview
ServerSettingsErroris now structured instead of carrying a free-formdetailstring. The contracts layer adds aServerSettingsOperationenum and optionalproviderInstanceId/environmentVariablefields;causeis required and kept as the original failure. User-facingmessageis built from the operation and context, not from nested error text.Server settings code constructs these errors at each boundary (file I/O, normalization, secret read/write/remove, directory prep) with the matching operation label. Startup and change-stream warnings log
operation, provider/env context, andcauseinstead ofdetail. Invalidsettings.jsonparse warnings also attach the decodecause.A new test asserts that a failed provider environment secret read returns
read-secretcontext, preserves the exact underlyingSecretStoreReadError, and does not embed that cause’s message inServerSettingsError.message.Reviewed by Cursor Bugbot for commit b38c1ad. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Structure
ServerSettingsErrorwith typed operations and contextual fieldsdetailstring onServerSettingsErrorwith a typedoperationfield (e.g.read-secret,write-file,normalize) and optionalproviderInstanceIdandenvironmentVariablefields.causeas a required field onServerSettingsError; the error message no longer embeds the cause message.serverSettings.tsandserverRuntimeStartup.tsto use the new shape.serverSettings.test.tsthat verifies context propagation when a secret read fails.ServerSettingsErrormessage format changes and no longer includes the underlying cause message; callers that parse or display this message will see different output.Macroscope summarized b38c1ad.