fix(api): create a workspace and its owner membership atomically#363
fix(api): create a workspace and its owner membership atomically#363cavidelizade wants to merge 1 commit into
Conversation
WorkspaceService.Create inserted the workspace, then added the owner membership in a separate statement and discarded the error. If that second write failed, the workspace existed with no members, and since access is gated on membership the owner was locked out of the workspace they just created, with no way to clean it up from the UI. Add WorkspaceStore.CreateWithOwner, which does both writes in one transaction (mirrors ProjectStore.CreateWithCreatorMember), and use it from the service. Closes Devlaner#340 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 3 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Creating a workspace wasn't atomic and the "add owner as member" error was discarded. If that second write failed, the workspace existed with no members, and since access is gated on membership the owner was locked out of the workspace they just created.
Linked issues
Closes #340
Type of change
fix:)Surface
apps/api/)What changed
Added
WorkspaceStore.CreateWithOwner, which inserts the workspace and the owner membership in a single transaction, and switched the service to it. This mirrorsProjectStore.CreateWithCreatorMember, which already does the same thing. Also replaced the magicRole: 20withmodel.RoleOwner.Test plan
go build,go vet,go test ./...greenAI assistance
Claude Code (Opus 4.8), commits carry aCo-Authored-By:trailer