@roomi-fields/grillhouse 0.24.11 → 0.24.13

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.
@@ -153,7 +153,11 @@
153
153
  // handover as its report, with no session more; so does BLOQUÉ (its `raison`), at
154
154
  // « hors-portee », save for a developpeur whose sheet sends the red to the testwriter (`renvoi`,
155
155
  // below), which is that sending. Either stop goes up to the supervisor, the sheet's `piece` as
156
- // its piece.
156
+ // its piece. A developpeur's FAIT that names criteria it does not hold out of the plan
157
+ // (`hors_plan`) stops at « hors-portee » too, at 3 Code, as a required check keeps a merge from
158
+ // a change that does not pass it: the question names each criterion and its package, the
159
+ // supervisor answers `--etendre <paquet>`, or amends the criterion and `--reprendre` (BP 320.17:
160
+ // « critère 10 hors plan, non fait » in three handovers fell at the review).
157
161
  // - A plan that carries no test (sansTests: in a repository of packages, no package with a script
158
162
  // `test:vitest` lies in a path of the plan or holds it, as `npm test -- <chemin>` refuses a path
159
163
  // out of every package or in a package without that script) skips the testwriter and the proof:
@@ -355,8 +359,14 @@
355
359
  // restricted to what the fix changes and its dependents, and the reviewer again, on the
356
360
  // difference: the lot it read before is kept (`lot` of its sheet's entry), as Gerrit keeps each
357
361
  // patch set, and the next review receives the command of the difference between the two lots,
358
- // the files of the lot that changed since, and the findings still open, which it judges lifted
359
- // or not (`suivi`); the rest of the lot it does not read again (its skill, « La relecture
362
+ // the files of the lot that changed since, and the findings still open, each with the
363
+ // developpeur's answer under it, which it judges lifted or not (`suivi`). As the author answers
364
+ // in each thread of a review on GitHub or Gerrit, a sheet FAIT of the developpeur answers each
365
+ // finding open for him, by its title, levé or contesté with its reason, with its piece
366
+ // (`reponses`); a sheet without the answer to one is refused (`reponsesAuxConstats` of
367
+ // scripts/resultats.mjs) and asked again once of the same session, and the answer is kept with
368
+ // its finding in the state until the next review (BP 320.21: the cause of his choice in a
369
+ // 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
360
370
  // bornée »). A blocking finding without a valid agent, or one that puts its criterion in
361
371
  // question (`critere_en_cause`), stops at « relecture-arret »; so does the third RENDU since the
362
372
  // ticket's last ACCEPTÉ.
@@ -378,9 +388,22 @@
378
388
  // to the log (it brings the branch onto main, pushes it and reads the CI of the commit pushed).
379
389
  // A queue already running exits 0 at once: the circuit waits while the branch is in the queue
380
390
  // and the queue's lock names a live process. Then the state of the ticket: closed, the circuit
381
- // ends at « integre », exit 0 (the queue's last word at the ticket named with it, a CI it could
382
- // not read); reopened (out of the queue, or a red CI), it stops at « integration », the queue's
391
+ // sorts the discoveries (below), then ends at « integre », exit 0 (the queue's last word at the
392
+ // ticket named with it, a CI it could not read); reopened (out of the queue, or a red CI), it stops at « integration », the queue's
383
393
  // last word as its reason; still in the queue, it stops at « a-repasser », the queue's reason.
394
+ // - Then the tri of the discoveries (step 5.3, `trier`), as Chromium and Mozilla give each new
395
+ // report a verdict before it is filed: each discovery a sheet filed is kept with the circuit's
396
+ // results (`decouverte`: its id, its subject); without one, no session. Else one session of the
397
+ // explorateur out of the envelope, on Sonnet, in the main tree (the copy is gone), under the
398
+ // rights of its role (reading, the build of a package, no pass), its instruction from the eighth
399
+ // template, its sheet the tri's (`tri` of scripts/resultats.mjs): one line per discovery
400
+ // (`conformiteDuTri`), each with its verdict (traitee, doublon, sans-suite, a-porter,
401
+ // non-confirmee), the piece of a traitee or an a-porter a command played again on main or
402
+ // file:line; a sheet out of conformity is asked again once of the same session. Each verdict is
403
+ // written at its discovery's ticket and set there as a label; an a-porter or a non-confirmee
404
+ // reopens under `a-valider`. A tri without a sheet that conforms leaves the discoveries as they
405
+ // are, said at the ticket; it never stops the circuit nor undoes the integration. Its end is kept
406
+ // with the circuit's results (`tri`), which the bilan counts.
384
407
  // - The working directory is the ticket's, `.claude/worktrees/<ticket>.travail`: the instructions,
385
408
  // results and errors of the sessions, the patches and message of the integration. It lives as
386
409
  // long as the ticket, as the workspace of a pipeline: a circuit relaunched takes it up again, no
@@ -395,7 +418,8 @@
395
418
  // on the plan under way (`{ objet, role, seance }`: the plan, the explorateur or the
396
419
  // questionneur, its session), null otherwise; `etape` is the state's name of a numbered step of
397
420
  // the process (scripts/etapes.mjs: testwriter 2, preuve 2.1, developpeur 3, controles 3.1, or 4.1
398
- // the final pass once `finale`, references 4.2, relecture 4.3, integration 5.1, file 5.2), or
421
+ // the final pass once `finale`, references 4.2, relecture 4.3, integration 5.1, file 5.2, tri
422
+ // 5.3), or
399
423
  // integre at the end; `raison` names the stop (« arrete » once the supervisor stopped the
400
424
  // circuit); `question` the question of a stop for the supervisor (`{ arret, fait, piece,
401
425
  // question, qui }`), null otherwise; `paquets` the plan of the ticket, in its order; `constats`
@@ -465,7 +489,7 @@
465
489
  // them), 16 relecture-arret (a finding without a valid agent, one on a criterion, the third
466
490
  // RENDU), 17 integration (the integration script refuses the lot, or the queue reopens the
467
491
  // ticket), 19 hors-portee (a testwriter or developpeur whose sheet says BLOQUÉ, without a
468
- // sending to the testwriter), 20 besoin (a testwriter or developpeur whose sheet says BESOIN, a
492
+ // 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
469
493
  // reviewer whose sheet carries a `question`, or a ticket labelled `arbitrage` whose arbitrage
470
494
  // `refusArbitrage` of scripts/integration/integrer.mjs refuses, at the launch or a resumption,
471
495
  // before any session), 22 questionnement (questions of the plan left open
@@ -525,16 +549,20 @@ import {
525
549
  A_ELAGUER,
526
550
  bloquantsDeLaFiche,
527
551
  conformiteDuLot,
552
+ conformiteDuTri,
528
553
  lireFiche,
529
554
  lireRapportsVitest,
530
555
  lireResumes,
531
556
  lireSarif,
532
557
  regleDeLaLigne,
558
+ reponsesAuxConstats,
533
559
  reponsesAuxQuestions,
534
560
  RESULTATS,
535
561
  schemaDeFiche,
562
+ VERDICTS_DU_TRI,
563
+ VERDICTS_ROUVERTS,
536
564
  } from './resultats.mjs';
537
- import { AUTEUR_DE_LA_FILE } from './integration/file.mjs';
565
+ import { AUTEUR_DE_LA_FILE, INTEGRE } from './integration/file.mjs';
538
566
  import { dossierCommun, lireEntrees } from './integration/file-attente.mjs';
539
567
  import { refusArbitrage } from './integration/integrer.mjs';
540
568
  import { AUTEUR_DU_VERDICT } from './integration/verdict.mjs';
@@ -565,7 +593,7 @@ const SEANCES_DEVELOPPEUR = boucle('code').max;
565
593
  const RELECTURES = boucle('relecture').max;
566
594
  // The steps of the circuit's state, read from the list of the steps.
567
595
  const etatDe = n => SUITE.find(e => e.numero === n).etat;
