@roomi-fields/grillhouse 0.24.10 → 0.24.12

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:
@@ -224,9 +228,13 @@
224
228
  // script `test:vitest` plays only when the lot touches it), `npm test -- <test files of the lot>`
225
229
  // that none of them holds, each test played once, then the guards in the envelope of the plan (`GRILLHOUSE_ENVELOPPE=<plan> npm run
226
230
  // grillhouse:gardes`, and `npm run gardes` when the project has it). Each red is read in the
227
- // results of its command: a failed test of the reports of Vitest, a finding of the guards'
228
- // SARIF, a failed build or task of the summary; a red check none of them situates is one red of
229
- // the command. A red a path of the plan holds is the developpeur's; the others (one without a
231
+ // results of its command: a failed test of the reports of Vitest, a finding of level error of
232
+ // the guards' SARIF, a failed build or task of the summary; a red check none of them situates is
233
+ // one red of the command. As SARIF 2.1.0 and GitHub code scanning, a warning or a note shows
234
+ // without failing: the report of the checks lists them apart, under their own title, and gives
235
+ // them to no developpeur; a guards' task red without a finding of level error keeps its line of
236
+ // a red task, with its log (BPScript 320.17: 8 warnings on the code of the plan, given as reds,
237
+ // stopped at « sans-livraison » a lot whose one error was the ceiling's, to regenerate). A red a path of the plan holds is the developpeur's; the others (one without a
230
238
  // file, the root's or a project's guard without SARIF, in a package out of the plan, or a red of
231
239
  // a reference, which its regeneration lifts) wait for the final pass. Green,
232
240
  // the checks lead to the final pass.
@@ -374,9 +382,22 @@
374
382
  // to the log (it brings the branch onto main, pushes it and reads the CI of the commit pushed).
375
383
  // A queue already running exits 0 at once: the circuit waits while the branch is in the queue
376
384
  // and the queue's lock names a live process. Then the state of the ticket: closed, the circuit
377
- // ends at « integre », exit 0 (the queue's last word at the ticket named with it, a CI it could
378
- // not read); reopened (out of the queue, or a red CI), it stops at « integration », the queue's
385
+ // sorts the discoveries (below), then ends at « integre », exit 0 (the queue's last word at the
386
+ // 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
379
387
  // last word as its reason; still in the queue, it stops at « a-repasser », the queue's reason.
388
+ // - Then the tri of the discoveries (step 5.3, `trier`), as Chromium and Mozilla give each new
389
+ // report a verdict before it is filed: each discovery a sheet filed is kept with the circuit's
390
+ // results (`decouverte`: its id, its subject); without one, no session. Else one session of the
391
+ // explorateur out of the envelope, on Sonnet, in the main tree (the copy is gone), under the
392
+ // rights of its role (reading, the build of a package, no pass), its instruction from the eighth
393
+ // template, its sheet the tri's (`tri` of scripts/resultats.mjs): one line per discovery
394
+ // (`conformiteDuTri`), each with its verdict (traitee, doublon, sans-suite, a-porter,
395
+ // non-confirmee), the piece of a traitee or an a-porter a command played again on main or
396
+ // file:line; a sheet out of conformity is asked again once of the same session. Each verdict is
397
+ // written at its discovery's ticket and set there as a label; an a-porter or a non-confirmee
398
+ // reopens under `a-valider`. A tri without a sheet that conforms leaves the discoveries as they
399
+ // are, said at the ticket; it never stops the circuit nor undoes the integration. Its end is kept
400
+ // with the circuit's results (`tri`), which the bilan counts.
380
401
  // - The working directory is the ticket's, `.claude/worktrees/<ticket>.travail`: the instructions,
381
402
  // results and errors of the sessions, the patches and message of the integration. It lives as
382
403
  // long as the ticket, as the workspace of a pipeline: a circuit relaunched takes it up again, no
@@ -391,7 +412,8 @@
391
412
  // on the plan under way (`{ objet, role, seance }`: the plan, the explorateur or the
392
413
  // questionneur, its session), null otherwise; `etape` is the state's name of a numbered step of
393
414
  // the process (scripts/etapes.mjs: testwriter 2, preuve 2.1, developpeur 3, controles 3.1, or 4.1
394
- // the final pass once `finale`, references 4.2, relecture 4.3, integration 5.1, file 5.2), or
415
+ // the final pass once `finale`, references 4.2, relecture 4.3, integration 5.1, file 5.2, tri
416
+ // 5.3), or
395
417
  // integre at the end; `raison` names the stop (« arrete » once the supervisor stopped the
396
418
  // circuit); `question` the question of a stop for the supervisor (`{ arret, fait, piece,
397
419
  // question, qui }`), null otherwise; `paquets` the plan of the ticket, in its order; `constats`
@@ -461,7 +483,7 @@
461
483
  // them), 16 relecture-arret (a finding without a valid agent, one on a criterion, the third
462
484
  // RENDU), 17 integration (the integration script refuses the lot, or the queue reopens the
463
485
  // ticket), 19 hors-portee (a testwriter or developpeur whose sheet says BLOQUÉ, without a
464
- // sending to the testwriter), 20 besoin (a testwriter or developpeur whose sheet says BESOIN, a
486
+ // 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
465
487
  // reviewer whose sheet carries a `question`, or a ticket labelled `arbitrage` whose arbitrage
466
488
  // `refusArbitrage` of scripts/integration/integrer.mjs refuses, at the launch or a resumption,
467
489
  // before any session), 22 questionnement (questions of the plan left open
@@ -521,6 +543,7 @@ import {
521
543
  A_ELAGUER,
522
544
  bloquantsDeLaFiche,
523
545
  conformiteDuLot,
546
+ conformiteDuTri,
524
547
  lireFiche,
525
548
  lireRapportsVitest,
526
549
  lireResumes,
@@ -529,8 +552,10 @@ import {
529
552
  reponsesAuxQuestions,
530
553
  RESULTATS,
531
554
  schemaDeFiche,
555
+ VERDICTS_DU_TRI,
556
+ VERDICTS_ROUVERTS,
532
557
  } from './resultats.mjs';
533
- import { AUTEUR_DE_LA_FILE } from './integration/file.mjs';
558
+ import { AUTEUR_DE_LA_FILE, INTEGRE } from './integration/file.mjs';
534
559
  import { dossierCommun, lireEntrees } from './integration/file-attente.mjs';
535
560
  import { refusArbitrage } from './integration/integrer.mjs';
536
561
  import { AUTEUR_DU_VERDICT } from './integration/verdict.mjs';
@@ -561,7 +586,7 @@ const SEANCES_DEVELOPPEUR = boucle('code').max;
561
586
  const RELECTURES = boucle('relecture').max;
562
587
  // The steps of the circuit's state, read from the list of the steps.
563
588
  const etatDe = n => SUITE.find(e => e.numero === n).etat;
564
- const [TESTS, PREUVE, CODE, CONTROLES, REFERENCES, RELECTURE, INTEGRATION, EN_FILE] = [
589
+ const [TESTS, PREUVE, CODE, CONTROLES, REFERENCES, RELECTURE, INTEGRATION, EN_FILE, TRI] = [
565
590
  '2',
566
591
  '2.1',
567
592
  '3',
@@ -570,6 +595,7 @@ const [TESTS, PREUVE, CODE, CONTROLES, REFERENCES, RELECTURE, INTEGRATION, EN_FI
570
595
  '4.3',
571
596
  '5.1',
572
597
  '5.2',
598
+ '5.3',
573
599
  ].map(etatDe);
574
600
  // The variable in which bd reads the author of a comment (`bd --help`: « default: $BEADS_ACTOR,
575
601
  // git user.name, $USER »), each session's its role; the author of the circuit's own lines.
@@ -1042,20 +1068,25 @@ const mtime = f => {
1042
1068
  // schema of its role's sheet and the options <session> names (its id, or the session it
1043
1069
  // resumes), its instruction on its standard input and its result on its standard output, added
1044
1070
  // to the log under its header line, then its line written to the register, as lancer.sh does.
1045
- // Its launch is kept with the circuit's results (`lancement`: its role and its session id), which
1046
- // the bilan reads to count the sessions the circuit launched (scripts/bilan.mjs).
1071
+ // Its launch is kept with the circuit's results (`lancement`: its role, its session id, and the
1072
+ // <objet> of a session that is not its role's own work, `tri`), which the bilan reads to count the
1073
+ // sessions the circuit launched (scripts/bilan.mjs). Its sheet is the schema <fiche>, by default
1074
+ // its role's.
1047
1075
  function lancer(
1048
1076
  ctx,
1049
1077
  role,
1050
1078
  consigne,
1051
- { fort, horsEnveloppe, droits = [], session = [], ouvre, reprend } = {}
1079
+ { fort, horsEnveloppe, droits = [], session = [], ouvre, reprend, fiche: sorte, objet } = {}
1052
1080
  ) {
1053
1081
  rmSync(ctx.fin, { force: true });
1054
1082
  rmSync(ctx.resultat, { force: true });
1055
1083
  rmSync(ctx.horsPlan, { force: true });
1056
1084
  const id = ouvre ?? reprend ?? session[1] ?? null;
1057
1085
  if (id) {
1058
- inscrire(ctx, { role: AUTEUR_DU_CIRCUIT, lancement: { role, seance: id } });
1086
+ inscrire(ctx, {
1087
+ role: AUTEUR_DU_CIRCUIT,
1088
+ lancement: { role, seance: id, ...(objet ? { objet } : {}) },
1089
+ });
1059
1090
  }
1060
1091
  const fichier = path.join(ctx.tmp, `consigne-${++ctx.numero}.md`);
1061
1092
  writeFileSync(fichier, consigne);
@@ -1068,7 +1099,12 @@ function lancer(
1068
1099
  if (horsEnveloppe) {
1069
1100
  entete(ctx, role);
1070
1101
  fds = [openSync(fichier, 'r'), openSync(reponse, 'w'), openSync(ctx.journal, 'a')];
1071
- const fiche = ['--output-format', 'json', '--json-schema', JSON.stringify(schemaDeFiche(role))];
1102
+ const fiche = [
1103
+ '--output-format',
1104
+ 'json',
1105
+ '--json-schema',
1106
+ JSON.stringify(schemaDeFiche(sorte ?? role)),
1107
+ ];
1072
1108
  commande = {
1073
1109
  cmd: process.env.CLAUDE_BIN || 'claude',
1074
1110
  args: ['-p', '--agent', role, ...fiche, ...droits, '--add-dir', ctx.tmp, ...session],
@@ -1194,7 +1230,8 @@ async function attendreLaSeance(ctx, groupe) {
1194
1230
  // The template of the instruction at <rang> (0 the testwriter's and the developpeur's, 1 the
1195
1231
  // reviewer's, 2 any session's on a sheet absent or out of its schema, 3 the testwriter's and the
1196
1232
  // developpeur's on a resumption, 4 the questionneur's on the plan, 5 the explorateur's on the plan,
1197
- // 6 the explorateur's on the questions of the plan), filled with <valeurs>.
1233
+ // 6 the explorateur's on the questions of the plan, 7 the explorateur's on the tri of the
1234
+ // discoveries), filled with <valeurs>.
1198
1235
  function consigne(valeurs, rang = 0) {
1199
1236
  const texte = readFileSync(GABARIT, 'utf8');
1200
1237
  const bloc = [...texte.matchAll(/```text\n([\s\S]*?)\n```/g)][rang];
@@ -1322,7 +1359,8 @@ function seanceLancee(ctx, role, r) {
1322
1359
  // a motionless session, or twice no sheet that conforms (« sans-fiche »). <avec> joins its fields
1323
1360
  // to the sheet's entry (the lot a review read); <valider>(sheet, attempt) names what makes a sheet
1324
1361
  // out of conformity beyond its schema at that attempt (an unknown package of a plan, an answer
1325
- // without a line for a question put), or null.
1362
+ // without a line for a question put, a discovery without its verdict), or null. <fiche> names its
1363
+ // sheet's schema when it is not its role's (`tri`), and <objet> its launch (`lancer`).
1326
1364
  async function jusquALaFiche(ctx, role, texte, options = {}) {
1327
1365
  const {
1328
1366
  neuve,
@@ -1349,7 +1387,7 @@ async function jusquALaFiche(ctx, role, texte, options = {}) {
1349
1387
  if (repli && r.seance !== 0) return null;
1350
1388
  lu =
1351
1389
  r.seance === 0
1352
- ? lireSaFiche(ctx, role, r.sortie)
1390
+ ? lireSaFiche(ctx, reste.fiche ?? role, r.sortie)
1353
1391
  : { erreur: `la séance finit en erreur (code ${r.seance})` };
1354
1392
  const faute = lu.fiche ? valider(lu.fiche, essai) : null;
1355
1393
  if (faute) lu = { erreur: `fiche non conforme : ${faute}` };
@@ -1364,10 +1402,14 @@ async function jusquALaFiche(ctx, role, texte, options = {}) {
1364
1402
  );
1365
1403
  }
1366
1404
 
1367
- // The sheet of <role> in the output <sortie> of its session (`lireFiche`), each file piece of it
1368
- // checked in the ticket's copy, or in the repository before the copy exists.
1369
- const lireSaFiche = (ctx, role, sortie) =>
1370
- lireFiche(role, sortie, { copie: existsSync(ctx.copie) ? ctx.copie : ctx.racine });
1405
+ // The sheet of schema <sorte> (a role's, or the tri's) in the output <sortie> of its session
1406
+ // (`lireFiche`), each file piece of it checked in the ticket's copy, or in the main tree before the
1407
+ // copy exists and once the integration removed it, and each piece of the ticket in its description.
1408
+ const lireSaFiche = (ctx, sorte, sortie) =>
1409
+ lireFiche(sorte, sortie, {
1410
+ copie: existsSync(ctx.copie) ? ctx.copie : ctx.racine,
1411
+ ticket: leTicket(ctx).description,
1412
+ });
1371
1413
 
1372
1414
  // The name of the package <dossier> as a title writes it: its package's name, or its path.
1373
1415
  function nomDe(ctx, dossier) {
@@ -1377,7 +1419,8 @@ function nomDe(ctx, dossier) {
1377
1419
 
1378
1420
  // The sheet <fiche> of <role>, kept with the ticket's sheets, <avec> joined to its entry, each of
1379
1421
  // its discoveries filed closed under the ticket (scripts/ticket.sh, label `decouverte`), its
1380
- // components the packages of the plan; returns it.
1422
+ // components the packages of the plan, and kept with the circuit's results (`decouverte`: its id
1423
+ // and its subject), which the tri reads; returns it.
1381
1424
  function garder(ctx, role, fiche, avec = {}) {
1382
1425
  inscrire(ctx, { role, fiche, ...avec });
1383
1426
  const composants = ctx.paquets.map(c => nomDe(ctx, c)).join(', ');
@@ -1391,13 +1434,19 @@ function garder(ctx, role, fiche, avec = {}) {
1391
1434
  env: { ...process.env, [ACTEUR]: AUTEUR_DU_CIRCUIT },
1392
1435
  }
1393
1436
  );
1394
- if (r.status !== 0) {
1395
- process.stderr.write(`⚠️ découverte « ${d.sujet} » non consignée : ${r.stderr}\n`);
1396
- }
1437
+ const id = r.status === 0 ? r.stdout.trim().split('\n').at(-1) : '';
1438
+ if (id) inscrire(ctx, { role: AUTEUR_DU_CIRCUIT, decouverte: { id, sujet: d.sujet } });
1439
+ else process.stderr.write(`⚠️ découverte « ${d.sujet} » non consignée : ${r.stderr}\n`);
1397
1440
  }
1398
1441
  return fiche;
1399
1442
  }
1400
1443
 
1444
+ // The discoveries the sheets of the ticket filed, `{ id, sujet }`, in their order.
1445
+ const decouvertesDuTicket = ctx =>
1446
+ lesFiches(ctx)
1447
+ .filter(e => e.role === AUTEUR_DU_CIRCUIT && e.decouverte)
1448
+ .map(e => e.decouverte);
1449
+
1401
1450
  const lire = f => (existsSync(f) ? readFileSync(f, 'utf8') : '');
1402
1451
 
1403
1452
  // The circuit's reports since the reviewer's last sheet: those of its proofs and checks (the final
@@ -1928,6 +1977,25 @@ function arretDuStatut(ctx, role, tentative, fiche) {
1928
1977
  );
1929
1978
  }
1930
1979
 
1980
+ // The stop « hors-portee » for the developpeur's sheet FAIT <fiche> of the session <tentative>
1981
+ // that does not hold criteria out of the plan (`hors_plan`), as a required check keeps a merge
1982
+ // from a change that does not pass it: each criterion and its package in the fact and in the
1983
+ // question, the answers `--etendre <paquet>` or the criterion amended and `--reprendre`; their
1984
+ // pieces as its piece, the handover after them.
1985
+ function arretHorsDuPlan(ctx, tentative, fiche) {
1986
+ const criteres = fiche.hors_plan.map(h => `critère ${h.critere} (${h.paquet})`).join(', ');
1987
+ const paquets = [...new Set(fiche.hors_plan.map(h => h.paquet))].join(',');
1988
+ const passation = derniereDe(ctx, 'developpeur')?.text ?? 'aucune';
1989
+ return new Arret(
1990
+ 'hors-portee',
1991
+ `Le développeur dit FAIT sans tenir, hors du plan, ${criteres} (séance ${tentative}).\n\nSa passation :\n\n${passation}`,
1992
+ {
1993
+ piece: fiche.hors_plan.map(h => h.piece).join('\n'),
1994
+ 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\`.`,
1995
+ }
1996
+ );
1997
+ }
1998
+
1931
1999
  // The sending to the testwriter in the developpeur's sheet <fiche> (its `renvoi`): what the
1932
2000
  // testwriter receives, the sending, then the developpeur's handover; null without a sending.
1933
2001
  function renvoiDe(ctx, fiche) {
@@ -2073,6 +2141,145 @@ function fileEnCours(ctx) {
2073
2141
  return Number.isInteger(pid) && vivant(pid);
2074
2142
  }
2075
2143
 
2144
+ // The tri of the discoveries of the ticket (step 5.3 of scripts/etapes.mjs), once the queue has
2145
+ // brought its lot onto main, as Chromium and Mozilla give each new report a verdict before it is
2146
+ // filed. Without a discovery, no session. Else one session of the explorateur out of the
2147
+ // envelope, on Sonnet, in the main tree, under the rights of its role (reading, the build of a
2148
+ // package, no pass), its instruction from the eighth template (the ticket, its commit on main, the
2149
+ // one the queue names in the reason it closes the ticket with, `commitIntegre`, its discoveries,
2150
+ // one per line), its sheet the tri's (`tri` of scripts/resultats.mjs): one line per discovery
2151
+ // (`conformiteDuTri`), asked again once of the same session. Each verdict is written at the ticket
2152
+ // of its discovery (`Circuit · tri : <verdict> — <texte> (<piece>)`), its label set there; an
2153
+ // a-porter or a non-confirmee reopens under `a-valider`, the pane's list « à valider »; the others
2154
+ // stay closed. The line of the tri at the ticket names each writing that failed (the verdict, the
2155
+ // label, the reopening), with its error, and counts as reopened only what reopened. A tri that ends
2156
+ // without a sheet that conforms leaves the discoveries as
2157
+ // they are and says so at the ticket. Either way, its end is kept with the circuit's results
2158
+ // (`tri`: the discoveries read, whether its sheet conformed, its verdicts by kind), which the bilan
2159
+ // reads, and the working directory the queue removed at the closure, recreated for the session, is
2160
+ // removed again.
2161
+ async function trier(ctx) {
2162
+ const decouvertes = decouvertesDuTicket(ctx);
2163
+ if (!decouvertes.length) return;
2164
+ const ids = decouvertes.map(d => d.id);
2165
+ const n = `${decouvertes.length} découverte${decouvertes.length > 1 ? 's' : ''}`;
2166
+ // The commit the queue brought onto main for this ticket, not main's last, another ticket's
2167
+ // once several circuits run.
2168
+ const show = ctx.bd('show', ctx.ticket, '--json');
2169
+ const fermeture = show.status === 0 ? (JSON.parse(show.stdout)[0]?.close_reason ?? null) : null;
2170
+ const integre = commitIntegre(fermeture);
2171
+ const commit = integre
2172
+ ? spawnSync('git', ['-C', ctx.racine, 'log', '-1', '--format=%h %s', integre], {
2173
+ encoding: 'utf8',
2174
+ }).stdout.trim()
2175
+ : '';
2176
+ mkdirSync(ctx.tmp, { recursive: true });
2177
+ let fiche = null;
2178
+ let faute = null;
2179
+ try {
2180
+ fiche = await jusquALaFiche(
2181
+ ctx,
2182
+ EXPLORATEUR,
2183
+ consigne(
2184
+ {
2185
+ depot: ctx.racine,
2186
+ ticket: ctx.ticket,
2187
+ sujet: ctx.sujet,
2188
+ commit: commit || 'inconnu',
2189
+ decouvertes: decouvertes.map(d => `- ${d.id} — ${d.sujet}`).join('\n'),
2190
+ },
2191
+ 7
2192
+ ),
2193
+ {
2194
+ horsEnveloppe: true,
2195
+ droits: horsDeLEnveloppe(ctx, EXPLORATEUR, 'sonnet'),
2196
+ id: randomUUID(),
2197
+ fiche: 'tri',
2198
+ objet: 'tri',
2199
+ valider: f => conformiteDuTri(f, ids),
2200
+ }
2201
+ );
2202
+ } catch (x) {
2203
+ if (!(x instanceof Arret)) throw x;
2204
+ faute = premiereLigne(x.rapport);
2205
+ } finally {
2206
+ rmSync(ctx.tmp, { recursive: true, force: true });
2207
+ }
2208
+ if (!fiche) {
2209
+ inscrire(ctx, {
2210
+ role: AUTEUR_DU_CIRCUIT,
2211
+ etape: TRI,
2212
+ tri: { decouvertes: ids.length, conforme: false, verdicts: {} },
2213
+ });
2214
+ commenter(
2215
+ ctx,
2216
+ TRI,
2217
+ `le tri ne rend pas de fiche conforme (${faute}) : les ${n} restent telles quelles ; l'intégration tient.`
2218
+ );
2219
+ return;
2220
+ }
2221
+ // Each writing at a discovery's ticket, by its name; one that fails is named at the ticket.
2222
+ const echecs = [];
2223
+ const rouvertes = [];
2224
+ for (const l of fiche.verdicts) {
2225
+ const rouvre = VERDICTS_ROUVERTS.includes(l.verdict);
2226
+ const ecritures = [
2227
+ [
2228
+ 'verdict',
2229
+ [
2230
+ 'comments',
2231
+ 'add',
2232
+ l.decouverte,
2233
+ `${PREFIXE}${TRI} : ${l.verdict} — ${l.texte.trim()}${l.piece ? ` (${l.piece.trim()})` : ''}${rouvre ? ' ; rouverte sous a-valider, pour le responsable.' : ''}`,
2234
+ ],
2235
+ ],
2236
+ [
2237
+ 'étiquette',
2238
+ [
2239
+ 'update',
2240
+ l.decouverte,
2241
+ '--add-label',
2242
+ l.verdict,
2243
+ ...(rouvre ? ['--add-label', 'a-valider'] : []),
2244
+ ],
2245
+ ],
2246
+ ...(rouvre ? [['réouverture', ['reopen', l.decouverte]]] : []),
2247
+ ];
2248
+ const ratees = ecritures.flatMap(([quoi, args]) => {
2249
+ const r = ctx.bd(...args);
2250
+ return r.status === 0 ? [] : [`${quoi} (${premiereLigne(r.stderr) || `code ${r.status}`})`];
2251
+ });
2252
+ if (ratees.length) echecs.push(`${l.decouverte} : ${ratees.join(', ')}`);
2253
+ if (rouvre && !ratees.some(x => x.startsWith('réouverture'))) rouvertes.push(l.decouverte);
2254
+ }
2255
+ const verdicts = Object.fromEntries(
2256
+ VERDICTS_DU_TRI.map(v => [v, fiche.verdicts.filter(l => l.verdict === v).length]).filter(
2257
+ ([, k]) => k
2258
+ )
2259
+ );
2260
+ inscrire(ctx, {
2261
+ role: AUTEUR_DU_CIRCUIT,
2262
+ etape: TRI,
2263
+ tri: { decouvertes: ids.length, conforme: true, verdicts },
2264
+ });
2265
+ commenter(
2266
+ ctx,
2267
+ TRI,
2268
+ `${n} triée${decouvertes.length > 1 ? 's' : ''} — ${Object.entries(verdicts)
2269
+ .map(([v, k]) => `${k} ${v}`)
2270
+ .join(
2271
+ ', '
2272
+ )} ; ${rouvertes.length ? `rouvertes sous a-valider : ${rouvertes.join(', ')}` : 'aucune rouverte'}${echecs.length ? ` ; écritures en échec : ${echecs.join(' ; ')}` : ''}.`
2273
+ );
2274
+ }
2275
+
2276
+ // The commit the queue names in the reason of a ticket it closes (`intégré : <commit>`,
2277
+ // scripts/integration/file.mjs), or null for another reason.
2278
+ export function commitIntegre(raison) {
2279
+ const r = String(raison ?? '');
2280
+ return r.startsWith(INTEGRE) ? r.slice(INTEGRE.length).trim().split(' ')[0] || null : null;
2281
+ }
2282
+
2076
2283
  // The type of a conventional commit for the ticket's type in Beads; `feat` for any other.
2077
2284
  const TYPES_DE_COMMIT = { bug: 'fix', chore: 'chore', docs: 'docs' };
2078
2285
 
@@ -2505,8 +2712,21 @@ function situer(ctx, liste, chemin) {
2505
2712
  // and that package again when it is out of the plan, whether it is a finding to settle
2506
2713
  // (`a-arbitrer`), and the package whose task gave it, as Turborepo names it (« // » for the
2507
2714
  // root's guards; null for a red of the command).
2715
+ // As SARIF 2.1.0 and GitHub code scanning, a finding of level error fails, a warning or a note
2716
+ // shows without failing: `{ rouges, avertissements }`, `avertissements` the lines of the findings
2717
+ // of another level, which the report lists apart. A guards' task red without a finding of level
2718
+ // error keeps its line of a red task, with its log.
2508
2719
  function rougesDe(ctx, liste, c) {
2509
- if (c.code === 0 || c.code === A_REPASSER) return [];
2720
+ const lus = lireSarif(c.dossier).constats.filter(k => k.genre !== A_ELAGUER);
2721
+ const vert = c.code === 0 || c.code === A_REPASSER;
2722
+ const duCadre = k => NOMS_DES_GARDES.includes(k.garde);
2723
+ const rouge = k => k.niveau === 'error';
2724
+ const ligneDe = k => {
2725
+ const ou = k.fichier ? ` ${k.fichier}${k.ligne ? `:${k.ligne}` : ''}` : '';
2726
+ return `${k.garde}${ou} — ${k.message}${k.genre === 'a-arbitrer' ? ' (à arbitrer)' : ''}`;
2727
+ };
2728
+ const avertissements = lus.filter(k => !rouge(k)).map(k => `${k.niveau} ${ligneDe(k)}`);
2729
+ if (vert) return { rouges: [], avertissements };
2510
2730
  const out = [];
2511
2731
  const testes = new Set();
2512
2732
  for (const res of lireRapportsVitest(c.dossier)) {
@@ -2532,11 +2752,10 @@ function rougesDe(ctx, liste, c) {
2532
2752
  }
2533
2753
  }
2534
2754
  // A key of the debt to lower (`a-elaguer`, scripts/dette.mjs) is a note, not a red.
2535
- const constats = lireSarif(c.dossier).constats.filter(k => k.genre !== A_ELAGUER);
2755
+ const constats = lus.filter(rouge);
2536
2756
  for (const k of constats) {
2537
- const ou = k.fichier ? ` ${k.fichier}${k.ligne ? `:${k.ligne}` : ''}` : '';
2538
2757
  out.push({
2539
- texte: `constat ${k.garde}${ou} — ${k.message}${k.genre === 'a-arbitrer' ? ' (à arbitrer)' : ''}`,
2758
+ texte: `constat ${ligneDe(k)}`,
2540
2759
  fichier: k.fichier ?? null,
2541
2760
  gardes: [k.garde, k.regle].filter(Boolean),
2542
2761
  ...situer(ctx, liste, k.fichier),
@@ -2545,7 +2764,7 @@ function rougesDe(ctx, liste, c) {
2545
2764
  });
2546
2765
  }
2547
2766
  // The guards of the project wrote findings when one comes from a guard out of the frame's.
2548
- const duProjet = constats.some(k => !NOMS_DES_GARDES.includes(k.garde));
2767
+ const duProjet = constats.some(k => !duCadre(k));
2549
2768
  for (const t of lireResumes(c.dossier)) {
2550
2769
  if (t.code === null || t.code === 0 || t.code === A_REPASSER) continue;
2551
2770
  if (t.script === 'test:vitest' && testes.has(t.dossier)) continue;
@@ -2574,7 +2793,7 @@ function rougesDe(ctx, liste, c) {
2574
2793
  horsTitre: null,
2575
2794
  });
2576
2795
  }
2577
- return out;
2796
+ return { rouges: out, avertissements };
2578
2797
  }
2579
2798
 
2580
2799
  const ligneDeCommande = c =>
@@ -2590,8 +2809,10 @@ const ligneDeCommande = c =>
2590
2809
  // package the pass restricted to the regeneration does not play again stands, as a CI keeps the
2591
2810
  // verdict of a job it does not run again; when the regeneration changes nothing (`rejouee`
2592
2811
  // false), no command plays, and they all stand. `{ rouge, aRepasser, arbitrer, auDeveloppeur,
2593
- // texte, complet, resume, horsTitre, lieux, tous, notes }`: `texte` the report for the
2594
- // developpeur, his reds first; `complet` every red, for a stop; `auDeveloppeur` whether a red lies
2812
+ // texte, complet, resume, horsTitre, lieux, tous, notes, avertissements }`: `texte` the report for
2813
+ // the developpeur, his reds first; `complet` every red, for a stop, and the warnings;
2814
+ // `avertissements` the section of the warnings and notes of the guards, which are no reds, for the
2815
+ // report of the checks (empty without one); `auDeveloppeur` whether a red lies
2595
2816
  // in a package of the plan; `horsTitre` the packages out of the plan that hold a red; `arbitrer`
2596
2817
  // when every red of the plan is a finding to settle; `lieux` the place of each red, `{ fichier,
2597
2818
  // gardes, dansLePlan }`, its file (null for a red without one), the names its finding carries
@@ -2619,7 +2840,7 @@ function controles(ctx, finale, restreinte = null, reportes = null) {
2619
2840
  r = npm(ctx, 'controles', args, env);
2620
2841
  }
2621
2842
  const c = { args, env, ...r };
2622
- return { ...c, rouges: rougesDe(ctx, liste, c) };
2843
+ return { ...c, ...rougesDe(ctx, liste, c) };
2623
2844
  });
2624
2845
  // The packages the commands played (the root's tasks under « // »), whose reds are read again.
2625
2846
  const joues = new Set(resultats.flatMap(r => lireResumes(r.dossier).map(t => t.paquet)));
@@ -2677,6 +2898,15 @@ function controles(ctx, finale, restreinte = null, reportes = null) {
2677
2898
  const ligne = r => [`- ${r.texte}`, ...(r.detail ? ['', r.detail, ''] : [])];
2678
2899
  const nomDuPaquet = r => r.paquet ?? 'hors des paquets';
2679
2900
  const journal = `Le journal du ticket, pour le détail des commandes : ${ctx.journal}`;
2901
+ // The warnings and notes of the guards, apart from the reds: shown, given to no one to correct.
2902
+ const signales = resultats.flatMap(r => r.avertissements);
2903
+ const avertissements = signales.length
2904
+ ? [
2905
+ `Les avertissements (${signales.length}), qui ne sont pas des rouges :`,
2906
+ ...signales.map(l => `- ${l}`),
2907
+ '',
2908
+ ]
2909
+ : [];
2680
2910
  const texte = [
2681
2911
  `${ou} : ${resume}.`,
2682
2912
  '',
@@ -2703,6 +2933,7 @@ function controles(ctx, finale, restreinte = null, reportes = null) {
2703
2933
  '',
2704
2934
  ]
2705
2935
  : []),
2936
+ ...avertissements,
2706
2937
  journal,
2707
2938
  ].join('\n');
2708
2939
  return {
@@ -2713,6 +2944,7 @@ function controles(ctx, finale, restreinte = null, reportes = null) {
2713
2944
  texte,
2714
2945
  complet,
2715
2946
  sansListe,
2947
+ avertissements: avertissements.length ? `\n\n${avertissements.join('\n').trimEnd()}` : '',
2716
2948
  // The reds of the stop, each with where it lies: the plan's, or at the final pass all of them;
2717
2949
  // never those left to the final pass.
2718
2950
  rouges: rouges.map(r => ({ paquet: nomDuPaquet(r), texte: r.texte, detail: r.detail })),
@@ -2962,6 +3194,7 @@ async function derouler(ctx, debut) {
2962
3194
  if (fiche.statut === 'BLOQUÉ') {
2963
3195
  throw arretDuStatut(ctx, 'developpeur', tentative, fiche);
2964
3196
  }
3197
+ if (fiche.hors_plan?.length) throw arretHorsDuPlan(ctx, tentative, fiche);
2965
3198
  const inchangee = empreinte(ctx) === avant;
2966
3199
  if (inchangee && reprend && livre(ctx)) {
2967
3200
  // A resumed developpeur that finds the lot delivered: the checks judge it.
@@ -3040,7 +3273,7 @@ async function derouler(ctx, debut) {
3040
3273
  'controles',
3041
3274
  `${k.resume} ; ${k.rouge ? 'des rouges sont ceux de références' : 'la dette des gardes baisse'} (${noms.join(', ')}) : à leur régénération.`,
3042
3275
  resultat(k.rouge ? 'rouge' : 'vert'),
3043
- k.texte
3276
+ `${k.texte}${k.avertissements}`
3044
3277
  );
3045
3278
  // The report of the reds of the plan, which go to the developpeur when a command of the
3046
3279
  // project refuses the lot.
@@ -3077,7 +3310,7 @@ async function derouler(ctx, debut) {
3077
3310
  'controles',
3078
3311
  `${k.resume} ; développeur relancé (séance ${suivante}).`,
3079
3312
  resultat('rouge'),
3080
- k.texte
3313
+ `${k.texte}${k.avertissements}`
3081
3314
  );
3082
3315
  etape = CODE;
3083
3316
  tentative = suivante;
@@ -3090,7 +3323,13 @@ async function derouler(ctx, debut) {
3090
3323
  // which plays once, on the regenerated tree, as make remakes a generated file before
3091
3324
  // what reads it.
3092
3325
  geste(ctx, 'regeneration');
3093
- ecrireRapport(ctx, 'controles', `${k.resume}.`, resultat('vert'));
3326
+ ecrireRapport(
3327
+ ctx,
3328
+ 'controles',
3329
+ `${k.resume}.`,
3330
+ resultat('vert'),
3331
+ `${k.resume}.${k.avertissements}`
3332
+ );
3094
3333
  ctx.renvoiAuTestwriter = false;
3095
3334
  ctx.aRegenerer = {
3096
3335
  noms: k.references.map(r => r.nom),
@@ -3101,7 +3340,13 @@ async function derouler(ctx, debut) {
3101
3340
  tentative = 0;
3102
3341
  finale = true;
3103
3342
  } else {
3104
- ecrireRapport(ctx, 'controles', `${k.resume}.`, resultat('vert'));
3343
+ ecrireRapport(
3344
+ ctx,
3345
+ 'controles',
3346
+ `${k.resume}.`,
3347
+ resultat('vert'),
3348
+ `${k.resume}.${k.avertissements}`
3349
+ );
3105
3350
  // Green checks: a sending of the developpeur to the testwriter may come again.
3106
3351
  ctx.renvoiAuTestwriter = false;
3107
3352
  if (!passeFinale) {
@@ -3246,14 +3491,19 @@ async function derouler(ctx, debut) {
3246
3491
  } else if (etape === EN_FILE) {
3247
3492
  const f = file(ctx);
3248
3493
  if (f.etat === 'ferme') {
3249
- ecrireEtat(ctx, { ...etat, etape: 'integre', code: 0 });
3250
3494
  commenter(ctx, 'file', `${f.raison}.`);
3251
- return { code: 0 };
3495
+ etape = TRI;
3496
+ continue;
3252
3497
  }
3253
3498
  if (f.etat === 'en-file') throw new Arret('a-repasser', f.raison);
3254
3499
  throw new Arret('integration', `La file rouvre le ticket.\n\n${f.raison}`, {
3255
3500
  piece: f.raison,
3256
3501
  });
3502
+ } else if (etape === TRI) {
3503
+ // The lot is on main: the tri of its discoveries, which neither stops nor undoes it.
3504
+ await trier(ctx);
3505
+ ecrireEtat(ctx, { ...etat, etape: 'integre', code: 0 });
3506
+ return { code: 0 };
3257
3507
  } else {
3258
3508
  throw new Usage(`étape inconnue dans l'état : ${etape}`);
3259
3509
  }
@@ -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
  }