@roomi-fields/grillhouse 0.45.1 → 0.47.0

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 (114) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +52 -0
  3. package/cadre/templates/c/package.json +19 -0
  4. package/cadre/templates/projet/.github/workflows/ci.yml +34 -49
  5. package/cadre/templates/projet/.github/workflows/machine-vierge.yml +101 -0
  6. package/cadre/templates/projet/CLAUDE.md +28 -5
  7. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  8. package/charte.md +61 -23
  9. package/dist/temporal/circuit/appel.d.ts +7 -0
  10. package/dist/temporal/circuit/appel.js +17 -0
  11. package/dist/temporal/circuit/appel.js.map +1 -1
  12. package/dist/temporal/circuit/client.d.ts +28 -5
  13. package/dist/temporal/circuit/client.js +56 -13
  14. package/dist/temporal/circuit/client.js.map +1 -1
  15. package/dist/temporal/circuit/commande.js +16 -4
  16. package/dist/temporal/circuit/commande.js.map +1 -1
  17. package/dist/temporal/circuit/contrat.d.ts +22 -2
  18. package/dist/temporal/circuit/contrat.js +76 -0
  19. package/dist/temporal/circuit/contrat.js.map +1 -1
  20. package/dist/temporal/circuit/deroule.js +68 -11
  21. package/dist/temporal/circuit/deroule.js.map +1 -1
  22. package/dist/temporal/file/activites.d.ts +2 -0
  23. package/dist/temporal/file/activites.js +7 -0
  24. package/dist/temporal/file/activites.js.map +1 -1
  25. package/dist/temporal/file/contrat.d.ts +28 -18
  26. package/dist/temporal/file/contrat.js +8 -5
  27. package/dist/temporal/file/contrat.js.map +1 -1
  28. package/dist/temporal/file/deroule.d.ts +1 -1
  29. package/dist/temporal/file/deroule.js +91 -42
  30. package/dist/temporal/file/deroule.js.map +1 -1
  31. package/dist/temporal/tickets/activites.d.ts +1 -0
  32. package/dist/temporal/tickets/activites.js +37 -11
  33. package/dist/temporal/tickets/activites.js.map +1 -1
  34. package/dist/temporal/tickets/contrat.d.ts +14 -0
  35. package/dist/temporal/tickets/deroule.js +16 -3
  36. package/dist/temporal/tickets/deroule.js.map +1 -1
  37. package/docs/ARCHITECTURE.md +309 -128
  38. package/docs/INTERFACE.md +42 -22
  39. package/hooks/register.tsx +30 -0
  40. package/package.json +1 -1
  41. package/scripts/activites.mjs +60 -21
  42. package/scripts/arbres-juges.mjs +59 -0
  43. package/scripts/attente-a-l-arret.mjs +29 -52
  44. package/scripts/attente-au-tour.mjs +8 -26
  45. package/scripts/avancement.mjs +2 -38
  46. package/scripts/branche-de-nuit.mjs +14 -45
  47. package/scripts/ci-de-main.mjs +273 -0
  48. package/scripts/circuit.mjs +204 -64
  49. package/scripts/circuits-cles.d.mts +9 -0
  50. package/scripts/circuits-cles.mjs +38 -0
  51. package/scripts/coeurs-dedies.mjs +4 -3
  52. package/scripts/dernier-vert.mjs +78 -10
  53. package/scripts/enveloppe/travail-de-la-copie.mjs +5 -2
  54. package/scripts/etapes.mjs +7 -2
  55. package/scripts/faits-du-circuit.mjs +63 -28
  56. package/scripts/fichiers-nommes.mjs +55 -0
  57. package/scripts/file-des-tickets.d.mts +17 -0
  58. package/scripts/file-des-tickets.mjs +39 -0
  59. package/scripts/grillhouse-maj.mjs +20 -1
  60. package/scripts/integration/file.mjs +137 -592
  61. package/scripts/integration/integrer.mjs +10 -7
  62. package/scripts/langages/c/binaires.json +4 -0
  63. package/scripts/langages/c/binaires.mjs +83 -0
  64. package/scripts/langages/c/clang-format.mjs +62 -0
  65. package/scripts/langages/c/clang-tidy.mjs +93 -0
  66. package/scripts/langages/c/clang.mjs +42 -0
  67. package/scripts/langages/c/commandes.mjs +530 -0
  68. package/scripts/langages/c/composants.mjs +209 -0
  69. package/scripts/langages/c/exemples.mjs +250 -0
  70. package/scripts/langages/c/index-interfaces.mjs +77 -0
  71. package/scripts/langages/c/index.mjs +120 -0
  72. package/scripts/langages/c/lot.mjs +41 -0
  73. package/scripts/langages/c/mise-a-jour.mjs +70 -0
  74. package/scripts/langages/c/squelette.mjs +61 -0
  75. package/scripts/langages/c/verdict.mjs +99 -0
  76. package/scripts/langages/cargo/clippy.mjs +16 -9
  77. package/scripts/langages/cargo/commandes.mjs +7 -2
  78. package/scripts/langages/cargo/sccache.mjs +19 -6
  79. package/scripts/langages/typescript/tests.mjs +31 -5
  80. package/scripts/langages/typescript/turbo-des-paquets.mjs +67 -8
  81. package/scripts/langages/typescript/vitest-config/changements.mjs +32 -3
  82. package/scripts/langages/typescript/vitest-config/lances.mjs +16 -0
  83. package/scripts/langages-des-paquets.mjs +30 -2
  84. package/scripts/langages.mjs +1 -0
  85. package/scripts/limite-d-usage.mjs +88 -0
  86. package/scripts/mesure/avancement.mjs +1 -1
  87. package/scripts/migrations/0.47.0-ci-de-main.mjs +48 -0
  88. package/scripts/migrations.mjs +2 -2
  89. package/scripts/outils-cles.d.mts +13 -5
  90. package/scripts/outils-cles.mjs +157 -17
  91. package/scripts/passe-de-la-machine.mjs +26 -2
  92. package/scripts/places-de-la-machine.mjs +52 -6
  93. package/scripts/plafond-de-la-machine.d.mts +10 -2
  94. package/scripts/plafond-de-la-machine.mjs +39 -13
  95. package/scripts/reponses-du-circuit.d.mts +16 -0
  96. package/scripts/reponses-du-circuit.mjs +39 -3
  97. package/scripts/resultats.mjs +32 -11
  98. package/scripts/seances.mjs +211 -59
  99. package/scripts/session-start.sh +2 -11
  100. package/scripts/sortie.mjs +1 -1
  101. package/scripts/sous-commandes.mjs +5 -2
  102. package/scripts/superviseur.mjs +305 -295
  103. package/scripts/tableau.mjs +73 -45
  104. package/scripts/transitions.d.mts +22 -1
  105. package/scripts/transitions.mjs +111 -13
  106. package/scripts/workflows-du-cadre.mjs +21 -1
  107. package/skills/explorateur/SKILL.md +34 -13
  108. package/skills/grill/SKILL.md +6 -5
  109. package/skills/pitmaster/SKILL.md +33 -27
  110. package/skills/redacteur/references/documents-d-un-composant.md +1 -1
  111. package/skills/relecteur/SKILL.md +6 -0
  112. package/skills/testwriter/SKILL.md +4 -0
  113. package/scripts/ci-des-branches.mjs +0 -93
  114. package/scripts/migrations/0.33.0-ci-des-branches-de-ticket.mjs +0 -31
