Commit 661249c
committed
fix: tolerate duplicate dev environment creation during concurrent invite acceptance
When two invite-accept requests race for the same member, both can observe a
project as missing its development environment and attempt to create it. The
loser hit the unique constraint on (projectId, slug, orgMemberId) and the
resulting P2002 error propagated, failing the accept with an incomplete-setup
error even though the environment had already been created.
Catch P2002 in the per-project creation loop and treat the project as already
provisioned, matching the existing P2002 handling for the org-membership row.
Non-P2002 errors still surface the incomplete-setup failure.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qe3bkKy2Pzgt3E2EE5CMNY1 parent c936c79 commit 661249c
1 file changed
Lines changed: 28 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
228 | 246 | | |
229 | 247 | | |
230 | 248 | | |
| |||
0 commit comments