René's URL Explorer Experiment


Title: fix(db): reconcile folders stranded by old pods during the cutover drain by waleedlatif1 · Pull Request #6049 · simstudioai/sim · GitHub

Open Graph Title: fix(db): reconcile folders stranded by old pods during the cutover drain by waleedlatif1 · Pull Request #6049 · simstudioai/sim

X Title: fix(db): reconcile folders stranded by old pods during the cutover drain by waleedlatif1 · Pull Request #6049 · simstudioai/sim

Description: Adds 0275, the post-drain reconcile for the generic-folder cutover shipped in #6045. Why this exists 0272 and 0274 both ran while the previous app version was still serving. During the blue/green window the old pods write the legacy folder tables exclusively while the new pods write folder exclusively, so any folder an old pod creates between the migration and its own termination lives only in the legacy table and is invisible to the new code. 0274's header asked to be run again once the deploy drained. A journaled migration never replays, so that re-run has to be its own file. This is it. The stranding window did materialize in production — measured live at 06:52Z, mid-drain: rows to insert workflow_folder 1 (archived, no parent, no workflows inside) workspace_file_folders 0 The single stranded row has no user impact — it was created and archived within 100ms by canary traffic. The count at execution time may be higher, since old pods were still serving when that was taken. Covers both trees, where 0274 covered only file. The workflow side is the higher-volume one and is where the stranded row actually landed. Design Insert-only for ids missing from folder, never a mirror upsert. 0274 could upsert every column because file folders can never diverge in name — workspace_file_folders enforces the same active-unique key folder does. That does not hold here: 0272's dedup renamed 47 workflow folders across 35 collision groups, so folder is deliberately different from workflow_folder for those rows. An upsert would revert all 47 to their colliding names and violate folder_workspace_resource_parent_name_active_unique in the process. First free suffix, not a row number. The target name may already be held by a row this block is not inserting, so the dedup probes upward until it finds a genuinely free name. Only active rows dedupe. The partial unique index ignores soft-deleted rows, so an archived folder keeps its original name and reappears under it if restored. Depth-ordered inserts. A parent always lands before its children — the self-referencing FK is checked immediately and the folder_parent_resource_type_match trigger reads the parent row, so a child inserted first fails both. Wrapped in a DO block, for the same reason 0274 is: 0272 ends with an embedded COMMIT for its trailing CONCURRENTLY index builds, so files after it are not guaranteed to run inside drizzle's batch transaction. Verification Executed the actual migration file against Postgres 17 with adversarial fixtures. Every case a naive implementation gets wrong: Fixture Expected Result Row 0272 renamed to Reports (2) untouched ✅ not reverted Stranded active Reports, with Reports (2) already taken Reports (3) ✅ Stranded archived row with colliding name keeps Reports ✅ no suffix Fully-stranded 3-level chain parents insert first ✅ Stranded child colliding with a sibling dedupes within parent ✅ Nested (2) Same name in another workspace untouched ✅ File Reports vs workflow Reports independent ✅ resource_type scoped Idempotency: three consecutive runs, byte-identical state. bun run check:migrations passes. Operational note — this has a deadline Run before the soft-delete cleanup job purges expired folder rows. Cleanup hard-deletes from folder but never from the legacy tables, so a run landing after a purge would reinstate every purged folder as a soft-deleted phantom in Recently Deleted whose files and workflows are already gone. The retention window is far longer than any drain, so shipping promptly is sufficient — but this is the one constraint that makes deferring it indefinitely dangerous rather than merely redundant. Not in this PR — dropping the legacy tables Deliberately held. Verified for a future contract PR, but not acted on: Application code is already fully clean — zero reads, zero writes, zero dual-read fallbacks to either legacy table. The reader-removal precondition is satisfied by #6045, which is deployed. Structurally the drop is trivial: the only inbound FKs are self-references. Nothing else in the database depends on either table. Full-row comparison (not just counts) is clean on both trees: 1,495/1,495 file rows match on every column; the workflow side shows zero parent drift, with the only material difference being the one stranded row. What is not satisfied is rollback posture. The tables are the only rollback path, KB/Tables folders have hours of production exposure with no meaningful user traffic yet, and schema.ts carries a binding policy that dropping on the strength of "no code references it" alone destroys that path. They cost essentially nothing to keep. That call belongs to the repo owner once the new folder trees have seen real usage. ⚠️ For whoever writes that drop PR: do not let any script glob workflow_folder* when dropping indexes. workflow_folder_sort_idx is an index on the live workflow table, not on the legacy folder table. It looks obviously safe in review and is not.

Open Graph Description: Adds 0275, the post-drain reconcile for the generic-folder cutover shipped in #6045. Why this exists 0272 and 0274 both ran while the previous app version was still serving. During the blue/green w...