@@ -21,9 +21,9 @@
21
21
  // (scripts/faits-du-circuit.mjs), which calls the functions below (the opening, a step of the plan,
22
22
  // the preparation of a pass, a fact, a stop, the end). The command `npx grillhouse circuit` is the
23
23
  // client of that workflow (src/temporal/circuit/commande.ts): it puts a ticket in the queue of the
24
- // tickets of the project, answers a stop, or stops the circuit. A question wakes the supervisor by
25
- // the wait of the questions (`npx grillhouse superviseur --attendre`, scripts/superviseur.mjs),
26
- // which reads the server, and the normal end of a circuit wakes no one: the board shows it.
24
+ // tickets of the project, answers a stop, or stops the circuit. A question reaches the supervisor by
25
+ // the push of the greffon into the queue of its session (`relever`, scripts/superviseur.mjs),
26
+ // which reads the server, and the normal end of a circuit is given once by the same push.
27
27
  //
28
28
  // The decisions of each step (the step that follows, its attempt, its report, its stop) are the
29
29
  // functions without input nor output of scripts/transitions.mjs (`transition`, `apresLaPreuve`,
@@ -95,8 +95,8 @@
95
95
  // scripts/resultats.mjs, from the explorateur's last sheet of the plan), which the circuit
96
96
  // writes in the description (« ## Sorte », after the criteria) and at the ticket with the plan:
97
97
  // mechanical, a gesture without new behaviour, with its reason and the command that makes it;
98
- // comportement, with its reason, the plan « comportement inchangé » when the lot changes no
99
- // behaviour; absent or unreadable, comportement, the whole circuit (grillhouse-sos, BPScript
98
+ // comportement, with its reason and its field `comportement` (changé, tests-adaptés, or
99
+ // inchangé for a gesture written by hand); absent or unreadable, comportement, the whole circuit (grillhouse-sos, BPScript
100
100
  // 320.16: 38 tools moved by mv through the testwriter and the developpeur, 117 comments). As
101
101
  // Google's large-scale changes (Rosie, ClangMR) let a tool make the change that a verification
102
102
  // and a review judge, with no new test, a mechanical ticket (`cheminMecanique`: no `--depuis`,
@@ -236,11 +236,11 @@
236
236
  // a file of the lot: a testwriter with no new test to write says so in his handover, the existing
237
237
  // reds are enough. Under a plan « comportement changé » it fails without a red, with a broken file
238
238
  // of the lot, or with a green the sheet names; under a plan « comportement
239
- // inchangé », nothing has to turn red and every green passes, so only a broken
239
+ // tests-adaptés », nothing has to turn red and every green passes, so only a broken
240
240
  // file fails it (`preuveReussie`). A failed proof relaunches the
241
241
  // testwriter with its report, twice at most. The report (reds, justified greens) is written at
242
242
  // the ticket. A proof with a red launches the developpeur, and so does a proof without a red
243
- // when a finding of the reviewer still open names him, or under a plan « comportement inchangé »,
243
+ // when a finding of the reviewer still open names him, or under a plan « comportement tests-adaptés »,
244
244
  // whose lot has code to write though nothing turns red; else it skips him (`apresLaPreuve`): the
245
245
  // lot is a lot of tests alone, and the checks and the review judge it with no session of the
246
246
  // developpeur.
@@ -622,7 +622,7 @@ import {
622
622
  } from 'node:fs';
623
623
  import os from 'node:os';
624
624
  import path from 'node:path';
625
- import { outilsDe } from './outils-cles.mjs';
625
+ import { empreintesDe, outilsDe } from './outils-cles.mjs';
626
626
  import { donneesDe } from './donnees-cles.mjs';
627
627
  import { engendresDe } from './engendres.mjs';
628
628
  import { fluxDe } from './flux-des-paquets.mjs';
@@ -714,7 +714,7 @@ import { leTitre, ticketAuLancement } from './depart-du-ticket.mjs';
714
714
  import { ouvrirBase } from './mesure/base-de-passe.mjs';
715
715
  import { GREFFON } from './cadre.mjs';
716
716
  import { retirerLesCopiesDuDepot } from './copies-finies.mjs';
717
- import { lesReponses } from './reponses-du-circuit.mjs';
717
+ import { lesReponses, reponseMecanique } from './reponses-du-circuit.mjs';
718
718
 
719
719
  // The time a session's transcripts may stand still before the circuit stops it.
720
720
  export const IMMOBILE_MS = 20 * 60 * 1000;
@@ -812,7 +812,7 @@ export function contexte(o) {
812
812
  const tmp = `${copie}.travail`;
813
813
  mkdirSync(tmp, { recursive: true });
814
814
  const baseDuRun = ouvrirBase('circuit');
815
- return {
815
+ const ctx = {
816
816
  ...o,
817
817
  racine,
818
818
  copie,
@@ -832,6 +832,90 @@ export function contexte(o) {
832
832
  tmp,
833
833
  ports: null,
834
834
  };
835
+ // The extension of the plan a write out of the plan in a file the ticket names asks for.
836
+ ctx.etendreEnVol = e => etendreEnVol(ctx, e);
837
+ // The components the plan set apart from the survey, which the checks keep verifying.
838
+ ctx.ecartes = ecartesDuPlan(fichesDuPlan(ctx), ctx.paquets, resoudre);
839
+ return ctx;
840
+ }
841
+
842
+ // The sheets of the plan of the explorateur, in their order (`{ fiche, reponse }`).
843
+ const fichesDuPlan = ctx => lesFiches(ctx).filter(estUnPlan);
844
+
845
+ /**
846
+ * The directories of the components the last sheet of the plan <plans> sets apart (`ecartes`, its
847
+ * answer to the questionneur included: an answer that says none keeps those of the plan it answers),
848
+ * less those the plan <paquets> holds now: a component that enters the plan, by the circuit or by
849
+ * the supervisor, leaves the list. <resoudre> turns a name or a path into a directory.
850
+ */
851
+ export function ecartesDuPlan(plans, paquets, resoudre) {
852
+ const dedans = d => paquets.some(p => p === '.' || d === p || d.startsWith(`${p}/`));
853
+ const dossiers = (ficheDuPlan(plans, 'ecartes')?.ecartes ?? []).flatMap(e => {
854
+ try {
855
+ return [resoudre(e.composant)];
856
+ } catch {
857
+ return [];
858
+ }
859
+ });
860
+ return [...new Set(dossiers)].filter(d => !dedans(d));
861
+ }
862
+
863
+ // The plan of <ctx> extended, without a stop, to the components <composants> (directories) the plan
864
+ // had set apart and that a red of the checks or of the final pass holds: written to the title in
865
+ // the order of the plan and said at the ticket with its piece, the red and the reason of the
866
+ // setting apart that it belies; kept among the circuit's sheets (`etendus`) as `--etendre` keeps it.
867
+ function etendreAuxEcartes(ctx, { composants, rouges = [] }) {
868
+ const gagnes = composants.filter(c => !ctx.paquets.includes(c));
869
+ if (!gagnes.length) {
870
+ return;
871
+ }
872
+ const raisons = new Map(
873
+ (ficheDuPlan(fichesDuPlan(ctx), 'ecartes')?.ecartes ?? []).flatMap(e => {
874
+ try {
875
+ return [[ctx.resoudre(e.composant), e.raison]];
876
+ } catch {
877
+ return [];
878
+ }
879
+ })
880
+ );
881
+ const pieces = gagnes.map(c => {
882
+ const rouge = rouges.find(r => r.ecarte === c)?.texte ?? 'un rouge';
883
+ return `${c} : ${rouge} ; écarté du relevé pour « ${raisons.get(c) ?? 'sans raison écrite'} », ce que ce rouge dément`;
884
+ });
885
+ const { plan, lu } = planEtendu(ctx, ctx.paquets, gagnes);
886
+ const titre = ecrireLePlan(ctx, plan);
887
+ inscrire(ctx, {
888
+ role: AUTEUR_DU_CIRCUIT,
889
+ plan: { empreinte: empreinteDuPlan(leTicket(ctx)), etendus: gagnes },
890
+ });
891
+ commenter(
892
+ ctx,
893
+ 'plan',
894
+ `le circuit étend le plan à ${gagnes.join(', ')}, des composants que le plan avait écartés du relevé et que le rouge nomme : ${titre.split(' — ').at(-1)}${ORDRE_LU[lu]}.\n${pieces.map(p => `- ${p}`).join('\n')}`
895
+ );
896
+ ctx.paquets = [...plan];
897
+ ctx.ecartes = ctx.ecartes.filter(d => !gagnes.includes(d));
898
+ }
899
+
900
+ // The plan of <ctx> extended to the package <paquet>, the home of <chemin>, a file the ticket's
901
+ // description names (<piece>: « ticket, § Architecture » or « ticket, critère N »): the package
902
+ // enters the title in the order of `ordonnerLePlan`, written by bd and said at the ticket with its
903
+ // piece, and kept with the circuit's sheets (`etendus`) as `--etendre` keeps it. The step goes on.
904
+ function etendreEnVol(ctx, { paquet, chemin, piece }) {
905
+ if (ctx.paquets.includes(paquet)) {
906
+ return;
907
+ }
908
+ const { plan, lu } = planEtendu(ctx, ctx.paquets, [paquet]);
909
+ const titre = ecrireLePlan(ctx, plan);
910
+ inscrire(ctx, {
911
+ role: AUTEUR_DU_CIRCUIT,
912
+ plan: { empreinte: empreinteDuPlan(leTicket(ctx)), etendus: [paquet] },
913
+ });
914
+ commenter(
915
+ ctx,
916
+ 'plan',
917
+ `le circuit étend le plan à ${paquet} : ${chemin}, que le ticket nomme (${piece}) : ${titre.split(' — ').at(-1)}${ORDRE_LU[lu]}.`
918
+ );
835
919
  }
836
920
 
837
921
  // The step of the circuit's state <etat> in words, « 3 Code » (scripts/etapes.mjs), or its
@@ -1047,7 +1131,7 @@ export const SANS_CONFLIT = Object.freeze({
1047
1131
  // session (its code, name, report, piece and question), the faults of the key named.
1048
1132
  export function outilsAuLancement(racine) {
1049
1133
  try {
1050
- return { outils: outilsDe(racine) };
1134
+ return { outils: outilsDe(racine), empreintes: empreintesDe(racine) };
1051
1135
  } catch (err) {
1052
1136
  const rapport = `La clé grillhouse.outils du package.json est refusée :\n${err.message}`;
1053
1137
  return {
@@ -1224,21 +1308,31 @@ export function ficheDuPlan(plans, champ) {
1224
1308
  return derniere.fiche;
1225
1309
  }
1226
1310
 
1311
+ // A sheet of the plan (the explorateur's, which holds criteria), and a line of the circuit that
1312
+ // turns the sort of the ticket on the same plan (`ecrireLaSorte`: the supervisor's `--mecanique`,
1313
+ // the reviewer's `comportement-change`).
1314
+ const estUnPlan = e => e.role === EXPLORATEUR && Array.isArray(e.fiche?.criteres);
1315
+ const estUneBascule = e =>
1316
+ e.role === AUTEUR_DU_CIRCUIT && typeof e.sorte === 'object' && e.sorte !== null;
1317
+
1227
1318
  // The sort of the ticket its plan says (`sorteDuPlan` of scripts/resultats.mjs): the sheet of the
1228
- // plan that says it (`ficheDuPlan`), comportement without one (grillhouse-sos).
1229
- const sorteDuTicket = ctx =>
1230
- sorteDuPlan(
1231
- ficheDuPlan(
1232
- lesFiches(ctx).filter(e => e.role === EXPLORATEUR && Array.isArray(e.fiche?.criteres)),
1233
- 'sorte'
1234
- )
1235
- );
1319
+ // plan that says it (`ficheDuPlan`), comportement without one (grillhouse-sos); a line that turns
1320
+ // the sort after the last sheet of the plan stands over it, the plan kept as it is.
1321
+ function sorteDuTicket(ctx) {
1322
+ const tous = lesFiches(ctx);
1323
+ const bascule = tous.findLastIndex(estUneBascule);
1324
+ if (bascule > tous.findLastIndex(estUnPlan)) {
1325
+ return tous[bascule].sorte;
1326
+ }
1327
+ return sorteDuPlan(ficheDuPlan(tous.filter(estUnPlan), 'sorte'));
1328
+ }
1236
1329
 
1237
- // Whether a testwriter or a developpeur has worked the lot since the last sheet of the plan.
1330
+ // Whether a testwriter or a developpeur has worked the lot since the last sheet of the plan or the
1331
+ // last turn of its sort.
1238
1332
  function lotTravaille(ctx) {
1239
1333
  const tous = lesFiches(ctx);
1240
- const plan = tous.findLastIndex(e => e.role === EXPLORATEUR && Array.isArray(e.fiche?.criteres));
1241
- return tous.slice(plan + 1).some(e => AGENTS_DU_LOT.includes(e.role));
1334
+ const depuis = Math.max(tous.findLastIndex(estUnPlan), tous.findLastIndex(estUneBascule));
1335
+ return tous.slice(depuis + 1).some(e => AGENTS_DU_LOT.includes(e.role));
1242
1336
  }
1243
1337
 
1244
1338
  // Whether the ticket of <ctx> goes the mechanical path, as Google's large-scale changes (Rosie,
@@ -1319,7 +1413,8 @@ export function publierLArret(ctx, erreur, etat) {
1319
1413
  etape: lieu,
1320
1414
  arret: e.nom,
1321
1415
  ...(lieu === CONTROLES && etat.finale ? { finale: true } : {}),
1322
- ...(e.resultat ? { resultat: e.resultat } : {}),
1416
+ // The hour a usage limit lifts is no outcome of a pass: the bilan reads none of it.
1417
+ ...(e.resultat && e.nom !== 'limite-d-usage' ? { resultat: e.resultat } : {}),
1323
1418
  });
1324
1419
  const ou = ouDansLeCircuit({ etape: lieu, finale: etat.finale && lieu === CONTROLES });
1325
1420
  commenter(
@@ -1341,26 +1436,6 @@ export function publierLArret(ctx, erreur, etat) {
1341
1436
  };
1342
1437
  }
1343
1438
 
1344
- // What the circuit keeps between steps, which the decisions read and change (scripts/transitions.mjs).
1345
- export const MEMOIRE = [
1346
- 'controlesRouges',
1347
- 'renvoiAuTestwriter',
1348
- 'refus',
1349
- 'rienALivrer',
1350
- 'regeneration',
1351
- 'regenereSur',
1352
- 'aRegenerer',
1353
- 'verifie',
1354
- 'toursDeLaPasseFinale',
1355
- 'constats',
1356
- 'verts',
1357
- 'reprise',
1358
- 'relancesTestwriter',
1359
- 'conflitsRelances',
1360
- 'fichiersDuConflit',
1361
- 'retourDuConflit',
1362
- ];
1363
-
1364
1439
  // The fact <fait> of the circuit of <ctx>, with its <parametres>, the facts <faits> of the step
1365
1440
  // read before it: a session, a pass, a reading of the copy or of the ticket.
1366
1441
  export async function lireLeFait(ctx, fait, parametres, faits) {
@@ -1440,6 +1515,9 @@ export async function lireLeFait(ctx, fait, parametres, faits) {
1440
1515
  return empreinteDeLEtape(ctx, parametres.etape);
1441
1516
  case 'portes':
1442
1517
  return portesDuRouge(ctx, parametres.lieux);
1518
+ case 'etendreAuxEcartes':
1519
+ etendreAuxEcartes(ctx, parametres);
1520
+ return true;
1443
1521
  case 'empreinteAvant':
1444
1522
  case 'empreinte':
1445
1523
  return empreinte(ctx);
@@ -1523,6 +1601,8 @@ export function appliquer(ctx, e) {
1523
1601
  ecrireRapport(ctx, e.etape, e.texte, e.resultat, e.rapport);
1524
1602
  } else if (e.genre === 'inscrire') {
1525
1603
  inscrire(ctx, { role: AUTEUR_DU_CIRCUIT, ...e.entree });
1604
+ } else if (e.genre === 'sorte') {
1605
+ ecrireLaSorte(ctx, e.sorte);
1526
1606
  } else {
1527
1607
  throw new Error(`effet inconnu des décisions du circuit : ${e.genre}`);
1528
1608
  }
@@ -1786,9 +1866,32 @@ const lignesDesNoms = noms =>
1786
1866
  // The sort <sorte> (`sorteDuPlan`) in words: its kind, then its reason.
1787
1867
  const texteDeLaSorte = sorte =>
1788
1868
  sorte.raison
1789
- ? `${sorte.genre}${sorte.inchange ? ' inchangé' : ''} — ${sorte.raison}`
1869
+ ? `${sorte.genre}${sorte.comportement && sorte.comportement !== 'changé' ? ` ${sorte.comportement}` : ''} — ${sorte.raison}`
1790
1870
  : `${sorte.genre} — la fiche ne dit pas sa sorte lisiblement : le circuit entier`;
1791
1871
 
1872
+ // The section « ## Sorte » of the sort <sorte>: its words, then the command of a mechanical ticket.
1873
+ const sectionDeLaSorte = sorte => ({
1874
+ tete: SORTE,
1875
+ lignes: [
1876
+ '',
1877
+ texteDeLaSorte(sorte),
1878
+ ...(sorte.commande ? ['', `Commande : \`${sorte.commande}\``] : []),
1879
+ '',
1880
+ ],
1881
+ });
1882
+
1883
+ // The description <description> with its section « ## Sorte » for the sort <sorte>, in place of the
1884
+ // one it holds or else after its criteria; the rest of it as it was.
1885
+ function redecrireLaSorte(description, sorte) {
1886
+ const sections = sectionsDe(description).filter(s => s.tete !== SORTE);
1887
+ const i = sections.findIndex(deCriteres);
1888
+ sections.splice(i < 0 ? sections.length : i + 1, 0, sectionDeLaSorte(sorte));
1889
+ return sections
1890
+ .flatMap(s => (s.tete ? [s.tete, ...s.lignes] : s.lignes))
1891
+ .join('\n')
1892
+ .trim();
1893
+ }
1894
+
1792
1895
  // The sections of the description <description>: the text before its first `##` heading, then
1793
1896
  // each heading with its lines.
1794
1897
  function sectionsDe(description) {
@@ -1868,19 +1971,7 @@ export function decrireLePlan(
1868
1971
  lignes: [...(avant.length ? avant : ['']), ...liste, ''],
1869
1972
  };
1870
1973
  const apres = [
1871
- ...(sorte
1872
- ? [
1873
- {
1874
- tete: SORTE,
1875
- lignes: [
1876
- '',
1877
- texteDeLaSorte(sorte),
1878
- ...(sorte.commande ? ['', `Commande : \`${sorte.commande}\``] : []),
1879
- '',
1880
- ],
1881
- },
1882
- ]
1883
- : []),
1974
+ ...(sorte ? [sectionDeLaSorte(sorte)] : []),
1884
1975
  ...(noms?.length ? [{ tete: NOMS_PUBLIES, lignes: ['', lignesDesNoms(noms), ''] }] : []),
1885
1976
  ...(questions.length
1886
1977
  ? [{ tete: QUESTIONS_OUVERTES, lignes: ['', lignesOuvertes(questions), ''] }]
@@ -1913,6 +2004,37 @@ function ecrireLePlan(ctx, plan, description = null) {
1913
2004
  return titre;
1914
2005
  }
1915
2006
 
2007
+ // The sort of the ticket turned to <sorte> on the same plan, whose packages and criteria stay: kept
2008
+ // as a line of the circuit among the sheets (`sorteDuTicket` reads it after the last sheet of the
2009
+ // plan), written in the description (« ## Sorte ») and said at the ticket (`Circuit · plan : …`).
2010
+ function ecrireLaSorte(ctx, sorte) {
2011
+ ctx.sorte = sorte;
2012
+ inscrire(ctx, { role: AUTEUR_DU_CIRCUIT, sorte });
2013
+ ecrireLePlan(ctx, ctx.paquets, redecrireLaSorte(leTicket(ctx).description, sorte));
2014
+ commenter(ctx, 'plan', `la sorte du ticket devient ${texteDeLaSorte(sorte)} ; le plan reste.`);
2015
+ }
2016
+
2017
+ // The `--mecanique` answer of <ctx> to the stop <e> of the testwriter (`reponseMecanique` of
2018
+ // scripts/reponses-du-circuit.mjs, which refuses out of that stop, without a reason or on a
2019
+ // ticket already mechanical: a Usage): the sort turned, the plan kept as it is, and the stop's
2020
+ // state moved to the step the sort asks, 1.1 with a command, the developpeur without.
2021
+ function basculer(ctx, e) {
2022
+ const r = reponseMecanique({
2023
+ etat: e,
2024
+ sorte: sorteDuTicket(ctx),
2025
+ commande: ctx.mecanique.commande,
2026
+ contexte: ctx.contexte,
2027
+ });
2028
+ if (r.refus) {
2029
+ throw new Usage(r.refus);
2030
+ }
2031
+ ecrireLaSorte(ctx, r.sorte);
2032
+ ctx.reprendre = true;
2033
+ ctx.verts = {};
2034
+ ctx.reprise = null;
2035
+ return { ...e, etape: r.suivant.etape, raison: null, question: null, rapport: null };
2036
+ }
2037
+
1916
2038
  /**
1917
2039
  * The plan <paquets> the explorateur writes for <ctx>, with each package the supervisor gave the
1918
2040
  * plan (`--etendre`, kept among the sheets, `etendus`) that it leaves out, in its order
@@ -2355,11 +2477,23 @@ const ORDRE_LU = {
2355
2477
  " (le paquet gagné va en fin de plan : ni la copie ni l'arbre principal ne se chargent pour l'ordonner)",
2356
2478
  };
2357
2479
 
2480
+ // The context `--etendre` gives the sessions of the run it resumes on the stop <question>: the
2481
+ // supervisor's answer (the packages <etendus> the plan gains, the plan <plan> as it is now), then his own text <contexte>. The stop's fact
2482
+ // and piece stay out of it: they say the plan as it was and tell a session to stop (a lock's
2483
+ // message), and a session reads its context as the supervisor's word. Without a question, his
2484
+ // text alone, or null.
2485
+ export function contexteDeLExtension({ question, etendus, plan, contexte }) {
2486
+ const reponse = question
2487
+ ? `Le superviseur a étendu le plan à ${etendus.join(', ')} ; le plan du ticket est maintenant : ${plan}.`
2488
+ : null;
2489
+ return [reponse, contexte].filter(Boolean).join('\n\n') || null;
2490
+ }
2491
+
2358
2492
  // The plan extended by the supervisor to the packages of `--etendre` (each a path or a package
2359
2493
  // name of the repository, else a Usage): each one enters the title in the order of
2360
2494
  // `ordonnerLePlan`, written by bd and said at the ticket. With the state <e>, the run then resumes
2361
- // the step under way, as `--reprendre` does, the question of the stop and the text of
2362
- // `--contexte` as the context of its sessions; a stop « sans-livraison » whose developpeur's last
2495
+ // the step under way, as `--reprendre` does, the supervisor's answer to the stop
2496
+ // (`contexteDeLExtension`) and the text of `--contexte` as the context of its sessions; a stop « sans-livraison » whose developpeur's last
2363
2497
  // sheet sends the red to the testwriter (`renvoi`, twice in a row) resumes at the step of the role
2364
2498
  // it names, the testwriter's, as a retry plays the job that failed. Without a state, it starts on
2365
2499
  // the plan extended. The state the run resumes from.
@@ -2385,10 +2519,12 @@ function etendre(ctx, e) {
2385
2519
  if (!e) {
2386
2520
  return e;
2387
2521
  }
2388
- ctx.contexte =
2389
- [e.question ? `${e.question.fait}\n\n${e.question.piece}` : null, ctx.contexte]
2390
- .filter(Boolean)
2391
- .join('\n\n') || null;
2522
+ ctx.contexte = contexteDeLExtension({
2523
+ question: e.question,
2524
+ etendus: ctx.etendre,
2525
+ plan: titre.split(' — ').at(-1),
2526
+ contexte: ctx.contexte,
2527
+ });
2392
2528
  ctx.reprendre = true;
2393
2529
  const renvoi =
2394
2530
  e.etape === CODE && e.raison === 'sans-livraison'
@@ -2406,8 +2542,11 @@ async function avantLePlan(ctx, e) {
2406
2542
  }
2407
2543
  e = etendre(ctx, e);
2408
2544
  }
2545
+ if (ctx.mecanique) {
2546
+ e = basculer(ctx, e);
2547
+ }
2409
2548
  // The findings open at the launch of a run with the supervisor's context (`--contexte`, or the
2410
- // question `--etendre` gives it) are its sessions' context; without one, their task.
2549
+ // answer `--etendre` gives to the stop) are its sessions' context; without one, their task.
2411
2550
  ctx.constats = auLancement(ctx.contexte, ctx.constats);
2412
2551
  // The rank of the circuit's arrival among the machine's waits for a place: drawn at its
2413
2552
  // launch, kept by its state from one session to the next and across a resumption, so that a
@@ -2442,6 +2581,7 @@ async function avantLePlan(ctx, e) {
2442
2581
  return { code: monter(ctx, { ...lancement.arret, etat: d }) };
2443
2582
  }
2444
2583
  ctx.outils = lancement.outils;
2584
+ ctx.empreintes = lancement.empreintes;
2445
2585
  const donnees = donneesAuLancement(ctx.racine);
2446
2586
  if (donnees.arret) {
2447
2587
  return { code: monter(ctx, { ...donnees.arret, etat: d }) };
@@ -3,5 +3,14 @@
3
3
  /** The number of circuits at once (1 when absent), or the fault by its name. */
4
4
  export function reglageDesCircuits(pkg: unknown): { max: number | null; faute: string | null };
5
5
 
6
+ /** The minutes between two presentations of a question not answered, by default (5). */
7
+ export const RAPPEL_PAR_DEFAUT: number;
8
+
9
+ /** The re-presentation interval in minutes (5 when absent), or the fault by its name. */
10
+ export function reglageDuRappel(pkg: unknown): { minutes: number | null; faute: string | null };
11
+
12
+ /** The re-presentation interval of the project at <racine>; 5 when it does not read. */
13
+ export function rappelDuProjet(racine: string): number;
14
+
6
15
  /** The number of circuits at once of the project at <racine>, undefined when it does not read. */
7
16
  export function maxDuProjet(racine: string): number | undefined;
@@ -23,6 +23,44 @@ export function reglageDesCircuits(pkg) {
23
23
  return { max: c, faute: null };
24
24
  }
25
25
 
26
+ // The minutes between two presentations of a question of a circuit that nobody answered, by default.
27
+ export const RAPPEL_PAR_DEFAUT = 5;
28
+
29
+ // The reading of the key `grillhouse.rappel` of a package.json: the minutes between two
30
+ // presentations of a question not answered, a number above 0; absent or null, 5. Any other value
31
+ // is a fault, named with its value.
32
+ // Returns { minutes, faute }: `minutes` null on a fault; `faute` null when the key reads.
33
+ export function reglageDuRappel(pkg) {
34
+ const r = pkg?.grillhouse?.rappel;
35
+ if (r === undefined || r === null) {
36
+ return { minutes: RAPPEL_PAR_DEFAUT, faute: null };
37
+ }
38
+ if (typeof r !== 'number' || !(r > 0) || !Number.isFinite(r)) {
39
+ return {
40
+ minutes: null,
41
+ faute: `grillhouse.rappel vaut ${JSON.stringify(r)}, pas un nombre > 0.`,
42
+ };
43
+ }
44
+ return { minutes: r, faute: null };
45
+ }
46
+
47
+ /**
48
+ * The re-presentation interval, in minutes, of the project at <racine>, as its package.json sets
49
+ * it; 5 when the package.json does not read, and 5 too on a fault (the greffon names it).
50
+ * @param {string} racine
51
+ * @returns {number}
52
+ */
53
+ export function rappelDuProjet(racine) {
54
+ try {
55
+ return (
56
+ reglageDuRappel(JSON.parse(readFileSync(path.join(racine, 'package.json'), 'utf8')))
57
+ .minutes ?? RAPPEL_PAR_DEFAUT
58
+ );
59
+ } catch {
60
+ return RAPPEL_PAR_DEFAUT;
61
+ }
62
+ }
63
+
26
64
  /**
27
65
  * The number of circuits at once of the project at <racine>, as its package.json sets it; undefined
28
66
  * when the package.json or the key does not read (the queue names the fault).
@@ -59,11 +59,12 @@ export function mesureDeclareeDe(pkg) {
59
59
  /**
60
60
  * The number of dedicated cores (threads) a measure asks for: the one its project declares, else
61
61
  * the default part of the budget; within the budget and one at least.
62
- * @param {{ declaree: { coeurs?: number } | null, budget: { coeurs: number, memoire: number } }} o
62
+ * @param {{ declaree: { coeurs?: number } | null, budget: { coeurs: number, memoire: number },
63
+ * places: number }} o
63
64
  * @returns {number}
64
65
  */
65
- export function coeursDeLaMesureDe({ declaree, budget }) {
66
- const voulus = declaree?.coeurs ?? partParDefautDe(budget).coeurs;
66
+ export function coeursDeLaMesureDe({ declaree, budget, places }) {
67
+ const voulus = declaree?.coeurs ?? partParDefautDe(budget, places, undefined).coeurs;
67
68
  return Math.max(1, Math.min(budget.coeurs, voulus));
68
69
  }
69
70
 
@@ -34,22 +34,24 @@
34
34
  // removes at its end.
35
35
  // - `npm test` measures itself against the last green under the circuit's mark,
36
36
  // `GRILLHOUSE_DEPUIS_LE_VERT` (scripts/langages/typescript/tests.mjs, scripts/circuit.mjs); it never keeps one.
37
- // - The circuit's passes, in a project whose CI runs on a ticket's branch, measure themselves
38
- // against the base of their lot (`lot`, the variable `GRILLHOUSE_BASE_DU_LOT` that the circuit
39
- // gives to `npm test` and `npm run verifier`): the copy's HEAD, which main reached green by that
40
- // CI, as Google's presubmit plays the tests a change affects. Their changes carry the mark
37
+ // - The circuit's passes, in every project, measure themselves against the base of their lot
38
+ // (`lot`, the variable `GRILLHOUSE_BASE_DU_LOT` that the circuit gives to `npm test` and
39
+ // `npm run verifier`, and the queue to its final pass): the copy's HEAD, the tip of main of its
40
+ // time, as Google's presubmit plays the tests a change affects. Their changes carry the mark
41
41
  // `cible`: each package plays the tests Vitest relates to them, a file out of its graph playing
42
42
  // neither the whole package nor the tests that read it by its path
43
- // (scripts/langages/typescript/vitest-config/changements.mjs); the complete pass is the CI's and
44
- // the night's. Such a pass keeps no green.
43
+ // (scripts/langages/typescript/vitest-config/changements.mjs); the complete pass is the CI's of
44
+ // main and the night's. Such a pass keeps no green.
45
45
  // - Only the measure of the changed files and the keeping of the green live here: the files go to
46
46
  // `vitest --changed`, and no module of language chooses the packages it plays by the last green
47
47
  // (the tests of a crate or a Python project are tasks of Turborepo, which its cache selects).
48
48
  // The green is kept by the one pass of the verification (scripts/langages/typescript/verifier.mjs),
49
49
  // once, when every task of every language of the graph is green, and never when one is red.
50
50
  import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
51
+ import { createRequire } from 'node:module';
51
52
  import os from 'node:os';
52
53
  import path from 'node:path';
54
+ import { garderLArbreJuge } from './arbres-juges.mjs';
53
55
  import { etatDuDepot, fichierSous, git, SHA, sortie } from './etat-du-depot.mjs';
54
56
  // The variable that names the file of the changes since the last green, which the runner of the
55
57
  // tests of the module of the language reads in each package.
@@ -121,8 +123,11 @@ function lireLaBase(etat, base) {
121
123
  return { commit, arbre, branche: null };
122
124
  }
123
125
 
124
- // Keeps <etat> (etatDuDepot) as the last green of its branch, of main when HEAD is detached.
126
+ // Keeps <etat> (etatDuDepot) as the last green of its branch, of main when HEAD is detached; its
127
+ // tree is judged too (scripts/arbres-juges.mjs): the complete verification of a lot of the direct
128
+ // way is what lets its commit go to main.
125
129
  export function garderLeVert(etat) {
130
+ garderLArbreJuge(etat.racine, etat.arbre);
126
131
  const branche = etat.branche ?? etat.main;
127
132
  const f = branche ? fichierDuVert(etat.racine, branche) : null;
128
133
  if (!f) {
@@ -140,7 +145,7 @@ function difference(racine, avant, apres) {
140
145
  return null;
141
146
  }
142
147
  const champs = r.stdout.split('\0');
143
- const out = { fichiers: [], supprimes: [], sousModules: [] };
148
+ const out = { fichiers: [], supprimes: [], sousModules: [], modifies: new Set() };
144
149
  for (let i = 0; i + 1 < champs.length; i += 2) {
145
150
  const [modeAvant, modeApres, , , statut] = champs[i].replace(/^:/, '').split(' ');
146
151
  const f = champs[i + 1];
@@ -150,11 +155,72 @@ function difference(racine, avant, apres) {
150
155
  out.supprimes.push(f);
151
156
  } else {
152
157
  out.fichiers.push(f);
158
+ if (statut === 'M') {
159
+ out.modifies.add(f);
160
+ }
153
161
  }
154
162
  }
155
163
  return out;
156
164
  }
157
165
 
166
+ const CODE = /\.(?:[cm]?[jt]sx?)$/;
167
+ const DOCUMENT = /\.mdx?$/;
168
+
169
+ // The isolated transpilation of the source <texte> of the file <f> (fixed options, comments
170
+ // removed, value imports kept): its executable output; null when it fails.
171
+ function sortieCompilee(ts, f, texte) {
172
+ const r = ts.transpileModule(texte, {
173
+ fileName: f,
174
+ reportDiagnostics: true,
175
+ compilerOptions: {
176
+ target: ts.ScriptTarget.ESNext,
177
+ module: ts.ModuleKind.ESNext,
178
+ jsx: ts.JsxEmit.Preserve,
179
+ removeComments: true,
180
+ verbatimModuleSyntax: true,
181
+ sourceMap: false,
182
+ },
183
+ });
184
+ return r.diagnostics?.length ? null : r.outputText;
185
+ }
186
+
187
+ // Moves from <ch>.fichiers to <ch>.sansEffet the files changed (never added, never removed) that
188
+ // no test can tell from their previous state: a document, and a file of code whose isolated
189
+ // transpilation is identical in the trees <avant> and <apres>. Any doubt leaves the file a change.
190
+ function classerSansEffet(racine, avant, apres, ch) {
191
+ let ts = null;
192
+ const lire = (arbre, f) => {
193
+ const r = git(racine, ['show', `${arbre}:${f}`]);
194
+ return r.status === 0 ? r.stdout : null;
195
+ };
196
+ const sansEffet = [];
197
+ for (const f of ch.fichiers) {
198
+ if (!ch.modifies.has(f)) {
199
+ continue;
200
+ }
201
+ if (DOCUMENT.test(f)) {
202
+ sansEffet.push(f);
203
+ } else if (CODE.test(f)) {
204
+ const a = lire(avant, f);
205
+ const b = lire(apres, f);
206
+ if (a === null || b === null) {
207
+ continue;
208
+ }
209
+ try {
210
+ ts ??= createRequire(import.meta.url)('typescript');
211
+ const sa = sortieCompilee(ts, f, a);
212
+ if (sa !== null && sa === sortieCompilee(ts, f, b)) {
213
+ sansEffet.push(f);
214
+ }
215
+ } catch {
216
+ // a transpilation that fails leaves the file a change
217
+ }
218
+ }
219
+ }
220
+ ch.fichiers = ch.fichiers.filter(f => !sansEffet.includes(f));
221
+ ch.sansEffet = sansEffet;
222
+ }
223
+
158
224
  // The files the commit <commit> of the repository at <racine> tracks that the tree <arbre> no longer
159
225
  // holds, as a Set of paths from its top; null when git fails.
160
226
  function supprimesDuCommit(racine, commit, arbre) {
@@ -216,6 +282,7 @@ export function mesure(racine, { tout = false, base, lot, dans = os.tmpdir() } =
216
282
  }
217
283
  ch.supprimes = ch.supprimes.filter(f => suivis.has(f));
218
284
  }
285
+ classerSansEffet(etat.racine, vert.arbre, etat.arbre, ch);
219
286
  const dir = mkdtempSync(path.join(dans, 'grillhouse-changements-'));
220
287
  const fichier = path.join(dir, 'changements.json');
221
288
  writeFileSync(
@@ -224,15 +291,16 @@ export function mesure(racine, { tout = false, base, lot, dans = os.tmpdir() } =
224
291
  racine: etat.racine,
225
292
  fichiers: ch.fichiers,
226
293
  supprimes: ch.supprimes,
294
+ ...(ch.sansEffet.length ? { sansEffet: ch.sansEffet } : {}),
227
295
  ...(cible ? { cible: true } : {}),
228
296
  })
229
297
  );
230
- const n = ch.fichiers.length + ch.supprimes.length;
298
+ const n = ch.fichiers.length + ch.supprimes.length + ch.sansEffet.length;
231
299
  return {
232
300
  etat: donnee ? null : etat,
233
301
  env: { [CHANGEMENTS]: fichier },
234
302
  ligne: cible
235
- ? `↳ depuis la base du lot ${vert.commit.slice(0, 7)} : ${n} fichier(s) changé(s) ; chaque paquet rejoué joue les tests que ses changements atteignent, la passe complète à la CI de la branche et à la nuit.`
303
+ ? `↳ depuis la base du lot ${vert.commit.slice(0, 7)} : ${n} fichier(s) changé(s) ; chaque paquet rejoué joue les tests que ses changements atteignent, la passe complète à la CI de main et à la nuit.`
236
304
  : donnee
237
305
  ? `↳ depuis la base ${vert.commit.slice(0, 7)} : ${n} fichier(s) changé(s) ; chaque paquet rejoué joue les tests que ses changements atteignent.`
238
306
  : `↳ depuis le dernier vert de ${vert.branche} (${vert.commit.slice(0, 12)}, arbre ${vert.arbre.slice(0, 12)}) : ${n} fichier(s) changé(s) ; chaque paquet rejoué joue les tests que ses changements atteignent.`,
@@ -72,7 +72,7 @@ import path from 'node:path';
72
72
  import { pathToFileURL } from 'node:url';
73
73
  import { couvertPar, encoreDeclares, engendresDe, regenerer, touchesPar } from '../engendres.mjs';
74
74
  import { avecLesDonnees, donneesDe } from '../donnees-cles.mjs';
75
- import { avecLesOutils, outilsDe } from '../outils-cles.mjs';
75
+ import { avecLesOutils, empreintesDe, outilsDe } from '../outils-cles.mjs';
76
76
 
77
77
  const LOT = 'grillhouse-travail.patch';
78
78
 
@@ -106,7 +106,10 @@ function lesCles(copie) {
106
106
  try {
107
107
  return {
108
108
  engendres: engendresDe(copie),
109
- env: avecLesDonnees(donneesDe(copie), avecLesOutils(outilsDe(copie), process.env)),
109
+ env: avecLesDonnees(
110
+ donneesDe(copie),
111
+ avecLesOutils(outilsDe(copie), process.env, empreintesDe(copie))
112
+ ),
110
113
  };
111
114
  } catch (e) {
112
115
  return {