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 — chore(api): remove a dead route builder, bound folder-index reads, reject invalid cursors by waleedlatif1 · Pull Request #6568 · simstudioai/sim Conversation
Collaborator
Stacked on #6567 → #6565 → #6560. Review only this PR's own commits; merge after its parents. Three independent tidies from the v2 parity audit, one commit each. All are incomplete application of new work rather than regressions from 1. Dead route builder and 27 dead endpoint labels
Verified by string literal, not just by symbol: each of the 46 members was grepped as a bare string across Ratchet metrics are byte-identical before and after (1093 routes, 1093 Zod-backed, 0 non-Zod) — the builder lived outside a 2. Unbounded folder-index reads
3. Invalid cursors silently restarting pagination
Reverting each fix turns its tests red. type-check · biome · 633 tests · Follow-up left undone:
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 Dead route builder. Deletes unused Bounded folder-index reads. Invalid cursor rejection. Adds shared Reviewed by Cursor Bugbot for commit 23b7792. 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 removes an unused public-route wrapper and dead endpoint labels, centralizes strict offset-cursor validation, and narrows folder-index bounds after the earlier review.
Confidence Score: 4/5The PR is not yet safe to merge because an accepted over-cap folder state can make workflow updates commit and then return HTTP 413. The capped fallback folder-index read occurs after updateWorkflowRecord, so workspaces that exceed the unenforced folder ceiling can receive a failure response after the requested workflow mutation has already persisted. Files Needing Attention: apps/sim/lib/workflows/application/update-workflow.ts
|
| Filename | Overview |
|---|---|
| apps/sim/lib/workflows/application/update-workflow.ts | Adds bounded folder-index reads, but the fallback read can throw after a workflow update has already persisted. |
| apps/sim/lib/workflows/application/create-workflow.ts | Explicitly bounds the folderId branch's folder-index load. |
| apps/sim/lib/folders/queries.ts | Preserves unbounded behavior when maxRows is omitted and documents the opt-in bound. |
| apps/sim/app/api/v2/lib/response.ts | Adds reusable validation for offset cursors. |
| apps/sim/app/api/v2/tables/[tableId]/rows/route.ts | Uses strict offset-cursor decoding for table-row pagination. |
| apps/sim/app/api/v1/middleware.ts | Removes endpoint labels associated with the deleted unused route builder. |
apps/sim/lib/workflows/application/update-workflow.ts, line 181-185 (link)
Update commits before folder failure
If a workspace contains more than 10,000 active workflow folders, a name-, description-, lock-, or policy-only update persists through updateWorkflowRecord, then this capped fallback index read throws and returns HTTP 413. The caller therefore receives a failure even though the requested workflow mutation has already committed.
Reviews (2): Last reviewed commit: "fix(api): reject an undecodable offset c..." | 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.
…int labels `withPublicApiRouteHandler` and 27 `ApiEndpoint` union members landed together in #5273, but the v2 surface shipped on `defineV2JsonRoute` + `v2RateLimits` instead. The builder had no production caller — only its own test — and the v2 rate limiter never reads an `ApiEndpoint` label, so those members were never emitted to telemetry by symbol or by string literal. Remaining members are exactly the labels a v1 route passes to `checkRateLimit` or `authenticateRequest`. Drops the now-unreachable `hasZodUsage` branch from the API validation audit; no ratchet metric moves (route total stays 1093).
`createWorkflow` and `updateWorkflow` each resolve a folder two ways inside one function. The folderPath branch goes through `resolveWorkflowFolderPath`, which loads the path index with `maxRows: MAX_FOLDERS_PER_WORKSPACE`; the folderId branch loaded it with no bound at all, issuing a `SELECT` over every active folder row in the workspace. In `updateWorkflow` the unbounded read and the bounded fallback sit thirty lines apart in the same function. Passes the cap at both sites, matching the read sites that already opt in. Exceeding it throws `FolderCollectionLimitExceededError` rather than truncating, because a partial path index resolves real folder paths to `undefined` and re-roots resources at the workspace root. `maxRows` deliberately stays opt-in rather than becoming the default. Folder creation does not refuse at the same ceiling on every path — `POST /api/folders` goes through the `createFolder` name/parentId variant, which passes no `maxFolderRows`, so the count guard in `executeCreateFolderAtPath` never runs and a workspace can already hold more than `MAX_FOLDERS_PER_WORKSPACE` folders. Defaulting the bound would make every path-index consumer throw for a state the product allows to exist. Reconciling reader and writer is a separate change with a user-facing limit, not a chore.
GET /api/v2/tables/{tableId}/rows coerced an undecodable pagination cursor to
offset 0 and re-served page one. A client paging forward reads that as a fresh
first page and can loop over it forever. Every sibling v2 cursor list — logs,
files, workflows, workflow runs, workflow versions, workspace members, tables,
knowledge documents — already rejects with a validation error instead.
Extracts the offset-cursor decode both offset-paginated v2 routes had inlined
into `decodeOffsetCursor`, next to the existing `decodeSortedCursor`, so the
reject-don't-restart rule has one home.
9667823 to
79a3486
Compare
fe432f9 to
23b7792
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 23b7792. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
3cab8ef
into
improvement/v2-route-standardization
There was an error while loading. Please reload this page.
23b77927
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.