René's URL Explorer Experiment


Title: fix(db): wave 1 performance follow-ups from re-audit by waleedlatif1 · Pull Request #8984 · simstudioai/sim · GitHub

Open Graph Title: fix(db): wave 1 performance follow-ups from re-audit by waleedlatif1 · Pull Request #8984 · simstudioai/sim

X Title: fix(db): wave 1 performance follow-ups from re-audit by waleedlatif1 · Pull Request #8984 · simstudioai/sim

Description: Summary Unauthenticated keyword search (restored): callers with no signed-in reader rank keyword hits with the pre-#8975 code again, byte for byte. That means the two-step rankRows query with the same ordering and topK limits, split per base and run in parallel when getQueryStrategy says so. Why: the single-statement candidate CTE first materializes every match and then probes again to rank, serially. Its worst case on a large base with a very common term hasn't been measured, so this keeps the old path until it is. There is zero behavior change against what runs in production today. Signed-in readers are unchanged. Everything else from #8975 stays: the Confluence 403/404 skip, the member-engine count gate, and the keyword.sql stage on the signed-in path. keyword-ranking.integration.ts still compares the result against the two-step oracle (which the implementation now matches again) and still asserts ACL exclusion for workspace keys and session readers. The seed-only test became a guard assertion in beforeAll. Chat refresh coalescer: a reload past the 30s hold cancelled and restarted the chat's detail read on every request, so a slow read could restart forever. A chain now cancels a stuck read at most once (ChatDetailRefresh.replaced). A later request past the hold joins the read in flight with cancelRefetch: false, whether or not the chat is cached, and then reads again once it settles. That second read keeps the "final read sees every request" guarantee. Reporting usage cache, admin deletes: Better Auth's admin /admin/remove-user deletes the user through internalAdapter.deleteUser. That skips both deleteUserAccount and user.deleteUser.beforeDelete, so the user's usage_log rows cascade away while stored prefixes still count them. New databaseHooks.user.delete.after calls invalidateReportingUsagePrefixes(). Better Auth queues it to run after the delete commits. deleteUserAccount deletes through drizzle, so the hook never fires there, and its own invalidation stays. Reporting usage cache, observability: when Redis is configured but not ready, replaceEpoch now throws instead of returning silently, so the callers' existing warn logs fire. The payer bump warning now carries payerType. Semantics are unchanged: no command is issued while Redis is not ready, and with no Redis there is nothing to discard. Tests and TSDoc: row-writes.integration.ts: the 40k-row cleanup now runs in finally. Dropped the no-op GIN pending-list flush: both integration provisioning paths build the index with fastupdate = off. TSDoc corrections in lockWorkspaceStorageForMutationInTx (applies only to context = 'workspace' rows) and readLogStatsSegments (the subquery's LEFT join). Not changed: Planner settings on the unique probe. There is no measured problem. Limiting the payer epoch bump to enterprise payers. A caller-supplied period need not carry source, so skipping would risk an unseen top-up. Type of Change Bug fix Testing handle-resource-event.test.ts: added a test, parameterized over a cached transcript and a first load. A stuck read is cancelled at most once, the slow replacement finishes, and a trailing read follows. Both cases fail on staging's coalescer. The cached case also fails without cancelRefetch: false. The first-load case fails without the trailing read. queries.test.ts passes (40 tests). Biome on changed files, plus check:comment-hygiene, check:utils, check:test-patterns and check:sql-date-binding. CI runs type-check, the other audits and the integration suites. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing (new tests pass the test-audit authoring gate) 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 Unauthenticated keyword search (restored): callers with no signed-in reader rank keyword hits with the pre-#8975 code again, byte for byte. That means the two-step rankRows query with the ...

X Description: Summary Unauthenticated keyword search (restored): callers with no signed-in reader rank keyword hits with the pre-#8975 code again, byte for byte. That means the two-step rankRows query with the ...

Opengraph URL: https://github.com/simstudioai/sim/pull/8984

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,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-controllerpull_requests
route-actionfiles
fetch-noncev2:d326dc0a-1049-0648-2345-a5e3c6623a52
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id998E:3BD2EB:2E4333:40F0F8:6AFB54B8
html-safe-nonce4f989a9798e7e74a805a35099ba1f0dd4d223c813b903985479a58522f7182cd
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OThFOjNCRDJFQjoyRTQzMzM6NDBGMEY4OjZBRkI1NEI4IiwidmlzaXRvcl9pZCI6IjY4NDc3MjU0Mzg1Mjk5MTgxMzYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac0d519d8b0bd7de15f6846a7c4db133968f5eb92fb4e29dd2c4192fcad33eda0a
hovercard-subject-tagpull_request:4848923828
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/8984/files
twitter:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
og:image:altSummary Unauthenticated keyword search (restored): callers with no signed-in reader rank keyword hits with the pre-#8975 code again, byte for byte. That means the two-step rankRows query with the ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None7122bb414b542dba14d71a3f0b9f6fd2abce715b9f5912d082800563e6c806d1
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasecbf66c024bb6d10e6955baa7413c54cf13a201bb
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/8984/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F8984%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F8984%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/8984/files
Reloadhttps://github.com/simstudioai/sim/pull/8984/files
Reloadhttps://github.com/simstudioai/sim/pull/8984/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests197 (197)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
waleedlatif1https://github.com/waleedlatif1
staginghttps://github.com/simstudioai/sim/tree/staging
review/wave1-reaudithttps://github.com/simstudioai/sim/tree/review/wave1-reaudit
Conversation 17 https://github.com/simstudioai/sim/pull/8984
Commits 2 https://github.com/simstudioai/sim/pull/8984/commits
Checks 52 https://github.com/simstudioai/sim/pull/8984/checks
Files changed https://github.com/simstudioai/sim/pull/8984/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8984/files
fix(db): wave 1 performance follow-ups from re-audit https://github.com/simstudioai/sim/pull/8984/files#top
Show all changes 2 commits https://github.com/simstudioai/sim/pull/8984/files
d1da235 fix: wave 1 performance follow-ups from re-audit waleedlatif1 Oct 13, 2026 https://github.com/simstudioai/sim/pull/8984/commits/d1da2350143d3b338fd77e88b5785c4a59883ba1
d69d524 fix: restore the two-step unauthenticated keyword ranking, join cache… waleedlatif1 Oct 13, 2026 https://github.com/simstudioai/sim/pull/8984/commits/d69d52493afd10b0d91d6b09699b18ad56dd6490
Clear filters https://github.com/simstudioai/sim/pull/8984/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8984/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8984/files
handle-resource-event.test.ts https://github.com/simstudioai/sim/pull/8984/files#diff-93088aafd364984313e51ce5866bde15143a752d2c8127b0b3888f4b91ca0eec
mothership-chats.ts https://github.com/simstudioai/sim/pull/8984/files#diff-d93326dc7ad3c0d6856933a9ba910634ba50d1e7c3292f43f7aaa85ca2979311
auth.ts https://github.com/simstudioai/sim/pull/8984/files#diff-1196450729bfda994f3823921eacd28e3200408dbb562d8481108db9abe4a0e2
reporting-usage-epoch.ts https://github.com/simstudioai/sim/pull/8984/files#diff-d701e999f19d01652769c666c736b8a867d285847a36b63c288e8c22351e99d9
tracking.ts https://github.com/simstudioai/sim/pull/8984/files#diff-6fd53176883b29868eaf2da3c52a8bcab3fecdd0af61802d5303a8149f3c9ba9
keyword-ranking.integration.ts https://github.com/simstudioai/sim/pull/8984/files#diff-dbc1b7d20728cb75a89040787a45199d84a9d2184eceb740400de2960f7f7476
queries.ts https://github.com/simstudioai/sim/pull/8984/files#diff-5f10054baeef2f06350b32a6520d8f841f86a2fc908435296dd8dcb097497ba9
stats-queries.ts https://github.com/simstudioai/sim/pull/8984/files#diff-5468680ab5b624c7e1b22cee5ac5026220cb589fbc4ea14df8f28c3cc0165182
row-writes.integration.ts https://github.com/simstudioai/sim/pull/8984/files#diff-653e2260e6bc1166f12f87c1cd10329f4ae89e569dc2f54ade8cf6b57c027468
apps/sim/app/workspace/[workspaceId]/home/hooks/stream/handle-resource-event.test.tshttps://github.com/simstudioai/sim/pull/8984/files#diff-93088aafd364984313e51ce5866bde15143a752d2c8127b0b3888f4b91ca0eec
View file https://github.com/simstudioai/sim/blob/d69d52493afd10b0d91d6b09699b18ad56dd6490/apps/sim/app/workspace/%5BworkspaceId%5D/home/hooks/stream/handle-resource-event.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8984/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8984/files#diff-93088aafd364984313e51ce5866bde15143a752d2c8127b0b3888f4b91ca0eec
https://github.com/simstudioai/sim/pull/8984/files#diff-93088aafd364984313e51ce5866bde15143a752d2c8127b0b3888f4b91ca0eec
https://github.com/simstudioai/sim/pull/8984/files#diff-93088aafd364984313e51ce5866bde15143a752d2c8127b0b3888f4b91ca0eec
apps/sim/hooks/queries/mothership-chats.tshttps://github.com/simstudioai/sim/pull/8984/files#diff-d93326dc7ad3c0d6856933a9ba910634ba50d1e7c3292f43f7aaa85ca2979311
View file https://github.com/simstudioai/sim/blob/d69d52493afd10b0d91d6b09699b18ad56dd6490/apps/sim/hooks/queries/mothership-chats.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8984/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8984/files#diff-d93326dc7ad3c0d6856933a9ba910634ba50d1e7c3292f43f7aaa85ca2979311
https://github.com/simstudioai/sim/pull/8984/files#diff-d93326dc7ad3c0d6856933a9ba910634ba50d1e7c3292f43f7aaa85ca2979311
https://github.com/simstudioai/sim/pull/8984/files#diff-d93326dc7ad3c0d6856933a9ba910634ba50d1e7c3292f43f7aaa85ca2979311
apps/sim/lib/auth/auth.tshttps://github.com/simstudioai/sim/pull/8984/files#diff-1196450729bfda994f3823921eacd28e3200408dbb562d8481108db9abe4a0e2
View file https://github.com/simstudioai/sim/blob/d69d52493afd10b0d91d6b09699b18ad56dd6490/apps/sim/lib/auth/auth.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8984/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8984/files#diff-1196450729bfda994f3823921eacd28e3200408dbb562d8481108db9abe4a0e2
https://github.com/simstudioai/sim/pull/8984/files#diff-1196450729bfda994f3823921eacd28e3200408dbb562d8481108db9abe4a0e2
https://github.com/simstudioai/sim/pull/8984/files#diff-1196450729bfda994f3823921eacd28e3200408dbb562d8481108db9abe4a0e2
Please reload this pagehttps://github.com/simstudioai/sim/pull/8984/files
https://github.com/simstudioai/sim/pull/8984/files#diff-1196450729bfda994f3823921eacd28e3200408dbb562d8481108db9abe4a0e2
apps/sim/lib/billing/core/reporting-usage-epoch.tshttps://github.com/simstudioai/sim/pull/8984/files#diff-d701e999f19d01652769c666c736b8a867d285847a36b63c288e8c22351e99d9
View file https://github.com/simstudioai/sim/blob/d69d52493afd10b0d91d6b09699b18ad56dd6490/apps/sim/lib/billing/core/reporting-usage-epoch.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8984/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8984/files#diff-d701e999f19d01652769c666c736b8a867d285847a36b63c288e8c22351e99d9
https://github.com/simstudioai/sim/pull/8984/files#diff-d701e999f19d01652769c666c736b8a867d285847a36b63c288e8c22351e99d9
https://github.com/simstudioai/sim/pull/8984/files#diff-d701e999f19d01652769c666c736b8a867d285847a36b63c288e8c22351e99d9
https://github.com/simstudioai/sim/pull/8984/files#diff-d701e999f19d01652769c666c736b8a867d285847a36b63c288e8c22351e99d9
apps/sim/lib/billing/storage/tracking.tshttps://github.com/simstudioai/sim/pull/8984/files#diff-6fd53176883b29868eaf2da3c52a8bcab3fecdd0af61802d5303a8149f3c9ba9
View file https://github.com/simstudioai/sim/blob/d69d52493afd10b0d91d6b09699b18ad56dd6490/apps/sim/lib/billing/storage/tracking.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8984/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8984/files#diff-6fd53176883b29868eaf2da3c52a8bcab3fecdd0af61802d5303a8149f3c9ba9
https://github.com/simstudioai/sim/pull/8984/files#diff-6fd53176883b29868eaf2da3c52a8bcab3fecdd0af61802d5303a8149f3c9ba9
apps/sim/lib/knowledge/__integration__/keyword-ranking.integration.tshttps://github.com/simstudioai/sim/pull/8984/files#diff-dbc1b7d20728cb75a89040787a45199d84a9d2184eceb740400de2960f7f7476
View file https://github.com/simstudioai/sim/blob/d69d52493afd10b0d91d6b09699b18ad56dd6490/apps/sim/lib/knowledge/__integration__/keyword-ranking.integration.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8984/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8984/files#diff-dbc1b7d20728cb75a89040787a45199d84a9d2184eceb740400de2960f7f7476
https://github.com/simstudioai/sim/pull/8984/files#diff-dbc1b7d20728cb75a89040787a45199d84a9d2184eceb740400de2960f7f7476
https://github.com/simstudioai/sim/pull/8984/files#diff-dbc1b7d20728cb75a89040787a45199d84a9d2184eceb740400de2960f7f7476
https://github.com/simstudioai/sim/pull/8984/files#diff-dbc1b7d20728cb75a89040787a45199d84a9d2184eceb740400de2960f7f7476
https://github.com/simstudioai/sim/pull/8984/files#diff-dbc1b7d20728cb75a89040787a45199d84a9d2184eceb740400de2960f7f7476
https://github.com/simstudioai/sim/pull/8984/files#diff-dbc1b7d20728cb75a89040787a45199d84a9d2184eceb740400de2960f7f7476
https://github.com/simstudioai/sim/pull/8984/files#diff-dbc1b7d20728cb75a89040787a45199d84a9d2184eceb740400de2960f7f7476
https://github.com/simstudioai/sim/pull/8984/files#diff-dbc1b7d20728cb75a89040787a45199d84a9d2184eceb740400de2960f7f7476
https://github.com/simstudioai/sim/pull/8984/files#diff-dbc1b7d20728cb75a89040787a45199d84a9d2184eceb740400de2960f7f7476
https://github.com/simstudioai/sim/pull/8984/files#diff-dbc1b7d20728cb75a89040787a45199d84a9d2184eceb740400de2960f7f7476
https://github.com/simstudioai/sim/pull/8984/files#diff-dbc1b7d20728cb75a89040787a45199d84a9d2184eceb740400de2960f7f7476
https://github.com/simstudioai/sim/pull/8984/files#diff-dbc1b7d20728cb75a89040787a45199d84a9d2184eceb740400de2960f7f7476
Please reload this pagehttps://github.com/simstudioai/sim/pull/8984/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8984/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.