@roomi-fields/grillhouse 0.24.13 → 0.24.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -217,12 +217,23 @@
217
217
  // of its paths and the content of each file it lists, taken before and after the session; the
218
218
  // sheet and the handover do not count) has nothing to deliver, the gesture `rien-a-livrer`, as a
219
219
  // CI skips a job without object: the checks judge the lot; green, the run goes on; red, the
220
- // circuit stops at « sans-livraison », its report sending to the developpeur's handover.
220
+ // circuit stops at « sans-livraison », its report sending to the developpeur's handover. A
221
+ // developpeur that `--depuis developpeur` launches on the lot the integration refused (`refus`,
222
+ // the fingerprint of its plan), as a merge queue lets a lot it sends back pass again only with a
223
+ // change, a session that changes nothing does not go to the checks of the copy, which do not see
224
+ // that red: the developpeur is relaunched once with the refusal, then the
225
+ // circuit stops at « sans-livraison », the refusal as its piece (BP 320.37: three times FAIT
226
+ // without a file changed, the checks of the copy green, the integration red on the same lot).
221
227
  // - A sheet of the developpeur whose `renvoi` names the testwriter says the red that remains lies
222
228
  // in the tests of the lot: the gesture `renvoi-au-testwriter`, whether or not the session
223
- // changed a file: the testwriter, the sending and the handover as his report, then the proof
224
- // and the developpeur. The same sending twice in a row, with no green checks between them, stops
225
- // at « sans-livraison ».
229
+ // changed a file: the testwriter, the sending and the handover as his report, with the red
230
+ // output of the last checks when checks ran since his session, as a CI hands back the log of
231
+ // the check that fails, then the proof and the developpeur. The same sending twice in a row on
232
+ // the same red output of the checks (none, or the same), with no green checks between them,
233
+ // stops at « sans-livraison »: a round trip without a new fact; a sending on another red output
234
+ // relaunches the testwriter (BP 320.37: a first sending before any check, a second after checks
235
+ // that named the guard's line). That output is kept in the state (`controlesRouges`), so that a
236
+ // `--reprendre` or a `--depuis` keeps it.
226
237
  // - The checks after the developpeur judge the plan, as Bazel plays the targets of a change: `npm
227
238
  // test -- <package>` for each package of the plan, touched by the lot or not (a package without a
228
239
  // script `test:vitest` plays only when the lot touches it), `npm test -- <test files of the lot>`
@@ -379,7 +390,9 @@
379
390
  // `<type>(<paquets>): <sujet> (<ticket>)`, the type read from the ticket's type (bug fix,
380
391
  // chore, docs, else feat), its body written once from the final state: the criteria of the plan,
381
392
  // then each deviation the sheets of the developpeur and of the reviewer name (`ecarts`), once by
382
- // its subject, from the last sheet that carries it, with the trailer Co-Authored-By. It runs
393
+ // its subject, from the last sheet that carries it, with the trailer Co-Authored-By; and the
394
+ // references that write files in full (`--references`), which the integration regenerates on
395
+ // main of the moment instead of applying their files from the lot. It runs
383
396
  // scripts/integration/integrer.mjs from the main tree, its output added to the log: 0 is the
384
397
  // commit on agent/<ticket> (which the circuit names from git), the copy removed, the branch in
385
398
  // the queue; 75 (« à repasser ») plays it once more (`rejeu`), then stops at « a-repasser »; any
@@ -413,7 +426,7 @@
413
426
  // - The state is `.claude/worktrees/<ticket>.circuit.json`, written again at each step and at the
414
427
  // start and end of each session: `{ etape, tentative, code, raison, rapport, finale, boucles,
415
428
  // seance, question, questionnement, processus, depart, paquets, constats, verifie, mene, reprise,
416
- // journal }`; `processus` the process of the circuit that writes it, `depart` its start (field
429
+ // refus, journal }`; `processus` the process of the circuit that writes it, `depart` its start (field
417
430
  // 22 of /proc/<pid>/stat), which together name it, a number alone being reused; `questionnement` the work
418
431
  // on the plan under way (`{ objet, role, seance }`: the plan, the explorateur or the
419
432
  // questionneur, its session), null otherwise; `etape` is the state's name of a numbered step of
@@ -430,14 +443,23 @@
430
443
  // the session that runs, null between two; `verifie` the tree of the lot the last whole final
431
444
  // pass green played, null before; `mene` the start (an ISO date) of the step the circuit leads
432
445
  // itself while it runs, null otherwise; `reprise` the session of the testwriter or developpeur
433
- // its relaunches resume, `{ agent, seance }`, null before any.
446
+ // its relaunches resume, `{ agent, seance }`, null before any; `refus` the integration's refusal
447
+ // of the lot (`{ rapport, piece, empreinte, lance, relance }`: its output, its piece, the
448
+ // fingerprint of the plan refused, whether `--depuis developpeur` launched the developpeur on it,
449
+ // whether a session so launched left it unchanged once), null before any, once the integration
450
+ // accepts the lot, and on a run from the testwriter.
434
451
  // - `--reprendre` starts again at the step of the state, its report given to the next session,
435
452
  // after any stop, the death of the circuit included. A session the state names
436
453
  // that still runs is waited for first, and stopped when it stands still as long as a motionless
