@roomi-fields/grillhouse 0.24.11 → 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:
@@ -378,9 +382,22 @@
378
382
  // to the log (it brings the branch onto main, pushes it and reads the CI of the commit pushed).
379
383
  // A queue already running exits 0 at once: the circuit waits while the branch is in the queue
380
384
  // 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
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
383
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.
384
401
  // - The working directory is the ticket's, `.claude/worktrees/<ticket>.travail`: the instructions,
385
402
  // results and errors of the sessions, the patches and message of the integration. It lives as
386
403
  // long as the ticket, as the workspace of a pipeline: a circuit relaunched takes it up again, no
@@ -395,7 +412,8 @@
395
412
  // on the plan under way (`{ objet, role, seance }`: the plan, the explorateur or the
396
413
  // questionneur, its session), null otherwise; `etape` is the state's name of a numbered step of
397
414
  // 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
415
+ // the final pass once `finale`, references 4.2, relecture 4.3, integration 5.1, file 5.2, tri
416
+ // 5.3), or
399
417
  // integre at the end; `raison` names the stop (« arrete » once the supervisor stopped the
400
418
  // circuit); `question` the question of a stop for the supervisor (`{ arret, fait, piece,
401
419
  // question, qui }`), null otherwise; `paquets` the plan of the ticket, in its order; `constats`
@@ -465,7 +483,7 @@
465
483
  // them), 16 relecture-arret (a finding without a valid agent, one on a criterion, the third
466
484
  // RENDU), 17 integration (the integration script refuses the lot, or the queue reopens the
467
485
  // 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
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
469
487
  // reviewer whose sheet carries a `question`, or a ticket labelled `arbitrage` whose arbitrage
470
488
  // `refusArbitrage` of scripts/integration/integrer.mjs refuses, at the launch or a resumption,
471
489
  // before any session), 22 questionnement (questions of the plan left open
