Title: fix(inbox): disable the inbox atomically and simplify its webhook tests by waleedlatif1 · Pull Request #6441 · simstudioai/sim · GitHub
Open Graph Title: fix(inbox): disable the inbox atomically and simplify its webhook tests by waleedlatif1 · Pull Request #6441 · simstudioai/sim
X Title: fix(inbox): disable the inbox atomically and simplify its webhook tests by waleedlatif1 · Pull Request #6441 · simstudioai/sim
Description: Follow-up audit of #6431 and #6436. Two findings, one behavioral and one test-quality. Atomic disable disableInbox deleted the webhook row and cleared the workspace inbox columns as two independent statements in a Promise.all. That was tolerable before, but workspace.inbox_provider_id is now uniquely indexed, which turns a half-applied disable into a fatal state: the workspace keeps the id of an AgentMail inbox that has already been deleted, that address becomes free at the provider, and the next workspace to claim the same username gets the same id back — so its enableInbox fails on the unique constraint and surfaces a raw Postgres error to the admin. Narrow (needs a partial failure plus username reuse) and self-inflicted, but it is a state the index newly makes unrecoverable, so both writes now run in one transaction. The AgentMail API deletes still happen before it, so no external I/O is held inside the transaction. Test simplification Dropped a ~35-line hand-rolled table fixture that schemaMock from @sim/testing already provides; the file now uses the repo idiom vi.mock('@sim/db', () => ({ ...dbChainMock, ...schemaMock })). Dropped a helper whose four queueTableRows calls were three-quarters no-ops — the shared chain mock already resolves unqueued chains to an empty array — along with its TSDoc, which was wrong about why the calls were needed. The unknown-inbox test previously queued an empty workspace result, which made it pass against the pre-fix code too. It now asserts the routed inbox id reaches the lookup, so it discriminates. Verified by checking out the pre-fix route from main and running the suite against it: 6 of 7 tests fail. The seventh is the oversized-body test, which guards the shared body cap that predates all of this and correctly passes on both. Audit findings that needed no change Recorded so they are on file rather than re-derived later: No legitimate delivery that previously succeeded now fails. Traced enable, rename, entitlement lapse, and both partial-write windows. In the one window that looked like a regression (webhook row written, workspace row not yet updated) the old code verified the signature and then failed its inboxProviderId mismatch check — same 401, same provider retry. The unverified inbox id influences nothing but secret selection. After the verification gate it is never read again; every downstream field comes from the post-verification parse. All 401 paths return an identical status and body, and both branches pay the same indexed round-trip, so there is no enumeration oracle. Removing the old post-verification mismatch check is provably redundant — there is now a single JSON.parse, so the routing id and the message id are the same object property. Every writer of inbox_provider_id audited: only enableInbox and disableInbox. Workspace creation and forking both omit the column, and no script-migration touches it.
Open Graph Description: Follow-up audit of #6431 and #6436. Two findings, one behavioral and one test-quality. Atomic disable disableInbox deleted the webhook row and cleared the workspace inbox columns as two independent...
X Description: Follow-up audit of #6431 and #6436. Two findings, one behavioral and one test-quality. Atomic disable disableInbox deleted the webhook row and cleared the workspace inbox columns as two independent...
Opengraph URL: https://github.com/simstudioai/sim/pull/6441
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:8000bd14-70af-2803-22ef-b13ad17a9ddd |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B9DC:7D93E:960E02:CDED73:6AFB4BCB |
| html-safe-nonce | ac25c1316c3a379838b67253ca69e23c7328dec8177dfe5be22cb62a787dbe09 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOURDOjdEOTNFOjk2MEUwMjpDREVENzM6NkFGQjRCQ0IiLCJ2aXNpdG9yX2lkIjoiNzA4Mzk1MTU4MTg2MjUxMzYxMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6958538664ef9dfbfe7af1a13df9bdc069c88a430e6a6a261bbc160b6048df2b |
| hovercard-subject-tag | pull_request:4235973672 |
| 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/6441/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 | Follow-up audit of #6431 and #6436. Two findings, one behavioral and one test-quality. Atomic disable disableInbox deleted the webhook row and cleared the workspace inbox columns as two independent... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | acf7616d06cc051644705b379878c9bb13dc5e70ecf4ffd9b34140f8ac01d7e1 |
| 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 | 26504db649b58525278f77a52b80ba5f10d5f4de |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width