Title: refactor(table): move the internal row routes onto the application boundary by waleedlatif1 · Pull Request #6809 · simstudioai/sim · GitHub
Open Graph Title: refactor(table): move the internal row routes onto the application boundary by waleedlatif1 · Pull Request #6809 · simstudioai/sim
X Title: refactor(table): move the internal row routes onto the application boundary by waleedlatif1 · Pull Request #6809 · simstudioai/sim
Description: Summary Stacked on #6808. Moves the internal table row routes onto the application boundary — the routes that authorized in their own handlers and queried the database from the adapter. rows/[rowId] (GET/PATCH/DELETE) is 127 lines instead of 274, with no @sim/db, no drizzle and no checkAccess. rows/upsert and the enrichment-detail route follow the same shape. Both internal direct-DB adapters are now closed. Only the v1 one remains (see below). Migrating surfaced why the violation existed: write-provenance resolution needs the canonical schema to map a caller's column key to the storage column it certifies, and the adapter could only do that because it was already loading the table illegally. The envelope now splits on the real seam — the adapter reads the header and payload field (transport), the use case resolves the selections against the canonical table (domain). That split preserves a distinction the defaulting logic would erase: an internal caller that sends no envelope stays deliberately untracked. Defaulting it to exact-empty would certify "this write introduced no secrets" on a runtime write that may well have introduced some. present() now receives the same { principal, input } its sibling hooks responseHeaders and finalizeResponse already got. These routes serve a session and a workflow execution on one path and owe them different column keyings, so rendering per caller kind is presentation, not domain — a gap in the builder rather than a special case for one route. tableRowWireSchema describes what the single-row routes actually return. The contract claimed a full TableRow with the executions sidecar and Date objects — true of the list route, never true here. The hand-rolled handlers were never validated against their own contracts, so the drift was invisible. New use case readTableRowEnrichmentDetail, sharing tableOperations.readRow since it is a projection of the same row under the same role. Deliberate wire changes Both follow from adopting the shared concealment policy, and both are narrower than what they replace: a cross-tenant table conceals as 404 where the old blanket handler answered 403, while an in-workspace role denial still answers 403. The upsert row now carries position, which every other single-row response already returned. Nothing in hooks/queries/tables.ts branches on either status. Not in this PR v1/tables/[tableId]/rows/[rowId] is the last direct-DB adapter. It resolves its actor through resolveWorkspaceRequestActor rather than the canonical resolvePrincipalAttribution the use cases use, so migrating it changes billing attribution for workspace API keys. That deserves its own analysis rather than being folded in here. rows, query and rows/find are also still on the legacy pattern. Wire changes Beyond the refactor, four intended differences on the three migrated routes: Cross-tenant denial is now concealed as 404 Table not found instead of 403. In-workspace role denials still answer 403. This matches what v2 and the ~80 other routes on the shared builder already do, and it stops the internal surface confirming a table's existence to a non-member. Workspace mismatch answers 404 rather than 400. An unclassified failure answers 500 Internal server error rather than leaking the message. The upsert response now carries position, which the sibling GET/PATCH already emitted. No client branches on any of the changed statuses or strings — hooks/queries/tables.ts inspects only 423 for the lock. Type of Change Refactor Bug fix (contract drift, provenance certification) Testing Tested manually. 2,785 tests pass, type-check clean, all 29 audits pass. Every behavioural change is mutation-tested — forcing one keying, dropping the actor, pre-resolving the envelope, certifying an untracked internal write, and skipping the bundle completeness check each turn the covering tests red. The upsert and enrichment surfaces had no route-level tests before; they do now. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)
Open Graph Description: Summary Stacked on #6808. Moves the internal table row routes onto the application boundary — the routes that authorized in their own handlers and queried the database from the adapter. rows/[rowI...
X Description: Summary Stacked on #6808. Moves the internal table row routes onto the application boundary — the routes that authorized in their own handlers and queried the database from the adapter. rows/[rowI...
Opengraph URL: https://github.com/simstudioai/sim/pull/6809
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:aadc2f71-1331-99b7-0767-be50c3b867c4 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CC78:11532:924666:CF23E7:6AFB5128 |
| html-safe-nonce | 8a4afc22f26387a7e16ca59c263c3255bf40265ded05608b8102fc2081ea3465 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzc4OjExNTMyOjkyNDY2NjpDRjIzRTc6NkFGQjUxMjgiLCJ2aXNpdG9yX2lkIjoiNjU2NTI2OTY3NTk3MjQ0ODU1MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e220f444f0d4616f947a9613e512b400f9f35848eb5916a927767d22cb23327d |
| hovercard-subject-tag | pull_request:4301600946 |
| 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/6809/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 | Summary Stacked on #6808. Moves the internal table row routes onto the application boundary — the routes that authorized in their own handlers and queried the database from the adapter. rows/[rowI... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7122bb414b542dba14d71a3f0b9f6fd2abce715b9f5912d082800563e6c806d1 |
| 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 | cbf66c024bb6d10e6955baa7413c54cf13a201bb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width