René's URL Explorer Experiment


Title: feat(admin): move a workspace between organizations by mzxchandra · Pull Request #7254 · simstudioai/sim · GitHub

Open Graph Title: feat(admin): move a workspace between organizations by mzxchandra · Pull Request #7254 · simstudioai/sim

X Title: feat(admin): move a workspace between organizations by mzxchandra · Pull Request #7254 · simstudioai/sim

Description: Summary Lets the admin panel move a workspace from one organization to another. The move was restricted to personal/grandfathered sources — assertWorkspaceMovable threw "Inter-organization workspace transfers are not supported" — so support could only re-home a workspace with manual SQL. Most of the machinery already existed: durable operation IDs, seat-capacity checks, and changeWorkspaceStoragePayerInTx, which already accepted an arbitrary source payer, so the storage-ledger rebalance between two orgs needed no change. The work is a guard relaxation plus handling what the source organization loses. Two invariants this feature could break, now enforced here Moving a workspace between organizations is the first operation in the product capable of separating an artifact from the org that owns it. Two invariants nothing has ever had to defend: A custom block and its bound workflow always share an organization. publishCustomBlock refuses a workflow outside the target org, so the pair has always been co-located. getCustomBlockAuthority resolves by the consumer's org, and admitCustomBlockChildExecution deliberately skips its concurrency reservation because "the consumer and source workspaces are always in the same organization". A stranded row would run a foreign tenant's workflow under its owner's credentials, billed to the wrong payer. The move unpublishes those blocks through the product's own deleteCustomBlock, and records CUSTOM_BLOCK_DELETED in the source org's audit view. A fork parent and child always share an organization. assertCanFork pins the child to the source's org and resolveForkEdge has no org check at all. The move refuses while a cross-org edge would result; the fork must be disconnected first. Three blockers Each is evaluated in preflight and re-checked inside the transaction, because a subscription can lapse, a fork can be created, and an invitation can arrive in between. Blocker Code Why Cross-org fork edge fork-lineage-conflict Unlinking destroys promote history irreversibly; that call belongs to the customer, not a support admin mid-dialog Live pending invitation pending-invitations-present Re-stamping an org-scoped invitation converts a pending membership in the source org into one in the destination, consuming a seat for an invitation the destination never issued. Expired invitations do not block Entitlement downgrade destination-entitlement-downgrade Silent capability loss with no cleanup available and no signal to affected users Blocking on invitations deleted the most intricate part of the design — no cross-org invitation migration, no intent resolver, no sibling-invitation creation. invitation-migration-plan.ts is untouched and the shipped personal→org invitation path is not modified at all. Concurrency Both organizations are now locked, ascending by id, mirroring acquireOrganizationUserMutationLocks. The source id is read optimistically before the transaction and re-verified under the locks, retrying through the existing loop via SourceOrganizationChangedError. Lock order is unchanged: invitation/workspace advisory locks → org locks → workspace row. Audit The workspace-scoped move entry resolves to the destination after the move, because buildOrgScopeCondition scopes org audit reads by the org's current workspaces. Without more, the org that lost the workspace would have no record. Adds an org-level entry (workspaceId: null + metadata.organizationId, that condition's other branch) so the loss is diagnosable from the side that incurred it. Type of Change New feature Testing Automated: full apps/sim suite — 37,306 tests across 2,669 files, zero failures. turbo run type-check clean across all 26 workspaces. check:api-validation:strict, check:boundaries, check:client-boundary, check:route-verbs, check:api-contract-routes, check:utils, check:import-specifiers, and the 39-audit check:audits bundle all pass. 11 new tests cover the org→org path: both org locks acquired in sorted order after the invitation locks and before the row lock; the payer transfer fenced on the source org read under those locks (the assertion that makes the whole move safe); each blocker refusing without mutating anything; custom blocks unpublished; the source-org audit entry landing in the source and not the destination; and the personal source path unchanged, as a regression fence. End to end against a real database, two orgs and a workspace with content on both sides. Verified: org-owned workspaces appear as candidates with their source org named; every blocker refuses and mutates nothing; the happy path re-homes org, payer, and organizationAssignedAt; the move is reversible; replaying an operationId is idempotent; and both invariant post-conditions hold (zero cross-org custom blocks, zero cross-org fork edges). E2E surfaced two defects the unit tests missed, both now with regression tests: getMovedWorkspaceSummary took an appliedContext parameter no call site passed, so every applied move reported sourceOrganization: null; and the source-org audit entries were specified but never implemented. Reviewers should focus on the lock ordering in moveWorkspaceToOrganization and the expectedCurrentPayer fence — that optimistic check is what makes the payer transfer safe under concurrency. 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) Notes for reviewers Not verifiable on a local deployment. resolveOrganizationEnterprisePlan short-circuits on isAccessControlEnabled && !isHosted, so every org resolves as entitled locally and the downgrade blocker cannot fire. That is correct — the gates it protects also all-pass there, so nothing is lost — but it means the blocker needs a hosted deployment to exercise. Related: isOrganizationOnEnterprisePlan is really "is on a paid org plan" (isOrgPlan = isTeam || isEnterprise), so Team is not a downgrade from Enterprise for these capabilities. The blocker reuses that same predicate deliberately, so it can never disagree with the gates it protects. Companion PR in simstudioai/admin adds the review modal that presents all of this before the admin confirms. Review history Supersedes #7243, which is closed. That PR carried the same file state but had accumulated ~45 review threads across 10 rounds, and the bots had started re-reviewing the thread history rather than the diff — re-raising findings already fixed and regressing the score on unchanged code. This is a clean slate on identical code. 23 findings were fixed there before this PR was opened, every one a real bug except a single false positive that was pushed back on with the type definitions. The substantive ones: Writer races. Enforcing the invariants at move time was never sufficient — publishCustomBlock and fork creation wrote without the lock the move holds, so either could commit after its scans. Both now serialize with it. The first fix for the fork was itself racy (the policy organization is captured before the transaction, and the lock is skipped entirely when it is null), so the parent is now row-locked instead, which also removed a lock-order inversion against invitation acceptance, a 5s timeout overwriting the fork's 10s, and an organization-wide lock held across the whole content copy. Fork blocker gated on an organization source, so a personal workspace whose parent had since moved into one was blocked by preflight but not by the transaction. Durable payload parser validated sourceOrganizationId then dropped it, so every reload would have claimed the source was not persisted. usageCount is a union of live and deployed placements, so subtracting a live-only count misattributed blocks; both figures are now measured with identical predicates. Entitlement fence, in four passes. Absence of a subscription row read as a pass; the plan was never checked; the fence rejected every move in the two deployment modes where entitlement is not subscription-backed; and billing-blocked organizations read as entitled. It now evaluates both organizations under the locks through a shared isSubscriptionBackedEntitlement predicate exported alongside the short-circuits it mirrors. EMPTY_CREDENTIAL_SUMMARY omitted two newly required contract fields, which would have failed validation on every successful move. Truncation was silent, then inconsistent: lists are now bounded with disclosed counts and a notice that opens "This review is incomplete".