@@ -525,6 +543,7 @@ import {
525
543
  A_ELAGUER,
526
544
  bloquantsDeLaFiche,
527
545
  conformiteDuLot,
546
+ conformiteDuTri,
528
547
  lireFiche,
529
548
  lireRapportsVitest,
530
549
  lireResumes,
@@ -533,8 +552,10 @@ import {
533
552
  reponsesAuxQuestions,
534
553
  RESULTATS,
535
554
  schemaDeFiche,
555
+ VERDICTS_DU_TRI,
556
+ VERDICTS_ROUVERTS,
536
557
  } from './resultats.mjs';
537
- import { AUTEUR_DE_LA_FILE } from './integration/file.mjs';
558
+ import { AUTEUR_DE_LA_FILE, INTEGRE } from './integration/file.mjs';
538
559
  import { dossierCommun, lireEntrees } from './integration/file-attente.mjs';
539
560
  import { refusArbitrage } from './integration/integrer.mjs';
540
561
  import { AUTEUR_DU_VERDICT } from './integration/verdict.mjs';
@@ -565,7 +586,7 @@ const SEANCES_DEVELOPPEUR = boucle('code').max;
565
586
  const RELECTURES = boucle('relecture').max;
566
587
  // The steps of the circuit's state, read from the list of the steps.
567
588
  const etatDe = n => SUITE.find(e => e.numero === n).etat;
568
- const [TESTS, PREUVE, CODE, CONTROLES, REFERENCES, RELECTURE, INTEGRATION, EN_FILE] = [
589
+ const [TESTS, PREUVE, CODE, CONTROLES, REFERENCES, RELECTURE, INTEGRATION, EN_FILE, TRI] = [
569
590
  '2',
570
591
  '2.1',
571
592
  '3',
@@ -574,6 +595,7 @@ const [TESTS, PREUVE, CODE, CONTROLES, REFERENCES, RELECTURE, INTEGRATION, EN_FI
574
595
  '4.3',
575
596
  '5.1',
576
597
  '5.2',
598
+ '5.3',
577
599
  ].map(etatDe);
578
600
  // The variable in which bd reads the author of a comment (`bd --help`: « default: $BEADS_ACTOR,
579
601
  // git user.name, $USER »), each session's its role; the author of the circuit's own lines.
@@ -1046,20 +1068,25 @@ const mtime = f => {
1046
1068
  // schema of its role's sheet and the options <session> names (its id, or the session it
1047
1069
  // resumes), its instruction on its standard input and its result on its standard output, added
1048
1070
  // 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).
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.
1051
1075
  function lancer(
1052
1076
  ctx,
1053
1077
  role,
1054
1078
  consigne,
1055
- { fort, horsEnveloppe, droits = [], session = [], ouvre, reprend } = {}
1079
+ { fort, horsEnveloppe, droits = [], session = [], ouvre, reprend, fiche: sorte, objet } = {}
1056
1080
  ) {
1057
1081
  rmSync(ctx.fin, { force: true });
1058
1082
  rmSync(ctx.resultat, { force: true });
1059
1083
  rmSync(ctx.horsPlan, { force: true });
1060
1084
  const id = ouvre ?? reprend ?? session[1] ?? null;
1061
1085
  if (id) {
1062
- 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
+ });
1063
1090
  }
1064
1091
  const fichier = path.join(ctx.tmp, `consigne-${++ctx.numero}.md`);
1065
1092
  writeFileSync(fichier, consigne);
@@ -1072,7 +1099,12 @@ function lancer(
1072
1099
  if (horsEnveloppe) {
1073
1100
  entete(ctx, role);
1074
1101
  fds = [openSync(fichier, 'r'), openSync(reponse, 'w'), openSync(ctx.journal, 'a')];
1075
- 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
+ ];
1076
1108
  commande = {
1077
1109
  cmd: process.env.CLAUDE_BIN || 'claude',
1078
1110
  args: ['-p', '--agent', role, ...fiche, ...droits, '--add-dir', ctx.tmp, ...session],
@@ -1198,7 +1230,8 @@ async function attendreLaSeance(ctx, groupe) {
1198
1230
  // The template of the instruction at <rang> (0 the testwriter's and the developpeur's, 1 the
1199
1231
  // reviewer's, 2 any session's on a sheet absent or out of its schema, 3 the testwriter's and the
1200
1232
  // 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>.
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>.
1202
1235
  function consigne(valeurs, rang = 0) {
1203
1236
  const texte = readFileSync(GABARIT, 'utf8');
1204
1237
  const bloc = [...texte.matchAll(/```text\n([\s\S]*?)\n```/g)][rang];
@@ -1326,7 +1359,8 @@ function seanceLancee(ctx, role, r) {
1326
1359
  // a motionless session, or twice no sheet that conforms (« sans-fiche »). <avec> joins its fields
1327
1360
  // to the sheet's entry (the lot a review read); <valider>(sheet, attempt) names what makes a sheet
1328
1361
  // 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.
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`).
1330
1364
  async function jusquALaFiche(ctx, role, texte, options = {}) {
1331
1365
  const {
1332
1366
  neuve,
@@ -1353,7 +1387,7 @@ async function jusquALaFiche(ctx, role, texte, options = {}) {
1353
1387
  if (repli && r.seance !== 0) return null;
1354
1388
  lu =
1355
1389
  r.seance === 0
1356
- ? lireSaFiche(ctx, role, r.sortie)
1390
+ ? lireSaFiche(ctx, reste.fiche ?? role, r.sortie)
1357
1391
  : { erreur: `la séance finit en erreur (code ${r.seance})` };
1358
1392
  const faute = lu.fiche ? valider(lu.fiche, essai) : null;
1359
1393
  if (faute) lu = { erreur: `fiche non conforme : ${faute}` };
@@ -1368,10 +1402,14 @@ async function jusquALaFiche(ctx, role, texte, options = {}) {
1368
1402
  );
1369
1403
  }
1370
1404
 
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 });
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
+ });
1375
1413
 
1376
1414
  // The name of the package <dossier> as a title writes it: its package's name, or its path.
1377
1415
  function nomDe(ctx, dossier) {
@@ -1381,7 +1419,8 @@ function nomDe(ctx, dossier) {
1381
1419
 
1382
1420
  // The sheet <fiche> of <role>, kept with the ticket's sheets, <avec> joined to its entry, each of
1383
1421
  // its discoveries filed closed under the ticket (scripts/ticket.sh, label `decouverte`), its
1384
- // 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.
1385
1424
  function garder(ctx, role, fiche, avec = {}) {
1386
1425
  inscrire(ctx, { role, fiche, ...avec });
1387
1426
  const composants = ctx.paquets.map(c => nomDe(ctx, c)).join(', ');
@@ -1395,13 +1434,19 @@ function garder(ctx, role, fiche, avec = {}) {
1395
1434
  env: { ...process.env, [ACTEUR]: AUTEUR_DU_CIRCUIT },
1396
1435
  }
1397
1436
  );
1398
- if (r.status !== 0) {
1399
- process.stderr.write(`⚠️ découverte « ${d.sujet} » non consignée : ${r.stderr}\n`);
1400
- }
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`);
1401
1440
  }
1402
1441
  return fiche;
1403
1442
  }
1404
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
+
1405
1450
  const lire = f => (existsSync(f) ? readFileSync(f, 'utf8') : '');
1406
1451
 
1407
1452
  // The circuit's reports since the reviewer's last sheet: those of its proofs and checks (the final
@@ -1932,6 +1977,25 @@ function arretDuStatut(ctx, role, tentative, fiche) {
1932
1977
  );
1933
1978
  }
1934
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
+
1935
1999
  // The sending to the testwriter in the developpeur's sheet <fiche> (its `renvoi`): what the
1936
2000
  // testwriter receives, the sending, then the developpeur's handover; null without a sending.
1937
2001
  function renvoiDe(ctx, fiche) {
@@ -2077,6 +2141,145 @@ function fileEnCours(ctx) {
2077
2141
  return Number.isInteger(pid) && vivant(pid);
2078
2142
  }
2079
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
+
2080
2283
  // The type of a conventional commit for the ticket's type in Beads; `feat` for any other.
2081
2284
  const TYPES_DE_COMMIT = { bug: 'fix', chore: 'chore', docs: 'docs' };
2082
2285
 
@@ -2991,6 +3194,7 @@ async function derouler(ctx, debut) {
2991
3194
  if (fiche.statut === 'BLOQUÉ') {
2992
3195
  throw arretDuStatut(ctx, 'developpeur', tentative, fiche);
2993
3196
  }
3197
+ if (fiche.hors_plan?.length) throw arretHorsDuPlan(ctx, tentative, fiche);
2994
3198
  const inchangee = empreinte(ctx) === avant;
2995
3199
  if (inchangee && reprend && livre(ctx)) {
2996
3200
  // A resumed developpeur that finds the lot delivered: the checks judge it.
@@ -3287,14 +3491,19 @@ async function derouler(ctx, debut) {
3287
3491
  } else if (etape === EN_FILE) {
3288
3492
  const f = file(ctx);
3289
3493
  if (f.etat === 'ferme') {
3290
- ecrireEtat(ctx, { ...etat, etape: 'integre', code: 0 });
3291
3494
  commenter(ctx, 'file', `${f.raison}.`);
3292
- return { code: 0 };
3495
+ etape = TRI;
3496
+ continue;
3293
3497
  }
3294
3498
  if (f.etat === 'en-file') throw new Arret('a-repasser', f.raison);
3295
3499
  throw new Arret('integration', `La file rouvre le ticket.\n\n${f.raison}`, {
3296
3500
  piece: f.raison,
3297
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 };
3298
3507
  } else {
3299
3508
  throw new Usage(`étape inconnue dans l'état : ${etape}`);
3300
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
  }
@@ -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.
@@ -77,6 +77,9 @@ const ESSAIS_PAR_BRANCHE = 5;
77
77
  // The variable in which bd reads the author of a comment, and the queue's author.
78
78
  const ACTEUR = 'BEADS_ACTOR';
79
79
  export const AUTEUR_DE_LA_FILE = 'file';
80
+ // The reason of the closure of a ticket the queue brought onto main, before its commit, which the
81
+ // circuit reads to name that commit (scripts/circuit.mjs, the tri of the discoveries).
82
+ export const INTEGRE = 'intégré : ';
80
83
  // How long the queue looks for the run of the CI, then waits for it.
81
84
  const RECHERCHE_CI_MS = 2 * 60 * 1000;
82
85
  const ATTENTE_CI_MS = 30 * 60 * 1000;
@@ -302,7 +305,7 @@ function main(argv) {
302
305
  const entrer = (entree, nouveau) => {
303
306
  const court = nouveau.slice(0, 7);
304
307
  bd('update', entree.ticket, '--remove-label', 'en-file');
305
- bd('close', entree.ticket, '--reason', `intégré : ${court}`);
308
+ bd('close', entree.ticket, '--reason', `${INTEGRE}${court}`);
306
309
  rmSync(path.join(racine, '.claude', 'worktrees', `${entree.ticket}.travail`), {
307
310
  recursive: true,
308
311
  force: true,
@@ -0,0 +1,41 @@
1
+ // From 0.24.12 the circuit sorts the discoveries of a ticket once its lot is on main (step 5.3, the
2
+ // tri of the discoveries, grillhouse-0yu.5): each one receives its verdict at its ticket, and an
3
+ // `a-porter` or a `non-confirmee` reopens under `a-valider`. A project's `docs/agents/issue-tracker.md`
4
+ // is its own since 0.23.0, and its template's rule said a discovery « reopens on the owner's
5
+ // word », the supervisor bringing those that touch a real use: a rule the frame no longer holds.
6
+ //
7
+ // - Each of the two sentences of that rule, when the file holds it as the template wrote it,
8
+ // becomes the rule of the tri, as the template now writes it; nothing else of the file changes.
9
+ // - A file without them (already migrated, or rewritten by the project) is not written; a project
10
+ // without the file neither.
11
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
12
+ import path from 'node:path';
13
+
14
+ export const version = '0.24.12';
15
+ export const nom = 'tri des découvertes';
16
+
17
+ const FICHIER = path.join('docs', 'agents', 'issue-tracker.md');
18
+ // Each former sentence, and the sentence of the tri that replaces it.
19
+ const REMPLACEMENTS = [
20
+ [
21
+ "; it reopens on the owner's word. A discovery that blocks stops the agent, and its handoff names it. The supervisor brings to the owner the discoveries that touch a real use.",
22
+ ". Once the ticket's lot is on main, the tri of the discoveries (step 5.3, the `explorateur`) gives each one its verdict at its ticket, with its piece, as a label: `traitee`, `doublon` or `sans-suite` leave it closed; `a-porter` (a defect of the actual use) or `non-confirmee` (no proof played again, what lacks written) reopen it under `a-valider`, for the owner. A discovery that blocks stops the agent, and its handoff names it.",
23
+ ],
24
+ [
25
+ "`decouverte` (a discovery recorded closed; it reopens on the owner's word),",
26
+ '`decouverte` (a discovery recorded closed; the tri reopens it under `a-valider` when its verdict is `a-porter` or `non-confirmee`), `traitee`, `doublon`, `sans-suite`, `a-porter`, `non-confirmee` (the verdict of the tri of a discovery),',
27
+ ],
28
+ ];
29
+
30
+ /** Brings the rule of the tri to the project's issue-tracker.md; returns what it did. */
31
+ export function migrer(projet) {
32
+ const fichier = path.join(projet, FICHIER);
33
+ if (!existsSync(fichier)) return [];
34
+ const texte = readFileSync(fichier, 'utf8');
35
+ const neuf = REMPLACEMENTS.reduce((t, [ancien, nouveau]) => t.replace(ancien, nouveau), texte);
36
+ if (neuf === texte) return [];
37
+ writeFileSync(fichier, neuf);
38
+ return [
39
+ `${FICHIER} : une découverte reçoit son verdict au tri des découvertes, en fin de ticket, au lieu de se rouvrir sur le mot du responsable`,
40
+ ];
41
+ }
@@ -29,6 +29,7 @@ import * as apiExtractorDuPaquet from './migrations/0.24.2-api-extractor-du-paqu
29
29
  import * as nomsDeclaresInutilises from './migrations/0.24.4-noms-declares-inutilises.mjs';
30
30
  import * as lignesMalFormees from './migrations/0.24.6-lignes-mal-formees.mjs';
31
31
  import * as matiereDansLesTests from './migrations/0.24.7-matiere-dans-les-tests.mjs';
32
+ import * as triDesDecouvertes from './migrations/0.24.12-tri-des-decouvertes.mjs';
32
33
 
33
34
  /** The migrations of the package. */
34
35
  export const MIGRATIONS = [
@@ -42,6 +43,7 @@ export const MIGRATIONS = [
42
43
  nomsDeclaresInutilises,
43
44
  lignesMalFormees,
44
45
  matiereDansLesTests,
46
+ triDesDecouvertes,
45
47
  ];
46
48
 
47
49
  /**