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): stop leaking failed SQL in v1 table 500s and restore the 423 lock field by waleedlatif1 · Pull Request #6569 · simstudioai/sim Conversation
Collaborator
Stacked on #6568 → #6567 → #6565 → #6560. Review only this PR's own commits; merge after its parents. v1 is the live public API. It was rewritten to delegate to the shared application layer, and three response behaviors drifted from 1. Failed SQL and bound parameters leaked in 500 bodies
Reverting the fix shows exactly what any API-key holder could harvest: 2. The 423 lock field was dropped
3. Duplicate table name: 400 → 409 — keeping 409This changed on
Tradeoff accepted: a client matching 400 specifically for a name collision now sees 409 — but such a client already needs a 409 branch for every sibling v1 endpoint. FixOne shared projection, Also removes the Deliberately not converted: Reverting turns 6 tests red. type-check · biome · 1113 tests ·
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 SummaryHigh Risk Overview Adds shared Pins the leak and lock behaviors with route and helper tests. Reviewed by Cursor Bugbot for commit 5519d45. 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 centralizes table orchestration-result error responses so internal failures use generic messages while classified errors retain their status and safe message.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/app/api/table/utils.ts | Adds the shared failure-result projection that conceals internal messages, preserves classified errors, and includes lock metadata. |
| apps/sim/app/api/v1/tables/[tableId]/route.ts | Routes delete failures through the shared projection to prevent SQL details from reaching v1 clients and restore the lock field. |
| apps/sim/app/api/v1/tables/[tableId]/rows/[rowId]/route.ts | Applies the same safe projection to row deletion failures. |
| apps/sim/app/api/table/[tableId]/route.ts | Centralizes lock, rename, move, and delete failure rendering while preserving the explicit move-table not-found message. |
| apps/sim/app/api/table/utils.test.ts | Covers generic internal errors, classified failures, status mapping, and 423 lock metadata. |
| apps/sim/app/api/v1/tables/[tableId]/route.test.ts | Adds route-level regression tests for SQL concealment and lock-kind responses. |
| apps/sim/app/api/v2/tables/utils.ts | Replaces the removed row-write alias with its identical underlying classifier. |
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Table route] --> B[perform mutation]
B -->|Success| C[Success response]
B -->|Failure result| D[orchestrationOutcomeErrorResponse]
D --> E{Error classification}
E -->|Internal or absent| F[Generic fallback and 500]
E -->|Locked| G[Specific error and lock field and 423]
E -->|Other classified| H[Specific safe error and mapped status]
Reviews (2): Last reviewed commit: "chore(tables): tidy v1 error projection ..." | Re-trigger Greptile
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ssage leak
The v1 table routes were rewritten to consume `lib/table/orchestration`
results, and two response behaviors drifted from what the live API returned.
Information disclosure: an unclassified failure's `outcome.error` carries
whatever text the fault happened to have. Drizzle wraps a throw raised inside
a transaction in an error whose own message is the failed statement and its
bound parameters, so `DELETE /api/v1/tables/{tableId}` and
`DELETE /api/v1/tables/{tableId}/rows/{rowId}` returned that verbatim in the
500 body to any API-key holder. Previously these returned a fixed generic
string.
Lost `lock` field: the 423 body used to be `{ error, lock }`. The delete,
row-delete, and column-update routes (v1 and internal) dropped the lock kind
the orchestration result already computes, leaving clients unable to tell
which lock to clear.
Both are fixed at one altitude: `orchestrationOutcomeErrorResponse` in
`app/api/table/utils.ts` is now the only way a table route projects an
orchestration failure onto the wire. It renders the route's fallback for an
unclassified failure and the real message for a classified one (validation,
not-found, conflict, locked keep their specific text), and carries `lock` on a
423. A future route cannot reintroduce either bug by hand-spelling the body.
Duplicate table names on `POST /api/v1/tables` keep answering 409 rather than
reverting to the previous 400. 409 is the correct semantic, and every other v1
duplicate-name surface (knowledge, files, workflow import) already answers 409;
the tables 400 was the outlier. v1 tables appears in no published OpenAPI
document and no in-repo client branches on the status, so the compatibility
cost is limited to a caller matching 400 specifically for a name collision.
fe432f9 to
23b7792
Compare
12e43a6 to
5519d45
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 5519d45. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
262ce32
into
improvement/v2-route-standardization
There was an error while loading. Please reload this page.
5519d458
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.