Open Graph Description: Summary Lets the admin panel move a workspace from one organization to another. The move was restricted to personal/grandfathered sources — assertWorkspaceMovable threw "Inter-organization wor...

X Description: Summary Lets the admin panel move a workspace from one organization to another. The move was restricted to personal/grandfathered sources — assertWorkspaceMovable threw "Inter-organization...

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

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:1b828725-b603-1ad4-5a12-30f7331eef50
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idAAA0:EE197:368E24:4BA6ED:6AFB35AF
html-safe-nonce2fc041c4e36b770cde865c05dccd365e289e0f97ccec1549ea9116bd72bbe35c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQUEwOkVFMTk3OjM2OEUyNDo0QkE2RUQ6NkFGQjM1QUYiLCJ2aXNpdG9yX2lkIjoiODY3NTcwMTQzOTk3Mzc2NjU3NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacf3d10a04387981fa201e25657dadbc54a72c90b051f60350b72a10c072e20e25
hovercard-subject-tagpull_request:4389594884
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/7254/files
twitter:imagehttps://avatars.githubusercontent.com/u/129460234?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/129460234?s=400&v=4
og:image:altSummary Lets the admin panel move a workspace from one organization to another. The move was restricted to personal/grandfathered sources — assertWorkspaceMovable threw "Inter-organization wor...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneefe184de15c1d8c1107a340cfc27bf7187b458dc07687ee1fa51f035148fb3d1
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
releasef567cf3af46b50a3211fb5dab569a9d6a7b58025
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/7254/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F7254%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%2F7254%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/7254/files
Reloadhttps://github.com/simstudioai/sim/pull/7254/files
Reloadhttps://github.com/simstudioai/sim/pull/7254/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests198 (198)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
icecrasher321https://github.com/icecrasher321
staginghttps://github.com/simstudioai/sim/tree/staging
feat/admin-workspace-org-transferhttps://github.com/simstudioai/sim/tree/feat/admin-workspace-org-transfer
Conversation 61 https://github.com/simstudioai/sim/pull/7254
Commits 1 https://github.com/simstudioai/sim/pull/7254/commits
Checks 27 https://github.com/simstudioai/sim/pull/7254/checks
Files changed https://github.com/simstudioai/sim/pull/7254/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/7254/files
feat(admin): move a workspace between organizations https://github.com/simstudioai/sim/pull/7254/files#top
Show all changes 1 commit https://github.com/simstudioai/sim/pull/7254/files
7809360 feat(admin): move a workspace between organizations mzxchandra Aug 29, 2026 https://github.com/simstudioai/sim/pull/7254/commits/78093604a80f3f73700e916b086e7c5bfe092ad3
Clear filters https://github.com/simstudioai/sim/pull/7254/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/7254/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/7254/files
create-fork.test.ts https://github.com/simstudioai/sim/pull/7254/files#diff-296e1a98029b9a96a81aa7f980262a8491ff20cccc8f94b9820b968ed932b189
create-fork.ts https://github.com/simstudioai/sim/pull/7254/files#diff-202ab0340bdbd94663e1182c0295106afbcba13ffa9f7e481276fee250b041ee
dashboard-workspaces.ts https://github.com/simstudioai/sim/pull/7254/files#diff-7718961cbbad076ba576ce19c35c863db3d8e3367524cfd71907ccbced36ceb8
subscription.ts https://github.com/simstudioai/sim/pull/7254/files#diff-ba28a867a18d2fec4e36fc5dea465c7dcfd8b755794a2e6ea72b0eec32fd99be
operations.ts https://github.com/simstudioai/sim/pull/7254/files#diff-62275746551c533d2f1fde5464bc8e91f8884813163e90d8a4c9e905c9ffa44f
admin-move-source-impact.test.ts https://github.com/simstudioai/sim/pull/7254/files#diff-6ad7ae4765f074eb08391dd5746bd65b6c67557cfda83abbf8dd434520979af6
admin-move-source-impact.ts https://github.com/simstudioai/sim/pull/7254/files#diff-f80f7f0e80868597705b5fc333751201785abe7fcfc010d38a62a7c300a23234
admin-move.test.ts https://github.com/simstudioai/sim/pull/7254/files#diff-6b85519a0f0b50bb3a96328ec5d00bab2376c14e12cbd79ed99ae4ff4b76a615
admin-move.ts https://github.com/simstudioai/sim/pull/7254/files#diff-21cb83908e161603e2963824ec195fc05d5b4963f93bdb3353996c4ea6d29a4d
apps/sim/ee/workspace-forking/lib/create-fork.test.tshttps://github.com/simstudioai/sim/pull/7254/files#diff-296e1a98029b9a96a81aa7f980262a8491ff20cccc8f94b9820b968ed932b189
View file https://github.com/simstudioai/sim/blob/78093604a80f3f73700e916b086e7c5bfe092ad3/apps/sim/ee/workspace-forking/lib/create-fork.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/7254/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/7254/files#diff-296e1a98029b9a96a81aa7f980262a8491ff20cccc8f94b9820b968ed932b189
https://github.com/simstudioai/sim/pull/7254/files#diff-296e1a98029b9a96a81aa7f980262a8491ff20cccc8f94b9820b968ed932b189
https://github.com/simstudioai/sim/pull/7254/files#diff-296e1a98029b9a96a81aa7f980262a8491ff20cccc8f94b9820b968ed932b189
https://github.com/simstudioai/sim/pull/7254/files#diff-296e1a98029b9a96a81aa7f980262a8491ff20cccc8f94b9820b968ed932b189
https://github.com/simstudioai/sim/pull/7254/files#diff-296e1a98029b9a96a81aa7f980262a8491ff20cccc8f94b9820b968ed932b189
apps/sim/ee/workspace-forking/lib/create-fork.tshttps://github.com/simstudioai/sim/pull/7254/files#diff-202ab0340bdbd94663e1182c0295106afbcba13ffa9f7e481276fee250b041ee
View file https://github.com/simstudioai/sim/blob/78093604a80f3f73700e916b086e7c5bfe092ad3/apps/sim/ee/workspace-forking/lib/create-fork.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/7254/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/7254/files#diff-202ab0340bdbd94663e1182c0295106afbcba13ffa9f7e481276fee250b041ee
https://github.com/simstudioai/sim/pull/7254/files#diff-202ab0340bdbd94663e1182c0295106afbcba13ffa9f7e481276fee250b041ee
https://github.com/simstudioai/sim/pull/7254/files#diff-202ab0340bdbd94663e1182c0295106afbcba13ffa9f7e481276fee250b041ee
Please reload this pagehttps://github.com/simstudioai/sim/pull/7254/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/7254/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/7254/files
https://github.com/simstudioai/sim/pull/7254/files#diff-202ab0340bdbd94663e1182c0295106afbcba13ffa9f7e481276fee250b041ee
apps/sim/lib/api/contracts/v1/admin/dashboard-workspaces.tshttps://github.com/simstudioai/sim/pull/7254/files#diff-7718961cbbad076ba576ce19c35c863db3d8e3367524cfd71907ccbced36ceb8
View file https://github.com/simstudioai/sim/blob/78093604a80f3f73700e916b086e7c5bfe092ad3/apps/sim/lib/api/contracts/v1/admin/dashboard-workspaces.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/7254/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/7254/files#diff-7718961cbbad076ba576ce19c35c863db3d8e3367524cfd71907ccbced36ceb8
https://github.com/simstudioai/sim/pull/7254/files#diff-7718961cbbad076ba576ce19c35c863db3d8e3367524cfd71907ccbced36ceb8
https://github.com/simstudioai/sim/pull/7254/files#diff-7718961cbbad076ba576ce19c35c863db3d8e3367524cfd71907ccbced36ceb8
Please reload this pagehttps://github.com/simstudioai/sim/pull/7254/files
https://github.com/simstudioai/sim/pull/7254/files#diff-7718961cbbad076ba576ce19c35c863db3d8e3367524cfd71907ccbced36ceb8
apps/sim/lib/billing/core/subscription.tshttps://github.com/simstudioai/sim/pull/7254/files#diff-ba28a867a18d2fec4e36fc5dea465c7dcfd8b755794a2e6ea72b0eec32fd99be
View file https://github.com/simstudioai/sim/blob/78093604a80f3f73700e916b086e7c5bfe092ad3/apps/sim/lib/billing/core/subscription.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/7254/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/7254/files#diff-ba28a867a18d2fec4e36fc5dea465c7dcfd8b755794a2e6ea72b0eec32fd99be
https://github.com/simstudioai/sim/pull/7254/files#diff-ba28a867a18d2fec4e36fc5dea465c7dcfd8b755794a2e6ea72b0eec32fd99be
Please reload this pagehttps://github.com/simstudioai/sim/pull/7254/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/7254/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.