fix(server-nestjs): make Registry create paths idempotent - #2632
Open
shikanime wants to merge 2 commits into
Open
fix(server-nestjs): make Registry create paths idempotent#2632shikanime wants to merge 2 commits into
shikanime wants to merge 2 commits into
Conversation
Signed-off-by: William Phetsinorath <william.phetsinorath-open@interieur.gouv.fr> Change-Id: Icef5672b7cc38801260f64eb34569a716a6a6964
shikanime
force-pushed
the
fix/registry-create-idempotent
branch
from
August 28, 2026 17:07
2212abf to
9fe52fc
Compare
Signed-off-by: William Phetsinorath <william.phetsinorath-open@interieur.gouv.fr> Change-Id: Ie82b4c47953aa13959e3dd34fb99afba6a6a6964
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.
Issues liées
#2620 (fermer délibérément après la fusion)
Quel est le comportement actuel ?
Lors d'une synchronisation concurrente (cron + événement), deux appels peuvent tenter de créer la même ressource Harbor en parallèle. Le POST perdant reçoit une erreur 409 (conflit) et la synchronisation échoue avec une erreur.
Quatre chemins de création sont concernés : la création de projet, l'ajout d'un membre de groupe, la création d'un robot et la création d'une stratégie de rétention. Chacun était protégé par un GET d'existence préalable dans la couche métier, mais sous une course cette garde ne suffisait pas.
Comportement attendu
L'idempotence est encapsulée dans le service client (
registry-client.service.ts) sous un motifensure*create-first : on tente la création ; si la ressource existe déjà (409), on la met à jour puis on relit l'état courant. La synchronisation devient idempotente face à la course.Changements
registry-client.service.tsexposeensureProject,ensureGroupMember,ensureRobotetensureRetention: chaque méthode tente la création, puis réconcilie sur un 409.null, la couche métier déclenche une rotation pour obtenir un secret frais.registry.service.ts) est simplifiée : elle appelle les méthodesensure*et ne gère plus les statuts 409 elle-même.