Repository navigation
fix(workspaces): hand off a departing member's files without binding every file id - #10038
Merged
Merged
Conversation
…every file id Member removal transferred file creators by selecting the departing member's file ids and updating with an id list, so a member owning more files than Postgres's 65,535 bind parameters failed the whole removal transaction. Every statement in the file creator handoff is now keyed by the caller's scope predicate: rows are locked in id order through a subquery, version heads load through a subquery, and the final update matches the same predicate. A versioned file committed after the history pass keeps its creator until its history is frozen.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryReplaces file-ID lists with scope-based queries so member removal can hand off more than 65,535 files.
No actionable issues found. Tests were not run during this review. Reviews (2) · Last reviewed commit: "fix(workspaces): hand off a departing me..." · Reviewed by Greptile |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
update ... where id in (<every id>)handoffFileCreatorsInTxis now keyed by the caller's scope predicate throughout: rows are lockedFOR UPDATEin id order through a subquery (nothing loaded into memory), version heads load through a subquery, and the final update matches the same predicateworkspace/project) still have their implicit history frozen before the creator changes. The update only moves a versioned file whose head is current, so a file committed after the history pass keeps its creator rather than losing its original-upload attributioncurrentWorkspaceFileVersionNumberSqland addedworkspaceFileVersionHeadCurrentSql(the SQL form ofisVersionHeadCurrent)inArraycalls in the removal and handoff paths (workspace, project, and org handoff, workflow reassignment, org membership removal). They bind workspace, project, member, or invitation ids, which don't grow with the number of rows a member ownsType of Change
Testing
shared-resource-handoff.integration.ts: it seeds 66,000 knowledge-base files withgenerate_series, removes the member throughrevokeWorkspaceAccessTx, and asserts every file moved to the successor. It fails on the pre-fix code withMAX_PARAMETERS_EXCEEDEDon the id-list update and passes with the fix (~9s)bun run test:integrationwith shared-resource-handoff, file-versions, creator-lifetime, projects foundation, membership-removal-lock-order, managed-membership, and owners: 189 passedChecklist
test-auditauthoring gate)