@roomi-fields/grillhouse 0.24.12 → 0.24.14

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>`
@@ -359,8 +370,14 @@
359
370
  // restricted to what the fix changes and its dependents, and the reviewer again, on the
360
371
  // difference: the lot it read before is kept (`lot` of its sheet's entry), as Gerrit keeps each
361
372
  // patch set, and the next review receives the command of the difference between the two lots,
362
- // the files of the lot that changed since, and the findings still open, which it judges lifted
363
- // or not (`suivi`); the rest of the lot it does not read again (its skill, « La relecture
373
+ // the files of the lot that changed since, and the findings still open, each with the
374
+ // developpeur's answer under it, which it judges lifted or not (`suivi`). As the author answers
375
+ // in each thread of a review on GitHub or Gerrit, a sheet FAIT of the developpeur answers each
376
+ // finding open for him, by its title, levé or contesté with its reason, with its piece
377
+ // (`reponses`); a sheet without the answer to one is refused (`reponsesAuxConstats` of
378
+ // scripts/resultats.mjs) and asked again once of the same session, and the answer is kept with
379
+ // its finding in the state until the next review (BP 320.21: the cause of his choice in a
380
+ // handover the circuit does not read, three RENDU, then the stop); the rest of the lot it does not read again (its skill, « La relecture
364
381
  // bornée »). A blocking finding without a valid agent, or one that puts its criterion in
365
382
  // question (`critere_en_cause`), stops at « relecture-arret »; so does the third RENDU since the
366
383
  // ticket's last ACCEPTÉ.
@@ -373,7 +390,9 @@
373
390
  // `<type>(<paquets>): <sujet> (<ticket>)`, the type read from the ticket's type (bug fix,
374
391
  // chore, docs, else feat), its body written once from the final state: the criteria of the plan,
375
392
  // then each deviation the sheets of the developpeur and of the reviewer name (`ecarts`), once by
376
- // 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
377
396
  // scripts/integration/integrer.mjs from the main tree, its output added to the log: 0 is the
378
397
  // commit on agent/<ticket> (which the circuit names from git), the copy removed, the branch in
379
398
  // the queue; 75 (« à repasser ») plays it once more (`rejeu`), then stops at « a-repasser »; any
@@ -407,7 +426,7 @@
407
426
  // - The state is `.claude/worktrees/<ticket>.circuit.json`, written again at each step and at the
408
427
  // start and end of each session: `{ etape, tentative, code, raison, rapport, finale, boucles,
409
428
  // seance, question, questionnement, processus, depart, paquets, constats, verifie, mene, reprise,
410
- // 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
411
430
  // 22 of /proc/<pid>/stat), which together name it, a number alone being reused; `questionnement` the work
412
431
  // on the plan under way (`{ objet, role, seance }`: the plan, the explorateur or the
413
432
  // questionneur, its session), null otherwise; `etape` is the state's name of a numbered step of
@@ -424,14 +443,23 @@
424
443
  // the session that runs, null between two; `verifie` the tree of the lot the last whole final
425
444
  // pass green played, null before; `mene` the start (an ISO date) of the step the circuit leads
426
445
  // itself while it runs, null otherwise; `reprise` the session of the testwriter or developpeur
427
- // 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.
428
451
  // - `--reprendre` starts again at the step of the state, its report given to the next session,
429
452
  // after any stop, the death of the circuit included. A session the state names
430
453
  // that still runs is waited for first, and stopped when it stands still as long as a motionless
431
- // 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
432
457
  // changed it or kept it), from the testwriter.
433
458
  // - `--depuis <testwriter|developpeur>` has the lot corrected: it plays the whole ticket from
434
- // 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
435
463
  // of GitLab CI plays the jobs after it with the same variables: from the testwriter, his proof,
436
464
  // then the developpeur launched by a red of the proof as without `--depuis`; from the
437
465
  // developpeur, his checks; then the final pass, the reviewer and the integration. It goes with
@@ -478,9 +506,11 @@
478
506
  // (the third developpeur of the checks or of the final pass leaves a red check, a red of the
479
507
  // final pass out of the plan or that no package of the plan holds, or reds to settle),
480
508
  // 15 sans-livraison (a developpeur session that changes no file of the plan, its checks red; the
481
- // first session of a `--reprendre` whose plan already holds changes goes on to the checks; or
482
- // the developpeur's same sending to the testwriter twice in a row, no green checks between
483
- // 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
484
514
  // RENDU), 17 integration (the integration script refuses the lot, or the queue reopens the
485
515
  // ticket), 19 hors-portee (a testwriter or developpeur whose sheet says BLOQUÉ, without a
486
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
@@ -549,6 +579,7 @@ import {
549
579
  lireResumes,
550
580
  lireSarif,
551
581
  regleDeLaLigne,
582
+ reponsesAuxConstats,
552
583
  reponsesAuxQuestions,
553
584
  RESULTATS,
554
585
  schemaDeFiche,
@@ -557,7 +588,7 @@ import {
557
588
  } from './resultats.mjs';
558
589
  import { AUTEUR_DE_LA_FILE, INTEGRE } from './integration/file.mjs';
559
590
  import { dossierCommun, lireEntrees } from './integration/file-attente.mjs';
560
- import { refusArbitrage } from './integration/integrer.mjs';
591
+ import { couvertPar, refusArbitrage } from './integration/integrer.mjs';
561
592
  import { AUTEUR_DU_VERDICT } from './integration/verdict.mjs';
562
593
  import { attendreUnPeu } from './verrou-de-fichier.mjs';
563
594
  import { AttenteDeLaMachine, avecLaMachine } from './verrou-de-machine.mjs';
@@ -639,7 +670,11 @@ const generateur = (script, ...args) =>
639
670
  // gardes }`, `lit` the files of the copy it reads that another reference writes (as the
640
671
  // prerequisites of a rule of make: the index reads the interfaces, whose generated part the API
641
672
  // reports write), `gardes` the names the findings its regeneration lifts carry (their guard or
642
- // 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.
643
678
  const REFERENCES_DU_CADRE = [
644
679
  {
645
680
  nom: "l'index des interfaces",
@@ -647,6 +682,7 @@ const REFERENCES_DU_CADRE = [
647
682
  fichiers: ['docs/agents/index-des-interfaces.md'],
648
683
  lit: ['docs/INTERFACE.md', '**/docs/INTERFACE.md'],
649
684
  gardes: ['index-interfaces'],
685
+ entiers: ['docs/agents/index-des-interfaces.md'],
650
686
  },
651
687
  {
652
688
  nom: 'les turbo.json des paquets',
@@ -654,6 +690,7 @@ const REFERENCES_DU_CADRE = [
654
690
  fichiers: ['turbo.json', 'turbo.jsonc', '**/turbo.json'],
655
691
  lit: [],
656
692
  gardes: ['turbo-des-paquets'],
693
+ entiers: ['*/**/turbo.json'],
657
694
  },
658
695
  {
659
696
  nom: "les rapports d'API",
@@ -666,6 +703,7 @@ const REFERENCES_DU_CADRE = [
666
703
  ],
667
704
  lit: [],
668
705
  gardes: ['rapport-api', 'partie-generee'],
706
+ entiers: [],
669
707
  },
670
708
  {
671
709
  nom: 'la dette des gardes',
@@ -673,6 +711,7 @@ const REFERENCES_DU_CADRE = [
673
711
  fichiers: [DETTE],
674
712
  lit: [],
675
713
  gardes: [],
714
+ entiers: [],
676
715
  abaisser: true,
677
716
  },
678
717
  ];
@@ -973,8 +1012,8 @@ function ecrireRapport(ctx, etape, texte, resultat, rapport = texte) {
973
1012
  }
974
1013
 
975
1014
  // The state of the run, written whole (`seance` and `question` null and `finale` false unless <etat>
976
- // sets them, `processus`, `paquets`, `constats`, `verifie`, `reprise` and `aRegenerer` the
977
- // 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.
978
1017
  function ecrireEtat(ctx, etat) {
979
1018
  ctx.courant = {
980
1019
  finale: false,
@@ -991,6 +1030,8 @@ function ecrireEtat(ctx, etat) {
991
1030
  verifie: ctx.verifie ?? null,
992
1031
  reprise: ctx.reprise ?? null,
993
1032
  aRegenerer: ctx.aRegenerer ?? null,
1033
+ refus: ctx.refus ?? null,
1034
+ controlesRouges: ctx.controlesRouges ?? null,
994
1035
  };
995
1036
  const provisoire = `${ctx.etat}.${process.pid}`;
996
1037
  writeFileSync(
@@ -1250,13 +1291,23 @@ function consigne(valeurs, rang = 0) {
1250
1291
  // the plan, and the last handover of its author at the ticket. Every instruction, fresh or resumed,
1251
1292
  // carries the findings of the reviewer still open for its role (`ctx.constats`), all of them,
1252
1293
  // whatever the relaunch: a proof refused, red checks, a sending, a RENDU, a resumption of the
1253
- // supervisor. Throws an Arret for a launch that stops before its session, a motionless session, or
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`),
1296
+ // refused without one, and the circuit keeps each answer with its finding (`avecLesReponses`).
1297
+ // Throws an Arret for a launch that stops before its session, a motionless session, or
1254
1298
  // a session that ends twice without a sheet that conforms.
1255
- async function seance(ctx, role, { tentative, rapport, fort, derniere }) {
1299
+ async function seance(ctx, role, { tentative, rapport, fort, derniere, change }) {
1256
1300
  const nom = nomDuRole(role);
1257
1301
  const reprise = tentative > 1 && !derniere && ctx.reprise?.agent === role ? ctx.reprise : null;
1258
1302
  const constats = texteDesOuverts(ouverts(ctx, role));
1259
1303
  const plan = ctx.paquets.join(', ');
1304
+ // A developpeur's sheet answers each finding open for him, kept with its finding.
1305
+ const titres = role === 'developpeur' ? ouverts(ctx, role).map(c => c.titre) : [];
1306
+ const valider = f => reponsesAuxConstats(f, titres);
1307
+ const repondu = fiche => {
1308
+ if (fiche && titres.length) ctx.constats = avecLesReponses(ctx.constats, fiche);
1309
+ return fiche;
1310
+ };
1260
1311
  if (reprise) {
1261
1312
  const courte = {
1262
1313
  role: nom,
@@ -1265,9 +1316,10 @@ async function seance(ctx, role, { tentative, rapport, fort, derniere }) {
1265
1316
  paquets: plan,
1266
1317
  tentative,
1267
1318
  change:
1268
- role === 'testwriter'
1319
+ change ??
1320
+ (role === 'testwriter'
1269
1321
  ? 'la preuve du rouge, jouée après ta séance, refuse ton lot'
1270
- : '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'),
1271
1323
  rapport: rapport ?? 'aucun',
1272
1324
  constats,
1273
1325
  };
@@ -1276,8 +1328,9 @@ async function seance(ctx, role, { tentative, rapport, fort, derniere }) {
1276
1328
  premiere: 'reprend',
1277
1329
  id: reprise.seance,
1278
1330
  repli: true,
1331
+ valider,
1279
1332
  });
1280
- if (fiche) return fiche;
1333
+ if (fiche) return repondu(fiche);
1281
1334
  commenter(
1282
1335
  ctx,
1283
1336
  role,
@@ -1315,7 +1368,22 @@ async function seance(ctx, role, { tentative, rapport, fort, derniere }) {
1315
1368
  .map(r => `- ${r.nom} : ${r.fichiers.map(f => `\`${f}\``).join(', ')}`)
1316
1369
  .join('\n'),
1317
1370
  };
1318
- return await jusquALaFiche(ctx, role, consigne(valeurs), { fort, neuve: role });
1371
+ return repondu(await jusquALaFiche(ctx, role, consigne(valeurs), { fort, neuve: role, valider }));
1372
+ }
1373
+
1374
+ // The findings <constats>, each finding of the developpeur that his sheet <fiche> answers (by its
1375
+ // title) with its answer `{ etat, raison, piece }`, as a thread of a review keeps the author's
1376
+ // reply under its comment.
1377
+ function avecLesReponses(constats, fiche) {
1378
+ const parTitre = new Map((fiche.reponses ?? []).map(r => [r.titre, r]));
1379
+ return (constats ?? []).map(c => {
1380
+ const r = c.role === 'developpeur' ? parTitre.get(c.titre) : undefined;
1381
+ if (!r) return c;
1382
+ return {
1383
+ ...c,
1384
+ reponse: { etat: r.etat, ...(r.raison ? { raison: r.raison } : {}), piece: r.piece },
1385
+ };
1386
+ });
1319
1387
  }
1320
1388
 
1321
1389
  // The line CONTEXTE of a session: the text of `--contexte` of the run, which every session of the
@@ -1477,7 +1545,7 @@ const bloquants = bloquantsDeLaFiche;
1477
1545
 
1478
1546
  // The blocking findings <constats>, each under its heading, the criterion or rule it holds, its
1479
1547
  // recipient (or the criterion in question), its body and its piece (an element judged not
1480
- // conforming carries it in its body): lines.
1548
+ // conforming carries it in its body), then the developpeur's answer to it, when he gave one: lines.
1481
1549
  const lignesDesConstats = constats =>
1482
1550
  constats.flatMap((c, i) => [
1483
1551
  `### Constat ${i + 1} — ${c.titre}`,
@@ -1485,6 +1553,12 @@ const lignesDesConstats = constats =>
1485
1553
  c.critere_en_cause ? `Critère en cause : ${c.critere_en_cause}` : `Agent : ${c.role ?? '?'}`,
1486
1554
  c.corps,
1487
1555
  ...(c.piece ? [`Pièce : ${c.piece}`] : []),
1556
+ ...(c.reponse
1557
+ ? [
1558
+ `Réponse du développeur : ${c.reponse.etat}${c.reponse.raison ? ` — ${c.reponse.raison}` : ''}`,
1559
+ `Pièce de la réponse : ${c.reponse.piece}`,
1560
+ ]
1561
+ : []),
1488
1562
  '',
1489
1563
  ]);
1490
1564
 
@@ -1733,9 +1807,9 @@ function laPasseFinale(ctx) {
1733
1807
 
1734
1808
  // The references of the circuit: those the project declares in the package.json of the copy
1735
1809
  // (`grillhouse.references`), each `{ nom, commande, fichiers, tests, lit, gardes }` with a name, a
1736
- // command and files, `tests`, `lit` and `gardes` arrays when given, empty when not; then the frame's
1737
- // (REFERENCES_DU_CADRE, `cadre`), each but one whose first file a reference of the project covers,
1738
- // 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.
1739
1813
  function lesReferences(ctx) {
1740
1814
  const l = lireJson(path.join(existsSync(ctx.copie) ? ctx.copie : ctx.racine, 'package.json'))
1741
1815
  ?.grillhouse?.references;
@@ -1755,6 +1829,7 @@ function lesReferences(ctx) {
1755
1829
  tests: r.tests ?? [],
1756
1830
  lit: r.lit ?? [],
1757
1831
  gardes: r.gardes ?? [],
1832
+ entiers: [],
1758
1833
  cadre: false,
1759
1834
  }));
1760
1835
  const duCadre = REFERENCES_DU_CADRE.filter(
@@ -1763,16 +1838,6 @@ function lesReferences(ctx) {
1763
1838
  return [...duProjet, ...duCadre];
1764
1839
  }
1765
1840
 
1766
- // Whether one of <motifs> covers the file <fichier>, both from the root of the copy, as the
1767
- // inputs of Turborepo read them: a path names that file, a directory every file under it, a glob
1768
- // pattern (`*`, `**`) the files it matches (`path.matchesGlob` of Node).
1769
- export function couvertPar(motifs, fichier) {
1770
- return motifs.some(m => {
1771
- const dossier = m.replace(/\/+$/, '');
1772
- return fichier === dossier || fichier.startsWith(`${dossier}/`) || path.matchesGlob(fichier, m);
1773
- });
1774
- }
1775
-
1776
1841
  // The references a red of <lieux> is one of (each `{ fichier, gardes, dansLePlan }`, its file, the
1777
1842
  // names its finding carries, and whether a path of the plan holds it), however many other reds
1778
1843
  // stand beside it, as `--update-snapshots` updates the snapshots that fail and leaves the other
@@ -1997,12 +2062,17 @@ function arretHorsDuPlan(ctx, tentative, fiche) {
1997
2062
  }
1998
2063
 
1999
2064
  // The sending to the testwriter in the developpeur's sheet <fiche> (its `renvoi`): what the
2000
- // 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.
2001
2068
  function renvoiDe(ctx, fiche) {
2002
2069
  if (!fiche.renvoi) return null;
2003
2070
  const passation = derniereDe(ctx, 'developpeur')?.text ?? 'aucune';
2004
2071
  const raison = fiche.raison ? ` : ${fiche.raison}` : '';
2005
- 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}`;
2006
2076
  }
2007
2077
 
2008
2078
  // The findings of the reviewer still open for <role> (`ctx.constats`), in their order.
@@ -2025,7 +2095,8 @@ const texteDesOuverts = constats =>
2025
2095
  // remark reaches the ticket, no agent; the sheet's schema gives a RENDU at least one), after each
2026
2096
  // finding open before it that the sheet neither marks lifted (`suivi`, by its title) nor states
2027
2097
  // again. Each one `{ titre, regle, role, corps, piece }`, its recipient the agent it names, testwriter or
2028
- // developpeur. Throws an Arret `relecture-arret` for a finding without a valid recipient or one
2098
+ // developpeur, without the developpeur's answer to the review before (`reponse`): his next sheet
2099
+ // answers it again. Throws an Arret `relecture-arret` for a finding without a valid recipient or one
2029
2100
  // that puts a criterion in question.
2030
2101
  function constatsOuverts(ctx, fiche, texte) {
2031
2102
  const arret = raison =>
@@ -2041,13 +2112,14 @@ function constatsOuverts(ctx, fiche, texte) {
2041
2112
  return { titre: c.titre, regle: c.regle, role: c.role, corps: c.corps, piece: c.piece };
2042
2113
  });
2043
2114
  const leves = new Set((fiche.suivi ?? []).filter(s => s.etat === 'levé').map(s => s.titre));
2044
- const restes = (ctx.constats ?? []).filter(
2045
- c => !leves.has(c.titre) && !neufs.some(n => n.titre === c.titre)
2046
- );
2115
+ const restes = (ctx.constats ?? [])
2116
+ .filter(c => !leves.has(c.titre) && !neufs.some(n => n.titre === c.titre))
2117
+ .map(c => Object.fromEntries(Object.entries(c).filter(([k]) => k !== 'reponse')));
2047
2118
  return [...restes, ...neufs];
2048
2119
  }
2049
2120
 
2050
- // 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
2051
2123
  // scripts/integration/integrer.mjs from the main tree, its output added to the log. A run « à
2052
2124
  // repasser » (75) plays once more, the gesture `rejeu`. `{ code, sortie, args }`.
2053
2125
  function integrer(ctx) {
@@ -2076,6 +2148,20 @@ function integrer(ctx) {
2076
2148
  const message = path.join(ctx.tmp, 'message');
2077
2149
  writeFileSync(message, messageDeCommit(ctx));
2078
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
+ }
2079
2165
  let r;
2080
2166
  for (let essai = 1; essai <= 2; essai++) {
2081
2167
  entete(ctx, 'integration');
@@ -3082,6 +3168,8 @@ async function derouler(ctx, debut) {
3082
3168
  let { etape, tentative, rapport, finale } = debut;
3083
3169
  // The step a `--reprendre` starts at, the first of the loop.
3084
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;
3085
3173
  for (;;) {
3086
3174
  const reprend = reprise;
3087
3175
  reprise = false;
@@ -3121,6 +3209,8 @@ async function derouler(ctx, debut) {
3121
3209
  });
3122
3210
  // A testwriter who declares himself blocked or in need of an answer goes up to the supervisor.
3123
3211
  if (fiche.statut !== 'FAIT') throw arretDuStatut(ctx, 'testwriter', tentative, fiche);
3212
+ // No checks have run since this session.
3213
+ ctx.controlesRouges = null;
3124
3214
  commenter(ctx, 'testwriter', `séance ${tentative} finie, sa fiche lue.`);
3125
3215
  etape = PREUVE;
3126
3216
  } else if (etape === PREUVE) {
@@ -3158,7 +3248,9 @@ async function derouler(ctx, debut) {
3158
3248
  rapport,
3159
3249
  fort,
3160
3250
  derniere: fort,
3251
+ change: relanceSurLeRefus ? CHANGE_DU_REFUS : undefined,
3161
3252
  });
3253
+ relanceSurLeRefus = false;
3162
3254
  // A question goes up to the supervisor; a red out of reach, to the testwriter its sheet sends
3163
3255
  // it to, else up to the supervisor.
3164
3256
  if (fiche.statut === 'BESOIN') {
@@ -3168,17 +3260,20 @@ async function derouler(ctx, debut) {
3168
3260
  if (renvoi) {
3169
3261
  // The red that remains lies in the tests of the lot: the gesture `renvoi-au-testwriter`,
3170
3262
  // the testwriter, the sending and the handover as its report, then the proof and the
3171
- // developpeur.
3172
- 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) {
3173
3268
  if (empreinte(ctx) === avant) {
3174
3269
  inscrire(ctx, { role: AUTEUR_DU_CIRCUIT, etape: CODE, inchange: true });
3175
3270
  }
3176
3271
  throw new Arret(
3177
3272
  'sans-livraison',
3178
- `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}`
3179
3274
  );
3180
3275
  }
3181
- ctx.renvoiAuTestwriter = true;
3276
+ ctx.renvoiAuTestwriter = sortie;
3182
3277
  commenter(
3183
3278
  ctx,
3184
3279
  'developpeur',
@@ -3196,6 +3291,30 @@ async function derouler(ctx, debut) {
3196
3291
  }
3197
3292
  if (fiche.hors_plan?.length) throw arretHorsDuPlan(ctx, tentative, fiche);
3198
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
+ }
3199
3318
  if (inchangee && reprend && livre(ctx)) {
3200
3319
  // A resumed developpeur that finds the lot delivered: the checks judge it.
3201
3320
  commenter(
@@ -3230,6 +3349,8 @@ async function derouler(ctx, debut) {
3230
3349
  ? { arbre: arbreDeLaCopie(ctx), restreinte: regeneration.restreinte }
3231
3350
  : laPasseFinale(ctx);
3232
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;
3233
3354
  // The outcome the bilan reads (scripts/bilan.mjs): with the reds, each its place and its
3234
3355
  // text, by which it knows two checks that measured the same thing.
3235
3356
  const resultat = issue => ({
@@ -3330,7 +3451,7 @@ async function derouler(ctx, debut) {
3330
3451
  resultat('vert'),
3331
3452
  `${k.resume}.${k.avertissements}`
3332
3453
  );
3333
- ctx.renvoiAuTestwriter = false;
3454
+ ctx.renvoiAuTestwriter = null;
3334
3455
  ctx.aRegenerer = {
3335
3456
  noms: k.references.map(r => r.nom),
3336
3457
  notes: [],
@@ -3348,7 +3469,7 @@ async function derouler(ctx, debut) {
3348
3469
  `${k.resume}.${k.avertissements}`
3349
3470
  );
3350
3471
  // Green checks: a sending of the developpeur to the testwriter may come again.
3351
- ctx.renvoiAuTestwriter = false;
3472
+ ctx.renvoiAuTestwriter = null;
3352
3473
  if (!passeFinale) {
3353
3474
  // The checks green: the final pass, its sessions counted apart.
3354
3475
  etape = CONTROLES;
@@ -3472,12 +3593,13 @@ async function derouler(ctx, debut) {
3472
3593
  const r = integrer(ctx);
3473
3594
  if (r.code === A_REPASSER) throw new Arret('a-repasser', fin(r.sortie, 40));
3474
3595
  if (r.code !== 0) {
3475
- throw new Arret(
3476
- 'integration',
3596
+ throw refuser(
3597
+ ctx,
3477
3598
  `Le script d'intégration refuse le lot (code ${r.code}).\n\n${fin(r.sortie, 60)}`,
3478
- { piece: `$ node ${INTEGRER} ${r.args.join(' ')}\n${fin(r.sortie, 30)}` }
3599
+ `$ node ${INTEGRER} ${r.args.join(' ')}\n${fin(r.sortie, 30)}`
3479
3600
  );
3480
3601
  }
3602
+ ctx.refus = null;
3481
3603
  const branche = `agent/${ctx.ticket}`;
3482
3604
  const commit = spawnSync('git', ['-C', ctx.racine, 'rev-parse', '--short', branche], {
3483
3605
  encoding: 'utf8',
@@ -3496,9 +3618,7 @@ async function derouler(ctx, debut) {
3496
3618
  continue;
3497
3619
  }
3498
3620
  if (f.etat === 'en-file') throw new Arret('a-repasser', f.raison);
3499
- throw new Arret('integration', `La file rouvre le ticket.\n\n${f.raison}`, {
3500
- piece: f.raison,
3501
- });
3621
+ throw refuser(ctx, `La file rouvre le ticket.\n\n${f.raison}`, f.raison);
3502
3622
  } else if (etape === TRI) {
3503
3623
  // The lot is on main: the tri of its discoveries, which neither stops nor undoes it.
3504
3624
  await trier(ctx);
@@ -3545,6 +3665,25 @@ async function derouler(ctx, debut) {
3545
3665
  }
3546
3666
  }
3547
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
+
3548
3687
  // The gesture <genre> of the circuit (scripts/etapes.mjs, GESTES), with no session: its line at
3549
3688
  // the ticket and in the log, with its rule.
3550
3689
  function geste(ctx, genre) {
@@ -3602,10 +3741,18 @@ async function conduire(ctx, d) {
3602
3741
  return monter(ctx, a);
3603
3742
  }
3604
3743
 
3605
- // Where the run starts: the step a --depuis names (the testwriter's or the developpeur's), the
3606
- // step of the state <e> (null without one) on --reprendre, else the testwriter, the run starting
3607
- // 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.
3608
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;
3609
3756
  if (ctx.depuis) {
3610
3757
  return {
3611
3758
  etape: ctx.depuis === 'testwriter' ? TESTS : CODE,
@@ -3615,9 +3762,11 @@ function depart(ctx, e) {
3615
3762
  };
3616
3763
  }
3617
3764
  if (!ctx.reprendre) {
3618
- // 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.
3619
3766
  ctx.verifie = null;
3620
3767
  ctx.constats = [];
3768
+ ctx.refus = null;
3769
+ ctx.controlesRouges = null;
3621
3770
  return { etape: TESTS, tentative: 1, rapport: null, finale: false };
3622
3771
  }
3623
3772
  if (!e) throw new Usage(`rien à reprendre : ${ctx.etat} n'existe pas.`);
@@ -4068,6 +4217,7 @@ async function arreter(ctx, e) {
4068
4217
  ctx.constats = [...(lu.constats ?? [])];
4069
4218
  ctx.verifie = lu.verifie ?? null;
4070
4219
  ctx.reprise = lu.reprise ?? null;
4220
+ ctx.refus = lu.refus ?? null;
4071
4221
  ecrireEtat(ctx, {
4072
4222
  etape: lu.etape,
4073
4223
  tentative: lu.tentative,
@@ -4139,11 +4289,14 @@ export async function main(argv) {
4139
4289
  mkdirSync(path.dirname(ctx.copie), { recursive: true });
4140
4290
  let e = existsSync(ctx.etat) ? JSON.parse(readFileSync(ctx.etat, 'utf8')) : null;
4141
4291
  // The findings of the reviewer still open, the lot the whole final pass verified, the session a
4142
- // 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.
4143
4294
  ctx.constats = [...(e?.constats ?? [])];
4144
4295
  ctx.verifie = e?.verifie ?? null;
4145
4296
  ctx.reprise = e?.reprise ?? null;
4146
4297
  ctx.aRegenerer = e?.aRegenerer ?? null;
4298
+ ctx.refus = e?.refus ?? null;
4299
+ ctx.controlesRouges = e?.controlesRouges ?? null;
4147
4300
  // The supervisor's answers to a question: stop the circuit, or extend its plan and resume.
4148
4301
  if (ctx.arreter) return await arreter(ctx, e);
4149
4302
  // A circuit that outlives its caller is still the ticket's: no second run beside 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
  ];