GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||
GeezerVison is showing github.com — fix(api): collapse the internal error envelope and restore requestId by waleedlatif1 · Pull Request #6584 · simstudioai/sim Conversation
Collaborator
Summary
Internal routes only. No Type of Change
Testing
Added Checklist
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
PR SummaryMedium Risk Overview Removes Restores Reviewed by Cursor Bugbot for commit 8423bdc. Configure here. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Greptile SummaryThe PR unifies internal orchestration failures under the bare error envelope and restores request IDs across generated internal errors.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the previously reported authentication and parsing paths now add the active request ID to internal JSON error bodies in both builders.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/api/server/routes/internal-json-route.ts | Unifies the internal JSON error envelope and routes authentication, parsing, projected, and wrapper failures through request-ID-aware responses. |
| apps/sim/lib/api/server/routes/internal-binary-route.ts | Applies the same request-ID restoration to JSON error responses emitted by internal binary routes. |
| apps/sim/lib/api/server/routes/request-id.ts | Adds helpers to stamp object error bodies and safely rebuild existing JSON validation responses while preserving status and headers. |
| apps/sim/lib/api/server/routes/internal-json-route.test.ts | Covers the unified bare envelope and request IDs on authentication, parsing, and projected errors. |
| apps/sim/lib/api/server/routes/request-id.test.ts | Verifies request-ID injection, pass-through behavior, and preservation of response metadata. |
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Request[Internal API request] --> Wrapper[withRouteHandler request scope]
Wrapper --> Auth[Authentication]
Auth -->|401| Stamp[Add requestId to JSON error]
Auth --> Parse[Contract parsing]
Parse -->|400| Rebuild[Rebuild JSON response with requestId]
Parse --> UseCase[Application use case]
UseCase -->|Projected error| Stamp
UseCase -->|Unhandled error| Callback[Wrapper error callback]
Callback --> Stamp
Stamp --> Response[Error body plus x-request-id header]
Rebuild --> Response
Reviews (2): Last reviewed commit: "fix(api): stamp requestId on internal au..." | Re-trigger Greptile
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
The builders shipped two internal error envelopes: internalOrchestrationErrorPolicy
emitted { success: false, error } while internalPlainOrchestrationErrorPolicy
emitted { error }. That split approximated pre-builder behavior, where the shape
depended on which branch failed - guard clauses returned { error } and a route's
terminal try/catch returned { success: false, error }. A per-route policy cannot
express a per-branch rule, so the two disagreed on the same status across families.
Collapse to the bare { error } shape. It is what messageFromErrorBody reads on the
client and what most migrated routes already emitted. requestJson throws
ApiClientError for any non-2xx, so no typed client ever observes the discriminator.
success: true on success bodies is a separate contract and is untouched.
Also restore requestId to internal error bodies. withRouteHandler stamps it on the
bodies it generates, but the builder overrides dropped it, leaving it only on the
x-request-id header - invisible when a user pastes an error out of the UI. It is now
applied at the createJsonErrorResponse chokepoint and in both wrapper overrides, and
is omitted when there is no active request scope.
ee17317 to
8423bdc
Compare
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@cursor review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 8423bdc. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
8423bdc3
Deployed
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.