Skip to content

fix(sim-links): hand off a departing member's links to the successor - #9597

Merged
waleedlatif1 merged 4 commits into
stagingfrom
fix/sim-link-ownership-handoff
Nov 3, 2026
Merged

waleedlatif1 merged 4 commits into
stagingfrom
fix/sim-link-ownership-handoff

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Removing a member (admin removal, self-leave, or account deletion) hands their knowledge bases, files, permission groups and SSO providers to the organization's successor owner, but never touched sim_link
  • Their links kept naming them as creator: "Created by" showed a former member, their restricted links became admin-only, their unlisted links disappeared for everyone but admins, and rejoining silently restored manage rights
  • reassignOrganizationSharedResourcesTx now reassigns the departing member's links in that organization to the same successor, in the same transaction, matching the permission-group handoff
  • With no eligible successor, behavior is unchanged (links keep their creator, as the other resources do)

Type of Change

  • Bug fix

Testing

  • New case in shared-resource-handoff.integration.ts: a removed member's link moves to the owner while their link in another organization is untouched. Red with the fix reverted (1 failed | 45 passed), green with it (46 passed)
  • bun run lint, pre-push type-check

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)

@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 3, 2026 3:59am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues remain.

Summary

This PR hands a departing member’s Sim links to the organization’s successor owner.

  • An eligible owner inherits a departing member’s organization links.
  • Link creation holds membership steady through its write.

Reviews (4) · Last reviewed commit: "fix(sim-links): hold the creator's membe..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files

Confidence score: 3/5

  • account-deletion.ts can deadlock concurrent account deletions when it holds a successor member lock while waiting for that successor’s user lock. Avoid waiting on the user lock while holding the member lock.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/sim/lib/users/account-deletion.ts">

<violation number="1" location="apps/sim/lib/users/account-deletion.ts:969">
P1: This call can deadlock concurrent account deletions: it discovers Sim-link-only organizations after the user barrier, then holds a successor member lock while waiting for that successor’s user lock. Acquire these organization/member locks before the user barrier, or avoid holding the member lock while waiting for the successor user.

(Based on your team's feedback about account-deletion lock ordering.)</violation>
</file>

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/sim/lib/users/account-deletion.ts Resolved
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 6989ce8 into staging Nov 3, 2026
81 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/sim-link-ownership-handoff branch November 3, 2026 04:18

This branch was previously deployed

1 inactive deployment
Preview — 2db7e0f7 Deployed Nov 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant