Title: chore(api): remove a dead route builder, bound folder-index reads, reject invalid cursors by waleedlatif1 · Pull Request #6568 · simstudioai/sim · GitHub
Open Graph Title: chore(api): remove a dead route builder, bound folder-index reads, reject invalid cursors by waleedlatif1 · Pull Request #6568 · simstudioai/sim
X Title: chore(api): remove a dead route builder, bound folder-index reads, reject invalid cursors by waleedlatif1 · Pull Request #6568 · simstudioai/sim
Description: 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 main. 1. Dead route builder and 27 dead endpoint labels withPublicApiRouteHandler (~80 lines) had zero production callers — referenced only by its own test and two regexes in the audit script that existed to recognize it. It shipped in #5273 alongside 27 extra ApiEndpoint members, but the v2 surface actually runs on defineV2JsonRoute + v2RateLimits.publicApi. Verified by string literal, not just by symbol: each of the 46 members was grepped as a bare string across apps/, packages/, and scripts/, then narrowed to the only two positions that reach telemetry (checkRateLimit, authenticateRequest). 19 are live and kept. The decisive fact is that v2RateLimits never reads an ApiEndpoint, so no removed label can be emitted by any v2 route. Ratchet metrics are byte-identical before and after (1093 routes, 1093 Zod-backed, 0 non-Zod) — the builder lived outside a route.ts path, so it was never counted as a route. 2. Unbounded folder-index reads loadActiveFolderPathIndex was called without maxRows at 15 sites, while adjacent code two lines away passed the cap. Rather than paste the constant 15 more times, the cap is now the function's default. Safe because it throws (FolderCollectionLimitExceededError) rather than truncating, the query uses .limit(maxRows + 1) so a workspace exactly at the cap still passes, and folder creation already refuses at the same ceiling. Every domain constant is the identical value — MAX_KNOWLEDGE_FOLDERS_PER_WORKSPACE is literally an alias. 3. Invalid cursors silently restarting pagination GET /api/v2/tables/{tableId}/rows coerced an undecodable cursor to offset 0 and re-served page 1 — which can make a paging client loop forever. Eight sibling v2 cursor lists already reject; this route was the sole outlier. Extracted decodeOffsetCursor beside the existing decodeSortedCursor (the only two routes using the offset shape). Kept the literal 'Invalid cursor' rather than INVALID_CURSOR_MESSAGE, whose text is sort-mismatch-specific and would be wrong here. Reverting each fix turns its tests red. type-check · biome · 633 tests · check:api-validation · check:openapi — all pass. Follow-up left undone: maxRows: MAX_FOLDERS_PER_WORKSPACE is now redundant at ~25 call sites, but removing it means edits far outside this diff and would break tests asserting it explicitly.
Open Graph Description: 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 ...
X Description: 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 applicat...
Opengraph URL: https://github.com/simstudioai/sim/pull/6568
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:398a4496-756b-03d8-d5da-ba0dfce96614 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | AA64:3722BA:9996:D89E:6AFB42F1 |
| html-safe-nonce | 76b0f33a37248c1ff769493b79c435f7f97ff3ad744bfec5b1c635c97a7eb7ea |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQTY0OjM3MjJCQTo5OTk2OkQ4OUU6NkFGQjQyRjEiLCJ2aXNpdG9yX2lkIjoiNTQyMDI0NDk3NTU0NTQzNDg2NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6901f2433d29d2bca5a13094feaf1fc86c639a3ae333202836b758c90ddc569d |
| hovercard-subject-tag | pull_request:4257632862 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/6568/files |
| twitter:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| og:image:alt | 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 ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | d849b928f455c800985398e7f1b659425adb312a5fa14fba5d9a14e62e9fe5dd |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | a6c2f87cbcb6414452377b4967858ed6a66f1109 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width