GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — [Stability] Focus identity email address mutations by Storypapst · Pull Request #885 · OpenResilienceInitiative/ORISO-UserService Conversation
|
|
Warning Review limit reached
Next review available in: 55 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds the ChangesFocused identity email-mutation port
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant IdentityManager
participant IdentityEmailAddressUpdater
participant KeycloakService
participant UserAccountService
IdentityManager->>IdentityEmailAddressUpdater: updateEmailByUsername(username, email)
IdentityEmailAddressUpdater->>KeycloakService: updateEmailByUsername(username, email)
KeycloakService->>KeycloakService: Read representation and update when email changed
UserAccountService->>IdentityEmailAddressUpdater: updateCurrentUserEmail(email) or deleteCurrentUserEmail()
IdentityEmailAddressUpdater->>KeycloakService: Execute current-user email mutation
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
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. Comment |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Compose the focused email-address updater with the existing authentication, email-owner, role-read, username-availability, and second-factor seams on the integration branch. Preserve the original delivery commit and keep the combined branch review-only. Refs #887 Co-Authored-By: Claude Opus 4.8 <[email protected]>
Eighteen conflicts. KeycloakService now declares ten ports — pre-dev's nine plus
this branch's IdentityEmailAddressUpdater — and the eight shared mocks mirror it.
IdentityManager and UserAccountService each had both sides injecting a different
port, so both collaborators were kept.
Four conflicts needed a decision rather than a union, because the branch and
pre-dev had each moved methods off IdentityClient in different directions. The two
sets were derived from the two IdentityClient versions rather than assumed:
removed by this PR : changeEmailAddress (x2), deleteEmailAddress, updateEmail
already gone on pre-dev: closeSession, deactivateUser, deleteUser, findUserByEmail,
getById, getRealmRoles, isUsernameAvailable, loginUser, logoutUser,
rollBackUser, updateDummyEmail, updatePassword, verifyIgnoringOtp
KeycloakService.deleteEmailAddress becomes deleteCurrentUserEmail per the new port,
but keeps pre-dev's body: the branch's version called a single-argument
updateDummyEmail that #900 replaced. UserAccountServiceTest verifications follow
whichever side names a method that still exists. KeycloakTestConfig's override
block keeps pre-dev's rollbackUser and drops both the branch's older rollBackUser
spelling and the removed updateEmail.
CI contract suite: 68 tests green.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/main/java/de/caritas/cob/userservice/api/service/user/UserAccountService.java`:
- Around line 137-138: The email-change flow around
identityEmailAddressUpdater::updateCurrentUserEmail and deleteCurrentUserEmail
must define an application-level consistency boundary across Keycloak and local
writes. Implement an outbox or compensating workflow so local persistence
failures after the identity update cannot leave the systems with different email
values, and add a failure-path test covering that scenario.
In
`@src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.java`:
- Around line 289-291: Fix the malformed email-port migration remnants across
the test sources: in
src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.java:289-291,
remove the stray `@Override` and deleteCurrentUserEmail() declaration while
retaining deleteEmailAddress_Should_useServicesCorrectly as the `@Test` method; in
src/test/java/de/caritas/cob/userservice/api/service/user/UserAccountServiceTest.java:255-256
and :278-279, replace each local method declaration with
verify(identityEmailAddressUpdater).deleteCurrentUserEmail();; and in
src/test/java/de/caritas/cob/userservice/api/testConfig/KeycloakTestConfig.java:140-142,
remove the extra `@Override` before rollbackUser.
In
`@src/test/java/de/caritas/cob/userservice/api/admin/service/admin/update/UpdateAdminServiceIT.java`:
- Line 48: Update UpdateAdminServiceIT to verify that
IdentityEmailAddressUpdater receives the expected user identifier and newEmail
via updateEmailByUsername(...), in addition to the existing persisted Admin
assertions.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 84bb6dd8-9173-48ab-be0d-0f311b18b514
tests/ci/test_module_boundaries.py is excluded by none and included by nonedocumentation/USER_SERVICE_STABILITY.mdsrc/main/java/de/caritas/cob/userservice/api/IdentityManager.javasrc/main/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakService.javasrc/main/java/de/caritas/cob/userservice/api/port/out/IdentityClient.javasrc/main/java/de/caritas/cob/userservice/api/port/out/IdentityEmailAddressUpdater.javasrc/main/java/de/caritas/cob/userservice/api/service/user/UserAccountService.javasrc/test/java/de/caritas/cob/userservice/api/IdentityManagerTest.javasrc/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserAdminControllerE2EIT.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserAdminControllerMultiTenancyTrueE2EIT.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerAuthorizationIT.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerIT.javasrc/test/java/de/caritas/cob/userservice/api/admin/service/admin/create/CreateAdminServiceIT.javasrc/test/java/de/caritas/cob/userservice/api/admin/service/admin/update/UpdateAdminServiceIT.javasrc/test/java/de/caritas/cob/userservice/api/admin/service/consultant/create/agencyrelation/ConsultantAgencyRelationCreatorServiceTenantAwareIT.javasrc/test/java/de/caritas/cob/userservice/api/admin/service/consultant/update/ConsultantUpdateServiceBase.javasrc/test/java/de/caritas/cob/userservice/api/service/user/UserAccountServiceTest.javasrc/test/java/de/caritas/cob/userservice/api/testConfig/KeycloakTestConfig.java⚙️ CodeRabbit configuration file
src/test/**/*.java: Tests must be able to fail. Flag over-mocking that hides the defect,
assertions that cannot break, and missing edge cases.
Files:
src/test/java/de/caritas/cob/userservice/api/admin/service/admin/create/CreateAdminServiceIT.javasrc/test/java/de/caritas/cob/userservice/api/admin/service/consultant/create/agencyrelation/ConsultantAgencyRelationCreatorServiceTenantAwareIT.javasrc/test/java/de/caritas/cob/userservice/api/admin/service/admin/update/UpdateAdminServiceIT.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerAuthorizationIT.javasrc/test/java/de/caritas/cob/userservice/api/admin/service/consultant/update/ConsultantUpdateServiceBase.javasrc/test/java/de/caritas/cob/userservice/api/IdentityManagerTest.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserAdminControllerMultiTenancyTrueE2EIT.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserAdminControllerE2EIT.javasrc/test/java/de/caritas/cob/userservice/api/testConfig/KeycloakTestConfig.javasrc/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerIT.javasrc/test/java/de/caritas/cob/userservice/api/service/user/UserAccountServiceTest.java⚙️ CodeRabbit configuration file
src/main/**/*.java: Check behavior against the surrounding ORISO flow, not only types. Flag
missing transaction boundaries, swallowed exceptions, N+1 queries, and
privacy regressions around Matrix identifiers, chat content and user data.
Configuration must stay environment-driven — never hardcode hosts, IPs or
credentials (see ADR-005 / finding DB-M04).
Files:
src/main/java/de/caritas/cob/userservice/api/IdentityManager.javasrc/main/java/de/caritas/cob/userservice/api/port/out/IdentityEmailAddressUpdater.javasrc/main/java/de/caritas/cob/userservice/api/service/user/UserAccountService.javasrc/main/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakService.javaLearnt from: Storypapst
Repo: OpenResilienceInitiative/ORISO-UserService PR: 420
File: src/main/java/de/caritas/cob/userservice/api/conversation/service/AnonymousConversationCreatorService.java:34-35
Timestamp: 2026-07-12T05:15:05.095Z
Learning: In ORISO-UserService, treat `rocket-chat.enabled` defaulting to `false` (e.g., `Value("${rocket-chat.enabled:false}")`) as an intentional Matrix-only default. Do not flag code paths/config placeholders that use this default-false behavior as a bug in future reviews. Rocket.Chat must be explicitly enabled only by setting `ROCKET_CHAT_ENABLED=true` (or the equivalent `rocket-chat.enabled=true`), consistent with the repository’s `application*.properties`/configuration validator and the disabled Rocket.Chat service wiring.
Applied to files:
src/main/java/de/caritas/cob/userservice/api/IdentityManager.javasrc/main/java/de/caritas/cob/userservice/api/port/out/IdentityEmailAddressUpdater.javasrc/main/java/de/caritas/cob/userservice/api/service/user/UserAccountService.javasrc/main/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakService.java[warning] 1187-1187: Avoid LDAP injections
Context: verify(usersResource).search("[email protected]", 0, Integer.MAX_VALUE)
Note: [CWE-90] Improper Neutralization of Special Elements used in an LDAP Query ('LDAP Injection'). Security best practice.
(ldap-injection-java)
[warning] 1205-1205: Avoid LDAP injections
Context: verify(usersResource, never()).search(anyString(), anyInt(), anyInt())
Note: [CWE-90] Improper Neutralization of Special Elements used in an LDAP Query ('LDAP Injection'). Security best practice.
(ldap-injection-java)
[High] 256-256: Parse Error: ParseException: Parse exception in file 'src/test/java/de/caritas/cob/userservice/api/service/user/UserAccountServiceTest.java' at line 256, column 10: Encountered .
Was expecting one of:
(Parse Error)
documentation/USER_SERVICE_STABILITY.md (1)
377-377: LGTM!Also applies to: 428-440
src/main/java/de/caritas/cob/userservice/api/port/out/IdentityEmailAddressUpdater.java (1)
3-10: LGTM!src/main/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakService.java (1)
34-34: LGTM!Also applies to: 53-53, 87-87, 193-212, 756-772, 786-792
src/main/java/de/caritas/cob/userservice/api/IdentityManager.java (1)
9-9: LGTM!Also applies to: 24-24, 45-46
src/main/java/de/caritas/cob/userservice/api/service/user/UserAccountService.java (1)
14-14: LGTM!Also applies to: 42-42
src/test/java/de/caritas/cob/userservice/api/IdentityManagerTest.java (1)
10-10: LGTM!Also applies to: 31-31, 60-60, 71-71
src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.java (1)
15-15: LGTM!Also applies to: 234-264, 1178-1210, 1868-1892
src/test/java/de/caritas/cob/userservice/api/service/user/UserAccountServiceTest.java (1)
29-29: LGTM!Also applies to: 57-57, 196-196, 214-214, 234-234
src/test/java/de/caritas/cob/userservice/api/testConfig/KeycloakTestConfig.java (1)
84-93: LGTM!src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserAdminControllerE2EIT.java (1)
44-44: LGTM!Also applies to: 137-137
src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserAdminControllerMultiTenancyTrueE2EIT.java (1)
27-27: LGTM!Also applies to: 80-80
src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerAuthorizationIT.java (1)
81-81: LGTM!Also applies to: 175-175
src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerIT.java (1)
58-58: LGTM!Also applies to: 294-294
src/test/java/de/caritas/cob/userservice/api/admin/service/admin/create/CreateAdminServiceIT.java (1)
29-29: LGTM!Also applies to: 68-68
src/test/java/de/caritas/cob/userservice/api/admin/service/admin/update/UpdateAdminServiceIT.java (1)
19-19: LGTM!src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/create/agencyrelation/ConsultantAgencyRelationCreatorServiceTenantAwareIT.java (2)
33-33: LGTM!
93-93: LGTM!src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/update/ConsultantUpdateServiceBase.java (2)
21-21: LGTM!
46-46: LGTM!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| identityEmailAddressUpdater::updateCurrentUserEmail, | ||
| identityEmailAddressUpdater::deleteCurrentUserEmail); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Define an application-level consistency boundary for the email change.
updateCurrentUserEmail or deleteCurrentUserEmail completes before the local consultant, user, appointment, and notification work. If a later local write fails, Keycloak and ORISO store different email values.
Use an outbox or compensating workflow. A database transaction alone cannot make the Keycloak and database writes atomic. Add a failure-path test for a local persistence failure after the identity update.
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/main/java/de/caritas/cob/userservice/api/service/user/UserAccountService.java`
around lines 137 - 138, The email-change flow around
identityEmailAddressUpdater::updateCurrentUserEmail and deleteCurrentUserEmail
must define an application-level consistency boundary across Keycloak and local
writes. Implement an outbox or compensating workflow so local persistence
failures after the identity update cannot leave the systems with different email
values, and add a failure-path test covering that scenario.
Source: Path instructions
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| IdentityAuthentication.class, | ||
| IdentityDeactivator.class, | ||
| IdentityDummyEmailUpdater.class, | ||
| IdentityEmailAddressUpdater.class, |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
Verify the email-port interaction in this test.
UpdateAdminServiceIT changes newEmail but only checks the persisted Admin values at Lines 60-83. Because IdentityEmailAddressUpdater is an unstubbed void method on the Mockito mock, this test passes if UpdateAdminService skips updateEmailByUsername(...) or sends the wrong email. Verify the port call with the expected identifier and newEmail.
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/test/java/de/caritas/cob/userservice/api/admin/service/admin/update/UpdateAdminServiceIT.java`
at line 48, Update UpdateAdminServiceIT to verify that
IdentityEmailAddressUpdater receives the expected user identifier and newEmail
via updateEmailByUsername(...), in addition to the existing persisted Admin
assertions.
Source: Path instructions
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Integrate the focused IdentityEmailAddressUpdater port with pre-dev's identity port split. The auto-merger handled all 8 Spring @MockitoBean test files cleanly, inserting IdentityEmailAddressUpdater.class alphabetically. Six files needed manual resolution: - KeycloakService.updateProfile: adopt pre-dev's profile-based body, but read the representation once and pass it to the merged verifyEmail(Representation) signature. - IdentityClient: rewrite to pre-dev's narrowed contract minus the three email methods this PR removes. - IdentityManager.validateOneTimePassword: keep pre-dev's typed IdentityEmailVerification return, but route the email write through the new IdentityEmailAddressUpdater instead of IdentityClient.changeEmailAddress. - IdentityManagerTest: verify against identitySecondFactor and identityEmailAddressUpdater. - KeycloakTestConfig: retain PR's deleteCurrentUserEmail / updateEmailByUsername stubs and pre-dev's typed createUser signature. - USER_SERVICE_STABILITY.md: fold both PR's email-mutation description and Identity/profile row addition into pre-dev's expanded structure.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.java (1)
368-381: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winInstall the metrics mock before verifying the retry metric.
The test creates
outboundHttpMetricsbut does not callkeycloakService.setOutboundHttpMetrics(outboundHttpMetrics). Line 381 therefore always fails after the unauthorized retry.var outboundHttpMetrics = mock(OutboundHttpMetrics.class); +keycloakService.setOutboundHttpMetrics(outboundHttpMetrics); var unauthorized =🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.java` around lines 368 - 381, Ensure the test setup for getOtpCredential installs the outboundHttpMetrics mock via keycloakService.setOutboundHttpMetrics(outboundHttpMetrics) before exercising the request and verifying recordRetry. Keep the existing retry and Keycloak interaction assertions unchanged.Source: Path instructions
src/main/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakService.java (1)
214-221: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winValidate the email before the username-based update.
updateEmailByUsernamelowercases and persistsemailAddresswithout callinguserAccountInputValidator.validateEmailAddress(emailAddress). This bypasses adapter-owned validation on the post-verification path.Validate before normalization and lookup.
Proposed fix
public void updateEmailByUsername(String username, String emailAddress) { + userAccountInputValidator.validateEmailAddress(emailAddress); var lowerEmailAddress = emailAddress.toLowerCase(Locale.ROOT);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakService.java` around lines 214 - 221, Update updateEmailByUsername to call userAccountInputValidator.validateEmailAddress(emailAddress) before lowercasing the address or performing the username lookup, preserving the existing normalization and update flow afterward.src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/create/agencyrelation/ConsultantAgencyRelationCreatorServiceTenantAwareIT.java (1)
136-136: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winMake the agency lookup contract observable.
The tests stub
getAgenciesWithoutCaching(List.of(15L))whilegetAgency(15L)remains stubbed. The persistence assertions can pass if the service ignores the batch lookup and uses the single-agency lookup. If the batch lookup is the intended path, verify it and reject the fallback stub. If both calls are intentional, verify both calls explicitly.As per path instructions, tests must be able to fail.
Also applies to: 175-175
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/create/agencyrelation/ConsultantAgencyRelationCreatorServiceTenantAwareIT.java` at line 136, Update the affected tests around the agency lookup stubs to verify the intended getAgenciesWithoutCaching call and prevent the assertions from passing via the getAgency fallback; if both lookup methods are expected, explicitly verify both calls, otherwise remove or reject the unintended single-agency stub.Source: Path instructions
src/test/java/de/caritas/cob/userservice/api/admin/service/admin/create/CreateAdminServiceIT.java (1)
103-104: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winAssert exact
CreatedIdentitypropagation.The positive stubs return random
CreatedIdentityvalues, but the tests assert only thatAdmin.idis non-null. The same class treats a missingCreatedIdentity.userIdas an error. Use deterministic identities and assert thatCreatedIdentity.userIdbecomesAdmin.id. Also assert that the capturedUserDTOcontainsVALID_EMAIL_ADDRESS.As per path instructions, tests must be able to fail.
Also applies to: 138-139, 175-178, 208-211
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/de/caritas/cob/userservice/api/admin/service/admin/create/CreateAdminServiceIT.java` around lines 103 - 104, Update the positive test stubs around identityClient.createUser in the affected CreateAdminServiceIT scenarios to return deterministic CreatedIdentity instances with explicit userId values, then assert Admin.id exactly matches that userId rather than only being non-null. Capture the UserDTO passed to identityClient and assert its email equals VALID_EMAIL_ADDRESS in each applicable test, while preserving the existing missing-userId error coverage.Source: Path instructions
src/test/java/de/caritas/cob/userservice/api/IdentityManagerTest.java (1)
53-76: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winTest the non-created verification result.
The tests cover only
created() == true. Add a case wherecreated() == falseand verify thatidentityEmailAddressUpdater.updateEmailByUsernameis not called.As per path instructions, “Tests must be able to fail” and must cover missing edge cases.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/de/caritas/cob/userservice/api/IdentityManagerTest.java` around lines 53 - 76, Add a test for validateOneTimePassword using an IdentityEmailVerification with created() == false, and verify identityEmailAddressUpdater.updateEmailByUsername is never invoked. Keep the existing successful verification tests unchanged and configure the identitySecondFactor response for the non-created result.Source: Path instructions
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In
`@src/main/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakService.java`:
- Around line 214-221: Update updateEmailByUsername to call
userAccountInputValidator.validateEmailAddress(emailAddress) before lowercasing
the address or performing the username lookup, preserving the existing
normalization and update flow afterward.
In
`@src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.java`:
- Around line 368-381: Ensure the test setup for getOtpCredential installs the
outboundHttpMetrics mock via
keycloakService.setOutboundHttpMetrics(outboundHttpMetrics) before exercising
the request and verifying recordRetry. Keep the existing retry and Keycloak
interaction assertions unchanged.
In
`@src/test/java/de/caritas/cob/userservice/api/admin/service/admin/create/CreateAdminServiceIT.java`:
- Around line 103-104: Update the positive test stubs around
identityClient.createUser in the affected CreateAdminServiceIT scenarios to
return deterministic CreatedIdentity instances with explicit userId values, then
assert Admin.id exactly matches that userId rather than only being non-null.
Capture the UserDTO passed to identityClient and assert its email equals
VALID_EMAIL_ADDRESS in each applicable test, while preserving the existing
missing-userId error coverage.
In
`@src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/create/agencyrelation/ConsultantAgencyRelationCreatorServiceTenantAwareIT.java`:
- Line 136: Update the affected tests around the agency lookup stubs to verify
the intended getAgenciesWithoutCaching call and prevent the assertions from
passing via the getAgency fallback; if both lookup methods are expected,
explicitly verify both calls, otherwise remove or reject the unintended
single-agency stub.
In `@src/test/java/de/caritas/cob/userservice/api/IdentityManagerTest.java`:
- Around line 53-76: Add a test for validateOneTimePassword using an
IdentityEmailVerification with created() == false, and verify
identityEmailAddressUpdater.updateEmailByUsername is never invoked. Keep the
existing successful verification tests unchanged and configure the
identitySecondFactor response for the non-created result.
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 39e1a4fb-a9b9-4a5a-b83e-1c1d78014172
tests/ci/test_module_boundaries.py is excluded by none and included by nonedocumentation/USER_SERVICE_STABILITY.mdsrc/main/java/de/caritas/cob/userservice/api/IdentityManager.javasrc/main/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakService.javasrc/main/java/de/caritas/cob/userservice/api/port/out/IdentityClient.javasrc/test/java/de/caritas/cob/userservice/api/IdentityManagerTest.javasrc/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserAdminControllerE2EIT.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserAdminControllerMultiTenancyTrueE2EIT.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerAuthorizationIT.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerIT.javasrc/test/java/de/caritas/cob/userservice/api/admin/service/admin/create/CreateAdminServiceIT.javasrc/test/java/de/caritas/cob/userservice/api/admin/service/admin/update/UpdateAdminServiceIT.javasrc/test/java/de/caritas/cob/userservice/api/admin/service/consultant/create/agencyrelation/ConsultantAgencyRelationCreatorServiceTenantAwareIT.javasrc/test/java/de/caritas/cob/userservice/api/admin/service/consultant/update/ConsultantUpdateServiceBase.javasrc/test/java/de/caritas/cob/userservice/api/testConfig/KeycloakTestConfig.javaGitHub Actions: UserService Branch Validation / required integration tests: merge: reconcile PR #885 with pre-dev identity port split
Conclusion: failure
anslate
[INFO] Processing operation translateGroupChatAuthorContent
[INFO] Processing operation getMultilingualTenantById
[INFO] Processing operation updateTenant
[INFO] Processing operation getAllTenants
[INFO] Processing operation getTenantById
[INFO] Processing operation getRestrictedTenantDataBySubdomain
[INFO] Processing operation getRestrictedTenantDataByTenantId
[INFO] Processing operation getRestrictedSingleTenancyTenantData
[INFO] Processing operation getRestrictedTenantData
[INFO] Processing operation canAccessTenant
[INFO] Processing operation getDataProcessingAgreementPreview
[INFO] Processing operation confirmDataProcessingAgreement
[INFO] Processing operation getDataProcessingAgreementSignatures
[INFO] Processing operation getDataProcessingAgreementGate
[INFO] Processing operation createDataProcessingAgreementSignInvite
[INFO] Processing operation publishDataProcessingAgreement
[INFO] Processing operation getDataProcessingAgreementVersions
[INFO] Processing operation uploadTenantMedia
[INFO] Processing operation getTenantMedia
[INFO] 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[INFO] 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[INFO] Model uploadTenantMedia_request not generated since it's marked as unused (due to form parameters) and `skipFormModel` (global property) set to true (default)
[INFO] writing file /home/runner/work/ORISO-UserService/ORISO-UserService/target/generated-sources/openapi/de/caritas/cob/userservice/tenantadminservice/generated/web/model/AdminTenantDTO.java
[INFO] writing file /home/runner/work/ORISO-UserService/ORISO-UserService/target/generated-sources/openapi/docs/AdminTenantDTO.md
[INFO] writing file /home/runner/work/ORISO-UserService/ORISO-UserService/target/generated-sources/openapi/de/caritas/cob/userservice/tenantadminservice...
GitHub Actions: UserService Branch Validation / mariadb-contract _ MariaDB schema, statistics and replica contracts: merge: reconcile PR #885 with pre-dev identity port split
Conclusion: failure
anslate
[INFO] Processing operation translateGroupChatAuthorContent
[INFO] Processing operation getMultilingualTenantById
[INFO] Processing operation updateTenant
[INFO] Processing operation getAllTenants
[INFO] Processing operation getTenantById
[INFO] Processing operation getRestrictedTenantDataBySubdomain
[INFO] Processing operation getRestrictedTenantDataByTenantId
[INFO] Processing operation getRestrictedSingleTenancyTenantData
[INFO] Processing operation getRestrictedTenantData
[INFO] Processing operation canAccessTenant
[INFO] Processing operation getDataProcessingAgreementPreview
[INFO] Processing operation confirmDataProcessingAgreement
[INFO] Processing operation getDataProcessingAgreementSignatures
[INFO] Processing operation getDataProcessingAgreementGate
[INFO] Processing operation createDataProcessingAgreementSignInvite
[INFO] Processing operation publishDataProcessingAgreement
[INFO] Processing operation getDataProcessingAgreementVersions
[INFO] Processing operation uploadTenantMedia
[INFO] Processing operation getTenantMedia
[INFO] 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[INFO] 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[INFO] Model uploadTenantMedia_request not generated since it's marked as unused (due to form parameters) and `skipFormModel` (global property) set to true (default)
[INFO] writing file /home/runner/work/ORISO-UserService/ORISO-UserService/target/generated-sources/openapi/de/caritas/cob/userservice/tenantadminservice/generated/web/model/AdminTenantDTO.java
[INFO] writing file /home/runner/work/ORISO-UserService/ORISO-UserService/target/generated-sources/openapi/docs/AdminTenantDTO.md
[INFO] writing file /home/runner/work/ORISO-UserService/ORISO-UserService/target/generated-sources/openapi/de/caritas/cob/userservice/tenantadminservice...
GitHub Actions: UserService Branch Validation / 1_required integration tests.txt: merge: reconcile PR #885 with pre-dev identity port split
Conclusion: failure
anslate
[INFO] Processing operation translateGroupChatAuthorContent
[INFO] Processing operation getMultilingualTenantById
[INFO] Processing operation updateTenant
[INFO] Processing operation getAllTenants
[INFO] Processing operation getTenantById
[INFO] Processing operation getRestrictedTenantDataBySubdomain
[INFO] Processing operation getRestrictedTenantDataByTenantId
[INFO] Processing operation getRestrictedSingleTenancyTenantData
[INFO] Processing operation getRestrictedTenantData
[INFO] Processing operation canAccessTenant
[INFO] Processing operation getDataProcessingAgreementPreview
[INFO] Processing operation confirmDataProcessingAgreement
[INFO] Processing operation getDataProcessingAgreementSignatures
[INFO] Processing operation getDataProcessingAgreementGate
[INFO] Processing operation createDataProcessingAgreementSignInvite
[INFO] Processing operation publishDataProcessingAgreement
[INFO] Processing operation getDataProcessingAgreementVersions
[INFO] Processing operation uploadTenantMedia
[INFO] Processing operation getTenantMedia
[INFO] 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[INFO] 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[INFO] Model uploadTenantMedia_request not generated since it's marked as unused (due to form parameters) and `skipFormModel` (global property) set to true (default)
[INFO] writing file /home/runner/work/ORISO-UserService/ORISO-UserService/target/generated-sources/openapi/de/caritas/cob/userservice/tenantadminservice/generated/web/model/AdminTenantDTO.java
[INFO] writing file /home/runner/work/ORISO-UserService/ORISO-UserService/target/generated-sources/openapi/docs/AdminTenantDTO.md
[INFO] writing file /home/runner/work/ORISO-UserService/ORISO-UserService/target/generated-sources/openapi/de/caritas/cob/userservice/tenantadminservice...
GitHub Actions: UserService Branch Validation / test and build UserService: merge: reconcile PR #885 with pre-dev identity port split
Conclusion: failure
Processing operation translateGroupChatAuthorContent
[INFO] Processing operation getMultilingualTenantById
[INFO] Processing operation updateTenant
[INFO] Processing operation getAllTenants
[INFO] Processing operation getTenantById
[INFO] Processing operation getRestrictedTenantDataBySubdomain
[INFO] Processing operation getRestrictedTenantDataByTenantId
[INFO] Processing operation getRestrictedSingleTenancyTenantData
[INFO] Processing operation getRestrictedTenantData
[INFO] Processing operation canAccessTenant
[INFO] Processing operation getDataProcessingAgreementPreview
[INFO] Processing operation confirmDataProcessingAgreement
[INFO] Processing operation getDataProcessingAgreementSignatures
[INFO] Processing operation getDataProcessingAgreementGate
[INFO] Processing operation createDataProcessingAgreementSignInvite
[INFO] Processing operation publishDataProcessingAgreement
[INFO] Processing operation getDataProcessingAgreementVersions
[INFO] Processing operation uploadTenantMedia
[INFO] Processing operation getTenantMedia
[INFO] 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[INFO] 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[INFO] Model uploadTenantMedia_request not generated since it's marked as unused (due to form parameters) and `skipFormModel` (global property) set to true (default)
[INFO] writing file /home/runner/work/ORISO-UserService/ORISO-UserService/target/generated-sources/openapi/de/caritas/cob/userservice/tenantadminservice/generated/web/model/AdminTenantDTO.java
[INFO] writing file /home/runner/work/ORISO-UserService/ORISO-UserService/target/generated-sources/openapi/docs/AdminTenantDTO.md
[INFO] writing file /home/runner/work/ORISO-UserService/ORISO-UserService/target/generated-sources/openapi/de/caritas/cob/userservice/tenantadminservice/generated/web/m...
GitHub Actions: UserService Branch Validation / 2_mariadb-contract _ MariaDB schema, statistics and replica contracts.txt: merge: reconcile PR #885 with pre-dev identity port split
Conclusion: failure
anslate
[INFO] Processing operation translateGroupChatAuthorContent
[INFO] Processing operation getMultilingualTenantById
[INFO] Processing operation updateTenant
[INFO] Processing operation getAllTenants
[INFO] Processing operation getTenantById
[INFO] Processing operation getRestrictedTenantDataBySubdomain
[INFO] Processing operation getRestrictedTenantDataByTenantId
[INFO] Processing operation getRestrictedSingleTenancyTenantData
[INFO] Processing operation getRestrictedTenantData
[INFO] Processing operation canAccessTenant
[INFO] Processing operation getDataProcessingAgreementPreview
[INFO] Processing operation confirmDataProcessingAgreement
[INFO] Processing operation getDataProcessingAgreementSignatures
[INFO] Processing operation getDataProcessingAgreementGate
[INFO] Processing operation createDataProcessingAgreementSignInvite
[INFO] Processing operation publishDataProcessingAgreement
[INFO] Processing operation getDataProcessingAgreementVersions
[INFO] Processing operation uploadTenantMedia
[INFO] Processing operation getTenantMedia
[INFO] 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[INFO] 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[INFO] Model uploadTenantMedia_request not generated since it's marked as unused (due to form parameters) and `skipFormModel` (global property) set to true (default)
[INFO] writing file /home/runner/work/ORISO-UserService/ORISO-UserService/target/generated-sources/openapi/de/caritas/cob/userservice/tenantadminservice/generated/web/model/AdminTenantDTO.java
[INFO] writing file /home/runner/work/ORISO-UserService/ORISO-UserService/target/generated-sources/openapi/docs/AdminTenantDTO.md
[INFO] writing file /home/runner/work/ORISO-UserService/ORISO-UserService/target/generated-sources/openapi/de/caritas/cob/userservice/tenantadminservice...
GitHub Actions: UserService Branch Validation / 0_test and build UserService.txt: merge: reconcile PR #885 with pre-dev identity port split
Conclusion: failure
Processing operation translateGroupChatAuthorContent
[INFO] Processing operation getMultilingualTenantById
[INFO] Processing operation updateTenant
[INFO] Processing operation getAllTenants
[INFO] Processing operation getTenantById
[INFO] Processing operation getRestrictedTenantDataBySubdomain
[INFO] Processing operation getRestrictedTenantDataByTenantId
[INFO] Processing operation getRestrictedSingleTenancyTenantData
[INFO] Processing operation getRestrictedTenantData
[INFO] Processing operation canAccessTenant
[INFO] Processing operation getDataProcessingAgreementPreview
[INFO] Processing operation confirmDataProcessingAgreement
[INFO] Processing operation getDataProcessingAgreementSignatures
[INFO] Processing operation getDataProcessingAgreementGate
[INFO] Processing operation createDataProcessingAgreementSignInvite
[INFO] Processing operation publishDataProcessingAgreement
[INFO] Processing operation getDataProcessingAgreementVersions
[INFO] Processing operation uploadTenantMedia
[INFO] Processing operation getTenantMedia
[INFO] 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[INFO] 'host' (OAS 2.0) or 'servers' (OAS 3.0) not defined in the spec. Default to [http://localhost] for server URL [http://localhost/]
[INFO] Model uploadTenantMedia_request not generated since it's marked as unused (due to form parameters) and `skipFormModel` (global property) set to true (default)
[INFO] writing file /home/runner/work/ORISO-UserService/ORISO-UserService/target/generated-sources/openapi/de/caritas/cob/userservice/tenantadminservice/generated/web/model/AdminTenantDTO.java
[INFO] writing file /home/runner/work/ORISO-UserService/ORISO-UserService/target/generated-sources/openapi/docs/AdminTenantDTO.md
[INFO] writing file /home/runner/work/ORISO-UserService/ORISO-UserService/target/generated-sources/openapi/de/caritas/cob/userservice/tenantadminservice/generated/web/m...
⚙️ CodeRabbit configuration file
src/test/**/*.java: Tests must be able to fail. Flag over-mocking that hides the defect,
assertions that cannot break, and missing edge cases.
Files:
src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/create/agencyrelation/ConsultantAgencyRelationCreatorServiceTenantAwareIT.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserAdminControllerE2EIT.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerIT.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerAuthorizationIT.javasrc/test/java/de/caritas/cob/userservice/api/admin/service/admin/create/CreateAdminServiceIT.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserAdminControllerMultiTenancyTrueE2EIT.javasrc/test/java/de/caritas/cob/userservice/api/admin/service/consultant/update/ConsultantUpdateServiceBase.javasrc/test/java/de/caritas/cob/userservice/api/IdentityManagerTest.javasrc/test/java/de/caritas/cob/userservice/api/admin/service/admin/update/UpdateAdminServiceIT.javasrc/test/java/de/caritas/cob/userservice/api/testConfig/KeycloakTestConfig.javasrc/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.java⚙️ CodeRabbit configuration file
src/main/**/*.java: Check behavior against the surrounding ORISO flow, not only types. Flag
missing transaction boundaries, swallowed exceptions, N+1 queries, and
privacy regressions around Matrix identifiers, chat content and user data.
Configuration must stay environment-driven — never hardcode hosts, IPs or
credentials (see ADR-005 / finding DB-M04).
Files:
src/main/java/de/caritas/cob/userservice/api/IdentityManager.javasrc/main/java/de/caritas/cob/userservice/api/port/out/IdentityClient.javasrc/main/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakService.javaLearnt from: Storypapst
Repo: OpenResilienceInitiative/ORISO-UserService PR: 420
File: src/main/java/de/caritas/cob/userservice/api/conversation/service/AnonymousConversationCreatorService.java:34-35
Timestamp: 2026-07-12T05:15:05.095Z
Learning: In ORISO-UserService, treat `rocket-chat.enabled` defaulting to `false` (e.g., `Value("${rocket-chat.enabled:false}")`) as an intentional Matrix-only default. Do not flag code paths/config placeholders that use this default-false behavior as a bug in future reviews. Rocket.Chat must be explicitly enabled only by setting `ROCKET_CHAT_ENABLED=true` (or the equivalent `rocket-chat.enabled=true`), consistent with the repository’s `application*.properties`/configuration validator and the disabled Rocket.Chat service wiring.
Applied to files:
src/main/java/de/caritas/cob/userservice/api/IdentityManager.javasrc/main/java/de/caritas/cob/userservice/api/port/out/IdentityClient.javasrc/main/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakService.java[warning] 1059-1059: Avoid LDAP injections
Context: verify(usersResource).search("anotherEmail", 0, Integer.MAX_VALUE)
Note: [CWE-90] Improper Neutralization of Special Elements used in an LDAP Query ('LDAP Injection'). Security best practice.
(ldap-injection-java)
[warning] 1088-1088: Avoid LDAP injections
Context: verify(usersResource, never()).search(any(), any(), any())
Note: [CWE-90] Improper Neutralization of Special Elements used in an LDAP Query ('LDAP Injection'). Security best practice.
(ldap-injection-java)
[warning] 1098-1098: Avoid LDAP injections
Context: usersResource.search(any(), any(), any())
Note: [CWE-90] Improper Neutralization of Special Elements used in an LDAP Query ('LDAP Injection'). Security best practice.
(ldap-injection-java)
[warning] 1111-1111: Avoid LDAP injections
Context: verify(usersResource).search("newemail", 0, Integer.MAX_VALUE)
Note: [CWE-90] Improper Neutralization of Special Elements used in an LDAP Query ('LDAP Injection'). Security best practice.
(ldap-injection-java)
[error] 295-295: Spotless google-java-format check failed: illegal start of expression. Fix the syntax near line 295.
[error] 295-295: Spotless google-java-format check failed: illegal start of expression.
src/test/java/de/caritas/cob/userservice/api/admin/service/admin/update/UpdateAdminServiceIT.java (1)
51-51: 🗄️ Data Integrity & IntegrationAdd the missing email-port assertion.
The positive test still checks only local
Adminrows. The unstubbedIdentityEmailAddressUpdatermock does not fail whenupdateEmailByUsername(...)is skipped or receives the wrong identifier or email. Verify that the port receivesVALID_ADMIN_IDandnewEmail.As per path instructions, tests must be able to fail.
Source: Path instructions
src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserAdminControllerE2EIT.java (1)
43-52: LGTM!Also applies to: 140-147
src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserAdminControllerMultiTenancyTrueE2EIT.java (1)
26-35: LGTM!Also applies to: 83-90
src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserControllerIT.java (1)
58-65: LGTM!Also applies to: 297-304
src/test/java/de/caritas/cob/userservice/api/admin/service/admin/create/CreateAdminServiceIT.java (1)
28-37: LGTM!Also applies to: 71-79, 260-262
src/test/java/de/caritas/cob/userservice/api/admin/service/consultant/create/agencyrelation/ConsultantAgencyRelationCreatorServiceTenantAwareIT.java (1)
33-40: LGTM!Also applies to: 96-104
src/main/java/de/caritas/cob/userservice/api/port/out/IdentityClient.java (1)
13-25: 🗄️ Data Integrity & IntegrationNo contract gap remains.
Current email updates route through
IdentityEmailAddressUpdater, and the updated test expectations no longer call the removedIdentityClientmethods.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…rAccountServiceTest Both files had google-java-format parse errors from a bad earlier merge that left dangling '@OverRide public void deleteCurrentUserEmail() {' fragments above the actual test methods. - KeycloakServiceTest: collapse the two colliding method signatures into the new deleteCurrentUserEmail_Should_useServicesCorrectly (matches PR 885's rename of the underlying method). - UserAccountServiceTest: remove the stray @OverRide + method-signature fragments and switch the two consultant/user 'delete address' assertions from identityClient.deleteEmailAddress/changeEmailAddress (removed by PR 885) to identityEmailAddressUpdater.deleteCurrentUserEmail / updateCurrentUserEmail.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.java (4)
1209-1241: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winCover mixed-case normalization on the current-user path.
The test passes a lowercase address and expects lowercase values. It cannot detect removal of
Locale.ROOTnormalization fromupdateCurrentUserEmail. Pass a mixed-case address, then keep the lowercase expectations for search,setEmail, and the update payload.Proposed test change
- this.keycloakService.updateCurrentUserEmail("[email protected]"); + this.keycloakService.updateCurrentUserEmail("[email protected]");As per path instructions, tests must be able to fail and must cover edge cases.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.java` around lines 1209 - 1241, Update updateCurrentUserEmail_Should_UpdateOnce_When_EmailIsChangedAndAvailable to use a mixed-case input email while retaining lowercase expectations for UsersResource.search, UserRepresentation.setEmail, and the captured update payload, so the test verifies Locale.ROOT normalization on the current-user path.Source: Path instructions
2046-2060: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winVerify the required single username lookup.
Both tests stub
usersResource.search(USERNAME)but never verify it. The changed-email case can pass without a username lookup. The unchanged-email case can pass by returning before lookup. Add exact one-search verification to both tests. This enforces the contract of one username lookup and at most one update.Proposed assertions
keycloakService.updateEmailByUsername(USERNAME, "[email protected]"); + verify(usersResource, times(1)).search(USERNAME);Add the same assertion to the unchanged-email test.
As per path instructions, tests must be able to fail and must cover interaction bounds.
Also applies to: 2062-2074
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.java` around lines 2046 - 2060, Update both tests, updateEmailByUsername_Should_UpdateEmail_When_EmailDiffers and the unchanged-email test, to verify usersResource.search(USERNAME) is called exactly once. Keep the existing update assertions, ensuring the tests cover one username lookup and at most one update.Source: Path instructions
304-308: 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick winBind the fixtures to the authenticated user ID.
givenUsersResourceWithAnyUserIdaccepts every ID. These tests therefore pass ifKeycloakServiceresolves or updates a different user. Stub and verifyusersResource.get(userId)exactly. Use"userId"in the current-email test.As per path instructions, tests must be able to fail and must not hide identity-binding defects.
Also applies to: 1209-1223
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.java` around lines 304 - 308, Update the affected KeycloakService tests, including the current-email test and the additional cases around the referenced fixture, to stub usersResource.get(userId) with the exact authenticated ID instead of using givenUsersResourceWithAnyUserId. Verify that usersResource.get(userId) is called, using the literal "userId" where required, so the tests fail when a different user ID is resolved or updated.Source: Path instructions
238-247: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winMake the renamed tests assert the email write.
These tests verify only
validateEmailAddressandauthenticatedUser.getUserId(). They pass ifupdateCurrentUserEmaildoes not read, search, or update Keycloak. Assert the representation read, normalized availability search,setEmail, andupdate. Keep the null-email case, but make it prove that the representation is persisted.As per path instructions, tests must be able to fail and must cover edge cases.
Also applies to: 260-268
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.java` around lines 238 - 247, The renamed updateCurrentUserEmail tests currently verify only setup and validation, not the Keycloak write flow. Update updateCurrentUserEmail_Should_useServicesCorrectly and the null-email case to assert the user representation is read, email availability is searched with the normalized value, UserRepresentation.setEmail is called with the expected value, and UserResource.update persists it; retain the null-email scenario and ensure it proves persistence.Source: Path instructions
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In
`@src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.java`:
- Around line 1209-1241: Update
updateCurrentUserEmail_Should_UpdateOnce_When_EmailIsChangedAndAvailable to use
a mixed-case input email while retaining lowercase expectations for
UsersResource.search, UserRepresentation.setEmail, and the captured update
payload, so the test verifies Locale.ROOT normalization on the current-user
path.
- Around line 2046-2060: Update both tests,
updateEmailByUsername_Should_UpdateEmail_When_EmailDiffers and the
unchanged-email test, to verify usersResource.search(USERNAME) is called exactly
once. Keep the existing update assertions, ensuring the tests cover one username
lookup and at most one update.
- Around line 304-308: Update the affected KeycloakService tests, including the
current-email test and the additional cases around the referenced fixture, to
stub usersResource.get(userId) with the exact authenticated ID instead of using
givenUsersResourceWithAnyUserId. Verify that usersResource.get(userId) is
called, using the literal "userId" where required, so the tests fail when a
different user ID is resolved or updated.
- Around line 238-247: The renamed updateCurrentUserEmail tests currently verify
only setup and validation, not the Keycloak write flow. Update
updateCurrentUserEmail_Should_useServicesCorrectly and the null-email case to
assert the user representation is read, email availability is searched with the
normalized value, UserRepresentation.setEmail is called with the expected value,
and UserResource.update persists it; retain the null-email scenario and ensure
it proves persistence.
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 8996bcb3-430e-4ec7-8a3e-ac9beff25d18
src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.javasrc/test/java/de/caritas/cob/userservice/api/service/user/UserAccountServiceTest.java⚙️ CodeRabbit configuration file
src/test/**/*.java: Tests must be able to fail. Flag over-mocking that hides the defect,
assertions that cannot break, and missing edge cases.
Files:
src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.javasrc/test/java/de/caritas/cob/userservice/api/service/user/UserAccountServiceTest.javasrc/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.java (1)
15-15: LGTM!Also applies to: 293-293
src/test/java/de/caritas/cob/userservice/api/service/user/UserAccountServiceTest.java (2)
29-29: LGTM!Also applies to: 57-57, 196-196, 214-214, 234-234
255-256: 🎯 Functional CorrectnessNo change needed for the empty-email negative verification.
changeUserAccountEmailAddress(Optional.empty())currently routes only throughdeleteCurrentUserEmail; it does not callupdateCurrentUserEmailwith a non-null argument, so thisnever(anyString())assertion is not masking the reported null-edge-case failure mode.> Likely an incorrect or invalid review comment.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The @OverRide on line 135 had no method under it — leftover from an earlier merge that removed the updateEmail(String, String) stub when PR 885 dropped that method from IdentityClient.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.