866c8c046d
The PATCH endpoint for /v2/teams/:teamId/memberships/:membershipId had a bug where host records for assignAllTeamMembers event types were not created when a membership transitioned from accepted=false to accepted=true. The bug was caused by incorrect operation ordering: 1. Update membership (first update) 2. Get current membership (gets already-updated state) 3. Update membership again (second update) 4. Check if transition happened (condition never fires) Fixed by reordering to match the org-scoped controller pattern: 1. Get current membership BEFORE any updates 2. Update membership 3. Compare and call updateNewTeamMemberEventTypes if transition occurred Also added an e2e test to verify host records are created when membership transitions from accepted=false to accepted=true via PATCH. Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>