X Description: Adds 0275, the post-drain reconcile for the generic-folder cutover shipped in #6045. Why this exists 0272 and 0274 both ran while the previous app version was still serving. During the blue/green w...

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

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:8edc1c74-97d9-faa5-d668-44862f965bdf
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA334:2F3575:59B9A4:80BBF4:6AFB4353
html-safe-noncecbf2519f6afc31949a1f91d57bdba3c1bdd5b86476e2090a371e25e40d9e8290
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzM0OjJGMzU3NTo1OUI5QTQ6ODBCQkY0OjZBRkI0MzUzIiwidmlzaXRvcl9pZCI6Ijc4NTg3NDI5Mjc3NTI3MzI5OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac17d39bf2cb9553517d9559454c04c38af573506cd372ffd9a2099a7c1fb9a73c
hovercard-subject-tagpull_request:4157940802
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/6049/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:altAdds 0275, the post-drain reconcile for the generic-folder cutover shipped in #6045. Why this exists 0272 and 0274 both ran while the previous app version was still serving. During the blue/green w...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noned849b928f455c800985398e7f1b659425adb312a5fa14fba5d9a14e62e9fe5dd
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
releasea6c2f87cbcb6414452377b4967858ed6a66f1109
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/6049/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F6049%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%2F6049%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/6049/files
Reloadhttps://github.com/simstudioai/sim/pull/6049/files
Reloadhttps://github.com/simstudioai/sim/pull/6049/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests200 (200)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
chore/folders-legacy-contracthttps://github.com/simstudioai/sim/tree/chore/folders-legacy-contract
Conversation 16 https://github.com/simstudioai/sim/pull/6049
Commits 2 https://github.com/simstudioai/sim/pull/6049/commits
Checks 26 https://github.com/simstudioai/sim/pull/6049/checks
Files changed https://github.com/simstudioai/sim/pull/6049/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6049/files
fix(db): reconcile folders stranded by old pods during the cutover drain https://github.com/simstudioai/sim/pull/6049/files#top
Show all changes 2 commits https://github.com/simstudioai/sim/pull/6049/files
e339a38 fix(db): reconcile folders stranded by old pods during the cutover drain waleedlatif1 Jul 29, 2026 https://github.com/simstudioai/sim/pull/6049/commits/e339a38823d07b54319218b4f1fea8ff13f1e45b
a5dac82 fix(db): carry locked through the reconcile and start suffixes at (1) waleedlatif1 Jul 29, 2026 https://github.com/simstudioai/sim/pull/6049/commits/a5dac82cbdb26e76b32b24a3ab293220c14900c6
Clear filters https://github.com/simstudioai/sim/pull/6049/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6049/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6049/files
0275_folder_cutover_post_drain_reconcile.sql https://github.com/simstudioai/sim/pull/6049/files#diff-68015882cc881622637aa481348c39a126b7a7875a831843b465958f817e04c4
_journal.json https://github.com/simstudioai/sim/pull/6049/files#diff-37150cc65ad16ee6fbc5fa318fc096be7730e16d63eaf863e3df5521b7030649
packages/db/migrations/0275_folder_cutover_post_drain_reconcile.sqlhttps://github.com/simstudioai/sim/pull/6049/files#diff-68015882cc881622637aa481348c39a126b7a7875a831843b465958f817e04c4
View file https://github.com/simstudioai/sim/blob/a5dac82cbdb26e76b32b24a3ab293220c14900c6/packages/db/migrations/0275_folder_cutover_post_drain_reconcile.sql
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6049/{{ revealButtonHref }}
Please reload this pagehttps://github.com/simstudioai/sim/pull/6049/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6049/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6049/files
cursorhttps://github.com/apps/cursor
Jul 29, 2026https://github.com/simstudioai/sim/pull/6049/files#r3671916494
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
packages/db/migrations/0275_folder_cutover_post_drain_reconcile.sql#L137-L141https://github.com/simstudioai/sim/blob/a5dac82cbdb26e76b32b24a3ab293220c14900c6/packages/db/migrations/0275_folder_cutover_post_drain_reconcile.sql#L137-L141
https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjJmZDA3ODZhLTMzNzMtNDRkZi05NGUxLWRkZjBiYWZmMGNjNSIsImVuY3J5cHRpb25LZXkiOiJnallRZk14ZkEtXzExMnBRem9BOXczbEI2UHFGalpmUTZNaFU3a24wbllVIiwiYnJhbmNoIjoiY2hvcmUvZm9sZGVycy1sZWdhY3ktY29udHJhY3QiLCJyZXBvT3duZXIiOiJzaW1zdHVkaW9haSIsInJlcG9OYW1lIjoic2ltIn19
https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjJmZDA3ODZhLTMzNzMtNDRkZi05NGUxLWRkZjBiYWZmMGNjNSIsImVuY3J5cHRpb25LZXkiOiJnallRZk14ZkEtXzExMnBRem9BOXczbEI2UHFGalpmUTZNaFU3a24wbllVIiwiYnJhbmNoIjoiY2hvcmUvZm9sZGVycy1sZWdhY3ktY29udHJhY3QiLCJyZXBvT3duZXIiOiJzaW1zdHVkaW9haSIsInJlcG9OYW1lIjoic2ltIiwicHJOdW1iZXIiOjYwNDksImNvbW1pdFNoYSI6ImE1ZGFjODJjYmRiMjZlNzZiMzJiMjRhM2FiMjkzMjIwYzE0OTAwYzYiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ
Cursor Bugbothttps://cursor.com/bugbot
a5dac82https://github.com/simstudioai/sim/commit/a5dac82cbdb26e76b32b24a3ab293220c14900c6
herehttps://www.cursor.com/dashboard/bugbot
Please reload this pagehttps://github.com/simstudioai/sim/pull/6049/files
packages/db/migrations/meta/_journal.jsonhttps://github.com/simstudioai/sim/pull/6049/files#diff-37150cc65ad16ee6fbc5fa318fc096be7730e16d63eaf863e3df5521b7030649
View file https://github.com/simstudioai/sim/blob/a5dac82cbdb26e76b32b24a3ab293220c14900c6/packages/db/migrations/meta/_journal.json
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6049/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6049/files#diff-37150cc65ad16ee6fbc5fa318fc096be7730e16d63eaf863e3df5521b7030649
Please reload this pagehttps://github.com/simstudioai/sim/pull/6049/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.