Title: fix(queries): close correctness and stale-data defects found auditing the query layer by waleedlatif1 · Pull Request #6659 · simstudioai/sim · GitHub
Open Graph Title: fix(queries): close correctness and stale-data defects found auditing the query layer by waleedlatif1 · Pull Request #6659 · simstudioai/sim
X Title: fix(queries): close correctness and stale-data defects found auditing the query layer by waleedlatif1 · Pull Request #6659 · simstudioai/sim
Description: Summary A four-agent audit of the query and server-render layers, following #6657. Every finding was verified against the code before being fixed — several were reported but turned out not to be real, and those are listed at the bottom rather than "fixed". Functional bugs Table cell edits threw after using search. patchCachedRows walked tableKeys.rowsRoot non-exact, but that is a prefix — the find and write subtrees hang off it with non-paged shapes, so old.pages.map threw. It runs inside onMutate, so the edit rejected before reaching the server. A sibling helper already excluded those subtrees and its docstring claimed they "never match"; that was only true of the sibling. Both now share one helper. A transient failure permanently disabled cloud uploads. useCloudStorageConfigured combined staleTime: Infinity, retry: false, and the global retryOnMount: false on a workspace-independent key, and the upload path fails closed. One blip left it errored for the tab's life with no way back. useVoiceSettings carries the same three options and already escapes it. CloudWatch server-side filtering was dead. The log-group and log-stream selectors forwarded search as prefix but omitted it from the query key, so typing never changed the key and no refetch fired. A log group outside the first page was unreachable. An audit of all 69 selector definitions found these two and no others. Optimistic rows could collide. generateTempId used Date.now(), so two rows created in the same millisecond shared an id and one server response overwrote both. Stale data Workspace usage/credits were invalidated nowhere — the credits chip and run gate held page-load values until a reload, while six sites already refreshed subscriptionKeys after credits moved. Also fixed: KB list doc counts after upload/delete, billing state after a non-redirect plan switch, workflow lists after a copilot tool call (raw key missed the archived scope and the selector prefix), and an aliased schedule key namespace. Server reads The workspace row was read ~3× per workspace route and ~5× on settings. Memoization is deliberately partial: getWorkspaceWithOwner accepts a transaction and forUpdate and live callers use both, so only the plain no-options read is memoized — a row read inside a transaction or under a lock can never be served to a later caller. Guards prefetchWorkspaceSidebar / seedWorkspaceList had no test despite being the whole of #6656, and one existing assertion could not fail (it asserted on a key the function never writes). The file-folder seed now parses through its contract — it was the same shape bug #6657 fixed, waiting to recur. Reported but NOT real — deliberately unchanged CSV preview staleness. The key already folds in the file version and storage key, so a content update addresses a different entry. link-preview / unsubscribe retry traps. Same three options, no blast radius: finite staleTime, per-URL keys, consumers that degrade correctly. oauth-connections swallowing errors. No consumer reads isConnected; letting it reject would blank the suggested-action rows. Documented instead. A "permanent spinner" from the selector gate. The precedence bug was real, but the symptom was not — the throw happens before any request and the sole consumer never reads isLoading. Substituting ownerBilling for the Inbox/Sandbox or Enterprise checks would have changed who gets those features. Type of Change Bug fix Testing prefetch.test.ts 26/26, plus new tests for the usage, knowledge, CloudWatch key, and temp-id fixes — each proven to fail without its fix. type-check, biome, lint:check, check:audits, check:react-query, and the module-count ratchet all pass. Not verified locally: several affected files cannot load in a git worktree (pre-existing postcss/tailwind resolution failure) — workspace-files.test.tsx, the selector registry, and the upgrade/tool-event/schedules hosts. CI is the first place those run against these changes; please confirm Lint and Test is green before merging. 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 A four-agent audit of the query and server-render layers, following #6657. Every finding was verified against the code before being fixed — several were reported but turned out not to be re...
X Description: Summary A four-agent audit of the query and server-render layers, following #6657. Every finding was verified against the code before being fixed — several were reported but turned out not to be re...
Opengraph URL: https://github.com/simstudioai/sim/pull/6659
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:56a8a557-1790-0e8c-72a2-88e7bfce9659 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 814A:8CC91:223050:2EA3E0:6AFB4FF8 |
| html-safe-nonce | e7bc542a4bcf073ba198e7b5fc560cf27c58da16138aa9c9290adaca95a2cfe0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTRBOjhDQzkxOjIyMzA1MDoyRUEzRTA6NkFGQjRGRjgiLCJ2aXNpdG9yX2lkIjoiODU3OTI3Mjg0NDI4ODY3NTgzMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a918423e9ed9af0e3ac33fbf4b629ddecc5624a2a47186cccb2b774bda211c2f |
| hovercard-subject-tag | pull_request:4269051813 |
| 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/6659/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 A four-agent audit of the query and server-render layers, following #6657. Every finding was verified against the code before being fixed — several were reported but turned out not to be re... |
| 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