437
- // session. On a stop « questionnement », it lets the plan pass as it is then (the supervisor
454
+ // session. On a stop « integration », it plays the integration (or the queue) again on the same
455
+ // lot, as bors retries: a refusal can come from the load or from main (BP 320.16, 320.16.2). On
456
+ // a stop « questionnement », it lets the plan pass as it is then (the supervisor
438
457
  // changed it or kept it), from the testwriter.
439
458
  // - `--depuis <testwriter|developpeur>` has the lot corrected: it plays the whole ticket from
440
- // that step, the text of `--contexte` on the line CONTEXTE of each agent of the run, as a retry
459
+ // that step, the text of `--contexte` on the line CONTEXTE of each agent of the run (after a stop
460
+ // « integration », from the developpeur, the refusal as his report, the red to lift, as a merge
461
+ // queue sends the lot back to its author with the log of its check; from the testwriter, the
462
+ // refusal dropped), as a retry
441
463
  // of GitLab CI plays the jobs after it with the same variables: from the testwriter, his proof,
442
464
  // then the developpeur launched by a red of the proof as without `--depuis`; from the
443
465
  // developpeur, his checks; then the final pass, the reviewer and the integration. It goes with
@@ -484,9 +506,11 @@
484
506
  // (the third developpeur of the checks or of the final pass leaves a red check, a red of the
485
507
  // final pass out of the plan or that no package of the plan holds, or reds to settle),
486
508
  // 15 sans-livraison (a developpeur session that changes no file of the plan, its checks red; the
487
- // first session of a `--reprendre` whose plan already holds changes goes on to the checks; or
488
- // the developpeur's same sending to the testwriter twice in a row, no green checks between
489
- // them), 16 relecture-arret (a finding without a valid agent, one on a criterion, the third
509
+ // first session of a `--reprendre` whose plan already holds changes goes on to the checks; a
510
+ // second developpeur session that `--depuis developpeur` launched on the lot the integration
511
+ // refused and that changes nothing; or
512
+ // the developpeur's same sending to the testwriter twice in a row, on the same red output of the
513
+ // checks, no green checks between them), 16 relecture-arret (a finding without a valid agent, one on a criterion, the third
490
514
  // RENDU), 17 integration (the integration script refuses the lot, or the queue reopens the
491
515
  // ticket), 19 hors-portee (a testwriter or developpeur whose sheet says BLOQUÉ, without a
492
516
  // sending to the testwriter, or a developpeur's FAIT with criteria out of the plan), 20 besoin (a testwriter or developpeur whose sheet says BESOIN, a
@@ -564,7 +588,7 @@ import {
564
588
  } from './resultats.mjs';
565
589
  import { AUTEUR_DE_LA_FILE, INTEGRE } from './integration/file.mjs';
566
590
  import { dossierCommun, lireEntrees } from './integration/file-attente.mjs';
567
- import { refusArbitrage } from './integration/integrer.mjs';
591
+ import { couvertPar, refusArbitrage } from './integration/integrer.mjs';
568
592
  import { AUTEUR_DU_VERDICT } from './integration/verdict.mjs';
569
593
  import { attendreUnPeu } from './verrou-de-fichier.mjs';
570
594
  import { AttenteDeLaMachine, avecLaMachine } from './verrou-de-machine.mjs';
@@ -646,7 +670,11 @@ const generateur = (script, ...args) =>
646
670
  // gardes }`, `lit` the files of the copy it reads that another reference writes (as the
647
671
  // prerequisites of a rule of make: the index reads the interfaces, whose generated part the API
648
672
  // reports write), `gardes` the names the findings its regeneration lifts carry (their guard or
649
- // their rule).
673
+ // their rule), `entiers` the files of `fichiers` its command writes in full, which the integration
674
+ // does not apply from the lot but regenerates on main of the moment
675
+ // (scripts/integration/integrer.mjs): the index, the turbo.json of the packages (the root's is
676
+ // written in part); not the API reports, which read the build, nor the debt, which reads the notes
677
+ // of a pass.
650
678
  const REFERENCES_DU_CADRE = [
651
679
  {
652
680
  nom: "l'index des interfaces",
@@ -654,6 +682,7 @@ const REFERENCES_DU_CADRE = [
654
682
  fichiers: ['docs/agents/index-des-interfaces.md'],
655
683
  lit: ['docs/INTERFACE.md', '**/docs/INTERFACE.md'],
656
684
  gardes: ['index-interfaces'],
685
+ entiers: ['docs/agents/index-des-interfaces.md'],
657
686
  },
658
687
  {
659
688
  nom: 'les turbo.json des paquets',
@@ -661,6 +690,7 @@ const REFERENCES_DU_CADRE = [
661
690
  fichiers: ['turbo.json', 'turbo.jsonc', '**/turbo.json'],
662
691
  lit: [],
663
692
  gardes: ['turbo-des-paquets'],
693
+ entiers: ['*/**/turbo.json'],
664
694
  },
665
695
  {
666
696
  nom: "les rapports d'API",
@@ -673,6 +703,7 @@ const REFERENCES_DU_CADRE = [
673
703
  ],
674
704
  lit: [],
675
705
  gardes: ['rapport-api', 'partie-generee'],
706
+ entiers: [],
676
707
  },
677
708
  {
678
709
  nom: 'la dette des gardes',
@@ -680,6 +711,7 @@ const REFERENCES_DU_CADRE = [
680
711
  fichiers: [DETTE],
681
712
  lit: [],
682
713
  gardes: [],
714
+ entiers: [],
683
715
  abaisser: true,
684
716
  },
685
717
  ];
@@ -980,8 +1012,8 @@ function ecrireRapport(ctx, etape, texte, resultat, rapport = texte) {
980
1012
  }
981
1013
 
982
1014
  // The state of the run, written whole (`seance` and `question` null and `finale` false unless <etat>
983
- // sets them, `processus`, `paquets`, `constats`, `verifie`, `reprise` and `aRegenerer` the
984
- // run's), kept as the run's current state.
1015
+ // sets them, `processus`, `paquets`, `constats`, `verifie`, `reprise`, `aRegenerer`, `refus` and
1016
+ // `controlesRouges` the run's), kept as the run's current state.
985
1017
  function ecrireEtat(ctx, etat) {
986
1018
  ctx.courant = {
987
1019
  finale: false,
@@ -998,6 +1030,8 @@ function ecrireEtat(ctx, etat) {
998
1030
  verifie: ctx.verifie ?? null,
999
1031
  reprise: ctx.reprise ?? null,
1000
1032
  aRegenerer: ctx.aRegenerer ?? null,
1033
+ refus: ctx.refus ?? null,
1034
+ controlesRouges: ctx.controlesRouges ?? null,
1001
1035
  };
1002
1036
  const provisoire = `${ctx.etat}.${process.pid}`;
1003
1037
  writeFileSync(
@@ -1257,11 +1291,12 @@ function consigne(valeurs, rang = 0) {
1257
1291
  // the plan, and the last handover of its author at the ticket. Every instruction, fresh or resumed,
1258
1292
  // carries the findings of the reviewer still open for its role (`ctx.constats`), all of them,
1259
1293
  // whatever the relaunch: a proof refused, red checks, a sending, a RENDU, a resumption of the
1260
- // supervisor; a developpeur's sheet FAIT answers each of his by its title (`reponsesAuxConstats`),
1294
+ // supervisor; <change> says what changed on a resumption, when it is not the proof or the checks
1295
+ // (the integration's refusal of the lot, `refus`); a developpeur's sheet FAIT answers each of his by its title (`reponsesAuxConstats`),
1261
1296
  // refused without one, and the circuit keeps each answer with its finding (`avecLesReponses`).
1262
1297
  // Throws an Arret for a launch that stops before its session, a motionless session, or
1263
1298
  // a session that ends twice without a sheet that conforms.
1264
- async function seance(ctx, role, { tentative, rapport, fort, derniere }) {
1299
+ async function seance(ctx, role, { tentative, rapport, fort, derniere, change }) {
1265
1300
  const nom = nomDuRole(role);
1266
1301
  const reprise = tentative > 1 && !derniere && ctx.reprise?.agent === role ? ctx.reprise : null;
1267
1302
  const constats = texteDesOuverts(ouverts(ctx, role));
@@ -1281,9 +1316,10 @@ async function seance(ctx, role, { tentative, rapport, fort, derniere }) {
1281
1316
  paquets: plan,
1282
1317
  tentative,
1283
1318
  change:
1284
- role === 'testwriter'
1319
+ change ??
1320
+ (role === 'testwriter'
1285
1321
  ? 'la preuve du rouge, jouée après ta séance, refuse ton lot'
1286
- : 'les contrôles, joués après ta séance, sont rouges',
1322
+ : 'les contrôles, joués après ta séance, sont rouges'),
1287
1323
  rapport: rapport ?? 'aucun',
1288
1324
  constats,
1289
1325
  };
@@ -1771,9 +1807,9 @@ function laPasseFinale(ctx) {
1771
1807
 
1772
1808
  // The references of the circuit: those the project declares in the package.json of the copy
1773
1809
  // (`grillhouse.references`), each `{ nom, commande, fichiers, tests, lit, gardes }` with a name, a
1774
- // command and files, `tests`, `lit` and `gardes` arrays when given, empty when not; then the frame's
1775
- // (REFERENCES_DU_CADRE, `cadre`), each but one whose first file a reference of the project covers,
1776
- // which replaces it.
1810
+ // command and files, `tests`, `lit` and `gardes` arrays when given, empty when not, `entiers` empty;
1811
+ // then the frame's (REFERENCES_DU_CADRE, `cadre`), each but one whose first file a reference of the
1812
+ // project covers, which replaces it.
1777
1813
  function lesReferences(ctx) {
1778
1814
  const l = lireJson(path.join(existsSync(ctx.copie) ? ctx.copie : ctx.racine, 'package.json'))
1779
1815
  ?.grillhouse?.references;
@@ -1793,6 +1829,7 @@ function lesReferences(ctx) {
1793
1829
  tests: r.tests ?? [],
1794
1830
  lit: r.lit ?? [],
1795
1831
  gardes: r.gardes ?? [],
1832
+ entiers: [],
1796
1833
  cadre: false,
1797
1834
  }));
1798
1835
  const duCadre = REFERENCES_DU_CADRE.filter(
@@ -1801,16 +1838,6 @@ function lesReferences(ctx) {
1801
1838
  return [...duProjet, ...duCadre];
1802
1839
  }
1803
1840
 
1804
- // Whether one of <motifs> covers the file <fichier>, both from the root of the copy, as the
1805
- // inputs of Turborepo read them: a path names that file, a directory every file under it, a glob
1806
- // pattern (`*`, `**`) the files it matches (`path.matchesGlob` of Node).
1807
- export function couvertPar(motifs, fichier) {
1808
- return motifs.some(m => {
1809
- const dossier = m.replace(/\/+$/, '');
1810
- return fichier === dossier || fichier.startsWith(`${dossier}/`) || path.matchesGlob(fichier, m);
1811
- });
1812
- }
1813
-
1814
1841
  // The references a red of <lieux> is one of (each `{ fichier, gardes, dansLePlan }`, its file, the
1815
1842
  // names its finding carries, and whether a path of the plan holds it), however many other reds
1816
1843
  // stand beside it, as `--update-snapshots` updates the snapshots that fail and leaves the other
@@ -2035,12 +2062,17 @@ function arretHorsDuPlan(ctx, tentative, fiche) {
2035
2062
  }
2036
2063
 
2037
2064
  // The sending to the testwriter in the developpeur's sheet <fiche> (its `renvoi`): what the
2038
- // testwriter receives, the sending, then the developpeur's handover; null without a sending.
2065
+ // testwriter receives, the sending, the developpeur's handover, then the red output of the last
2066
+ // checks when checks ran since the testwriter's session (`ctx.controlesRouges`); null without a
2067
+ // sending.
2039
2068
  function renvoiDe(ctx, fiche) {
2040
2069
  if (!fiche.renvoi) return null;
2041
2070
  const passation = derniereDe(ctx, 'developpeur')?.text ?? 'aucune';
2042
2071
  const raison = fiche.raison ? ` : ${fiche.raison}` : '';
2043
- return `Le développeur renvoie le rouge qui reste aux tests du lot${raison}.\n\nSa passation :\n\n${passation}`;
2072
+ const controles = ctx.controlesRouges
2073
+ ? `\n\nLa sortie rouge des derniers contrôles :\n\n${ctx.controlesRouges}`
2074
+ : '';
2075
+ return `Le développeur renvoie le rouge qui reste aux tests du lot${raison}.\n\nSa passation :\n\n${passation}${controles}`;
2044
2076
  }
2045
2077
 
2046
2078
  // The findings of the reviewer still open for <role> (`ctx.constats`), in their order.
@@ -2086,7 +2118,8 @@ function constatsOuverts(ctx, fiche, texte) {
2086
2118
  return [...restes, ...neufs];
2087
2119
  }
2088
2120
 
2089
- // The integration of the lot: its two patches and its message, written from the copy, then
2121
+ // The integration of the lot: its two patches, its message and the references that write files in
2122
+ // full (`--references`, from `lesReferences`, the one list), written from the copy, then
2090
2123
  // scripts/integration/integrer.mjs from the main tree, its output added to the log. A run « à
2091
2124
  // repasser » (75) plays once more, the gesture `rejeu`. `{ code, sortie, args }`.
2092
2125
  function integrer(ctx) {
@@ -2115,6 +2148,20 @@ function integrer(ctx) {
2115
2148
  const message = path.join(ctx.tmp, 'message');
2116
2149
  writeFileSync(message, messageDeCommit(ctx));
2117
2150
  args.push('--message', message);
2151
+ const entieres = lesReferences(ctx)
2152
+ .filter(r => r.entiers.length)
2153
+ .map(({ nom, commande, fichiers, entiers, cadre }) => ({
2154
+ nom,
2155
+ commande,
2156
+ fichiers,
2157
+ entiers,
2158
+ cadre,
2159
+ }));
2160
+ if (entieres.length) {
2161
+ const f = path.join(ctx.tmp, 'references.json');
2162
+ writeFileSync(f, `${JSON.stringify(entieres)}\n`);
2163
+ args.push('--references', f);
2164
+ }
2118
2165
  let r;
2119
2166
  for (let essai = 1; essai <= 2; essai++) {
2120
2167
  entete(ctx, 'integration');
@@ -3121,6 +3168,8 @@ async function derouler(ctx, debut) {
3121
3168
  let { etape, tentative, rapport, finale } = debut;
3122
3169
  // The step a `--reprendre` starts at, the first of the loop.
3123
3170
  let reprise = Boolean(ctx.reprendre);
3171
+ // A developpeur relaunched on the integration's refusal of the lot he left unchanged.
3172
+ let relanceSurLeRefus = false;
3124
3173
  for (;;) {
3125
3174
  const reprend = reprise;
3126
3175
  reprise = false;
@@ -3160,6 +3209,8 @@ async function derouler(ctx, debut) {
3160
3209
  });
3161
3210
  // A testwriter who declares himself blocked or in need of an answer goes up to the supervisor.
3162
3211
  if (fiche.statut !== 'FAIT') throw arretDuStatut(ctx, 'testwriter', tentative, fiche);
3212
+ // No checks have run since this session.
3213
+ ctx.controlesRouges = null;
3163
3214
  commenter(ctx, 'testwriter', `séance ${tentative} finie, sa fiche lue.`);
3164
3215
  etape = PREUVE;
3165
3216
  } else if (etape === PREUVE) {
@@ -3197,7 +3248,9 @@ async function derouler(ctx, debut) {
3197
3248
  rapport,
3198
3249
  fort,
3199
3250
  derniere: fort,
3251
+ change: relanceSurLeRefus ? CHANGE_DU_REFUS : undefined,
3200
3252
  });
3253
+ relanceSurLeRefus = false;
3201
3254
  // A question goes up to the supervisor; a red out of reach, to the testwriter its sheet sends
3202
3255
  // it to, else up to the supervisor.
3203
3256
  if (fiche.statut === 'BESOIN') {
@@ -3207,17 +3260,20 @@ async function derouler(ctx, debut) {
3207
3260
  if (renvoi) {
3208
3261
  // The red that remains lies in the tests of the lot: the gesture `renvoi-au-testwriter`,
3209
3262
  // the testwriter, the sending and the handover as its report, then the proof and the
3210
- // developpeur.
3211
- if (ctx.renvoiAuTestwriter) {
3263
+ // developpeur. `renvoiAuTestwriter` keeps the red output of the checks the sending before
3264
+ // carried ('' for none), null after green checks: the same output twice in a row is a
3265
+ // round trip without a new fact.
3266
+ const sortie = ctx.controlesRouges ?? '';
3267
+ if (ctx.renvoiAuTestwriter === sortie) {
3212
3268
  if (empreinte(ctx) === avant) {
3213
3269
  inscrire(ctx, { role: AUTEUR_DU_CIRCUIT, etape: CODE, inchange: true });
3214
3270
  }
3215
3271
  throw new Arret(
3216
3272
  'sans-livraison',
3217
- `La fiche de la séance ${tentative} du développeur renvoie une deuxième fois de suite au testwriter, sans contrôles verts depuis le premier renvoi : le testwriter n'a pas levé ce rouge.\n\n${renvoi}`
3273
+ `La fiche de la séance ${tentative} du développeur renvoie une deuxième fois de suite au testwriter, sur la même sortie rouge des contrôles que le premier renvoi (aucune, ou la même), sans contrôles verts entre eux : le testwriter n'a pas levé ce rouge.\n\n${renvoi}`
3218
3274
  );
3219
3275
  }
3220
- ctx.renvoiAuTestwriter = true;
3276
+ ctx.renvoiAuTestwriter = sortie;
3221
3277
  commenter(
3222
3278
  ctx,
3223
3279
  'developpeur',
@@ -3235,6 +3291,30 @@ async function derouler(ctx, debut) {
3235
3291
  }
3236
3292
  if (fiche.hors_plan?.length) throw arretHorsDuPlan(ctx, tentative, fiche);
3237
3293
  const inchangee = empreinte(ctx) === avant;
3294
+ if (inchangee && ctx.refus?.lance && ctx.refus.empreinte === avant) {
3295
+ // The lot the integration refused, unchanged: as a merge queue lets a lot pass again only
3296
+ // with a change, neither the gesture `rien-a-livrer` nor the checks of the copy, which
3297
+ // the refusal does not see; the developpeur relaunched once with the refusal, then the
3298
+ // stop goes up.
3299
+ inscrire(ctx, { role: AUTEUR_DU_CIRCUIT, etape: CODE, inchange: true });
3300
+ if (ctx.refus.relance) {
3301
+ throw new Arret(
3302
+ 'sans-livraison',
3303
+ `La séance ${tentative} du développeur ne change aucun fichier du plan (${ctx.paquets.join(', ')}), une seconde fois sur le lot que l'intégration refuse.\n\n${ctx.refus.rapport}`,
3304
+ { piece: ctx.refus.piece }
3305
+ );
3306
+ }
3307
+ ctx.refus = { ...ctx.refus, relance: true };
3308
+ commenter(
3309
+ ctx,
3310
+ 'developpeur',
3311
+ `séance ${tentative}${fort ? ' (opus, effort high)' : ''} finie sans changement, sur le lot que l'intégration refuse : le circuit le relance une fois, le refus comme rapport.`
3312
+ );
3313
+ tentative++;
3314
+ rapport = rapportDuRefus(ctx.refus);
3315
+ relanceSurLeRefus = true;
3316
+ continue;
3317
+ }
3238
3318
  if (inchangee && reprend && livre(ctx)) {
3239
3319
  // A resumed developpeur that finds the lot delivered: the checks judge it.
3240
3320
  commenter(
@@ -3269,6 +3349,8 @@ async function derouler(ctx, debut) {
3269
3349
  ? { arbre: arbreDeLaCopie(ctx), restreinte: regeneration.restreinte }
3270
3350
  : laPasseFinale(ctx);
3271
3351
  const k = controles(ctx, passeFinale, passe.restreinte, regeneration?.reportes ?? null);
3352
+ // The output of these checks, red, which a sending to the testwriter carries.
3353
+ ctx.controlesRouges = k.rouge ? k.texte : null;
3272
3354
  // The outcome the bilan reads (scripts/bilan.mjs): with the reds, each its place and its
3273
3355
  // text, by which it knows two checks that measured the same thing.
3274
3356
  const resultat = issue => ({
@@ -3369,7 +3451,7 @@ async function derouler(ctx, debut) {
3369
3451
  resultat('vert'),
3370
3452
  `${k.resume}.${k.avertissements}`
3371
3453
  );
3372
- ctx.renvoiAuTestwriter = false;
3454
+ ctx.renvoiAuTestwriter = null;
3373
3455
  ctx.aRegenerer = {
3374
3456
  noms: k.references.map(r => r.nom),
3375
3457
  notes: [],
@@ -3387,7 +3469,7 @@ async function derouler(ctx, debut) {
3387
3469
  `${k.resume}.${k.avertissements}`
3388
3470
  );
3389
3471
  // Green checks: a sending of the developpeur to the testwriter may come again.
3390
- ctx.renvoiAuTestwriter = false;
3472
+ ctx.renvoiAuTestwriter = null;
3391
3473
  if (!passeFinale) {
3392
3474
  // The checks green: the final pass, its sessions counted apart.
3393
3475
  etape = CONTROLES;
@@ -3511,12 +3593,13 @@ async function derouler(ctx, debut) {
3511
3593
  const r = integrer(ctx);
3512
3594
  if (r.code === A_REPASSER) throw new Arret('a-repasser', fin(r.sortie, 40));
3513
3595
  if (r.code !== 0) {
3514
- throw new Arret(
3515
- 'integration',
3596
+ throw refuser(
3597
+ ctx,
3516
3598
  `Le script d'intégration refuse le lot (code ${r.code}).\n\n${fin(r.sortie, 60)}`,
3517
- { piece: `$ node ${INTEGRER} ${r.args.join(' ')}\n${fin(r.sortie, 30)}` }
3599
+ `$ node ${INTEGRER} ${r.args.join(' ')}\n${fin(r.sortie, 30)}`
3518
3600
  );
3519
3601
  }
3602
+ ctx.refus = null;
3520
3603
  const branche = `agent/${ctx.ticket}`;
3521
3604
  const commit = spawnSync('git', ['-C', ctx.racine, 'rev-parse', '--short', branche], {
3522
3605
  encoding: 'utf8',
@@ -3535,9 +3618,7 @@ async function derouler(ctx, debut) {
3535
3618
  continue;
3536
3619
  }
3537
3620
  if (f.etat === 'en-file') throw new Arret('a-repasser', f.raison);
3538
- throw new Arret('integration', `La file rouvre le ticket.\n\n${f.raison}`, {
3539
- piece: f.raison,
3540
- });
3621
+ throw refuser(ctx, `La file rouvre le ticket.\n\n${f.raison}`, f.raison);
3541
3622
  } else if (etape === TRI) {
3542
3623
  // The lot is on main: the tri of its discoveries, which neither stops nor undoes it.
3543
3624
  await trier(ctx);
@@ -3584,6 +3665,25 @@ async function derouler(ctx, debut) {
3584
3665
  }
3585
3666
  }
3586
3667
 
3668
+ // What changed for a developpeur relaunched on the integration's refusal of the lot he left as it was.
3669
+ const CHANGE_DU_REFUS =
3670
+ 'l’intégration refuse ton lot, et ta séance n’a changé aucun fichier du plan : son refus, dans le rapport ci-dessous, est le rouge à lever';
3671
+
3672
+ // The stop « integration » of the motive <rapport> and the piece <piece>, the refusal of the lot
3673
+ // kept in the state (`refus`: `{ rapport, piece, empreinte, lance, relance }`, the fingerprint of
3674
+ // the plan refused, whether a --depuis developpeur launched the developpeur on it, and whether a
3675
+ // session so launched already left it unchanged once), which --depuis developpeur gives the
3676
+ // developpeur.
3677
+ function refuser(ctx, rapport, piece) {
3678
+ ctx.refus = { rapport, piece, empreinte: empreinte(ctx), lance: false, relance: false };
3679
+ return new Arret('integration', rapport, { piece });
3680
+ }
3681
+
3682
+ // The developpeur's report on the integration's refusal <refus>: the red to lift, which the checks
3683
+ // of the copy, green, do not see.
3684
+ const rapportDuRefus = refus =>
3685
+ `L’intégration refuse ce lot : son refus, ci-dessous, est le rouge à lever ; les contrôles de ta copie, verts, ne le voient pas, et le lot ne repasse à l’intégration qu’avec un changement.\n\n${refus.rapport}`;
3686
+
3587
3687
  // The gesture <genre> of the circuit (scripts/etapes.mjs, GESTES), with no session: its line at
3588
3688
  // the ticket and in the log, with its rule.
3589
3689
  function geste(ctx, genre) {
@@ -3641,10 +3741,18 @@ async function conduire(ctx, d) {
3641
3741
  return monter(ctx, a);
3642
3742
  }
3643
3743
 
3644
- // Where the run starts: the step a --depuis names (the testwriter's or the developpeur's), the
3645
- // step of the state <e> (null without one) on --reprendre, else the testwriter, the run starting
3646
- // over.
3744
+ // Where the run starts: after a stop « integration », on --depuis developpeur, the developpeur,
3745
+ // the refusal (`refus`) as his report, the session so launched marked (`lance`), as a merge queue
3746
+ // sends the lot back to its author with the log of its check; else the step a --depuis names (the
3747
+ // testwriter's, which makes the lot again, the refusal dropped, or the developpeur's), the step of
3748
+ // the state <e> (null without one) on --reprendre, the integration or the queue played again on
3749
+ // the same lot after their stop, as bors retries, else the testwriter, the run starting over.
3647
3750
  function depart(ctx, e) {
3751
+ if (ctx.depuis === 'developpeur' && e?.raison === 'integration' && ctx.refus) {
3752
+ ctx.refus = { ...ctx.refus, lance: true, relance: false };
3753
+ return { etape: CODE, tentative: 1, rapport: rapportDuRefus(ctx.refus), finale: false };
3754
+ }
3755
+ if (ctx.depuis === 'testwriter') ctx.refus = null;
3648
3756
  if (ctx.depuis) {
3649
3757
  return {
3650
3758
  etape: ctx.depuis === 'testwriter' ? TESTS : CODE,
@@ -3654,9 +3762,11 @@ function depart(ctx, e) {
3654
3762
  };
3655
3763
  }
3656
3764
  if (!ctx.reprendre) {
3657
- // The run starts over: no lot verified, no finding of a review open.
3765
+ // The run starts over: no lot verified, no finding of a review open, no refusal, no checks played.
3658
3766
  ctx.verifie = null;
3659
3767
  ctx.constats = [];
3768
+ ctx.refus = null;
3769
+ ctx.controlesRouges = null;
3660
3770
  return { etape: TESTS, tentative: 1, rapport: null, finale: false };
3661
3771
  }
3662
3772
  if (!e) throw new Usage(`rien à reprendre : ${ctx.etat} n'existe pas.`);
@@ -4107,6 +4217,7 @@ async function arreter(ctx, e) {
4107
4217
  ctx.constats = [...(lu.constats ?? [])];
4108
4218
  ctx.verifie = lu.verifie ?? null;
4109
4219
  ctx.reprise = lu.reprise ?? null;
4220
+ ctx.refus = lu.refus ?? null;
4110
4221
  ecrireEtat(ctx, {
4111
4222
  etape: lu.etape,
4112
4223
  tentative: lu.tentative,
@@ -4178,11 +4289,14 @@ export async function main(argv) {
4178
4289
  mkdirSync(path.dirname(ctx.copie), { recursive: true });
4179
4290
  let e = existsSync(ctx.etat) ? JSON.parse(readFileSync(ctx.etat, 'utf8')) : null;
4180
4291
  // The findings of the reviewer still open, the lot the whole final pass verified, the session a
4181
- // relaunch resumes, and the references a regeneration has to run, kept from one run to the next.
4292
+ // relaunch resumes, the references a regeneration has to run, the integration's refusal of
4293
+ // the lot, and the red output of the last checks, kept from one run to the next.
4182
4294
  ctx.constats = [...(e?.constats ?? [])];
4183
4295
  ctx.verifie = e?.verifie ?? null;
4184
4296
  ctx.reprise = e?.reprise ?? null;
4185
4297
  ctx.aRegenerer = e?.aRegenerer ?? null;
4298
+ ctx.refus = e?.refus ?? null;
4299
+ ctx.controlesRouges = e?.controlesRouges ?? null;
4186
4300
  // The supervisor's answers to a question: stop the circuit, or extend its plan and resume.
4187
4301
  if (ctx.arreter) return await arreter(ctx, e);
4188
4302
  // A circuit that outlives its caller is still the ticket's: no second run beside it.
@@ -31,7 +31,7 @@
31
31
  # circuit gives them, so that a relaunch of an agent on its step resumes its session. The two
32
32
  # together are refused, CODE_USAGE; each takes a value as --modele does.
33
33
  # A resumed session receives its instruction alone: the session it resumes holds the sections
34
- # the launcher adds below, save « La construction de ton paquet échoue », which it receives.
34
+ # the launcher adds below, save « La construction échoue », which it receives.
35
35
  # - The agent's copy is the worktree .claude/worktrees/<ticket> (branch agent/<ticket>), created
36
36
  # from the main tree's HEAD when absent and moved forward to it otherwise. When the branch exists
37
37
  # without a copy, it is brought back to the main tree's HEAD and the copy is made on it: the lot
@@ -68,10 +68,16 @@
68
68
  # traces> --filter=<paquet>...… --continue=dependencies-successful`), whose failure does not
69
69
  # stop it: each task whose
70
70
  # dependencies succeed goes to its end, so what their tests read without depending on them is
71
- # built whole; the session opens, its instruction ending with a section « La construction de ton
72
- # paquet échoue » with the end of that output, since repairing it is the session's work (a
71
+ # built whole; the session opens, its instruction ending with a section « La construction
72
+ # échoue » with the end of that output, since repairing it is the session's work (a
73
73
  # provider's lot that breaks its consumers). Their consumers are not built. Any other plan, the
74
- # whole repository (`.`) included, builds the copy whole (`turbo run build`). The
74
+ # whole repository (`.`) included, or a path that is no package of the frame (BPScript's
75
+ # libraries/), reads the graph of the whole copy dry (`turbo run build --dry=json`), whose
76
+ # failure (Turborepo absent, its configuration refused) stops the launch, CODE_COPIE, then builds
77
+ # the copy whole as far as it builds (`turbo run build --continue=dependencies-successful`): its
78
+ # failure does not stop the launch either, and goes into the same section. The first line of the
79
+ # section says which build failed and what was built. The installation and every other step of
80
+ # the preparation stop it, CODE_COPIE. The
75
81
  # installation and the build play through `scripts/sous-modules.sh monter`, each shared submodule
76
82
  # of the main repository read-only, by the list the pose printed, whatever the installation
77
83
  # rewrites afterwards; with a shared submodule and no possible mount (bwrap absent or
@@ -90,7 +96,7 @@
90
96
  # CODE_COPIE), then the
91
97
  # section « Ton dossier de travail », which names the session's working directory, where every
92
98
  # temporary file goes (`dossierDeTravail` of enveloppe.mjs, the envelope's TMPDIR), then the
93
- # section « La construction de ton paquet échoue » when it fails. The prompt
99
+ # section « La construction échoue » when it fails. The prompt
94
100
  # carries « TON TICKET : <ticket> », which the role's locks read. The envelope is the sandbox, so
95
101
  # the session runs without permission prompts, under the rights and the context of its role
96
102
  # (scripts/droits.mjs, given the main tree, the copy and the ticket; a reading that fails stops
@@ -189,8 +195,10 @@ if node --input-type=module -e "import { lireEntrees } from '$ici/../integration
189
195
  echo "$refus" >&2
190
196
  exit "$CODE_COPIE"
191
197
  fi
192
- # The output of the session package's build, when it fails.
198
+ # The output of the session's build, when it fails, behind its first line, which says what failed
199
+ # and what was built (`echouer`).
193
200
  echec=$(mktemp)
201
+ echouer() { local sortie; sortie=$(cat "$echec"); printf '%s\n%s\n' "$1" "$sortie" > "$echec"; }
194
202
  (
195
203
  # Each step returns on failure: `set -e` does not act inside a subshell tested by `||`.
196
204
  if [ ! -d "$copie" ]; then
@@ -243,7 +251,18 @@ echec=$(mktemp)
243
251
  # line; none when a path of the plan is no package of the frame (the root, `.`, a folder).
244
252
  noms=$(node --input-type=module -e "import path from 'node:path'; import { lireLaListe } from '$ici/paquets-du-plan.mjs'; import { paquets } from '$ici/../paquets.mjs'; const [r, liste] = process.argv.slice(1); const tous = paquets(r).filter(p => !p.hors); const l = lireLaListe(liste).map(d => tous.find(p => p.dossier === path.normalize(d).replace(/\/\$/, ''))?.pkg.name ?? null); process.stdout.write(l.length && l.every(Boolean) ? l.join('\n') : '');" "$copie" "$paquets") || exit 1
245
253
  if [ -z "$noms" ]; then
246
- (cd "$copie" && monter npx --no-install turbo run build) || exit 1
254
+ # The graph read dry first: Turborepo absent or its configuration refused is a preparation
255
+ # that fails, which stops the launch. Then the whole copy, built as far as it builds
256
+ # (--continue=dependencies-successful): a failure does not stop the launch, it goes into the
257
+ # instruction, as for a plan of packages.
258
+ (cd "$copie" && monter npx --no-install turbo run build --dry=json > /dev/null) || exit 1
259
+ if ! (cd "$copie" && monter npx --no-install turbo run build --continue=dependencies-successful) > "$echec" 2>&1; then
260
+ cat "$echec"
261
+ echo "⚠️ La construction de la copie échoue : la séance s'ouvre, la consigne porte l'erreur."
262
+ echouer "La construction de la copie entière échoue ; ce qui n'attend pas la construction en échec est construit."
263
+ else
264
+ : > "$echec"
265
+ fi
247
266
  else
248
267
  mapfile -t lesNoms <<<"$noms"
249
268
  cibles=() lecteurs=()
@@ -279,6 +298,7 @@ echec=$(mktemp)
279
298
  if ! (cd "$copie" && monter npx --no-install turbo run build ${ids[@]+"${ids[@]}"} "${lecteurs[@]}" --continue=dependencies-successful) > "$echec" 2>&1; then
280
299
  cat "$echec"
281
300
  echo "⚠️ La construction du plan (${lesNoms[*]}) échoue : la séance s'ouvre, la consigne porte l'erreur."
301
+ echouer "La construction des paquets de ton plan échoue ; leurs fournisseurs et ce que leurs tests lisent sans dépendre d'eux sont construits."
282
302
  else
283
303
  : > "$echec"
284
304
  fi
@@ -297,7 +317,7 @@ rm -f "$travail/hors-plan"
297
317
  dossier=$'\n\n'"## Ton dossier de travail"$'\n\n'"Tout fichier temporaire s'écrit dans \`$travail\`, que \`\$TMPDIR\` nomme aussi."
298
318
  construction=
299
319
  if [ -s "$echec" ]; then
300
- construction=$'\n\n'"## La construction de ton paquet échoue"$'\n\n'"Ses fournisseurs et ce que ses tests lisent sans dépendre de lui sont construits ; sa propre construction échoue, et la réparer fait partie de ta tâche. La fin de sa sortie :"$'\n\n```\n'"$(tail -n 100 "$echec")"$'\n```'
320
+ construction=$'\n\n'"## La construction échoue"$'\n\n'"$(head -n 1 "$echec") La réparer fait partie de ta tâche. La fin de sa sortie :"$'\n\n```\n'"$(tail -n +2 "$echec" | tail -n 100)"$'\n```'
301
321
  fi
302
322
  rm -f "$echec"
303
323
  # The prompt, assembled in a file: claude reads it on its standard input, since as an argument it
@@ -212,7 +212,7 @@ export const GESTES = [
212
212
  genre: 'rien-a-livrer',
213
213
  geste: 'aux contrôles, qui jugent le lot',
214
214
  regle:
215
- 'un développeur qui ne change aucun fichier du plan n’a rien à livrer quand les contrôles sont verts ; rouges, l’arrêt monte (sans-livraison)',
215
+ 'un développeur qui ne change aucun fichier du plan n’a rien à livrer quand les contrôles sont verts ; rouges, l’arrêt monte (sans-livraison) ; sur le lot que l’intégration refuse, pour un développeur que --depuis developpeur lance, le geste ne joue pas : il est relancé une fois avec le refus',
216
216
  cas: 'BP 320.9 : 995-tools n’a rien à livrer, 4 montées et 49 min (B5)',
217
217
  },
218
218
  ];