[codex] Structure environment cloud HTTP errors#3392
Conversation
|
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 HTTP error handling to use typed reason codes instead of free-form message strings, with messages derived from lookup tables. The actual error behavior and messages remain unchanged, with backward-compatible decoding for rolling deployments. You can customize Macroscope's approvability policy. Learn more. |
Dismissing prior approval to re-evaluate 744a307
6c12fe1 to
1c4bd6e
Compare
352b1b4 to
1e09188
Compare
Dismissing prior approval to re-evaluate 1e09188
1e09188 to
73fb3f6
Compare
Dismissing prior approval to re-evaluate 73fb3f6
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
73fb3f6 to
7d11df3
Compare
Dismissing prior approval to re-evaluate 7d11df3
f785979
into
codex/cloud-http-error-boundaries
Summary
Tests
vp test apps/server/src/cloud/http.test.tsvp test apps/server/src/server.test.tsvp test apps/mobile/src/features/cloud/linkEnvironment.test.tsvp checkvp run typecheckvp run lint:mobileStacked on #3246.
Note
Medium Risk
Touches shared cross-peer HTTP contracts and many T3 Connect cloud paths (link, health, mint, relay); behavior is mostly message shape and logging, with backward-compatible decoding, but mis-encoded errors could affect mobile/relay clients during rollout.
Overview
Environment cloud HTTP errors now use typed
reason/operationfields instead of ad-hocmessagestrings at call sites. InenvironmentHttp.ts, 400/401/409 responses take enum reasons with derived user-facing messages; 500 responses addoperationplus optionalrelayOperation,relayPhase, andresponseStatusfor relay failures.apps/server/src/cloud/http.tsroutes all connect handlers throughfailEnvironmentCloudInternalError, which builds these structured errors, logsoperation(and relay context) withcauseTagonly, and still attaches fullcauseon the in-process error while encoding omitscause.Rolling deploy compatibility: optional schema fields and constructors accept legacy message-only JSON on decode; new code must pass structured context.
Tests were updated for
cloud_cli_authorization_required, encoded 500 bodies, legacy decode, and relay offline handling withoperation.Reviewed by Cursor Bugbot for commit 7d11df3. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add structured reason and operation codes to cloud environment HTTP errors
EnvironmentHttpBadRequestError,EnvironmentHttpUnauthorizedError,EnvironmentHttpConflictError,EnvironmentHttpInternalServerError, etc.) to derive standardized messages from reason/operation codes while preserving legacy message-only decoding for rolling deployments.reason,operation,relayOperation,relayPhase) alongside messages; legacy message-only payloads are still decoded correctly.Macroscope summarized 7d11df3.