Skip to content

refactor(server-nestjs): compose cluster module as Effect pipelines - #2759

Closed
shikanime wants to merge 9 commits into
pr/cluster-migrationfrom
cluster-pipeline
Closed

shikanime wants to merge 9 commits into
pr/cluster-migrationfrom
cluster-pipeline

Conversation

@shikanime

Copy link
Copy Markdown
Member

Issues liées

#2495 (PR empilée, se rebaser sur main après sa fusion)


Quel est le comportement actuel ?

Les méthodes de ClusterService orchestrent impérativement les requêtes Prisma, les hooks d'événements et les logs ; les erreurs métier sont levées par exceptions HTTP depuis le service.

Quel est le nouveau comportement ?

Le module cluster est composé en pipelines Effect déclaratifs : le service retourne des valeurs Effect (Effect.gen + pipe), le contrôleur décode l'entrée, exécute l'effet et mappe les erreurs métier typées (ClusterNotFound, LabelTaken, EnvironmentsActive, HookFailed) vers les statuts HTTP 404/409/400/422. Les lectures sont rejouées avec un backoff exponentiel jitteré. Les écritures (create, update, delete) transitent par le pipeline avec hooks upsert et logs.

Cette PR introduit-elle un breaking change ?

Non.

Autres informations

  • 12/12 tests cluster, build et lint verts, pnpm test racine exit 0.

@shikanime
shikanime requested a review from a team as a code owner September 21, 2026 13:52
@github-actions github-actions Bot added the built label Sep 21, 2026
@shikanime
shikanime force-pushed the cluster-pipeline branch 19 times, most recently from 12c8009 to ca4638d Compare September 22, 2026 08:35
@shikanime
shikanime marked this pull request as draft September 22, 2026 08:50
@shikanime
shikanime force-pushed the cluster-pipeline branch 4 times, most recently from dc78a38 to 632bff8 Compare September 22, 2026 09:18
@shikanime
shikanime force-pushed the cluster-pipeline branch 3 times, most recently from 632bff8 to 2ea571f Compare September 22, 2026 09:54
@shikanime
shikanime force-pushed the pr/cluster-migration branch 5 times, most recently from f456a32 to ae1f311 Compare September 30, 2026 17:42

@shikanime shikanime left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict : Commentaire

La composition Effect est propre et la conversion service→pipelines respecte le style du repo, mais le chemin force de deleteClusterRow régresse par rapport à la base de la pile : il supprime les environnements sans supprimer la ligne du cluster lui-même. Deux assertions de hook (emitAsync/addLog) ont aussi disparu des specs — c'est précisément le contrat strangler qu'on doit verrouiller ici. À corriger avant rebase sur #2495.

Comment thread apps/server-nestjs/src/modules/cluster/cluster.service.ts Outdated
Comment thread apps/server-nestjs/src/modules/cluster/cluster.service.ts Outdated
Comment thread apps/server-nestjs/src/modules/cluster/cluster.service.spec.ts Outdated
Comment thread apps/server-nestjs/package.json Outdated
Comment thread apps/server-nestjs/src/modules/cluster/cluster.service.ts Outdated
@shikanime
shikanime force-pushed the pr/cluster-migration branch from ae1f311 to 7e804f0 Compare October 1, 2026 10:22
@shikanime
shikanime force-pushed the cluster-pipeline branch 5 times, most recently from 79951d1 to 283771a Compare October 1, 2026 15:10
@shikanime
shikanime force-pushed the pr/cluster-migration branch from 752050a to ea5c6f0 Compare October 1, 2026 15:40
shikanime and others added 9 commits October 1, 2026 17:46
rebases cleanly.

Signed-off-by: Shikanime Deva <22115108+shikanime@users.noreply.github.com>
ClusterService injects EventEmitter2; import EventsModule so the provider resolves and the backend stops crashing at boot.

Co-authored-by: Automata <automata@shikanime.studio>
Signed-off-by: William Phetsinorath <william.phetsinorath-open@interieur.gouv.fr>
Signed-off-by: William Phetsinorath <william.phetsinorath-open@interieur.gouv.fr>
Change-Id: Ie239c572870d655ca697a5ad53e487496a6a6964
Co-authored-by: Automata <automata@shikanime.studio>
Signed-off-by: William Phetsinorath <william.phetsinorath-open@interieur.gouv.fr>
Change-Id: I93db2e1e646d689dee53abaf14959ba66a6a6964
Co-authored-by: Automata <automata@shikanime.studio>
Signed-off-by: William Phetsinorath <william.phetsinorath-open@interieur.gouv.fr>
Co-authored-by: Automata <automata@shikanime.studio>
Signed-off-by: William Phetsinorath <william.phetsinorath-open@interieur.gouv.fr>
Type the cluster service spec against real dependencies: mockDeep<PrismaService>, mockDeep EventEmitter2/LogService doubles with resolved promises and a satisfies-checked BaseConfig fixture, replacing all 'as never' constructor and mockResolvedValue escapes.

Co-authored-by: Automata <automata@shikanime.studio>
Signed-off-by: William Phetsinorath <william.phetsinorath-open@interieur.gouv.fr>
Change-Id: I7c729fa65527c99287cba4eace43b2956a6a6964
No spec imports it.effect/it.prop; the specs run Effect.runPromise
directly. Remove it from the package and the pnpm catalog.

Signed-off-by: William Phetsinorath <william.phetsinorath-open@interieur.gouv.fr>
Change-Id: Ie50f5fa9fde1ef9edee61da76c3aa1426a6a6964
@cloud-pi-native-sonarqube

Copy link
Copy Markdown

Comment thread apps/client/scripts/generate-icons.sh
Comment thread apps/server-nestjs/src/modules/cluster/cluster.module.ts

@StephaneTrebel StephaneTrebel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

La branche est à jour sur sa base empilée pr/cluster-migration, mais elle introduit une fuite de fichier temporaire dans le générateur d’icônes et un import de module dupliqué. Corriger ces deux constats, puis relancer les contrôles de la pile avant nouvelle revue.

@shikanime shikanime closed this Oct 2, 2026
@github-project-automation github-project-automation Bot moved this from Hypotheses to Done in Cloud Pi Native Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

built refactor Refactor code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants