Skip to content

fix: stop using broken addTeamMemberInternal in testCreateOne2OneWith - #5420

Open
blackheaven wants to merge 4 commits into
developfrom
gdifolco/fix-flaky-tests-conversation-binding
Open

fix: stop using broken addTeamMemberInternal in testCreateOne2OneWith#5420
blackheaven wants to merge 4 commits into
developfrom
gdifolco/fix-flaky-tests-conversation-binding

Conversation

@blackheaven

Copy link
Copy Markdown
Contributor

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

…Members

The test intermittently failed with a 500 from galley's internal
POST i/teams/:tid/members endpoint (uncheckedAddTeamMember), reached
via the addTeamMemberInternal helper. That helper is documented as
broken (SQSERVICES-471): it force-adds an existing user through a
path that fans out synchronous brig RPCs (getSize/getUser/
getAppIdsForTeam) plus Cassandra writes and SQS journaling, any of
which can transiently exhaust its retries and surface as an unhandled
500 server-error.

Switch to addUserToTeamWithRole, the proper brig invitation flow that
updates both brig and galley and is used by every sibling test in this
file. The member-join event is now asserted on the owner's WebSocket
(the invitee is created inside the call and cannot have a
pre-established connection), matching the testAddTeamConvWithRole
precedent (Teams.hs:679-680). Also corrects the misleading doc-comment
on the role parameter.
@blackheaven
blackheaven requested a review from a team as a code owner August 5, 2026 10:29
@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Aug 5, 2026

@battermann battermann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If addTeamMemberInternal is broken, can we remove it from Util, too?

Also could this test be migrated to the integration package, and be removed here all together?

Addresses @battermann's review on #5420.

1. Remove the broken `Util.addTeamMemberInternal` helper (SQSERVICES-471).
   All 14 call sites migrate to the proper invitation flow:
   - standard-role sites -> `addUserToTeamWithRole`
   - custom-permission sites -> `addUserToTeamWithRole` + new
     `updateTeamMemberPermissions` (public PUT /teams/:tid/members)
   - `testAddTeamMemberInternal` keeps inlined coverage of the internal
     add-member endpoint (its purpose; the invite flow cannot reproduce
     the member-websocket event assertion)
   - `testAddTeamMemberToConv` and `testCannotCreateLegalHoldDeviceOldAPI`
     restructured to mint members via the invitation flow. In
     `testAddTeamMemberToConv` the same-team members are no longer passed
     to `connectUsers` (same-binding-team connection requests are rejected
     with 403; those assertions are satisfied by the same-team condition).

2. Port `testCreateOne2OneWithMembers` and
   `testCreateOne2OneFailForNonTeamMembers` to the Testlib /integration
   package (`Test.One2OneTeamConv`) and remove them from galley. The
   galley-specific `assertTeamUpdate` (SQS queue) is replaced by a
   member-count check plus the real-time member-join websocket event.

Cleanup: collapse `makeOwner` onto `updateTeamMemberPermissions`; delete
the now-dead `createOne2OneTeamConv` helper.

Compile-verified (exe:galley-integration + integration); runtime deferred
to CI. `testAddTeamMemberToConv` was restructured and is the most
behaviour-sensitive change.
@blackheaven
blackheaven requested a review from battermann August 5, 2026 11:49
@blackheaven

Copy link
Copy Markdown
Contributor Author

I have migrated everything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants