fix(server-nestjs): make GitLab repo create and commit idempotent - #2624
Open
shikanime wants to merge 2 commits into
Open
fix(server-nestjs): make GitLab repo create and commit idempotent#2624shikanime wants to merge 2 commits into
shikanime wants to merge 2 commits into
Conversation
shikanime
force-pushed
the
fix/gitlab-create-commit-idempotent
branch
2 times, most recently
from
August 28, 2026 14:20
1447eff to
c29170c
Compare
shikanime
commented
Aug 31, 2026
shikanime
left a comment
Member
Author
There was a problem hiding this comment.
Verdict : Changements demandés — la PR ne compile pas (PR propriétaire : commentaire bloquant, non request-changes).
- gitlab-client.service.ts:355 — [🔴 Bloquant]
GitbeakerRequestErrorest encore référencé (error instanceof GitbeakerRequestError) mais l import a été retiré (ligne 21 absente du diff ; l edit supprimeimport { GitbeakerRequestError }).tscéchouera. Suggestion : remettreimport { GitbeakerRequestError } from "@gitbeaker/requester-utils"ou, mieux, ajouter un helperisGitbeakerBadRequestdansgitlab.utils.tset l utiliser ici (cohérent avecisGitbeakerUnauthorizeddéjà sur main). - gitlab.utils.ts / nexus.utils.ts / vault.utils.ts — [🟠 Important] Les gardes
isVaultNotFound,isVaultBadRequest,isNexusNotFound,isGitbeakerUnauthorizedsont déjà fusionnées surmain(ec9c18a914). Cette PR les re-ajoute : rebasez surmainpour ne garder que la logiqueensure*/maybeCreateCommit, sinon conflit (voir #2626 CONFLICTING). - gitlab-client.service.ts:352-366 — [✨ Éloge]
ensureGroupRepo(reload parProjects.all+ filtrename) etmaybeCreateCommit(tolère 400 + vérifie la présence du fichier) ciblent exactement la course concurrente décrite. Bonne couverture de test (collision + fichier absent).
Rebasez sur main puis corrigez l import manquant avant de sortir du draft.
shikanime
force-pushed
the
fix/gitlab-create-commit-idempotent
branch
from
August 31, 2026 11:44
c29170c to
115d118
Compare
shikanime
force-pushed
the
fix/gitlab-create-commit-idempotent
branch
5 times, most recently
from
September 1, 2026 11:05
9e91398 to
985cb46
Compare
shikanime
marked this pull request as ready for review
September 1, 2026 11:06
shikanime
force-pushed
the
fix/gitlab-create-commit-idempotent
branch
from
September 1, 2026 11:30
985cb46 to
951ed7f
Compare
…ection Review feedback: // style comments, shorter util name, casts dropped where inference suffices (Users.create already returns ExpandedUserSchema), and the has-already-been-taken / already-exists / 400 collision check moved into an isCommitAlreadyApplied guard used by maybeCreateCommit, with isGitbeakerRace naming entity collisions for ensure. ensure takes a single options object. Co-authored-by: Automata <automata@shikanime.studio> Signed-off-by: William Phetsinorath <william.phetsinorath-open@interieur.gouv.fr> Change-Id: I728df0130286bfab2d599b9c6091731b6a6a6964
isGitbeakerRace predicate matrix, ensure create/reload/collision contract (create called once, reload once, non-race rethrow), and a two-sync race scenario proving maybeCreateCommit never emits a second commit for content already synced. Rebased onto main; createGroupRepo rename adapted. Co-authored-by: Automata <automata@shikanime.studio> Signed-off-by: William Phetsinorath <william.phetsinorath-open@interieur.gouv.fr> Change-Id: I6ee1064982cadefe1562f097751ce3f76a6a6964
shikanime
force-pushed
the
fix/gitlab-create-commit-idempotent
branch
from
September 1, 2026 11:42
951ed7f to
acae553
Compare
|
This was referenced Sep 1, 2026
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.

0 New Issues
0 Fixed Issues
0 Accepted Issues
Issues liées
Quel est le comportement actuel ?
Deux trous d'idempotence dans
GitlabClientService:createGroupRepoappelleProjects.createsans tolérance de collision. Sous synchro concurrente, le perdant lèvehas already been taken.maybeCreateCommitlit le fichier puis appelleCommits.createséparément. Deux synchros qui se chevauchent peuvent toutes deux voir le fichier absent, émettre une actioncreate, et la seconde rencontrealready exists(400) sans tolérance.Comportement attendu
createGroupReporecharge le dépôt existant (recherche dansProjects.allpar nom) et le retourne en cas de collision.maybeCreateCommittraite une erreuralready 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: enveloppeProjects.createet 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.