René's URL Explorer Experiment


Title: improvement(tables): read row counts and versions through an append-only change log by TheodoreSpeaks · Pull Request #8653 · simstudioai/sim · GitHub

Open Graph Title: improvement(tables): read row counts and versions through an append-only change log by TheodoreSpeaks · Pull Request #8653 · simstudioai/sim

X Title: improvement(tables): read row counts and versions through an append-only change log by TheodoreSpeaks · Pull Request #8653 · simstudioai/sim

Description: Summary Every row write updates row_count / rows_version on the table's single user_table_definitions row and holds that lock until its commit is acknowledged by a standby, so one slow commit makes every other writer to the same table hit lock_timeout and roll back Phase 1 of moving those counters to an append-only change log (the buffered-counter pattern): adds user_table_row_changes, and every reader now reads stored value + unfolded tail in one statement (lib/table/row-changes.ts) — table get/list/query counts, the snapshot cache key, and the snapshot mount-safety check rows_version is the stored version plus the count of log rows, never max(id) — ids are allocated before commit, so a late commit can carry a lower id than one already seen and the cache would serve stale bytes New /api/cron/fold-table-row-changes (every minute, helm + docker crontab) folds each table's log into its definition row in one statement; SKIP LOCKED so it never waits on a held row and overlapping sweeps skip each other. updated_at now moves at fold time, so it trails the last insert/delete by up to a minute Fork copy no longer overwrites row_count after copying rows — the trigger already counts them, and once writers log changes the overwrite would double-count No behavior change on its own: nothing writes to the log yet. Phase 2 (separate PR, after this deploys) points the row-count / rows_version triggers at the log; shipping both together would let old instances read the stored column alone mid-deploy Prod schedules crons in infra; that entry is a separate infra PR Type of Change Improvement Testing New lib/table/row-changes.integration.ts against real Postgres (push + migrate): reads include the tail, fold keeps stored + tail constant, fold skips a held definition row in <1s instead of waiting, version stays exact and non-decreasing with 8 concurrent appenders while folds run, sweep covers every table. Reverting the reads to the stored column turns the read tests red Table integration suites on a migrated DB (155 passed), secret-provenance.integration.ts fixture gains the log table Local E2E on the running app: logged changes by hand → tables page showed stored + tail; cron fold → stored values updated, page unchanged, log empty, updated_at in UTC bun run test (local-only failures are .env-driven rate-limit/timeout tests untouched here, plus one flaky sandbox test that passes alone), bun run lint, check:audits, check:migrations origin/staging, block-registry check, docs-manifest:check, drizzle generate clean 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) 🤖 Generated with Claude Code https://claude.ai/code/session_01YVFtF6hWSD8ot7omjmqF5U

Open Graph Description: Summary Every row write updates row_count / rows_version on the table's single user_table_definitions row and holds that lock until its commit is acknowledged by a standby, so one slow commit ...

