Skip to content

Map GroupNotFoundException to 404 in setUserGroups and document groups semantics#476

Merged
pathob merged 1 commit into
mainfrom
fix/group-membership-error-mapping-and-docs
May 13, 2026
Merged

Map GroupNotFoundException to 404 in setUserGroups and document groups semantics#476
pathob merged 1 commit into
mainfrom
fix/group-membership-error-mapping-and-docs

Conversation

@pathob
Copy link
Copy Markdown
Contributor

@pathob pathob commented May 13, 2026

Under the new boolean-map membership model, group lifecycle is managed via the top-level groups map, so a non-existent group referenced from UserModel.groups is a client error (404), not an internal server error (500). Translate the Atlassian GroupNotFoundException thrown by addUserToGroup/removeUserFromGroup into the project's GroupNotFoundException.

Add a @Schema description to UserModel.groups so the auto-generated REST API docs explain the true/false/null semantics and the requirement that referenced groups must already exist.

…s semantics

Under the new boolean-map membership model, group lifecycle is managed via the
top-level groups map, so a non-existent group referenced from UserModel.groups
is a client error (404), not an internal server error (500). Translate the
Atlassian GroupNotFoundException thrown by addUserToGroup/removeUserFromGroup
into the project's GroupNotFoundException.

Add a @Schema description to UserModel.groups so the auto-generated REST API
docs explain the true/false/null semantics and the requirement that referenced
groups must already exist.
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aligns user group membership behavior with the new boolean-map membership model by translating Atlassian Crowd GroupNotFoundException into the project’s GroupNotFoundException (404) during setUserGroups, and clarifies the groups true/false/null semantics in generated API documentation.

Changes:

  • Map missing referenced groups in setUserGroups to com.deftdevs.bootstrapi.commons.exception.GroupNotFoundException (HTTP 404) instead of treating them as 500s.
  • Add coverage ensuring unknown group membership updates fail with the expected NotFound exception.
  • Document UserModel.groups membership semantics in OpenAPI schema and generated model docs (Crowd/Jira/Confluence).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crowd/src/main/java/com/deftdevs/bootstrapi/crowd/service/UsersServiceImpl.java Translates Atlassian GroupNotFoundException to the project NotFound exception during group membership updates.
crowd/src/test/java/com/deftdevs/bootstrapi/crowd/service/UsersServiceTest.java Adds a unit test asserting unknown groups produce the project GroupNotFoundException.
commons/src/main/java/com/deftdevs/bootstrapi/commons/model/UserModel.java Adds @Schema description documenting groups true/false/null semantics and pre-existing group requirement.
crowd/Models/UserModel.md Updates generated model docs to describe groups semantics.
jira/Models/UserModel.md Updates generated model docs to describe groups semantics.
confluence/Models/UserModel.md Updates generated model docs to describe groups semantics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pathob pathob merged commit 20d88be into main May 13, 2026
13 checks passed
@pathob pathob deleted the fix/group-membership-error-mapping-and-docs branch May 13, 2026 08:52
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.

2 participants