Repository navigation
fix(project-files): hold the Project and permission-group locks shared for non-charging file operations - #9058
Merged
Merged
Conversation
…d for non-charging file operations
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
…usive authorization
Contributor
[High impact] The PR appears safe to merge; both previous findings are fixed and no new blocking issue was found. SummaryProject file operations that do not charge storage now share the Project and permission-group locks. Storage-charging operations keep the Project lock exclusive.
|
…sed contract alias
… revived the file
Collaborator
Author
Collaborator
Author
|
@cubic-dev-ai review this PR |
Contributor
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
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
Changes only flag-gated Project file paths (behind the
projectsflag).create,update_content,upload_complete,versions.revert,extract_archive) declarechargesStorageand take it exclusively up front, so a shared hold is never upgraded;prepareProjectFileAccountingrefuses a context that was not authorized exclusively, so a missing flag fails deterministically instead of deadlocking under concurrency. The save/set/restore oflock_timeoutmoves into a sharedwithLockTimeouthelper. Lifecycle, payer transfer, retention, and account deletion stay exclusive and still exclude every file operation.acquirePermissionGroupOrgReadLock): group writes, workspace creation, and OAuth refresh still wait for it and the capability decision stays current through commit, but file operations no longer serialize on it. The 5slock_timeoutnow bounds only the acquisition and the caller's setting is restored.readProjectFileContentand version content reads drop an unused preflight transaction (prepareFromSnapshot); their snapshot use case authorizes, and the final transaction still revalidates after the storage read.ProjectFileRevisionConflictError) or cached-history conflicts; Project lock timeouts and lifecycle conflicts surface immediately instead of being retried and reported as a document conflict. Persist reads at most the largest editable file size.Stacked Project file PRs: #9017 merges cleanly on top of this; #9018 and later need a rebase anyway. Expected conflicts there:
knip.jsonc(feat(project-files): add cross-owner copy and bulk transfers #9018 adds entries; its newproject-file*.tscontract files lose the glob ignore)api/contracts/project-file{s,-doc,-folders,-lifecycle,-uploads,-versions}.tsandapi/contracts/v2/project-file{s,-folders,-lifecycle,-uploads,-versions}.tsprojects/files/application/authorization.ts(feat(project-files): add cross-owner copy and bulk transfers #9018 exports helpers),projects/application/authorization.ts,projects/files/application/lifecycle.tsbilling/storage/tracking.tsandprojects/membership.ts(feat(files): Project file browser and Mothership integration #9034)Type of Change
Testing
projects/files/__integration__/authorization.integration.ts: concurrent reads and a folder create proceed while a read holds the Project,lock_timeoutis restored, and exclusive Project and permission-group holders still wait; a storage-charging write still excludes shared holdersprojects/files/application/documents.test.ts: lock conflicts are surfaced, revision conflicts still retry (verified red on the old predicate)Checklist
test-auditauthoring gate)