X Description: Summary Every row write updates row_count / rows_version on the table&#39;s single user_table_definitions row and holds that lock until its commit is acknowledged by a standby, so one slow com...

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

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:623125d4-9139-c0c4-7aa6-bad476292452
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC0D6:32C32D:172A06:207C83:6AFB7831
html-safe-nonce297d6ab596df95e984f2bd3c0845b93e38a77f189a99b0591bff3a76e182b0a0
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMEQ2OjMyQzMyRDoxNzJBMDY6MjA3QzgzOjZBRkI3ODMxIiwidmlzaXRvcl9pZCI6IjQxMTM5NzY0OTU0NzMxMjk1MjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac66007a400729cac783a5c9ba734ec186bd36b476d3bc4a874e7dd1db5eb73459
hovercard-subject-tagpull_request:4753071175
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/8653/files
twitter:imagehttps://avatars.githubusercontent.com/u/19564703?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/19564703?s=400&v=4
og:image:altSummary Every row write updates row_count / rows_version on the table's single user_table_definitions row and holds that lock until its commit is acknowledged by a standby, so one slow commit ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None0e29e7974fdda2feeaf5c891efd4b23b0734b23480232b62c7bdef13f40b5b48
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
release2e8872b770cc4d5d0cc1f2026afab747a268e2ce
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/8653/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F8653%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%2F8653%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/8653/files
Reloadhttps://github.com/simstudioai/sim/pull/8653/files
Reloadhttps://github.com/simstudioai/sim/pull/8653/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests201 (201)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
TheodoreSpeakshttps://github.com/TheodoreSpeaks
staginghttps://github.com/simstudioai/sim/tree/staging
fix/table-version-lockhttps://github.com/simstudioai/sim/tree/fix/table-version-lock
Conversation 21 https://github.com/simstudioai/sim/pull/8653
Commits 5 https://github.com/simstudioai/sim/pull/8653/commits
Checks 37 https://github.com/simstudioai/sim/pull/8653/checks
Files changed https://github.com/simstudioai/sim/pull/8653/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8653/files
improvement(tables): read row counts and versions through an append-only change log https://github.com/simstudioai/sim/pull/8653/files#top
Show all changes 5 commits https://github.com/simstudioai/sim/pull/8653/files
5a9fe5c improvement(tables): read row counts and versions through an append-o… TheodoreSpeaks Oct 6, 2026 https://github.com/simstudioai/sim/pull/8653/commits/5a9fe5c92753eb6f273133c700f2fdbb0d2f4090
1501988 chore(helm): bump chart version for the table row-change fold cron job TheodoreSpeaks Oct 6, 2026 https://github.com/simstudioai/sim/pull/8653/commits/15019888d989f04c002c840fcdbe25b79f87aaa1
0c21400 fix(tables): seek pending fold tables by index and document the sweep… TheodoreSpeaks Oct 6, 2026 https://github.com/simstudioai/sim/pull/8653/commits/0c21400cb156e786df760577778d1871c522ba10
2d6a0dc fix(tables): give the fold cron route a response contract TheodoreSpeaks Oct 6, 2026 https://github.com/simstudioai/sim/pull/8653/commits/2d6a0dc829b0c3cb22e5c980d62add682791bc5d
5197510 chore(db): format regenerated row-change migration snapshot TheodoreSpeaks Oct 6, 2026 https://github.com/simstudioai/sim/pull/8653/commits/5197510313d8b2026854f8ce3187576c02c5bae7
Clear filters https://github.com/simstudioai/sim/pull/8653/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8653/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8653/files
route.ts https://github.com/simstudioai/sim/pull/8653/files#diff-1edd26eb435d54079bf2a0471bb58972a9fa1822131aa75711c0cb28ea5fd1b4
copy-resources.ts https://github.com/simstudioai/sim/pull/8653/files#diff-8090f65dbd57000145cea8bb14673ad7008ab9c9bf550c267d736e4abf3c7ffb
tables.ts https://github.com/simstudioai/sim/pull/8653/files#diff-927ba827479bb6f5c0c9cee9dfe1067112e939610060f6a1e939f232b976257d
row-changes.integration.ts https://github.com/simstudioai/sim/pull/8653/files#diff-90263768c7c62e6c740acbb6bcf23a053ef15a4c087b3dc53c02d0aba4ddc9a9
row-changes.ts https://github.com/simstudioai/sim/pull/8653/files#diff-1a5343986d8f2cb72dab7fb08bf3d7764815a7af1150739a93acc2c2f478f1f9
secret-provenance.integration.ts https://github.com/simstudioai/sim/pull/8653/files#diff-8467f67de269d07814ec5ecf77777a97ee64072b363f37e8e84ba7b474fd5155
secret-provenance.ts https://github.com/simstudioai/sim/pull/8653/files#diff-c596e887466f07fe84d02c25ab4be5746779df0d5c35286bf9ad0c7a87ab65af
service.ts https://github.com/simstudioai/sim/pull/8653/files#diff-691e9b1dc59be0015a1be5ea6189899b241d4e979a8b40e088dd7d722cfaadb6
snapshot-cache.ts https://github.com/simstudioai/sim/pull/8653/files#diff-289ccd68dde4b22893a4c19810d33a9fddda96f6402a7a15dbe74865414d2d9b
crontab https://github.com/simstudioai/sim/pull/8653/files#diff-113e45f5b7e8f56c36314e73cd9658a1e921c45572f442c95a0309a0116c7751
Chart.yaml https://github.com/simstudioai/sim/pull/8653/files#diff-d445852065771a32d12552f3dda5753bbf1f5cadfc7f4c3368a27d9c92932918
values.yaml https://github.com/simstudioai/sim/pull/8653/files#diff-5586790157aac5be1a3be674910d22e602e8c840abbf289d0ad31ffb5dac5cb1
0396_user_table_row_changes.sql https://github.com/simstudioai/sim/pull/8653/files#diff-79b59d777c5b8b0e725edae78a600aca19fe5c87e04cb71ae1d4ce17ccf59fca
0396_snapshot.json https://github.com/simstudioai/sim/pull/8653/files#diff-bf7a512b40e953b7cce8335a5e00268bbad412aa9512b1ec5f3f6de51afa0453
_journal.json https://github.com/simstudioai/sim/pull/8653/files#diff-37150cc65ad16ee6fbc5fa318fc096be7730e16d63eaf863e3df5521b7030649
schema.ts https://github.com/simstudioai/sim/pull/8653/files#diff-9a959e2ce3cb4c86957bbae021d06eae364f7b0cb18964f5873bab53220af928
schema-tables.generated.ts https://github.com/simstudioai/sim/pull/8653/files#diff-e0edf0f56682cbbb36446389d81ccd7516f377568a0c09cd8e9c1c87b0b1850e
check-api-validation-contracts.ts https://github.com/simstudioai/sim/pull/8653/files#diff-48ae6a4d0c1f820d5b644522d25742bb29af758bc8350f1a3cf3f8afa0bd00b0
apps/sim/app/api/cron/fold-table-row-changes/route.tshttps://github.com/simstudioai/sim/pull/8653/files#diff-1edd26eb435d54079bf2a0471bb58972a9fa1822131aa75711c0cb28ea5fd1b4
View file https://github.com/simstudioai/sim/blob/5197510313d8b2026854f8ce3187576c02c5bae7/apps/sim/app/api/cron/fold-table-row-changes/route.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8653/{{ revealButtonHref }}
apps/sim/ee/workspace-forking/lib/copy/copy-resources.tshttps://github.com/simstudioai/sim/pull/8653/files#diff-8090f65dbd57000145cea8bb14673ad7008ab9c9bf550c267d736e4abf3c7ffb
View file https://github.com/simstudioai/sim/blob/5197510313d8b2026854f8ce3187576c02c5bae7/apps/sim/ee/workspace-forking/lib/copy/copy-resources.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8653/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8653/files#diff-8090f65dbd57000145cea8bb14673ad7008ab9c9bf550c267d736e4abf3c7ffb
https://github.com/simstudioai/sim/pull/8653/files#diff-8090f65dbd57000145cea8bb14673ad7008ab9c9bf550c267d736e4abf3c7ffb
https://github.com/simstudioai/sim/pull/8653/files#diff-8090f65dbd57000145cea8bb14673ad7008ab9c9bf550c267d736e4abf3c7ffb
https://github.com/simstudioai/sim/pull/8653/files#diff-8090f65dbd57000145cea8bb14673ad7008ab9c9bf550c267d736e4abf3c7ffb
apps/sim/lib/api/contracts/tables.tshttps://github.com/simstudioai/sim/pull/8653/files#diff-927ba827479bb6f5c0c9cee9dfe1067112e939610060f6a1e939f232b976257d
View file https://github.com/simstudioai/sim/blob/5197510313d8b2026854f8ce3187576c02c5bae7/apps/sim/lib/api/contracts/tables.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8653/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8653/files#diff-927ba827479bb6f5c0c9cee9dfe1067112e939610060f6a1e939f232b976257d
apps/sim/lib/table/row-changes.integration.tshttps://github.com/simstudioai/sim/pull/8653/files#diff-90263768c7c62e6c740acbb6bcf23a053ef15a4c087b3dc53c02d0aba4ddc9a9
View file https://github.com/simstudioai/sim/blob/5197510313d8b2026854f8ce3187576c02c5bae7/apps/sim/lib/table/row-changes.integration.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8653/{{ revealButtonHref }}
Please reload this pagehttps://github.com/simstudioai/sim/pull/8653/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8653/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.