fix(ENG-2000): make a failed strategy update actually fail the job - #60
Closed
pierremarsotlyon1 wants to merge 1 commit into
Closed
fix(ENG-2000): make a failed strategy update actually fail the job#60pierremarsotlyon1 wants to merge 1 commit into
pierremarsotlyon1 wants to merge 1 commit into
Conversation
writeFileFromPromise already skips the write on a rejection, so the previously
published JSON was preserved and no zero was committed. But the scripts then
resolved normally: updateStrats.ts logged the rejection and exited 0, so the
workflow step reported success and the commit step ran anyway on a partial
update.
Two levels had to change, because fixing only the outer one did nothing:
updateCurveStrats / updatePassiveStrats raise an AggregateError after writing
whatever succeeded — they have their own inner Promise.allSettled, which
swallowed the rejection before it could ever reach the caller.
updateStrats / updateV2Strats set process.exitCode = 1 once every
protocol has had its chance to finish.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Linear: ENG-2000
Trouvé par une revue Codex du chantier ENG-2000. Indépendant du reste : ce correctif vaut aussi sans la migration.
Le problème
Le workflow régénère les JSON puis committe :
Les scripts utilisent
Promise.allSettledpour qu'un protocole en panne n'empêche pas les autres de finir — c'est voulu. Mais ils se contentaient de logger les rejets et rendaient la main normalement.Donc : panne du hub → le reader lève →
writeFileFromPromisesaute l'écriture, donc le JSON précédent est bien préservé et aucun zéro n'est publié → mais le script sort en code 0, l'étape passe au vert, et l'étape de commit s'exécute quand même.Le job réussissait donc alors qu'un protocole n'avait rien produit, sans alerte.
Pourquoi 4 fichiers et pas 2
Corriger les deux scripts extérieurs ne suffisait pas :
updateCurveStratsetupdatePassiveStratsont leur proprePromise.allSettledinterne, qui absorbait le rejet avant qu'il n'atteigne le compteur extérieur.strategies/updateCurveStrats.tsAggregateErroraprès avoir écrit ce qui a réussistrategies/updatePassiveStrats.tsupdateStrats.tsprocess.exitCode = 1si un protocole a échouéupdateV2Strats.tsL'ordre compte : on écrit d'abord, on lève ensuite. Les JSON valides restent à jour, seul le protocole en panne garde son fichier précédent.
Résultat
Avant : hub en 503 → étape verte, commit des autres résultats, silence.
Après : étape rouge, commit sauté,
❌ - 1/6 protocol update(s) failed — exiting non-zero.C'est le pendant côté publication du travail fait côté hub : ne jamais présenter une absence de donnée comme une donnée.
À prévoir au prochain passage sur ce repo
src/lib/strategies/v2.ts:9code en dur l'URL du hub, ce qui rend le chemin v2 intestable en local sans patcher le fichier. À rendre surchargeable lors du bump de@stake-dao/reader(phase 5.7 d'ENG-2000).🤖 Generated with Claude Code