Repository navigation
fix(scim): create a group and its members in one transaction - #2014
Merged
Merged
Conversation
POST /Groups inserted the team, then moved each member into it, each straight to the database. A failure after the insert left the team and the members already moved behind a 500, and the IdP's retry got a 409 "Group already exists". The insert and addMembers now run in one transaction, as PUT does, and a unique violation maps to a 409 through groupWriteConflict. Closes snapotter-hq#1763
Owner
|
Thanks @drakeo338, this makes SCIM group creation all-or-nothing: a member write that fails partway no longer leaves a half-created team behind, so the IdP's retry works instead of hitting a 409. The rollback test next to the PUT one covers the failure case. It merged as submitted and will ship in the next release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes #1763.
POST /api/v1/scim/v2/Groupsinserted the team and moved each member in separate statements with no transaction. When a member write failed partway (a NUL-byte id in the test), it returned a 500 but left the team created and the first member already moved, so the IdP's retry hit a 409. The handler now creates the team and its members in one transaction, like PUT and PATCH, and the audit and warn run after commit. A rollback test sits next to the PUT one.Type of change
Checklist
pnpm test)pnpm typecheck)Screenshots (if applicable)
None.
Unticked boxes were not run on this commit; only scim.test.ts was run (fails before the fix, passes after).