Skip to content

fix(server-nestjs): make GitLab repo create and commit idempotent - #2624

Draft
shikanime wants to merge 2 commits into
mainfrom
fix/gitlab-create-commit-idempotent
Draft

fix(server-nestjs): make GitLab repo create and commit idempotent#2624
shikanime wants to merge 2 commits into
mainfrom
fix/gitlab-create-commit-idempotent

Conversation

@shikanime

Copy link
Copy Markdown
Member

Issues liées

Quel est le comportement actuel ?

Deux trous d'idempotence dans GitlabClientService :

  • createGroupRepo appelle Projects.create sans tolérance de collision. Sous synchro concurrente, le perdant lève has already been taken.
  • maybeCreateCommit lit le fichier puis appelle Commits.create séparément. Deux synchros qui se chevauchent peuvent toutes deux voir le fichier absent, émettre une action create, et la seconde rencontre already exists (400) sans tolérance.

Comportement attendu

  • createGroupRepo recharge le dépôt existant (recherche dans Projects.all par nom) et le retourne en cas de collision.
  • maybeCreateCommit traite une erreur already exists / has already been taken (ou 400) comme un commit déjà appliqué, vérifie que le fichier existe désormais et continue sans lever.

Changements

  • createGroupRepo : enveloppe Projects.create et recharge le dépôt existant en cas de collision.
  • maybeCreateCommit : tolère un commit déjà appliqué (concurrence) et poursuit sans lever quand le fichier est présent.
  • Ajout de tests unitaires couvrant le rechargement après collision et le cas commit déjà existant.

@github-actions github-actions Bot added the built label Aug 28, 2026
@shikanime
shikanime force-pushed the fix/gitlab-create-commit-idempotent branch from 7beb262 to 1447eff Compare August 28, 2026 11:39
shikanime and others added 2 commits August 28, 2026 15:47
Signed-off-by: William Phetsinorath <william.phetsinorath-open@interieur.gouv.fr>
Change-Id: Iff465b31836b84656a084678aeec082a6a6a6964
Refs #2621

Co-authored-by: Automata <automata@shikanime.studio>
Signed-off-by: William Phetsinorath <william.phetsinorath-open@interieur.gouv.fr>
Change-Id: Ia59f39459a4b68f283b8d8786cf7fda06a6a6964
@shikanime
shikanime force-pushed the fix/gitlab-create-commit-idempotent branch from 1447eff to c29170c Compare August 28, 2026 14:20
@shikanime
shikanime changed the base branch from main to fix/uniformize-error-guards August 28, 2026 14:22
@cloud-pi-native-sonarqube

Copy link
Copy Markdown

Base automatically changed from fix/uniformize-error-guards to main August 28, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant