@roomi-fields/grillhouse 0.27.0 → 0.28.1

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.
Files changed (35) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/agents/explorateur.md +1 -1
  3. package/cadre/templates/paquet/docs/CADRE.md +36 -0
  4. package/cadre/templates/paquet/docs/INTERFACE.md +10 -0
  5. package/charte.md +26 -1
  6. package/docs/ARCHITECTURE.md +76 -8
  7. package/docs/INTERFACE.md +17 -2
  8. package/hooks/register.tsx +205 -24
  9. package/package.json +11 -1
  10. package/scripts/circuit.mjs +412 -98
  11. package/scripts/enveloppe/lancer.sh +10 -6
  12. package/scripts/etapes.mjs +21 -8
  13. package/scripts/grillhouse-maj.mjs +10 -9
  14. package/scripts/jointure.d.ts +18 -0
  15. package/scripts/langages/cargo/index.mjs +3 -0
  16. package/scripts/langages/cargo/squelette.mjs +111 -0
  17. package/scripts/langages/python/index.mjs +3 -0
  18. package/scripts/langages/python/squelette.mjs +66 -0
  19. package/scripts/langages/typescript/frontieres.mjs +14 -1
  20. package/scripts/langages/typescript/index.mjs +3 -0
  21. package/scripts/langages/typescript/squelette.mjs +120 -0
  22. package/scripts/langages-des-paquets.mjs +1 -1
  23. package/scripts/paquet.mjs +261 -0
  24. package/scripts/resultats.mjs +76 -1
  25. package/scripts/sous-commandes.mjs +1 -0
  26. package/scripts/tableau-des-composants.mjs +5 -3
  27. package/scripts/tableau.mjs +20 -10
  28. package/skills/developpeur/SKILL.md +3 -0
  29. package/skills/explorateur/SKILL.md +42 -4
  30. package/skills/grill/SKILL.md +6 -1
  31. package/skills/pitmaster/SKILL.md +30 -4
  32. package/skills/pitmaster/references/consigne-agent.md +34 -5
  33. package/skills/relecteur/SKILL.md +12 -0
  34. package/skills/testwriter/SKILL.md +2 -1
  35. package/types/index.d.ts +17 -3
@@ -90,6 +90,34 @@
90
90
  // passes (`plan`, its fingerprint: its title and its criteria); a plan that passed, its title
91
91
  // and criteria unchanged since, passes with no session, whatever else of its description
92
92
  // changed.
93
+ // - The sheet of the plan names what a component publishes to another (`noms_publies`: the
94
+ // provider, each consumer, its names), which the circuit writes in the description (« ## Noms
95
+ // publiés », after the sort), written again at each plan from the explorateur's last sheet (an
96
+ // empty list erases it, a sheet without the field keeps the section the description holds), as
97
+ // a code owner's approval covers what it reviewed: the guard of the consumers
98
+ // (scripts/langages/typescript/consommateurs-arbitres.mjs) reads that section, and a lot that
99
+ // adds those names to the provider's « Consommateurs » lines passes it with no arbitrage
100
+ // (grillhouse-la3, BPScript 320.14.2.10: a criterion alone named them, the guard refused the
101
+ // lot, and the supervisor wrote the section by hand before a new session).
102
+ // - The sheet of the plan says the sort of the ticket (`sorte`, read by `sorteDuPlan` of
103
+ // scripts/resultats.mjs, from the explorateur's last sheet of the plan), which the circuit
104
+ // writes in the description (« ## Sorte », after the criteria) and at the ticket with the plan:
105
+ // mechanical, a gesture without new behaviour, with its reason and the command that makes it;
106
+ // comportement, with its reason, the plan « comportement inchangé » when the lot changes no
107
+ // behaviour; absent or unreadable, comportement, the whole circuit (grillhouse-sos, BPScript
108
+ // 320.16: 38 tools moved by mv through the testwriter and the developpeur, 117 comments). As
109
+ // Google's large-scale changes (Rosie, ClangMR) let a tool make the change that a verification
110
+ // and a review judge, with no new test, a mechanical ticket (`cheminMecanique`: no `--depuis`,
111
+ // no testwriter nor developpeur since the plan) skips the testwriter, the proof and the
112
+ // developpeur, the gesture `mecanique`: at 1.1 one session of the explorateur in the envelope
113
+ // of the plan (lancer.sh `--fiche geste`, its sheet the schema `geste`, its instruction the
114
+ // ninth template) plays in the copy the command the plan names; its BLOQUÉ or BESOIN goes up as
115
+ // any agent's, and a copy that then holds no change of the plan stops at « sans-livraison ». A
116
+ // `--reprendre` at 1.1 whose copy already holds a change of the plan (the supervisor played the
117
+ // command himself) plays no session. Then the checks, the final pass, the review and the
118
+ // integration, as for any lot; a red of the checks or of the final pass that no regeneration
119
+ // lifts stops at « controles », and a RENDU at « relecture-arret » (`arretDuGesteMecanique`),
120
+ // a question for the supervisor, who has the lot corrected (`--depuis developpeur`) or stops.
93
121
  // - Each session is a launch of scripts/enveloppe/lancer.sh, a child process the circuit waits
94
122
  // for, in its own process group, its errors written to a file: a session outlives the death of
95
123
  // its circuit, and the state names its group while it runs. Its plan, the packages it writes (`--paquets`, the envelope's list), is the plan of the
@@ -212,11 +240,15 @@
212
240
  // not told apart. The proof passes with a red (of the lot, existing or of a build), even without
213
241
  // a file of the lot: a testwriter with no new test to write says so in his handover, the existing
214
242
  // reds are enough. It fails with neither a file of the lot nor a red, with a broken file of the
215
- // lot, or with a green of the lot no expected green justifies. A failed proof relaunches the
243
+ // lot, or with a green of the lot no expected green justifies; under a plan « comportement
244
+ // inchangé », nothing has to turn red and every green of the lot is expected, so only a broken
245
+ // file fails it (`preuveReussie`). A failed proof relaunches the
216
246
  // testwriter with its report, twice at most. The report (reds, justified greens) is written at
217
247
  // the ticket. A proof with a red launches the developpeur, and so does a proof without a red
218
- // when a finding of the reviewer still open names him; else it skips him: the lot is a lot of
219
- // tests alone.
248
+ // when a finding of the reviewer still open names him, or under a plan « comportement inchangé »,
249
+ // whose lot has code to write though nothing turns red; else it skips him (`apresLaPreuve`): the
250
+ // lot is a lot of tests alone, and the checks and the review judge it with no session of the
251
+ // developpeur.
220
252
  // - A developpeur is launched on a red, of a proof or of a check, on a finding of the reviewer, or
221
253
  // on a plan without tests: a session that changes no file of the plan (`git status --porcelain`
222
254
  // of its paths and the content of each file it lists, taken before and after the session; the
@@ -300,11 +332,15 @@
300
332
  // final pass, as `--update-snapshots` leaves every failure but the snapshots to its owner; its
301
333
  // finding without a file, or on a file the reference covers, stays the regeneration's (BPScript
302
334
  // 320.10: a word of library written in 030-binder, sent to no developpeur). Checks of the
303
- // plan green but for reds of references call for it too, before the final pass, as make
304
- // remakes a generated file before what reads it: the final pass that is due then plays once, on
305
- // the regenerated tree, and does not regenerate again a reference regenerated on that same tree
306
- // (BPScript 320.3.9: the ceiling of the words, red at the checks, left to the final pass, which
307
- // played the same tests again on the same tree for 6.1 min before regenerating). The circuit
335
+ // plan with a red of a reference, mixed with other reds or not, call for it too, before any red
336
+ // goes to the developpeur, as Bazel builds a genrule before the tests that read it: beside
337
+ // other reds, the checks of the plan play again on the regenerated tree, which judges a test
338
+ // that reads the reference (BPScript 320.6.5: a test that reads the hash the turbo.json declare,
339
+ // red beside their guard, went to a developpeur who had nothing to deliver, then could not write
340
+ // them); alone, the final pass that is due plays once, on the regenerated tree. Neither
341
+ // regenerates again a reference regenerated on that same tree (BPScript 320.3.9: the ceiling of
342
+ // the words, red at the checks, left to the final pass, which played the same tests again on
343
+ // the same tree for 6.1 min before regenerating). The circuit
308
344
  // keeps the copy as a lot, runs the command of each reference concerned on the whole copy (the
309
345
  // debt lowered from the notes of the pass, its guards not played again), out of the envelope,
310
346
  // under the lock of the machine, its output added to the log, then, as make remakes the targets
@@ -325,9 +361,9 @@
325
361
  // the regeneration, a question for the supervisor that carries each deviation (the command and
326
362
  // its code, the file), as the comment at the ticket does; the state keeps the references to regenerate and the reds of the
327
363
  // pass before (`aRegenerer`), for a regeneration resumed. A command of the project that refuses
328
- // (no real failure), its only deviation, after a final pass that carries reds of the plan,
364
+ // (no real failure), its only deviation, after a pass (the checks of the plan or the final pass) that carries reds of the plan,
329
365
  // judges the lot, as a ceiling refuses a lot beyond it: the copy restored, those reds go to the
330
- // developpeur with the end of its output, within his sessions, then the final pass again.
366
+ // developpeur with the end of its output, within his sessions, then that pass again.
331
367
  // - The proof, the checks and the final pass are heavy passes: each holds the lock of the machine
332
368
  // (scripts/verrou-de-machine.mjs), shared by every repository of the machine, and waits, the
333
369
  // wait written to the log, while another measure holds it; the wait bounded, the pass is at 75,
@@ -449,7 +485,7 @@
449
485
  // 22 of /proc/<pid>/stat), which together name it, a number alone being reused; `questionnement` the work
450
486
  // on the plan under way (`{ objet, role, seance }`: the plan, the explorateur or the
451
487
  // questionneur, its session), null otherwise; `etape` is the state's name of a numbered step of
452
- // the process (scripts/etapes.mjs: testwriter 2, preuve 2.1, developpeur 3, controles 3.1, or 4.1
488
+ // the process (scripts/etapes.mjs: geste 1.1, testwriter 2, preuve 2.1, developpeur 3, controles 3.1, or 4.1
453
489
  // the final pass once `finale`, references 4.2, relecture 4.3, integration 5.1, file 5.2, tri
454
490
  // 5.3), or
455
491
  // integre at the end; `raison` names the stop (« arrete » once the supervisor stopped the
@@ -609,6 +645,7 @@ import {
609
645
  reponsesAuxQuestions,
610
646
  RESULTATS,
611
647
  schemaDeFiche,
648
+ sorteDuPlan,
612
649
  VERDICTS_DU_TRI,
613
650
  VERDICTS_ROUVERTS,
614
651
  } from './resultats.mjs';
@@ -645,7 +682,8 @@ const SEANCES_DEVELOPPEUR = boucle('code').max;
645
682
  const RELECTURES = boucle('relecture').max;
646
683
  // The steps of the circuit's state, read from the list of the steps.
647
684
  const etatDe = n => SUITE.find(e => e.numero === n).etat;
648
- const [TESTS, PREUVE, CODE, CONTROLES, REFERENCES, RELECTURE, INTEGRATION, EN_FILE, TRI] = [
685
+ const [GESTE, TESTS, PREUVE, CODE, CONTROLES, REFERENCES, RELECTURE, INTEGRATION, EN_FILE, TRI] = [
686
+ '1.1',
649
687
  '2',
650
688
  '2.1',
651
689
  '3',
@@ -1183,6 +1221,8 @@ function lancer(
1183
1221
  ...(fort ? FORT : []),
1184
1222
  ...(ouvre ? ['--seance', ouvre] : []),
1185
1223
  ...(reprend ? ['--reprise', reprend] : []),
1224
+ // The schema of its sheet when it is not its role's (the explorateur's gesture).
1225
+ ...(sorte ? ['--fiche', sorte] : []),
1186
1226
  // The plan of the session: the packages of the title, which it writes; its component the
1187
1227
  // whole copy, which it reads.
1188
1228
  '--paquets',
@@ -1295,7 +1335,7 @@ async function attendreLaSeance(ctx, groupe) {
1295
1335
  // reviewer's, 2 any session's on a sheet absent or out of its schema, 3 the testwriter's and the
1296
1336
  // developpeur's on a resumption, 4 the questionneur's on the plan, 5 the explorateur's on the plan,
1297
1337
  // 6 the explorateur's on the questions of the plan, 7 the explorateur's on the tri of the
1298
- // discoveries), filled with <valeurs>.
1338
+ // discoveries, 8 the explorateur's on the gesture of a mechanical ticket), filled with <valeurs>.
1299
1339
  export function consigne(valeurs, rang = 0) {
1300
1340
  const texte = readFileSync(GABARIT, 'utf8');
1301
1341
  const bloc = [...texte.matchAll(/```text\n([\s\S]*?)\n```/g)][rang];
@@ -1942,18 +1982,19 @@ function referencesDesRouges(ctx, lieux, aElaguer = false) {
1942
1982
  // another one has just written runs after it, once for each reference whose writing calls for it;
1943
1983
  // then the copy kept again on that lot. `{ texte, regenerees, fichiers, restreinte }`: the report,
1944
1984
  // the names of the references changed, the files changed, and the range of the final pass that
1945
- // follows (null when nothing changed: no pass plays again, and the reds stand); with
1946
- // <avantLaPasse>, the regeneration the checks of the plan call for, the final pass that is due
1947
- // follows, whole or since the last review. A file a reference writes follows from the lot, as
1985
+ // follows (null when nothing changed: no pass plays again, and the reds stand); <suite>, the
1986
+ // regeneration the checks of the plan call for: `controles`, beside other reds, the checks of the
1987
+ // plan follow, on the regenerated tree; `passe`, without, the final pass that is due follows,
1988
+ // whole or since the last review; null after a final pass. A file a reference writes follows from the lot, as
1948
1989
  // the output of a genrule, without a word of the plan, and the reviewer reads its difference; a
1949
1990
  // file changed that none of the references run declares, or a command that fails (a reference of
1950
1991
  // the project at another code than 0, one of the frame on a real failure alone) restores the copy
1951
1992
  // as it was and stops at « references », each deviation in its question. With <refusAuLot>, the
1952
- // final pass that called for it carries reds of the plan: a command of the project that refuses
1993
+ // pass that called for it (the checks of the plan or the final pass) carries reds of the plan: a command of the project that refuses
1953
1994
  // (another code than 0, no real failure), its only deviation, judges the lot, as a ceiling that
1954
1995
  // never rises refuses a lot beyond it; the copy restored, `{ refus }` gives the report of each
1955
1996
  // refusal with the end of its output, for the developpeur (BPScript 320.10).
1956
- function regenerer(ctx, noms, notes = [], avantLaPasse = false, refusAuLot = false) {
1997
+ function regenerer(ctx, noms, notes = [], suite = null, refusAuLot = false) {
1957
1998
  // The notes of the debt, in a file of the run, which the command that lowers it reads.
1958
1999
  const fichierDesNotes = path.join(ctx.base.dossier, 'dette-a-abaisser.json');
1959
2000
  const toutes = lesReferences(ctx).map(r =>
@@ -2036,7 +2077,13 @@ function regenerer(ctx, noms, notes = [], avantLaPasse = false, refusAuLot = fal
2036
2077
  }
2037
2078
  if (!fichiers.length) {
2038
2079
  return {
2039
- texte: `La régénération (${refs.map(r => `${r.nom}, \`${r.commande}\``).join(' ; ')}) ne change aucun fichier : ${avantLaPasse ? 'la passe finale juge le lot tel quel' : 'aucune passe ne rejoue, et les rouges de la passe finale restent, chacun à son propriétaire'}.`,
2080
+ texte: `La régénération (${refs.map(r => `${r.nom}, \`${r.commande}\``).join(' ; ')}) ne change aucun fichier : ${
2081
+ suite === 'passe'
2082
+ ? 'la passe finale juge le lot tel quel'
2083
+ : suite === 'controles'
2084
+ ? 'les contrôles ne rejouent pas, et leurs rouges restent, chacun à son propriétaire'
2085
+ : 'aucune passe ne rejoue, et les rouges de la passe finale restent, chacun à son propriétaire'
2086
+ }.`,
2040
2087
  regenerees: [],
2041
2088
  fichiers,
2042
2089
  restreinte: null,
@@ -2044,7 +2091,13 @@ function regenerer(ctx, noms, notes = [], avantLaPasse = false, refusAuLot = fal
2044
2091
  }
2045
2092
  return {
2046
2093
  texte: [
2047
- `Les références régénérées sur la copie entière : ${regenerees.map(r => r.nom).join(', ')} ; le lot porte leurs fichiers, puis la passe finale${avantLaPasse ? '' : " restreinte à ce qu'elles changent"}.`,
2094
+ `Les références régénérées sur la copie entière : ${regenerees.map(r => r.nom).join(', ')} ; le lot porte leurs fichiers, puis ${
2095
+ suite === 'controles'
2096
+ ? "les contrôles du plan, sur l'arbre régénéré"
2097
+ : suite === 'passe'
2098
+ ? 'la passe finale'
2099
+ : "la passe finale restreinte à ce qu'elles changent"
2100
+ }.`,
2048
2101
  '',
2049
2102
  ...regenerees.map(r => `- ${r.nom} (\`${r.commande}\`) : ${siens(r).join(', ')}`),
2050
2103
  '',
@@ -2274,6 +2327,88 @@ export function arretDuTestwriterSaute(ctx, texte) {
2274
2327
  );
2275
2328
  }
2276
2329
 
2330
+ // The sheet of the plan that says its field <champ> (`sorte`, `noms_publies`) among the
2331
+ // explorateur's sheets of the plan <plans>, in their order (`{ fiche, reponse }` entries): the last
2332
+ // one, or, when it is his answer to the questionneur (`reponse`) and says none, the plan it
2333
+ // answers, so that the field survives the answer; null without a sheet of the plan.
2334
+ export function ficheDuPlan(plans, champ) {
2335
+ const derniere = plans.at(-1);
2336
+ if (!derniere) return null;
2337
+ if (derniere.reponse && !(champ in derniere.fiche) && plans.length > 1) {
2338
+ return plans.at(-2).fiche;
2339
+ }
2340
+ return derniere.fiche;
2341
+ }
2342
+
2343
+ // The sort of the ticket its plan says (`sorteDuPlan` of scripts/resultats.mjs): the sheet of the
2344
+ // plan that says it (`ficheDuPlan`), comportement without one (grillhouse-sos).
2345
+ const sorteDuTicket = ctx =>
2346
+ sorteDuPlan(
2347
+ ficheDuPlan(
2348
+ lesFiches(ctx).filter(e => e.role === EXPLORATEUR && Array.isArray(e.fiche?.criteres)),
2349
+ 'sorte'
2350
+ )
2351
+ );
2352
+
2353
+ // Whether a testwriter or a developpeur has worked the lot since the last sheet of the plan.
2354
+ function lotTravaille(ctx) {
2355
+ const tous = lesFiches(ctx);
2356
+ const plan = tous.findLastIndex(e => e.role === EXPLORATEUR && Array.isArray(e.fiche?.criteres));
2357
+ return tous.slice(plan + 1).some(e => AGENTS_DU_LOT.includes(e.role));
2358
+ }
2359
+
2360
+ // Whether the ticket of <ctx> goes the mechanical path, as Google's large-scale changes (Rosie,
2361
+ // ClangMR) let a tool make the change that a verification and a review judge: its plan says it
2362
+ // mechanical (`ctx.sorte`), no `--depuis` sends its lot to an agent, and no testwriter nor
2363
+ // developpeur has worked it since the plan (grillhouse-sos).
2364
+ export const cheminMecanique = ctx =>
2365
+ ctx.sorte?.genre === 'mécanique' && !ctx.depuis && !lotTravaille(ctx);
2366
+
2367
+ // The step after the plan of sort <sorte> (null when the path is not mechanical): the gesture of
2368
+ // a mechanical ticket (1.1), in place of the testwriter, the proof and the developpeur; the
2369
+ // developpeur of a plan without tests (<sansTests>); else the testwriter.
2370
+ export const etapeApresLePlan = ({ sorte, sansTests }) =>
2371
+ sorte?.genre === 'mécanique' ? GESTE : sansTests ? CODE : TESTS;
2372
+
2373
+ // The step after a proof that passes: the developpeur on a red (<rouges>), on a finding of the
2374
+ // reviewer still open for him (<pourLeDeveloppeur>), or under a plan « comportement inchangé »
2375
+ // (<inchange>), whose lot has code to write though nothing turns red, as a reorganisation does
2376
+ // (decision 3, amended by the owner on 2026-11-01); else the checks, a lot of tests alone, with
2377
+ // no session of the developpeur.
2378
+ export const apresLaPreuve = ({ rouges, pourLeDeveloppeur, inchange }) =>
2379
+ rouges > 0 || pourLeDeveloppeur || inchange ? CODE : CONTROLES;
2380
+
2381
+ // Whether a proof of the counts <compte> passes: no file of the lot that does not load, no green
2382
+ // without its expected green, and a red or a green justified or held by HEAD among the files of
2383
+ // the lot or a red without one. Under a plan « comportement inchangé » (<inchange>), nothing has
2384
+ // to turn red and every green is expected: a proof passes with no file of the lot that does not
2385
+ // load, its reds going to the developpeur.
2386
+ export function preuveReussie(
2387
+ { fichiers, rouges, casses, injustifies, justifies, anciens },
2388
+ { inchange }
2389
+ ) {
2390
+ if (casses > 0) return false;
2391
+ if (inchange) return true;
2392
+ return (fichiers > 0 || rouges > 0) && injustifies === 0 && rouges + justifies + anciens > 0;
2393
+ }
2394
+
2395
+ // The stop for a RENDU of a mechanical lot (`cheminMecanique`), or null: no testwriter nor
2396
+ // developpeur wrote it, so no relaunch treats its findings. An Arret `relecture-arret`, the
2397
+ // verdict <texte> in its report, the findings' pieces as its piece; its question, have the lot
2398
+ // corrected by the developpeur or stop the circuit.
2399
+ export function arretDuGesteMecanique(ctx, texte) {
2400
+ if (!cheminMecanique(ctx)) return null;
2401
+ const pieces = (ctx.constats ?? []).map(c => c.piece ?? c.titre).join('\n');
2402
+ return new Arret(
2403
+ 'relecture-arret',
2404
+ `Le relecteur rend un lot mécanique (${ctx.sorte.raison}), que la commande du plan a fait sans testwriter ni développeur : le circuit ne relance personne.\n\nLe verdict :\n\n${texte}`,
2405
+ {
2406
+ piece: pieces || null,
2407
+ question: `Le lot mécanique est rendu : le faire corriger par le développeur (\`--depuis developpeur --contexte\`), ou arrêter le circuit (\`--arreter\`) et changer le plan.`,
2408
+ }
2409
+ );
2410
+ }
2411
+
2277
2412
  // The integration of the lot: its two patches, its message and the references that write files in
2278
2413
  // full (`--references`, from `lesReferences`, the one list), written from the copy, then
2279
2414
  // scripts/integration/integrer.mjs from the main tree, its output added to the log. A run « à
@@ -2819,6 +2954,8 @@ function preuve(ctx) {
2819
2954
  let anciens = 0;
2820
2955
  const reportes = [];
2821
2956
  const mesure = mesureDeLaPreuve(ctx, liste, fichiers);
2957
+ // A plan « comportement inchangé »: every green of the lot is expected.
2958
+ const inchange = Boolean(ctx.sorte?.inchange);
2822
2959
  for (const { groupe, entier, avant, code, resultats, constructions } of mesure) {
2823
2960
  for (const { nom, erreur } of constructions) {
2824
2961
  if (reportes.includes(nom)) continue;
@@ -2880,6 +3017,8 @@ function preuve(ctx) {
2880
3017
  justifies.push(`${f} › ${a.nom} — ${raison}`);
2881
3018
  } else if (duF && avant.has(f)) {
2882
3019
  justifies.push(`${f} › ${a.nom} — ${duF.raison} (par le vert attendu du fichier)`);
3020
+ } else if (inchange) {
3021
+ justifies.push(`${f} › ${a.nom} — le plan dit « comportement inchangé »`);
2883
3022
  } else {
2884
3023
  injustifies.push(`${f} › ${a.nom}`);
2885
3024
  }
@@ -2889,11 +3028,17 @@ function preuve(ctx) {
2889
3028
  }
2890
3029
  const section = (titre, l) =>
2891
3030
  l.length ? [`${titre} (${l.length}) :`, ...l.map(x => `- ${x}`), ''] : [];
2892
- const ok =
2893
- (fichiers.length > 0 || rouges.length > 0) &&
2894
- casses.length === 0 &&
2895
- injustifies.length === 0 &&
2896
- rouges.length + justifies.length + anciens > 0;
3031
+ const ok = preuveReussie(
3032
+ {
3033
+ fichiers: fichiers.length,
3034
+ rouges: rouges.length,
3035
+ casses: casses.length,
3036
+ injustifies: injustifies.length,
3037
+ justifies: justifies.length,
3038
+ anciens,
3039
+ },
3040
+ { inchange }
3041
+ );
2897
3042
  const resume = `${rouges.length} rouge(s), ${justifies.length} vert(s) justifié(s), ${injustifies.length} vert(s) sans vert attendu, ${casses.length} fichier(s) qui ne se charge(nt) pas, ${anciens} test(s) vert(s) que HEAD tient déjà, laissé(s) de côté`;
2898
3043
  const ecrit = (...sections) =>
2899
3044
  [
@@ -2904,7 +3049,12 @@ function preuve(ctx) {
2904
3049
  '',
2905
3050
  ...(fichiers.length || rouges.length
2906
3051
  ? []
2907
- : ['Aucun fichier de test du lot dans le plan : rien ne prouve le rouge.', '']),
3052
+ : inchange
3053
+ ? [
3054
+ 'Aucun fichier de test du lot : le plan dit « comportement inchangé », rien à prouver.',
3055
+ '',
3056
+ ]
3057
+ : ['Aucun fichier de test du lot dans le plan : rien ne prouve le rouge.', '']),
2908
3058
  ...section('Rouges', rouges),
2909
3059
  ...sections,
2910
3060
  ...section(
@@ -3073,10 +3223,10 @@ const ligneDeCommande = c =>
3073
3223
  // verifier`, what the integration plays (4.1), restricted by <restreinte> (`{ avant, apres }`, two
3074
3224
  // lots kept) to the packages that changed from one to the other and their dependents, with the
3075
3225
  // root's tasks, the guards (`--filter=...[<avant>...<apres>] --filter=//`). After a regeneration,
3076
- // <reportes> (`{ rouges, rejouee }`) carries the reds of the final pass before it: each one in a
3077
- // package the pass restricted to the regeneration does not play again stands, as a CI keeps the
3078
- // verdict of a job it does not run again; when the regeneration changes nothing (`rejouee`
3079
- // false), no command plays, and they all stand. `{ rouge, aRepasser, arbitrer, auDeveloppeur,
3226
+ // <reportes> (`{ rouges, rejouee }`) carries the reds of the pass before it, the final pass or the
3227
+ // checks of the plan: each one in a package the pass after the regeneration does not play again
3228
+ // stands, as a CI keeps the verdict of a job it does not run again; when the regeneration changes
3229
+ // nothing (`rejouee` false), no command plays, and they all stand. `{ rouge, aRepasser, arbitrer, auDeveloppeur,
3080
3230
  // texte, complet, resume, horsTitre, lieux, tous, notes, avertissements }`: `texte` the report for
3081
3231
  // the developpeur, his reds first; `complet` every red, for a stop, and the warnings;
3082
3232
  // `avertissements` the section of the warnings and notes of the guards, which are no reds, for the
@@ -3085,7 +3235,7 @@ const ligneDeCommande = c =>
3085
3235
  // when every red of the plan is a finding to settle; `lieux` the place of each red, `{ fichier,
3086
3236
  // gardes, dansLePlan }`, its file (null for a red without one), the names its finding carries
3087
3237
  // (none for a test or a task), and whether a path of the plan holds it; `references`, out of the final pass, the references whose reds the checks saw,
3088
- // which their regeneration lifts before the final pass; `tous` every red as it was read; `notes`,
3238
+ // which their regeneration lifts before the checks judge the lot again, or before the final pass; `tous` every red as it was read; `notes`,
3089
3239
  // at the final pass, each key of the debt a guard wrote inscribed above what it finds, `{ garde,
3090
3240
  // fichier, regle, trouve }`.
3091
3241
  function controles(ctx, finale, restreinte = null, reportes = null) {
@@ -3125,7 +3275,7 @@ function controles(ctx, finale, restreinte = null, reportes = null) {
3125
3275
  ),
3126
3276
  ];
3127
3277
  // Out of the final pass, the reds of the plan are the developpeur's; a red of a reference goes to
3128
- // its regeneration (4.2), before the final pass; the others (the root, a red no file situates, a
3278
+ // its regeneration (4.2), before any red goes to him; the others (the root, a red no file situates, a
3129
3279
  // package out of the plan) wait for the final pass.
3130
3280
  const lieu = r => ({
3131
3281
  fichier: r.fichier ?? null,
@@ -3148,18 +3298,14 @@ function controles(ctx, finale, restreinte = null, reportes = null) {
3148
3298
  ? `rouge : ${rouges.length} rouge(s) — ${
3149
3299
  commandes.length
3150
3300
  ? enEchec.map(nommer).join(' ; ')
3151
- : "ceux de la passe finale d'avant, que la régénération ne change pas"
3301
+ : `ceux ${finale ? "de la passe finale d'avant" : "des contrôles d'avant"}, que la régénération ne change pas`
3152
3302
  }`
3153
3303
  : aRepasser.length
3154
3304
  ? `à repasser : ${aRepasser.map(nommer).join(' ; ')}`
3155
- : `verts : ${commandes.length ? resultats.map(ligneDeCommande).join(' ; ') : "la passe finale d'avant"}${
3305
+ : `verts : ${commandes.length ? resultats.map(ligneDeCommande).join(' ; ') : finale ? "la passe finale d'avant" : "les contrôles d'avant"}${
3156
3306
  laisses.length
3157
3307
  ? ` ; laissés à la passe finale, ${laisses.length} rouge(s) hors du plan`
3158
3308
  : ''
3159
- }${
3160
- references.length
3161
- ? ` ; des rouges sont ceux de références, à leur régénération avant la passe finale (${references.map(r => r.nom).join(', ')})`
3162
- : ''
3163
3309
  }`;
3164
3310
  // Where the checks played: the final pass out of the envelope, on the whole copy or restricted
3165
3311
  // to what changed since the last review; the checks of the plan, its tests and packages, its
@@ -3381,7 +3527,59 @@ async function derouler(ctx, debut) {
3381
3527
  const menee = MENEES.has(etape) ? { etape, debut: new Date().toISOString() } : null;
3382
3528
  ecrireEtat(ctx, { ...etat, mene: menee?.debut ?? null });
3383
3529
  try {
3384
- if (etape === TESTS && sansTests(ctx)) {
3530
+ // After the plan: the gesture of a mechanical ticket, the developpeur of a plan without
3531
+ // tests, else the testwriter.
3532
+ const route =
3533
+ etape === TESTS
3534
+ ? etapeApresLePlan({
3535
+ sorte: cheminMecanique(ctx) ? ctx.sorte : null,
3536
+ sansTests: sansTests(ctx),
3537
+ })
3538
+ : null;
3539
+ if (route === GESTE) {
3540
+ geste(ctx, 'mecanique');
3541
+ etape = GESTE;
3542
+ tentative = 1;
3543
+ } else if (etape === GESTE) {
3544
+ if (reprend && livre(ctx)) {
3545
+ // The copy already carries the gesture (the supervisor played the command himself).
3546
+ commenter(
3547
+ ctx,
3548
+ 'mecanique',
3549
+ 'la copie porte déjà un changement du plan : le geste ne rejoue pas, aux contrôles.'
3550
+ );
3551
+ } else {
3552
+ const { description } = leTicket(ctx);
3553
+ const fiche = await jusquALaFiche(
3554
+ ctx,
3555
+ EXPLORATEUR,
3556
+ consigne(
3557
+ {
3558
+ depot: ctx.racine,
3559
+ ticket: ctx.ticket,
3560
+ sujet: ctx.sujet,
3561
+ paquets: ctx.paquets.join(', '),
3562
+ raison: ctx.sorte.raison,
3563
+ commande: ctx.sorte.commande,
3564
+ description: description.trim() || 'aucune',
3565
+ },
3566
+ 8
3567
+ ),
3568
+ { fiche: 'geste', objet: 'geste' }
3569
+ );
3570
+ if (fiche.statut !== 'FAIT') throw arretDuStatut(ctx, EXPLORATEUR, tentative, fiche);
3571
+ if (!livre(ctx)) {
3572
+ throw new Arret(
3573
+ 'sans-livraison',
3574
+ `Le geste mécanique ne change aucun fichier du plan (${ctx.paquets.join(', ')}) : la commande du plan, \`${ctx.sorte.commande}\`, n'a rien changé dans la copie.`,
3575
+ { piece: `$ ${ctx.sorte.commande}\naucun fichier du plan changé dans ${ctx.copie}` }
3576
+ );
3577
+ }
3578
+ commenter(ctx, 'mecanique', 'la commande du plan a joué dans la copie : aux contrôles.');
3579
+ }
3580
+ etape = CONTROLES;
3581
+ tentative = 0;
3582
+ } else if (route === CODE) {
3385
3583
  commenter(
3386
3584
  ctx,
3387
3585
  'testwriter',
@@ -3413,12 +3611,19 @@ async function derouler(ctx, debut) {
3413
3611
  if (p.ok) {
3414
3612
  // A finding of the reviewer still open for the developpeur launches him, red or not.
3415
3613
  const pourLui = ouverts(ctx, 'developpeur').length > 0;
3416
- const auDeveloppeur = p.rouges > 0 || pourLui;
3614
+ const auDeveloppeur =
3615
+ apresLaPreuve({
3616
+ rouges: p.rouges,
3617
+ pourLeDeveloppeur: pourLui,
3618
+ inchange: Boolean(ctx.sorte?.inchange),
3619
+ }) === CODE;
3417
3620
  const suite = p.rouges
3418
3621
  ? 'au développeur'
3419
3622
  : pourLui
3420
3623
  ? 'aucun rouge ; au développeur, que nomme un constat du relecteur'
3421
- : 'aucun rouge : un lot de tests seul, aux contrôles';
3624
+ : ctx.sorte?.inchange
3625
+ ? 'aucun rouge : le plan dit « comportement inchangé », au développeur'
3626
+ : 'aucun rouge : un lot de tests seul, aux contrôles';
3422
3627
  ecrireRapport(ctx, 'preuve', `${p.resume} ; ${suite}.\n\n${p.texte}`, p.resultat);
3423
3628
  etape = auDeveloppeur ? CODE : CONTROLES;
3424
3629
  tentative = auDeveloppeur ? 1 : 0;
@@ -3534,8 +3739,9 @@ async function derouler(ctx, debut) {
3534
3739
  const passeFinale = finale;
3535
3740
  // The final pass: after a regeneration of the references, restricted to what it changed,
3536
3741
  // the reds of the pass before it carried (none plays when it changed nothing); else whole,
3537
- // or restricted to what changed since the last review.
3538
- const regeneration = passeFinale ? (ctx.regeneration ?? null) : null;
3742
+ // or restricted to what changed since the last review. The checks of the plan after a
3743
+ // regeneration that changed nothing: none plays, the reds of the checks before standing.
3744
+ const regeneration = ctx.regeneration ?? null;
3539
3745
  ctx.regeneration = null;
3540
3746
  const passe = !passeFinale
3541
3747
  ? { arbre: null, restreinte: null }
@@ -3580,7 +3786,53 @@ async function derouler(ctx, debut) {
3580
3786
  r => !dejaRegenerees.includes(r.nom)
3581
3787
  )
3582
3788
  : [];
3583
- if (aRegenerer.length) {
3789
+ // The checks of the plan with a red of a reference, mixed with others or not: its
3790
+ // regeneration before any red goes to the developpeur, as Bazel builds a genrule before the
3791
+ // tests that read it, but for a reference regenerated on this same tree; mixed with other
3792
+ // reds, the checks of the plan play again on the regenerated tree, which judges a test
3793
+ // that reads the reference; alone, the final pass that is due (BPScript 320.6.5: a test
3794
+ // that reads the turbo.json, red beside their guard, sent to the developpeur, who could not
3795
+ // write them).
3796
+ const regenereesAuxControles =
3797
+ !passeFinale && k.references.length && ctx.regenereSur?.arbre === arbreDeLaCopie(ctx)
3798
+ ? ctx.regenereSur.noms
3799
+ : [];
3800
+ const avantLesControles = passeFinale
3801
+ ? []
3802
+ : k.references.filter(r => !regenereesAuxControles.includes(r.nom));
3803
+ if (avantLesControles.length) {
3804
+ const noms = avantLesControles.map(r => r.nom);
3805
+ const meles = k.rouge || k.aRepasser;
3806
+ geste(ctx, 'regeneration');
3807
+ const phrase = `${k.resume} ; des rouges sont ceux de références (${noms.join(', ')}) : à leur régénération, puis ${meles ? 'les contrôles du plan' : 'la passe finale'}.`;
3808
+ ecrireRapport(
3809
+ ctx,
3810
+ 'controles',
3811
+ phrase,
3812
+ resultat(meles ? 'rouge' : 'vert'),
3813
+ meles ? `${k.texte}${k.avertissements}` : `${phrase}${k.avertissements}`
3814
+ );
3815
+ // Mixed, the developpeur who had nothing to deliver, for the checks of the plan that
3816
+ // follow; green, the final pass, its sessions counted apart, which a developpeur with
3817
+ // nothing to deliver before green checks does not concern.
3818
+ if (meles) {
3819
+ ctx.rienALivrer = rien;
3820
+ } else {
3821
+ ctx.renvoiAuTestwriter = null;
3822
+ tentative = 0;
3823
+ }
3824
+ // The report of the reds of the plan, which go to the developpeur when a command of the
3825
+ // project refuses the lot, as at the final pass (BPScript 320.10).
3826
+ ctx.aRegenerer = {
3827
+ noms,
3828
+ notes: [],
3829
+ suite: meles ? 'controles' : 'passe',
3830
+ rouges: meles ? k.tous : [],
3831
+ auDeveloppeur: meles && k.auDeveloppeur && !k.arbitrer ? k.texte : null,
3832
+ };
3833
+ etape = REFERENCES;
3834
+ finale = true;
3835
+ } else if (aRegenerer.length) {
3584
3836
  const noms = aRegenerer.map(r => r.nom);
3585
3837
  geste(ctx, 'regeneration');
3586
3838
  ecrireRapport(
@@ -3616,6 +3868,12 @@ async function derouler(ctx, debut) {
3616
3868
  'controles',
3617
3869
  'Les rouges du plan sont des constats à arbitrer : aucun développeur ne les tranche.'
3618
3870
  );
3871
+ } else if (k.rouge && cheminMecanique(ctx)) {
3872
+ // A mechanical lot: no testwriter nor developpeur lifts the red of its command.
3873
+ arreter(
3874
+ 'controles',
3875
+ `Le ticket est mécanique (${ctx.sorte.raison}) : ni testwriter ni développeur ne lève ce rouge du lot de sa commande. Le superviseur fait corriger le lot (\`--depuis developpeur\`, le rouge en \`--contexte\`), corrige le geste dans la copie puis \`--reprendre\`, ou arrête le circuit (\`--arreter\`).`
3876
+ );
3619
3877
  } else if (k.rouge && rien) {
3620
3878
  // The stop stands at the developpeur's step, which a resumption plays again.
3621
3879
  arreter('sans-livraison', rien, CODE);
@@ -3633,27 +3891,6 @@ async function derouler(ctx, debut) {
3633
3891
  arreter('controles', null);
3634
3892
  } else if (k.aRepasser) {
3635
3893
  arreter('a-repasser', null);
3636
- } else if (!passeFinale && k.references.length) {
3637
- // The checks green but for reds of references: their regeneration, then the final pass,
3638
- // which plays once, on the regenerated tree, as make remakes a generated file before
3639
- // what reads it.
3640
- geste(ctx, 'regeneration');
3641
- ecrireRapport(
3642
- ctx,
3643
- 'controles',
3644
- `${k.resume}.`,
3645
- resultat('vert'),
3646
- `${k.resume}.${k.avertissements}`
3647
- );
3648
- ctx.renvoiAuTestwriter = null;
3649
- ctx.aRegenerer = {
3650
- noms: k.references.map(r => r.nom),
3651
- notes: [],
3652
- avantLaPasse: true,
3653
- };
3654
- etape = REFERENCES;
3655
- tentative = 0;
3656
- finale = true;
3657
3894
  } else {
3658
3895
  ecrireRapport(
3659
3896
  ctx,
@@ -3685,7 +3922,8 @@ async function derouler(ctx, debut) {
3685
3922
  }
3686
3923
  } else if (etape === REFERENCES) {
3687
3924
  // The references to regenerate and the reds of the pass before, kept in the state from
3688
- // the final pass that called for them, so that a regeneration resumed knows them.
3925
+ // the pass that called for them (the checks of the plan, `suite`, or the final pass), so
3926
+ // that a regeneration resumed knows them.
3689
3927
  const a = ctx.aRegenerer;
3690
3928
  if (!a) {
3691
3929
  throw new Arret(
@@ -3694,10 +3932,11 @@ async function derouler(ctx, debut) {
3694
3932
  );
3695
3933
  }
3696
3934
  // A command of the project that refuses beside reds of the plan, within the developpeur's
3697
- // sessions: the copy restored, those reds go to him with its output, the final pass after.
3935
+ // sessions: the copy restored, those reds go to him with its output, then the pass that
3936
+ // called for the regeneration, the checks of the plan or the final pass.
3698
3937
  const suivante = tentative + 1;
3699
3938
  const auLot = Boolean(a.auDeveloppeur) && suivante <= SEANCES_DEVELOPPEUR;
3700
- const g = regenerer(ctx, a.noms, a.notes, Boolean(a.avantLaPasse), auLot);
3939
+ const g = regenerer(ctx, a.noms, a.notes, a.suite ?? null, auLot);
3701
3940
  if (g.refus) {
3702
3941
  const texte = [
3703
3942
  `La régénération des références refuse le lot ; la copie est rendue telle qu'avant elle, et les rouges du plan vont au développeur (séance ${suivante}).`,
@@ -3707,29 +3946,37 @@ async function derouler(ctx, debut) {
3707
3946
  ecrireRapport(ctx, 'references', texte, { regenerees: [], fichiers: [] });
3708
3947
  rapport = `${texte}\n\n${a.auDeveloppeur}`;
3709
3948
  ctx.aRegenerer = null;
3949
+ ctx.rienALivrer = null;
3710
3950
  etape = CODE;
3711
3951
  tentative = suivante;
3712
- finale = true;
3952
+ finale = a.suite !== 'controles';
3713
3953
  continue;
3714
3954
  }
3715
3955
  ecrireRapport(ctx, 'references', g.texte, {
3716
3956
  regenerees: g.regenerees,
3717
3957
  fichiers: g.fichiers,
3718
3958
  });
3719
- // After the checks, the final pass that is due, on the regenerated tree, which does not
3720
- // regenerate again the references just regenerated on it; after a final pass, the pass
3721
- // restricted to what the regeneration changed, with the reds of the pass before.
3722
- ctx.regenereSur = a.avantLaPasse ? { arbre: arbreDeLaCopie(ctx), noms: a.noms } : null;
3723
- ctx.regeneration = a.avantLaPasse
3724
- ? null
3725
- : {
3726
- restreinte: g.restreinte,
3727
- entiere: a.entiere,
3728
- reportes: { rouges: a.rouges, rejouee: g.fichiers.length > 0 },
3729
- };
3959
+ // After the checks, the pass that judges the regenerated tree, which does not regenerate
3960
+ // again the references just regenerated on it: beside other reds, the checks of the plan
3961
+ // again (none plays when the regeneration changed nothing, the reds of the checks before
3962
+ // standing); without, the final pass that is due. After a final pass, the pass restricted
3963
+ // to what the regeneration changed, with the reds of the pass before.
3964
+ ctx.regenereSur = a.suite ? { arbre: arbreDeLaCopie(ctx), noms: a.noms } : null;
3965
+ ctx.regeneration =
3966
+ a.suite === 'passe'
3967
+ ? null
3968
+ : a.suite === 'controles'
3969
+ ? g.fichiers.length
3970
+ ? null
3971
+ : { reportes: { rouges: a.rouges, rejouee: false } }
3972
+ : {
3973
+ restreinte: g.restreinte,
3974
+ entiere: a.entiere,
3975
+ reportes: { rouges: a.rouges, rejouee: g.fichiers.length > 0 },
3976
+ };
3730
3977
  ctx.aRegenerer = null;
3731
3978
  etape = CONTROLES;
3732
- finale = true;
3979
+ finale = a.suite !== 'controles';
3733
3980
  } else if (etape === RELECTURE) {
3734
3981
  const v = await relire(ctx);
3735
3982
  // A question for the owner: nothing is committed nor relaunched before his answer.
@@ -3772,7 +4019,7 @@ async function derouler(ctx, debut) {
3772
4019
  );
3773
4020
  }
3774
4021
  ctx.constats = constatsOuverts(ctx, v.fiche, v.texte);
3775
- const saute = arretDuTestwriterSaute(ctx, v.texte);
4022
+ const saute = arretDuTestwriterSaute(ctx, v.texte) ?? arretDuGesteMecanique(ctx, v.texte);
3776
4023
  if (saute) throw saute;
3777
4024
  const auTestwriter = ouverts(ctx, 'testwriter').length > 0;
3778
4025
  etape = auTestwriter ? TESTS : CODE;
@@ -4064,6 +4311,27 @@ const planPasse = (ctx, empreinte) =>
4064
4311
 
4065
4312
  // The heading of the section of the open questions in a plan's description.
4066
4313
  const QUESTIONS_OUVERTES = '## Questions ouvertes';
4314
+ // The heading of the section of the sort of the ticket in a plan's description (grillhouse-sos).
4315
+ const SORTE = '## Sorte';
4316
+ // The heading of the section of the names the plan publishes in its description, the one that
4317
+ // scripts/langages/typescript/consommateurs-arbitres.mjs reads (grillhouse-la3).
4318
+ const NOMS_PUBLIES = '## Noms publiés';
4319
+
4320
+ // The names <noms> a plan publishes (`noms_publies`), one line each, as the guard of the consumers
4321
+ // reads them: the provider, the consumer and each name between backquotes.
4322
+ const lignesDesNoms = noms =>
4323
+ noms
4324
+ .map(
4325
+ n =>
4326
+ `- \`${n.fournisseur}\` publie à \`${n.consommateur}\` : ${n.noms.map(x => `\`${x}\``).join(', ')}`
4327
+ )
4328
+ .join('\n');
4329
+
4330
+ // The sort <sorte> (`sorteDuPlan`) in words: its kind, then its reason.
4331
+ const texteDeLaSorte = sorte =>
4332
+ sorte.raison
4333
+ ? `${sorte.genre}${sorte.inchange ? ' inchangé' : ''} — ${sorte.raison}`
4334
+ : `${sorte.genre} — la fiche ne dit pas sa sorte lisiblement : le circuit entier`;
4067
4335
 
4068
4336
  // The sections of the description <description>: the text before its first `##` heading, then
4069
4337
  // each heading with its lines.
@@ -4088,13 +4356,22 @@ function numerotee(ligne) {
4088
4356
  }
4089
4357
 
4090
4358
  // The ticket's description <description> as it was before the plan, with the criteria the plan adds
4091
- // <criteres> in its section of criteria (a section « ## Critères » at its end without one) and its
4092
- // open questions <questions> in their section after it, absent without one; the rest of it as it
4093
- // was. The criteria already written stay as they are, the decision of the owner: each criterion the
4094
- // plan adds follows them, numbered after them. Written again from the description before the plan,
4095
- // the description holds the criteria of the explorateur's last sheet alone.
4096
- function decrireLePlan(description, criteres, questions) {
4097
- const gardees = sectionsDe(description).filter(s => s.tete !== QUESTIONS_OUVERTES);
4359
+ // <criteres> in its section of criteria (a section « ## Critères » at its end without one), the sort
4360
+ // of the ticket <sorte> in its section after it, its reason and the command of a mechanical ticket
4361
+ // (absent when the sheet says none), the names the plan publishes <noms> in their section after it
4362
+ // (an empty list erases the section; a sheet without them, <noms> undefined, keeps the section the
4363
+ // description holds, a supervisor's by hand included), and its open questions <questions> in their
4364
+ // section after them, absent without one; the rest of it as it was. The criteria already written
4365
+ // stay as they are, the decision of the owner: each criterion the plan adds follows them, numbered
4366
+ // after them. Written again from the description before the plan, the description holds the
4367
+ // criteria, the sort and the names of the explorateur's last sheet alone.
4368
+ export function decrireLePlan(description, criteres, questions, sorte = null, noms = undefined) {
4369
+ const gardees = sectionsDe(description).filter(
4370
+ s =>
4371
+ s.tete !== QUESTIONS_OUVERTES &&
4372
+ s.tete !== SORTE &&
4373
+ (noms === undefined || s.tete !== NOMS_PUBLIES)
4374
+ );
4098
4375
  let i = gardees.findIndex(deCriteres);
4099
4376
  if (i < 0) {
4100
4377
  gardees.at(-1).lignes.push('');
@@ -4110,12 +4387,26 @@ function decrireLePlan(description, criteres, questions) {
4110
4387
  tete: gardees[i].tete,
4111
4388
  lignes: [...(avant.length ? avant : ['']), ...liste, ''],
4112
4389
  };
4113
- if (questions.length) {
4114
- gardees.splice(i + 1, 0, {
4115
- tete: QUESTIONS_OUVERTES,
4116
- lignes: ['', lignesOuvertes(questions), ''],
4117
- });
4118
- }
4390
+ const apres = [
4391
+ ...(sorte
4392
+ ? [
4393
+ {
4394
+ tete: SORTE,
4395
+ lignes: [
4396
+ '',
4397
+ texteDeLaSorte(sorte),
4398
+ ...(sorte.commande ? ['', `Commande : \`${sorte.commande}\``] : []),
4399
+ '',
4400
+ ],
4401
+ },
4402
+ ]
4403
+ : []),
4404
+ ...(noms?.length ? [{ tete: NOMS_PUBLIES, lignes: ['', lignesDesNoms(noms), ''] }] : []),
4405
+ ...(questions.length
4406
+ ? [{ tete: QUESTIONS_OUVERTES, lignes: ['', lignesOuvertes(questions), ''] }]
4407
+ : []),
4408
+ ];
4409
+ gardees.splice(i + 1, 0, ...apres);
4119
4410
  return gardees
4120
4411
  .flatMap(s => (s.tete ? [s.tete, ...s.lignes] : s.lignes))
4121
4412
  .join('\n')
@@ -4178,6 +4469,10 @@ function fautesDesPaquets(ctx, fiche, description) {
4178
4469
  : null;
4179
4470
  }
4180
4471
 
4472
+ // The sort the sheet of the plan <fiche> writes in the description: the one it says, read
4473
+ // (`sorteDuPlan`), or none when the sheet says none.
4474
+ const sorteEcrite = fiche => ('sorte' in fiche ? sorteDuPlan(fiche) : null);
4475
+
4181
4476
  // The components the sheet <fiche> of the explorateur sets apart, each with its reason, as the
4182
4477
  // circuit writes them at the ticket; empty without one.
4183
4478
  const ecartsDe = fiche =>
@@ -4247,12 +4542,18 @@ async function lePlan(ctx) {
4247
4542
  ecrireLePlan(
4248
4543
  ctx,
4249
4544
  plan.paquets.map(ctx.resoudre),
4250
- decrireLePlan(t.description, plan.criteres, plan.questions)
4545
+ decrireLePlan(
4546
+ t.description,
4547
+ plan.criteres,
4548
+ plan.questions,
4549
+ sorteEcrite(plan),
4550
+ plan.noms_publies
4551
+ )
4251
4552
  );
4252
4553
  const ouvertesDuPlan = plan.questions.length ? `\n${lignesOuvertes(plan.questions)}` : 'aucune';
4253
4554
  dire(
4254
4555
  'plan',
4255
- `l'explorateur écrit le plan — paquets : ${plan.paquets.join(', ')}${ecartsDe(plan)} ; ${plan.criteres.length} critère(s) ajouté(s) ; questions ouvertes : ${ouvertesDuPlan}`
4556
+ `l'explorateur écrit le plan — paquets : ${plan.paquets.join(', ')}${ecartsDe(plan)} ; sorte : ${texteDeLaSorte(sorteDuPlan(plan))} ; ${plan.criteres.length} critère(s) ajouté(s) ; questions ouvertes : ${ouvertesDuPlan}`
4256
4557
  );
4257
4558
  const ecrit = leTicket(ctx);
4258
4559
  const lu = await session(
@@ -4289,6 +4590,8 @@ async function lePlan(ctx) {
4289
4590
  : `le plan — Les questions du questionneur :\n${lignesDesQuestions(lu.questions)}`
4290
4591
  );
4291
4592
  let reponses = [];
4593
+ // The plan the answer answers, whose sort the answer keeps when it says none.
4594
+ const premier = plan;
4292
4595
  if (posees.length) {
4293
4596
  plan = await session(
4294
4597
  EXPLORATEUR,
@@ -4303,6 +4606,8 @@ async function lePlan(ctx) {
4303
4606
  {
4304
4607
  ...explorateur,
4305
4608
  premiere: 'reprend',
4609
+ // The answer, apart from the plan it answers (`ficheDuPlan`).
4610
+ avec: { reponse: true },
4306
4611
  // A line of `reponses` by question put, asked again once; after it, a question without
4307
4612
  // its line stays open.
4308
4613
  valider: (f, essai) =>
@@ -4324,10 +4629,17 @@ async function lePlan(ctx) {
4324
4629
  .map(question => ({ question, piece: 'question du questionneur, sans réponse' })),
4325
4630
  ];
4326
4631
  if (posees.length) {
4632
+ const plans = [{ fiche: premier }, { fiche: plan, reponse: true }];
4327
4633
  ecrireLePlan(
4328
4634
  ctx,
4329
4635
  plan.paquets.map(ctx.resoudre),
4330
- decrireLePlan(t.description, plan.criteres, ouvertes)
4636
+ decrireLePlan(
4637
+ t.description,
4638
+ plan.criteres,
4639
+ ouvertes,
4640
+ sorteEcrite(ficheDuPlan(plans, 'sorte')),
4641
+ ficheDuPlan(plans, 'noms_publies').noms_publies
4642
+ )
4331
4643
  );
4332
4644
  }
4333
4645
  const empreinte = empreinteDuPlan(leTicket(ctx));
@@ -4585,6 +4897,8 @@ export async function main(argv) {
4585
4897
  const arret = await lePlan(ctx);
4586
4898
  if (arret !== null) return aLaFin(ctx, arret);
4587
4899
  }
4900
+ // The sort of the ticket its plan says, which the run reads at each step.
4901
+ ctx.sorte = sorteDuTicket(ctx);
4588
4902
  return aLaFin(ctx, await conduire(ctx, d));
4589
4903
  } catch (e) {
4590
4904
  if (!(e instanceof Usage)) throw e;