568
- const [TESTS, PREUVE, CODE, CONTROLES, REFERENCES, RELECTURE, INTEGRATION, EN_FILE] = [
596
+ const [TESTS, PREUVE, CODE, CONTROLES, REFERENCES, RELECTURE, INTEGRATION, EN_FILE, TRI] = [
569
597
  '2',
570
598
  '2.1',
571
599
  '3',
@@ -574,6 +602,7 @@ const [TESTS, PREUVE, CODE, CONTROLES, REFERENCES, RELECTURE, INTEGRATION, EN_FI
574
602
  '4.3',
575
603
  '5.1',
576
604
  '5.2',
605
+ '5.3',
577
606
  ].map(etatDe);
578
607
  // The variable in which bd reads the author of a comment (`bd --help`: « default: $BEADS_ACTOR,
579
608
  // git user.name, $USER »), each session's its role; the author of the circuit's own lines.
@@ -1046,20 +1075,25 @@ const mtime = f => {
1046
1075
  // schema of its role's sheet and the options <session> names (its id, or the session it
1047
1076
  // resumes), its instruction on its standard input and its result on its standard output, added
1048
1077
  // to the log under its header line, then its line written to the register, as lancer.sh does.
1049
- // Its launch is kept with the circuit's results (`lancement`: its role and its session id), which
1050
- // the bilan reads to count the sessions the circuit launched (scripts/bilan.mjs).
1078
+ // Its launch is kept with the circuit's results (`lancement`: its role, its session id, and the
1079
+ // <objet> of a session that is not its role's own work, `tri`), which the bilan reads to count the
1080
+ // sessions the circuit launched (scripts/bilan.mjs). Its sheet is the schema <fiche>, by default
1081
+ // its role's.
1051
1082
  function lancer(
1052
1083
  ctx,
1053
1084
  role,
1054
1085
  consigne,
1055
- { fort, horsEnveloppe, droits = [], session = [], ouvre, reprend } = {}
1086
+ { fort, horsEnveloppe, droits = [], session = [], ouvre, reprend, fiche: sorte, objet } = {}
1056
1087
  ) {
1057
1088
  rmSync(ctx.fin, { force: true });
1058
1089
  rmSync(ctx.resultat, { force: true });
1059
1090
  rmSync(ctx.horsPlan, { force: true });
1060
1091
  const id = ouvre ?? reprend ?? session[1] ?? null;
1061
1092
  if (id) {
1062
- inscrire(ctx, { role: AUTEUR_DU_CIRCUIT, lancement: { role, seance: id } });
1093
+ inscrire(ctx, {
1094
+ role: AUTEUR_DU_CIRCUIT,
1095
+ lancement: { role, seance: id, ...(objet ? { objet } : {}) },
1096
+ });
1063
1097
  }
1064
1098
  const fichier = path.join(ctx.tmp, `consigne-${++ctx.numero}.md`);
1065
1099
  writeFileSync(fichier, consigne);
@@ -1072,7 +1106,12 @@ function lancer(
1072
1106
  if (horsEnveloppe) {
1073
1107
  entete(ctx, role);
1074
1108
  fds = [openSync(fichier, 'r'), openSync(reponse, 'w'), openSync(ctx.journal, 'a')];
1075
- const fiche = ['--output-format', 'json', '--json-schema', JSON.stringify(schemaDeFiche(role))];
1109
+ const fiche = [
1110
+ '--output-format',
1111
+ 'json',
1112
+ '--json-schema',
1113
+ JSON.stringify(schemaDeFiche(sorte ?? role)),
1114
+ ];
1076
1115
  commande = {
1077
1116
  cmd: process.env.CLAUDE_BIN || 'claude',
1078
1117
  args: ['-p', '--agent', role, ...fiche, ...droits, '--add-dir', ctx.tmp, ...session],
@@ -1198,7 +1237,8 @@ async function attendreLaSeance(ctx, groupe) {
1198
1237
  // The template of the instruction at <rang> (0 the testwriter's and the developpeur's, 1 the
1199
1238
  // reviewer's, 2 any session's on a sheet absent or out of its schema, 3 the testwriter's and the
1200
1239
  // developpeur's on a resumption, 4 the questionneur's on the plan, 5 the explorateur's on the plan,
1201
- // 6 the explorateur's on the questions of the plan), filled with <valeurs>.
1240
+ // 6 the explorateur's on the questions of the plan, 7 the explorateur's on the tri of the
1241
+ // discoveries), filled with <valeurs>.
1202
1242
  function consigne(valeurs, rang = 0) {
1203
1243
  const texte = readFileSync(GABARIT, 'utf8');
1204
1244
  const bloc = [...texte.matchAll(/```text\n([\s\S]*?)\n```/g)][rang];
@@ -1217,13 +1257,22 @@ function consigne(valeurs, rang = 0) {
1217
1257
  // the plan, and the last handover of its author at the ticket. Every instruction, fresh or resumed,
1218
1258
  // carries the findings of the reviewer still open for its role (`ctx.constats`), all of them,
1219
1259
  // whatever the relaunch: a proof refused, red checks, a sending, a RENDU, a resumption of the
1220
- // supervisor. Throws an Arret for a launch that stops before its session, a motionless session, or
1260
+ // supervisor; a developpeur's sheet FAIT answers each of his by its title (`reponsesAuxConstats`),
1261
+ // refused without one, and the circuit keeps each answer with its finding (`avecLesReponses`).
1262
+ // Throws an Arret for a launch that stops before its session, a motionless session, or
1221
1263
  // a session that ends twice without a sheet that conforms.
1222
1264
  async function seance(ctx, role, { tentative, rapport, fort, derniere }) {
1223
1265
  const nom = nomDuRole(role);
1224
1266
  const reprise = tentative > 1 && !derniere && ctx.reprise?.agent === role ? ctx.reprise : null;
1225
1267
  const constats = texteDesOuverts(ouverts(ctx, role));
1226
1268
  const plan = ctx.paquets.join(', ');
1269
+ // A developpeur's sheet answers each finding open for him, kept with its finding.
1270
+ const titres = role === 'developpeur' ? ouverts(ctx, role).map(c => c.titre) : [];
1271
+ const valider = f => reponsesAuxConstats(f, titres);
1272
+ const repondu = fiche => {
1273
+ if (fiche && titres.length) ctx.constats = avecLesReponses(ctx.constats, fiche);
1274
+ return fiche;
1275
+ };
1227
1276
  if (reprise) {
1228
1277
  const courte = {
1229
1278
  role: nom,
@@ -1243,8 +1292,9 @@ async function seance(ctx, role, { tentative, rapport, fort, derniere }) {
1243
1292
  premiere: 'reprend',
1244
1293
  id: reprise.seance,
1245
1294
  repli: true,
1295
+ valider,
1246
1296
  });
1247
- if (fiche) return fiche;
1297
+ if (fiche) return repondu(fiche);
1248
1298
  commenter(
1249
1299
  ctx,
1250
1300
  role,
@@ -1282,7 +1332,22 @@ async function seance(ctx, role, { tentative, rapport, fort, derniere }) {
1282
1332
  .map(r => `- ${r.nom} : ${r.fichiers.map(f => `\`${f}\``).join(', ')}`)
1283
1333
  .join('\n'),
1284
1334
  };
1285
- return await jusquALaFiche(ctx, role, consigne(valeurs), { fort, neuve: role });
1335
+ return repondu(await jusquALaFiche(ctx, role, consigne(valeurs), { fort, neuve: role, valider }));
1336
+ }
1337
+
1338
+ // The findings <constats>, each finding of the developpeur that his sheet <fiche> answers (by its
1339
+ // title) with its answer `{ etat, raison, piece }`, as a thread of a review keeps the author's
1340
+ // reply under its comment.
1341
+ function avecLesReponses(constats, fiche) {
1342
+ const parTitre = new Map((fiche.reponses ?? []).map(r => [r.titre, r]));
1343
+ return (constats ?? []).map(c => {
1344
+ const r = c.role === 'developpeur' ? parTitre.get(c.titre) : undefined;
1345
+ if (!r) return c;
1346
+ return {
1347
+ ...c,
1348
+ reponse: { etat: r.etat, ...(r.raison ? { raison: r.raison } : {}), piece: r.piece },
1349
+ };
1350
+ });
1286
1351
  }
1287
1352
 
1288
1353
  // The line CONTEXTE of a session: the text of `--contexte` of the run, which every session of the
@@ -1326,7 +1391,8 @@ function seanceLancee(ctx, role, r) {
1326
1391
  // a motionless session, or twice no sheet that conforms (« sans-fiche »). <avec> joins its fields
1327
1392
  // to the sheet's entry (the lot a review read); <valider>(sheet, attempt) names what makes a sheet
1328
1393
  // out of conformity beyond its schema at that attempt (an unknown package of a plan, an answer
1329
- // without a line for a question put), or null.
1394
+ // without a line for a question put, a discovery without its verdict), or null. <fiche> names its
1395
+ // sheet's schema when it is not its role's (`tri`), and <objet> its launch (`lancer`).
1330
1396
  async function jusquALaFiche(ctx, role, texte, options = {}) {
1331
1397
  const {
1332
1398
  neuve,
@@ -1353,7 +1419,7 @@ async function jusquALaFiche(ctx, role, texte, options = {}) {
1353
1419
  if (repli && r.seance !== 0) return null;
1354
1420
  lu =
1355
1421
  r.seance === 0
1356
- ? lireSaFiche(ctx, role, r.sortie)
1422
+ ? lireSaFiche(ctx, reste.fiche ?? role, r.sortie)
1357
1423
  : { erreur: `la séance finit en erreur (code ${r.seance})` };
1358
1424
  const faute = lu.fiche ? valider(lu.fiche, essai) : null;
1359
1425
  if (faute) lu = { erreur: `fiche non conforme : ${faute}` };
@@ -1368,10 +1434,14 @@ async function jusquALaFiche(ctx, role, texte, options = {}) {
1368
1434
  );
1369
1435
  }
1370
1436
 
1371
- // The sheet of <role> in the output <sortie> of its session (`lireFiche`), each file piece of it
1372
- // checked in the ticket's copy, or in the repository before the copy exists.
1373
- const lireSaFiche = (ctx, role, sortie) =>
1374
- lireFiche(role, sortie, { copie: existsSync(ctx.copie) ? ctx.copie : ctx.racine });
1437
+ // The sheet of schema <sorte> (a role's, or the tri's) in the output <sortie> of its session
1438
+ // (`lireFiche`), each file piece of it checked in the ticket's copy, or in the main tree before the
1439
+ // copy exists and once the integration removed it, and each piece of the ticket in its description.
1440
+ const lireSaFiche = (ctx, sorte, sortie) =>
1441
+ lireFiche(sorte, sortie, {
1442
+ copie: existsSync(ctx.copie) ? ctx.copie : ctx.racine,
1443
+ ticket: leTicket(ctx).description,
1444
+ });
1375
1445
 
1376
1446
  // The name of the package <dossier> as a title writes it: its package's name, or its path.
1377
1447
  function nomDe(ctx, dossier) {
@@ -1381,7 +1451,8 @@ function nomDe(ctx, dossier) {
1381
1451
 
1382
1452
  // The sheet <fiche> of <role>, kept with the ticket's sheets, <avec> joined to its entry, each of
1383
1453
  // its discoveries filed closed under the ticket (scripts/ticket.sh, label `decouverte`), its
1384
- // components the packages of the plan; returns it.
1454
+ // components the packages of the plan, and kept with the circuit's results (`decouverte`: its id
1455
+ // and its subject), which the tri reads; returns it.
1385
1456
  function garder(ctx, role, fiche, avec = {}) {
1386
1457
  inscrire(ctx, { role, fiche, ...avec });
1387
1458
  const composants = ctx.paquets.map(c => nomDe(ctx, c)).join(', ');
@@ -1395,13 +1466,19 @@ function garder(ctx, role, fiche, avec = {}) {
1395
1466
  env: { ...process.env, [ACTEUR]: AUTEUR_DU_CIRCUIT },
1396
1467
  }
1397
1468
  );
1398
- if (r.status !== 0) {
1399
- process.stderr.write(`⚠️ découverte « ${d.sujet} » non consignée : ${r.stderr}\n`);
1400
- }
1469
+ const id = r.status === 0 ? r.stdout.trim().split('\n').at(-1) : '';
1470
+ if (id) inscrire(ctx, { role: AUTEUR_DU_CIRCUIT, decouverte: { id, sujet: d.sujet } });
1471
+ else process.stderr.write(`⚠️ découverte « ${d.sujet} » non consignée : ${r.stderr}\n`);
1401
1472
  }
1402
1473
  return fiche;
1403
1474
  }
1404
1475
 
1476
+ // The discoveries the sheets of the ticket filed, `{ id, sujet }`, in their order.
1477
+ const decouvertesDuTicket = ctx =>
1478
+ lesFiches(ctx)
1479
+ .filter(e => e.role === AUTEUR_DU_CIRCUIT && e.decouverte)
1480
+ .map(e => e.decouverte);
1481
+
1405
1482
  const lire = f => (existsSync(f) ? readFileSync(f, 'utf8') : '');
1406
1483
 
1407
1484
  // The circuit's reports since the reviewer's last sheet: those of its proofs and checks (the final
@@ -1432,7 +1509,7 @@ const bloquants = bloquantsDeLaFiche;
1432
1509
 
1433
1510
  // The blocking findings <constats>, each under its heading, the criterion or rule it holds, its
1434
1511
  // recipient (or the criterion in question), its body and its piece (an element judged not
1435
- // conforming carries it in its body): lines.
1512
+ // conforming carries it in its body), then the developpeur's answer to it, when he gave one: lines.
1436
1513
  const lignesDesConstats = constats =>
1437
1514
  constats.flatMap((c, i) => [
1438
1515
  `### Constat ${i + 1} — ${c.titre}`,
@@ -1440,6 +1517,12 @@ const lignesDesConstats = constats =>
1440
1517
  c.critere_en_cause ? `Critère en cause : ${c.critere_en_cause}` : `Agent : ${c.role ?? '?'}`,
1441
1518
  c.corps,
1442
1519
  ...(c.piece ? [`Pièce : ${c.piece}`] : []),
1520
+ ...(c.reponse
1521
+ ? [
1522
+ `Réponse du développeur : ${c.reponse.etat}${c.reponse.raison ? ` — ${c.reponse.raison}` : ''}`,
1523
+ `Pièce de la réponse : ${c.reponse.piece}`,
1524
+ ]
1525
+ : []),
1443
1526
  '',
1444
1527
  ]);
1445
1528
 
@@ -1932,6 +2015,25 @@ function arretDuStatut(ctx, role, tentative, fiche) {
1932
2015
  );
1933
2016
  }
1934
2017
 
2018
+ // The stop « hors-portee » for the developpeur's sheet FAIT <fiche> of the session <tentative>
2019
+ // that does not hold criteria out of the plan (`hors_plan`), as a required check keeps a merge
2020
+ // from a change that does not pass it: each criterion and its package in the fact and in the
2021
+ // question, the answers `--etendre <paquet>` or the criterion amended and `--reprendre`; their
2022
+ // pieces as its piece, the handover after them.
2023
+ function arretHorsDuPlan(ctx, tentative, fiche) {
2024
+ const criteres = fiche.hors_plan.map(h => `critère ${h.critere} (${h.paquet})`).join(', ');
2025
+ const paquets = [...new Set(fiche.hors_plan.map(h => h.paquet))].join(',');
2026
+ const passation = derniereDe(ctx, 'developpeur')?.text ?? 'aucune';
2027
+ return new Arret(
2028
+ 'hors-portee',
2029
+ `Le développeur dit FAIT sans tenir, hors du plan, ${criteres} (séance ${tentative}).\n\nSa passation :\n\n${passation}`,
2030
+ {
2031
+ piece: fiche.hors_plan.map(h => h.piece).join('\n'),
2032
+ question: `Le développeur ne tient pas, hors du plan, ${criteres} : le plan s'étend (\`--etendre ${paquets}\`), ou le critère s'amende au ticket, puis \`--reprendre\`.`,
2033
+ }
2034
+ );
2035
+ }
2036
+
1935
2037
  // The sending to the testwriter in the developpeur's sheet <fiche> (its `renvoi`): what the
1936
2038
  // testwriter receives, the sending, then the developpeur's handover; null without a sending.
1937
2039
  function renvoiDe(ctx, fiche) {
@@ -1961,7 +2063,8 @@ const texteDesOuverts = constats =>
1961
2063
  // remark reaches the ticket, no agent; the sheet's schema gives a RENDU at least one), after each
1962
2064
  // finding open before it that the sheet neither marks lifted (`suivi`, by its title) nor states
1963
2065
  // again. Each one `{ titre, regle, role, corps, piece }`, its recipient the agent it names, testwriter or
1964
- // developpeur. Throws an Arret `relecture-arret` for a finding without a valid recipient or one
2066
+ // developpeur, without the developpeur's answer to the review before (`reponse`): his next sheet
2067
+ // answers it again. Throws an Arret `relecture-arret` for a finding without a valid recipient or one
1965
2068
  // that puts a criterion in question.
1966
2069
  function constatsOuverts(ctx, fiche, texte) {
1967
2070
  const arret = raison =>
@@ -1977,9 +2080,9 @@ function constatsOuverts(ctx, fiche, texte) {
1977
2080
  return { titre: c.titre, regle: c.regle, role: c.role, corps: c.corps, piece: c.piece };
1978
2081
  });
1979
2082
  const leves = new Set((fiche.suivi ?? []).filter(s => s.etat === 'levé').map(s => s.titre));
1980
- const restes = (ctx.constats ?? []).filter(
1981
- c => !leves.has(c.titre) && !neufs.some(n => n.titre === c.titre)
1982
- );
2083
+ const restes = (ctx.constats ?? [])
2084
+ .filter(c => !leves.has(c.titre) && !neufs.some(n => n.titre === c.titre))
2085
+ .map(c => Object.fromEntries(Object.entries(c).filter(([k]) => k !== 'reponse')));
1983
2086
  return [...restes, ...neufs];
1984
2087
  }
1985
2088
 
@@ -2077,6 +2180,145 @@ function fileEnCours(ctx) {
2077
2180
  return Number.isInteger(pid) && vivant(pid);
2078
2181
  }
2079
2182
 
2183
+ // The tri of the discoveries of the ticket (step 5.3 of scripts/etapes.mjs), once the queue has
2184
+ // brought its lot onto main, as Chromium and Mozilla give each new report a verdict before it is
2185
+ // filed. Without a discovery, no session. Else one session of the explorateur out of the
2186
+ // envelope, on Sonnet, in the main tree, under the rights of its role (reading, the build of a
2187
+ // package, no pass), its instruction from the eighth template (the ticket, its commit on main, the
2188
+ // one the queue names in the reason it closes the ticket with, `commitIntegre`, its discoveries,
2189
+ // one per line), its sheet the tri's (`tri` of scripts/resultats.mjs): one line per discovery
2190
+ // (`conformiteDuTri`), asked again once of the same session. Each verdict is written at the ticket
2191
+ // of its discovery (`Circuit · tri : <verdict> — <texte> (<piece>)`), its label set there; an
2192
+ // a-porter or a non-confirmee reopens under `a-valider`, the pane's list « à valider »; the others
2193
+ // stay closed. The line of the tri at the ticket names each writing that failed (the verdict, the
2194
+ // label, the reopening), with its error, and counts as reopened only what reopened. A tri that ends
2195
+ // without a sheet that conforms leaves the discoveries as
2196
+ // they are and says so at the ticket. Either way, its end is kept with the circuit's results
2197
+ // (`tri`: the discoveries read, whether its sheet conformed, its verdicts by kind), which the bilan
2198
+ // reads, and the working directory the queue removed at the closure, recreated for the session, is
2199
+ // removed again.
2200
+ async function trier(ctx) {
2201
+ const decouvertes = decouvertesDuTicket(ctx);
2202
+ if (!decouvertes.length) return;
2203
+ const ids = decouvertes.map(d => d.id);
2204
+ const n = `${decouvertes.length} découverte${decouvertes.length > 1 ? 's' : ''}`;
2205
+ // The commit the queue brought onto main for this ticket, not main's last, another ticket's
2206
+ // once several circuits run.
2207
+ const show = ctx.bd('show', ctx.ticket, '--json');
2208
+ const fermeture = show.status === 0 ? (JSON.parse(show.stdout)[0]?.close_reason ?? null) : null;
2209
+ const integre = commitIntegre(fermeture);
2210
+ const commit = integre
2211
+ ? spawnSync('git', ['-C', ctx.racine, 'log', '-1', '--format=%h %s', integre], {
2212
+ encoding: 'utf8',
2213
+ }).stdout.trim()
2214
+ : '';
2215
+ mkdirSync(ctx.tmp, { recursive: true });
2216
+ let fiche = null;
2217
+ let faute = null;
2218
+ try {
2219
+ fiche = await jusquALaFiche(
2220
+ ctx,
2221
+ EXPLORATEUR,
2222
+ consigne(
2223
+ {
2224
+ depot: ctx.racine,
2225
+ ticket: ctx.ticket,
2226
+ sujet: ctx.sujet,
2227
+ commit: commit || 'inconnu',
2228
+ decouvertes: decouvertes.map(d => `- ${d.id} — ${d.sujet}`).join('\n'),
2229
+ },
2230
+ 7
2231
+ ),
2232
+ {
2233
+ horsEnveloppe: true,
2234
+ droits: horsDeLEnveloppe(ctx, EXPLORATEUR, 'sonnet'),
2235
+ id: randomUUID(),
2236
+ fiche: 'tri',
2237
+ objet: 'tri',
2238
+ valider: f => conformiteDuTri(f, ids),
2239
+ }
2240
+ );
2241
+ } catch (x) {
2242
+ if (!(x instanceof Arret)) throw x;
2243
+ faute = premiereLigne(x.rapport);
2244
+ } finally {
2245
+ rmSync(ctx.tmp, { recursive: true, force: true });
2246
+ }
2247
+ if (!fiche) {
2248
+ inscrire(ctx, {
2249
+ role: AUTEUR_DU_CIRCUIT,
2250
+ etape: TRI,
2251
+ tri: { decouvertes: ids.length, conforme: false, verdicts: {} },
2252
+ });
2253
+ commenter(
2254
+ ctx,
2255
+ TRI,
2256
+ `le tri ne rend pas de fiche conforme (${faute}) : les ${n} restent telles quelles ; l'intégration tient.`
2257
+ );
2258
+ return;
2259
+ }
2260
+ // Each writing at a discovery's ticket, by its name; one that fails is named at the ticket.
2261
+ const echecs = [];
2262
+ const rouvertes = [];
2263
+ for (const l of fiche.verdicts) {
2264
+ const rouvre = VERDICTS_ROUVERTS.includes(l.verdict);
2265
+ const ecritures = [
2266
+ [
2267
+ 'verdict',
2268
+ [
2269
+ 'comments',
2270
+ 'add',
2271
+ l.decouverte,
2272
+ `${PREFIXE}${TRI} : ${l.verdict} — ${l.texte.trim()}${l.piece ? ` (${l.piece.trim()})` : ''}${rouvre ? ' ; rouverte sous a-valider, pour le responsable.' : ''}`,
2273
+ ],
2274
+ ],
2275
+ [
2276
+ 'étiquette',
2277
+ [
2278
+ 'update',
2279
+ l.decouverte,
2280
+ '--add-label',
2281
+ l.verdict,
2282
+ ...(rouvre ? ['--add-label', 'a-valider'] : []),
2283
+ ],
2284
+ ],
2285
+ ...(rouvre ? [['réouverture', ['reopen', l.decouverte]]] : []),
2286
+ ];
2287
+ const ratees = ecritures.flatMap(([quoi, args]) => {
2288
+ const r = ctx.bd(...args);
2289
+ return r.status === 0 ? [] : [`${quoi} (${premiereLigne(r.stderr) || `code ${r.status}`})`];
2290
+ });
2291
+ if (ratees.length) echecs.push(`${l.decouverte} : ${ratees.join(', ')}`);
2292
+ if (rouvre && !ratees.some(x => x.startsWith('réouverture'))) rouvertes.push(l.decouverte);
2293
+ }
2294
+ const verdicts = Object.fromEntries(
2295
+ VERDICTS_DU_TRI.map(v => [v, fiche.verdicts.filter(l => l.verdict === v).length]).filter(
2296
+ ([, k]) => k
2297
+ )
2298
+ );
2299
+ inscrire(ctx, {
2300
+ role: AUTEUR_DU_CIRCUIT,
2301
+ etape: TRI,
2302
+ tri: { decouvertes: ids.length, conforme: true, verdicts },
2303
+ });
2304
+ commenter(
2305
+ ctx,
2306
+ TRI,
2307
+ `${n} triée${decouvertes.length > 1 ? 's' : ''} — ${Object.entries(verdicts)
2308
+ .map(([v, k]) => `${k} ${v}`)
2309
+ .join(
2310
+ ', '
2311
+ )} ; ${rouvertes.length ? `rouvertes sous a-valider : ${rouvertes.join(', ')}` : 'aucune rouverte'}${echecs.length ? ` ; écritures en échec : ${echecs.join(' ; ')}` : ''}.`
2312
+ );
2313
+ }
2314
+
2315
+ // The commit the queue names in the reason of a ticket it closes (`intégré : <commit>`,
2316
+ // scripts/integration/file.mjs), or null for another reason.
2317
+ export function commitIntegre(raison) {
2318
+ const r = String(raison ?? '');
2319
+ return r.startsWith(INTEGRE) ? r.slice(INTEGRE.length).trim().split(' ')[0] || null : null;
2320
+ }
2321
+
2080
2322
  // The type of a conventional commit for the ticket's type in Beads; `feat` for any other.
2081
2323
  const TYPES_DE_COMMIT = { bug: 'fix', chore: 'chore', docs: 'docs' };
2082
2324
 
@@ -2991,6 +3233,7 @@ async function derouler(ctx, debut) {
2991
3233
  if (fiche.statut === 'BLOQUÉ') {
2992
3234
  throw arretDuStatut(ctx, 'developpeur', tentative, fiche);
2993
3235
  }
3236
+ if (fiche.hors_plan?.length) throw arretHorsDuPlan(ctx, tentative, fiche);
2994
3237
  const inchangee = empreinte(ctx) === avant;
2995
3238
  if (inchangee && reprend && livre(ctx)) {
2996
3239
  // A resumed developpeur that finds the lot delivered: the checks judge it.
@@ -3287,14 +3530,19 @@ async function derouler(ctx, debut) {
3287
3530
  } else if (etape === EN_FILE) {
3288
3531
  const f = file(ctx);
3289
3532
  if (f.etat === 'ferme') {
3290
- ecrireEtat(ctx, { ...etat, etape: 'integre', code: 0 });
3291
3533
  commenter(ctx, 'file', `${f.raison}.`);
3292
- return { code: 0 };
3534
+ etape = TRI;
3535
+ continue;
3293
3536
  }
3294
3537
  if (f.etat === 'en-file') throw new Arret('a-repasser', f.raison);
3295
3538
  throw new Arret('integration', `La file rouvre le ticket.\n\n${f.raison}`, {
3296
3539
  piece: f.raison,
3297
3540
  });
3541
+ } else if (etape === TRI) {
3542
+ // The lot is on main: the tri of its discoveries, which neither stops nor undoes it.
3543
+ await trier(ctx);
3544
+ ecrireEtat(ctx, { ...etat, etape: 'integre', code: 0 });
3545
+ return { code: 0 };
3298
3546
  } else {
3299
3547
  throw new Usage(`étape inconnue dans l'état : ${etape}`);
3300
3548
  }
@@ -136,7 +136,10 @@ const ECRIRE = ['Edit', 'Write'];
136
136
  // names (the frame's plugin, `mods/grillhouse/skills/<rôle>/`), as permission rules.
137
137
  export const ROLES = {
138
138
  // It writes no file and nothing at the ticket: it surveys the components and reads the code by
139
- // the index, and ends on the plan in its sheet, which the circuit writes at the ticket.
139
+ // the index, and ends on the plan in its sheet, which the circuit writes at the ticket. At the
140
+ // tri of the discoveries, it reads each one and its parent, the history of main (`git log`, a
141
+ // read in its working directory, the main tree), and builds a package before it judges an error
142
+ // of types of its export; no pass (grillhouse-0yu.5).
140
143
  explorateur: {
141
144
  metacadre: true,
142
145
  index: true,
@@ -145,6 +148,7 @@ export const ROLES = {
145
148
  'Bash(bd show *)',
146
149
  'Bash(bd comments *)',
147
150
  'Bash(npx grillhouse composants-affectes *)',
151
+ 'Bash(npm run build -- --filter=*)',
148
152
  'Bash(codegraph explore *)',
149
153
  'mcp__codegraph__codegraph_explore',
150
154
  'mcp__rtfm__rtfm_search',
@@ -22,6 +22,10 @@
22
22
  // is an element of the report itself, exported.
23
23
  // - A changed source that the service does not read (a package without `tsconfig.json`) is named
24
24
  // in `horsDuService`: the reviewer surveys its elements himself, each named `<fichier>#<nom>`.
25
+ // - Every file the lot changes, a source or not, is named in `fichiers`: a line of the reviewer's
26
+ // conformity may name any of them, alone or as `<fichier>#<nom>`, as a review on GitHub or
27
+ // Gerrit accepts a comment on any line of any changed file (scripts/resultats.mjs,
28
+ // `conformiteDuLot`).
25
29
  import { spawnSync } from 'node:child_process';
26
30
  import { existsSync } from 'node:fs';
27
31
  import { createRequire } from 'node:module';
@@ -115,12 +119,14 @@ function declarationsDuRapport(ts, texte) {
115
119
  }
116
120
 
117
121
  // The elements the lot of the copy <copie> adds, changes or removes between the commits <avant>
118
- // and <apres>: `{ etat: 'fait', raison: null, elements, horsDuService, service }`, each element
122
+ // and <apres>: `{ etat: 'fait', raison: null, elements, horsDuService, fichiers, service }`, each element
119
123
  // `{ id, nom, genre, statut, paquet, fichier, ligne, exporte }` (`id` `<fichier>#<nom>`, `statut`
120
124
  // neuf, changé or supprimé, `fichier` from the copy, `ligne` in the file after, or before for a
121
125
  // removed one), sorted by file, line and name, `horsDuService` the changed sources the language
122
- // service does not read, `service` null when it ran, else why it could not (no `tsconfig.json`
123
- // in the components); or `{ etat: 'impossible', raison, elements: [], horsDuService: [] }`.
126
+ // service does not read, `fichiers` every file the lot changes, a source or not, sorted (a review
127
+ // accepts a comment on any changed file), `service` null when it ran, else why it could not (no
128
+ // `tsconfig.json` in the components); or `{ etat: 'impossible', raison, elements: [],
129
+ // horsDuService: [], fichiers: [] }`.
124
130
  export function elementsDuLot(copie, { avant, apres }) {
125
131
  try {
126
132
  return calculer(copie, avant, apres);
@@ -129,7 +135,13 @@ export function elementsDuLot(copie, { avant, apres }) {
129
135
  }
130
136
  }
131
137
 
132
- const impossible = raison => ({ etat: 'impossible', raison, elements: [], horsDuService: [] });
138
+ const impossible = raison => ({
139
+ etat: 'impossible',
140
+ raison,
141
+ elements: [],
142
+ horsDuService: [],
143
+ fichiers: [],
144
+ });
133
145
 
134
146
  function calculer(copie, avant, apres) {
135
147
  const r = git(copie, 'diff', '--name-status', '-z', '--no-renames', avant, apres);
@@ -241,6 +253,7 @@ function calculer(copie, avant, apres) {
241
253
  raison: null,
242
254
  elements,
243
255
  horsDuService: horsDuService.sort(),
256
+ fichiers: [...changesEnSet].sort(),
244
257
  service: s.raison ?? null,
245
258
  };
246
259
  }
@@ -12,6 +12,9 @@
12
12
  // testwriter (2) and one of the developpeur (3) carry the whole plan.
13
13
  // The plan (1) is read elsewhere in the state: by the work on the plan under way
14
14
  // (`questionnement`, the explorateur's or the questionneur's session) and by its stop (`arrets`).
15
+ // The tri of the discoveries (5.3) is the explorateur's too, once the queue has brought the lot
16
+ // onto main, as Chromium and Mozilla give each new report a verdict before it is filed; the
17
+ // role's own step stays the plan (`etapeDuRole`).
15
18
  // SUITE is the tree in its order, each step before its sub-steps.
16
19
  // - A step carries as many bounded loops as it needs (`boucles`), each spanning the step and its
17
20
  // sub-steps: each its key (`cle`, which keys its count in the state's `boucles`), its label and
@@ -30,6 +33,11 @@ import { A_REPASSER } from './vitest-config/pression.mjs';
30
33
  // Who works at a step the circuit leads itself, with no agent.
31
34
  export const AUTO = 'auto';
32
35
 
36
+ // The role that writes the plan and answers its questions once, and sorts the discoveries of the
37
+ // ticket once its lot is on main; the role that questions the plan.
38
+ export const EXPLORATEUR = 'explorateur';
39
+ export const QUESTIONNEUR = 'questionneur';
40
+
33
41
  export const ETAPES = [
34
42
  {
35
43
  numero: '1',
@@ -86,6 +94,8 @@ export const ETAPES = [
86
94
  sous: [
87
95
  { numero: '5.1', titre: 'Commit', qui: [AUTO], etat: 'integration' },
88
96
  { numero: '5.2', titre: 'File : main, poussée, CI', qui: [AUTO], etat: 'file' },
97
+ // The tri of the discoveries of the ticket, on the lot entered on main (grillhouse-0yu.5).
98
+ { numero: '5.3', titre: 'Tri des découvertes', qui: [EXPLORATEUR], etat: 'tri' },
89
99
  ],
90
100
  },
91
101
  ];
@@ -124,10 +134,6 @@ export const ARRETS = {
124
134
  'a-repasser': A_REPASSER,
125
135
  };
126
136
 
127
- // The role that writes the plan and answers its questions once, and the role that questions it.
128
- export const EXPLORATEUR = 'explorateur';
129
- export const QUESTIONNEUR = 'questionneur';
130
-
131
137
  // A role by its agent's name: an agent of the frame's plugin is named bare or scoped by the
132
138
  // plugin (`grillhouse:<rôle>`), as Claude Code names a plugin's agents and the register writes
133
139
  // them; the board and the bilan read a role this one way.