Skip to content

fix(webapp): accept invites for orgs with many projects#4043

Open
kathiekiwi wants to merge 1 commit into
mainfrom
fix/org-invire-timeout
Open

fix(webapp): accept invites for orgs with many projects#4043
kathiekiwi wants to merge 1 commit into
mainfrom
fix/org-invire-timeout

Conversation

@kathiekiwi

Copy link
Copy Markdown
Collaborator

Summary

Invite acceptance could fail for cloud organizations with many projects because the whole flow ran inside a single transaction and did too much work before it completed. In larger orgs, that pushed the transaction past its timeout and blocked the invite from being accepted.

This PR moves the expensive parts of invite acceptance out of the transaction, excludes deleted projects from environment setup, fixes error handling on /invites, and adds regression coverage for the failure cases.

Changes

  • Shortened the acceptInvite transaction path so invite acceptance no longer times out for larger orgs
  • Excluded soft-deleted projects from member environment setup
  • Fixed /invites to show invite acceptance errors instead of crashing

Test plan

  • ./test/member.server.test.ts

Manual

  • Accept an invite in a cloud org with 20+ projects
  • Confirm /invites shows an error message instead of crashing if invite acceptance fails

@changeset-bot

changeset-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 69fd84a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 46cce277-7a64-440e-9b5f-719983ee9608

📥 Commits

Reviewing files that changed from the base of the PR and between 394591d and 69fd84a.

📒 Files selected for processing (5)
  • .server-changes/fix-invite-accept-many-projects.md
  • apps/webapp/app/models/member.server.ts
  • apps/webapp/app/models/organization.server.ts
  • apps/webapp/app/routes/invites.tsx
  • apps/webapp/test/member.server.test.ts
✅ Files skipped from review due to trivial changes (1)
  • .server-changes/fix-invite-accept-many-projects.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • apps/webapp/app/routes/invites.tsx
  • apps/webapp/app/models/organization.server.ts
  • apps/webapp/test/member.server.test.ts
  • apps/webapp/app/models/member.server.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout. (16)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (10, 10)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (3, 10)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (8, 10)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (9, 10)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (5, 10)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (1, 10)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (2, 10)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (7, 10)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (4, 10)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (6, 10)
  • GitHub Check: code-quality / code-quality
  • GitHub Check: e2e-webapp / 🧪 E2E Tests: Webapp
  • GitHub Check: typecheck / typecheck
  • GitHub Check: audit
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (actions)

Walkthrough

Invite acceptance now validates the invite against the signed-in user, provisions missing DEVELOPMENT environments, and can recover when the invite record is missing or setup is incomplete. createEnvironment now accepts an optional maximumConcurrencyLimit override. The invites route returns structured form errors or redirects on incomplete setup and renders FormError above the invite list. Tests cover success, invalid or consumed invites, provisioning failures, and recovery cases.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: accepting invites for orgs with many projects.
Description check ✅ Passed The description covers the summary, changes, and testing, but omits template sections like Closes #issue, Changelog, and Screenshots.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/org-invire-timeout

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]

This comment was marked as resolved.

@kathiekiwi kathiekiwi force-pushed the fix/org-invire-timeout branch from 00e0192 to ea42a99 Compare June 26, 2026 17:31
@pkg-pr-new

pkg-pr-new Bot commented Jun 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

@trigger.dev/build

npm i https://pkg.pr.new/@trigger.dev/build@ea42a99

trigger.dev

npm i https://pkg.pr.new/trigger.dev@ea42a99

@trigger.dev/core

npm i https://pkg.pr.new/@trigger.dev/core@ea42a99

@trigger.dev/python

npm i https://pkg.pr.new/@trigger.dev/python@ea42a99

@trigger.dev/react-hooks

npm i https://pkg.pr.new/@trigger.dev/react-hooks@ea42a99

@trigger.dev/redis-worker

npm i https://pkg.pr.new/@trigger.dev/redis-worker@ea42a99

@trigger.dev/rsc

npm i https://pkg.pr.new/@trigger.dev/rsc@ea42a99

@trigger.dev/schema-to-json

npm i https://pkg.pr.new/@trigger.dev/schema-to-json@ea42a99

@trigger.dev/sdk

npm i https://pkg.pr.new/@trigger.dev/sdk@ea42a99

commit: ea42a99

@kathiekiwi kathiekiwi marked this pull request as ready for review June 26, 2026 18:36
coderabbitai[bot]

This comment was marked as resolved.

@kathiekiwi kathiekiwi force-pushed the fix/org-invire-timeout branch from ad7a7d4 to 394591d Compare June 28, 2026 20:27
devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

Move dev environment creation out of the membership transaction so accepting
an invite no longer hits the 5s Prisma transaction timeout.
@kathiekiwi kathiekiwi force-pushed the fix/org-invire-timeout branch from 394591d to 69fd84a Compare June 29, 2026 11:10
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