Skip to content

refactor(server-nestjs): route Keycloak group creation through shared ensure util - #2640

Merged
shikanime merged 1 commit into
mainfrom
refactor/keycloak-ensure-util
Sep 8, 2026
Merged

refactor(server-nestjs): route Keycloak group creation through shared ensure util#2640
shikanime merged 1 commit into
mainfrom
refactor/keycloak-ensure-util

Conversation

@shikanime

Copy link
Copy Markdown
Member

Issues liées

#2618 (référence ; le bug est déjà corrigé par #2623)


Quel est le comportement actuel ?

Les deux chemins de création de groupes Keycloak (ensureGroup et getOrCreateSubGroupByName) gèrent la course de création concurrente (409) via des try/catch impératifs locaux, dupliquant le motif ensure désormais partagé par les modules gitlab (#2624), nexus (#2627), registry (#2605) et sonarqube (#2639).

Quel est le nouveau comportement ?

Même comportement observable, exprimé avec le motif commun : isKeycloakConflict (409) et ensure{create, reload, onCollision} dans keycloak.utils.ts, et les deux sites d'appel réduits à la déclaration de create/reload. Les tests client existants (409 avec relecture, 409 sans entité trouvée, erreur non-409 sans relecture) passent inchangés et verrouillent la préservation du comportement.

Cette PR introduit-elle un breaking change ?

Non.

Autres informations

Clôture la campagne d'uniformisation du motif ensure sur server-nestjs (#2605 #2624 #2627 #2639).

@shikanime shikanime added the bug Something isn't working label Sep 1, 2026
@shikanime shikanime self-assigned this Sep 1, 2026
@shikanime shikanime added this to the 9.25.0 milestone Sep 1, 2026
@shikanime
shikanime requested a review from almorelle September 1, 2026 12:18
@github-actions github-actions Bot added the built label Sep 1, 2026
@shikanime
shikanime marked this pull request as ready for review September 1, 2026 12:23
@shikanime
shikanime requested a review from a team as a code owner September 1, 2026 12:23
@shikanime
shikanime enabled auto-merge September 1, 2026 12:23
@shikanime shikanime modified the milestones: 9.25.0, 9.26.0 Sep 1, 2026
@shikanime
shikanime removed the request for review from almorelle September 1, 2026 12:27
StephaneTrebel
StephaneTrebel previously approved these changes Sep 7, 2026
… ensure util

The ensure util now treats create as a bare write (void) and always reads
the entity back through reload: callers receive the representation
Keycloak computed, never a locally synthesized one. A race collision
(409) still reloads once and rethrows the original error when the
entity is not found. When reload finds nothing after a successful
write, ensure returns undefined; the service boundary re-establishes
the non-undefined guarantee with an explicit guard naming the group.

Signed-off-by: William Phetsinorath <[email protected]>
Change-Id: I05b26d3c6452b05e7c6243852fd35c116a6a6964
@shikanime
shikanime force-pushed the refactor/keycloak-ensure-util branch from 285ddb5 to c96fa00 Compare September 8, 2026 14:32
@cloud-pi-native-sonarqube

Copy link
Copy Markdown

@shikanime
shikanime added this pull request to the merge queue Sep 8, 2026
Merged via the queue into main with commit f3095b4 Sep 8, 2026
34 checks passed
@shikanime
shikanime deleted the refactor/keycloak-ensure-util branch September 8, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working built

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants