@roomi-fields/grillhouse 0.48.0 → 0.49.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 (155) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +90 -0
  3. package/agents/direct.md +9 -0
  4. package/cadre/templates/projet/.github/workflows/ci.yml +11 -0
  5. package/cadre/templates/projet/.github/workflows/nuit.yml +15 -6
  6. package/cadre/templates/projet/CLAUDE.md +10 -6
  7. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  8. package/cadre/templates/turbo/paquets.json +3 -1
  9. package/cadre/templates/turbo/sans-paquets.json +3 -1
  10. package/charte.md +51 -14
  11. package/dist/temporal/acte.d.ts +9 -0
  12. package/dist/temporal/acte.js +43 -20
  13. package/dist/temporal/acte.js.map +1 -1
  14. package/dist/temporal/circuit/appel.d.ts +4 -1
  15. package/dist/temporal/circuit/appel.js +15 -1
  16. package/dist/temporal/circuit/appel.js.map +1 -1
  17. package/dist/temporal/circuit/client.d.ts +7 -1
  18. package/dist/temporal/circuit/client.js +54 -1
  19. package/dist/temporal/circuit/client.js.map +1 -1
  20. package/dist/temporal/circuit/commande.js +30 -57
  21. package/dist/temporal/circuit/commande.js.map +1 -1
  22. package/dist/temporal/circuit/contrat.d.ts +2 -1
  23. package/dist/temporal/circuit/contrat.js +2 -1
  24. package/dist/temporal/circuit/contrat.js.map +1 -1
  25. package/dist/temporal/circuit/deroule.js +9 -2
  26. package/dist/temporal/circuit/deroule.js.map +1 -1
  27. package/dist/temporal/file/contrat.d.ts +16 -2
  28. package/dist/temporal/file/contrat.js +27 -3
  29. package/dist/temporal/file/contrat.js.map +1 -1
  30. package/dist/temporal/file/deroule.js +4 -4
  31. package/dist/temporal/file/deroule.js.map +1 -1
  32. package/dist/temporal/nuits/activites.d.ts +1 -15
  33. package/dist/temporal/nuits/activites.js +3 -62
  34. package/dist/temporal/nuits/activites.js.map +1 -1
  35. package/dist/temporal/nuits/contrat.d.ts +3 -21
  36. package/dist/temporal/nuits/deroule.js +38 -74
  37. package/dist/temporal/nuits/deroule.js.map +1 -1
  38. package/dist/temporal/places/client.d.ts +3 -16
  39. package/dist/temporal/places/client.js +3 -26
  40. package/dist/temporal/places/client.js.map +1 -1
  41. package/dist/temporal/places/contrat.d.ts +15 -51
  42. package/dist/temporal/places/contrat.js +3 -13
  43. package/dist/temporal/places/contrat.js.map +1 -1
  44. package/dist/temporal/places/deroule.js +11 -61
  45. package/dist/temporal/places/deroule.js.map +1 -1
  46. package/dist/temporal/tickets/activites.js +4 -2
  47. package/dist/temporal/tickets/activites.js.map +1 -1
  48. package/dist/temporal/tickets/contrat.d.ts +2 -1
  49. package/docs/ARCHITECTURE.md +337 -120
  50. package/docs/CADRE.md +16 -13
  51. package/docs/INTERFACE.md +90 -25
  52. package/hooks/hooks.json +9 -0
  53. package/hooks/register.tsx +59 -5
  54. package/package.json +1 -1
  55. package/scripts/activites.mjs +271 -42
  56. package/scripts/aiguillage.mjs +4 -1
  57. package/scripts/bilan.mjs +125 -2
  58. package/scripts/circuit.mjs +233 -159
  59. package/scripts/circuits-cles.d.mts +3 -3
  60. package/scripts/circuits-cles.mjs +6 -5
  61. package/scripts/coeurs-dedies.mjs +4 -4
  62. package/scripts/commandes-composees.mjs +12 -5
  63. package/scripts/dette.d.ts +2 -1
  64. package/scripts/dette.mjs +49 -6
  65. package/scripts/direct.mjs +343 -0
  66. package/scripts/droits.mjs +26 -4
  67. package/scripts/effets.mjs +4 -4
  68. package/scripts/engendres.mjs +2 -1
  69. package/scripts/enveloppe/enveloppe.mjs +119 -18
  70. package/scripts/enveloppe/lancer.sh +14 -3
  71. package/scripts/enveloppe/paquets-du-plan.mjs +9 -0
  72. package/scripts/enveloppe/travail-de-la-copie.mjs +119 -21
  73. package/scripts/etapes.mjs +3 -3
  74. package/scripts/faits-du-circuit.mjs +12 -11
  75. package/scripts/fermeture-de-la-machine.d.mts +4 -4
  76. package/scripts/fermeture-de-la-machine.mjs +10 -20
  77. package/scripts/fichiers-nommes.mjs +27 -1
  78. package/scripts/file-des-tickets.d.mts +18 -1
  79. package/scripts/file-des-tickets.mjs +63 -15
  80. package/scripts/flux-de-la-nuit.mjs +38 -0
  81. package/scripts/grillhouse-maj.mjs +13 -25
  82. package/scripts/groupe-cles.d.mts +6 -0
  83. package/scripts/groupe-cles.mjs +29 -1
  84. package/scripts/integration/file.mjs +148 -37
  85. package/scripts/jointure.d.ts +20 -3
  86. package/scripts/journal-des-etats.d.mts +16 -0
  87. package/scripts/journal-des-etats.mjs +44 -2
  88. package/scripts/journal.mjs +3 -0
  89. package/scripts/langages/c/commandes.mjs +5 -5
  90. package/scripts/langages/c/composants.mjs +13 -5
  91. package/scripts/langages/cargo/commandes.mjs +5 -6
  92. package/scripts/langages/python/commandes.mjs +5 -5
  93. package/scripts/langages/python/composants.mjs +10 -2
  94. package/scripts/langages/typescript/composants.mjs +10 -3
  95. package/scripts/langages/typescript/consommateurs-arbitres.mjs +15 -3
  96. package/scripts/langages/typescript/construire.mjs +2 -0
  97. package/scripts/langages/typescript/exemples.mjs +33 -1
  98. package/scripts/langages/typescript/index.mjs +19 -0
  99. package/scripts/langages/typescript/migrations/0.49.0-tests-equipes.mjs +32 -0
  100. package/scripts/langages/typescript/tests-de-nuit.mjs +158 -32
  101. package/scripts/langages/typescript/tests-du-poste.mjs +112 -32
  102. package/scripts/langages/typescript/titres-de-tests.mjs +11 -7
  103. package/scripts/langages/typescript/turbo-des-paquets.mjs +21 -4
  104. package/scripts/langages/typescript/verifier.mjs +3 -5
  105. package/scripts/langages/typescript/verrou-des-dependances.mjs +161 -0
  106. package/scripts/langages/typescript/vitest-config/cibles.mjs +57 -6
  107. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +11 -5
  108. package/scripts/langages/typescript/vitest.nuit.config.mjs +53 -5
  109. package/scripts/machine.mjs +1 -1
  110. package/scripts/mesure/base-de-passe.mjs +2 -1
  111. package/scripts/migrations/0.49.0-reservation-de-trois-coeurs.mjs +30 -0
  112. package/scripts/migrations.mjs +2 -0
  113. package/scripts/nuit.sh +129 -3
  114. package/scripts/paquet.mjs +16 -5
  115. package/scripts/paquets.d.ts +4 -0
  116. package/scripts/paquets.mjs +57 -0
  117. package/scripts/passe-de-la-machine.mjs +4 -7
  118. package/scripts/places-de-la-machine.mjs +55 -42
  119. package/scripts/places-du-serveur.mjs +2 -2
  120. package/scripts/plafond-de-la-machine.d.mts +7 -13
  121. package/scripts/plafond-de-la-machine.mjs +19 -35
  122. package/scripts/prefixe-des-tickets.mjs +1 -1
  123. package/scripts/references-changees.mjs +159 -0
  124. package/scripts/regles-des-places.d.mts +8 -31
  125. package/scripts/regles-des-places.mjs +14 -64
  126. package/scripts/repli-de-la-nuit.mjs +183 -0
  127. package/scripts/reponses-du-circuit.d.mts +2 -2
  128. package/scripts/reponses-du-circuit.mjs +21 -12
  129. package/scripts/reprise.mjs +27 -8
  130. package/scripts/resultats.mjs +21 -9
  131. package/scripts/seances.mjs +258 -40
  132. package/scripts/services-du-noyau.mjs +4 -0
  133. package/scripts/sous-commandes.mjs +24 -7
  134. package/scripts/superviseur.mjs +185 -39
  135. package/scripts/tableau.mjs +226 -94
  136. package/scripts/taches-du-graphe.mjs +84 -4
  137. package/scripts/ticket.mjs +348 -0
  138. package/scripts/transitions.d.mts +44 -0
  139. package/scripts/transitions.mjs +188 -17
  140. package/scripts/un-commit-par-ticket.mjs +4 -3
  141. package/scripts/verdict-de-la-nuit.mjs +47 -20
  142. package/scripts/verrou-de-fichier.mjs +2 -2
  143. package/scripts/verrous/ecriture-hors-enveloppe.mjs +86 -0
  144. package/scripts/verrous/verrou.mjs +17 -1
  145. package/skills/architecte/SKILL.md +203 -0
  146. package/skills/architecte/references/exemple-d-architecture.md +159 -0
  147. package/skills/developpeur/SKILL.md +1 -1
  148. package/skills/direct/SKILL.md +57 -0
  149. package/skills/explorateur/SKILL.md +10 -6
  150. package/skills/pitmaster/SKILL.md +37 -14
  151. package/skills/pitmaster/references/consigne-agent.md +7 -1
  152. package/skills/redacteur/references/documents-d-un-composant.md +2 -1
  153. package/skills/relecteur/SKILL.md +8 -0
  154. package/skills/testwriter/SKILL.md +10 -0
  155. package/scripts/ticket.sh +0 -25
@@ -4,7 +4,11 @@
4
4
  // through its mounts.
5
5
  //
6
6
  // node tests-de-nuit.mjs from the root of the copy: the night of the poste
7
- // node tests-de-nuit.mjs --hors-du-poste the night of a shared machine (a CI runner)
7
+ // node tests-de-nuit.mjs --hors-du-poste the night of an equipped runner: all but @poste
8
+ // node tests-de-nuit.mjs --hors-du-poste --sans-equipement all but @poste and @equipee
9
+ // node tests-de-nuit.mjs --du-poste the tests tagged @poste, then the measures of time unless
10
+ // the project's Nuit flow plays them (the night of PC3)
11
+ // node tests-de-nuit.mjs --mesures the benches and the time witnesses alone
8
12
  // node tests-de-nuit.mjs --hors-du-poste --tranche i/n its tranche i of n
9
13
  //
10
14
  // - The files `*.nuit.test.*` and `*.nuit.spec.*` of the copy, outside node_modules, dist and
@@ -18,6 +22,10 @@
18
22
  // time (GRILLHOUSE_TESTS_DE_NUIT=mesures), as Bazel plays a test tagged `exclusive` after the
19
23
  // others, nothing beside it, and as the module cargo plays its benches after its night tests
20
24
  // (grillhouse-bd7). Each run plays when the copy holds its files.
25
+ // - Each run plays one Vitest per unit: the root under the frame's configuration alone, and each
26
+ // directory below it that holds a Vitest configuration (`vitest.config.*`, else `vite.config.*`)
27
+ // with `--root` at that directory, under that configuration merged with the frame's, what the
28
+ // night sets winning (./vitest.nuit.config.mjs, `unitesDeLaNuit`).
21
29
  // - With `--hors-du-poste`, the night of a shared machine: the night tests alone, but those that
22
30
  // bear the tag `@poste` (`porteLEtiquetteDuPoste` of ./vitest-config/cibles.mjs, which the guard
23
31
  // ./tests-du-poste.mjs asks of a night test that depends on the poste), in one run
@@ -36,16 +44,18 @@
36
44
  // - The exit code: 0 when every run is green; 75, « à repasser », when every red run is at 75
37
45
  // (every failure depended on a duration, one under load, ./vitest-config/duree.reporter.mjs);
38
46
  // else the code of the first red run.
39
- // - They play on the whole budget of the machine as their part (`avecLaPasse` of
40
- // scripts/passe-de-la-machine.mjs, `entiere`), alone, once the temporary directory and the disk of
41
- // the copy have room, as every pass: a wait that reaches its bound ends at 75.
47
+ // - The night tests play on the part of their project (`avecLaPasse` of
48
+ // scripts/passe-de-la-machine.mjs, the sort « Nuit »), the measures of time on dedicated cores
49
+ // (`mesure`, `grillhouse.mesure`), once the temporary directory and the disk of the copy have
50
+ // room, as every pass: a wait that reaches its bound ends at 75.
42
51
  import { spawnSync } from 'node:child_process';
43
- import { readdirSync, rmSync } from 'node:fs';
52
+ import { existsSync, readdirSync, rmSync } from 'node:fs';
44
53
  import path from 'node:path';
45
54
  import { fileURLToPath, pathToFileURL } from 'node:url';
46
55
  import {
47
56
  A_REPASSER,
48
57
  avecLaPasse,
58
+ fluxDuProjetJoueLesMesures,
49
59
  LA_FORME,
50
60
  lireLaTranche,
51
61
  } from '../../services-du-noyau.mjs';
@@ -53,8 +63,10 @@ import {
53
63
  estUnBanc,
54
64
  estUnTestDeNuit,
55
65
  fichiersTemoins,
66
+ NUIT_PAQUET,
56
67
  NUIT_TRANCHE,
57
68
  NUIT_VARIABLE,
69
+ testsDuPoste,
58
70
  } from './vitest-config/cibles.mjs';
59
71
  import { fichiersDeLaTranche, RAPPORTS } from './tranches.mjs';
60
72
 
@@ -65,17 +77,26 @@ import { fichiersDeLaTranche, RAPPORTS } from './tranches.mjs';
65
77
  */
66
78
  export function lireLesArguments(args) {
67
79
  let horsDuPoste = false;
80
+ let sansEquipement = false;
81
+ let duPoste = false;
82
+ let mesuresSeules = false;
68
83
  let texte;
69
84
  for (let i = 0; i < args.length; i++) {
70
85
  const a = args[i];
71
86
  if (a === '--hors-du-poste') {
72
87
  horsDuPoste = true;
88
+ } else if (a === '--sans-equipement') {
89
+ sansEquipement = true;
90
+ } else if (a === '--du-poste') {
91
+ duPoste = true;
92
+ } else if (a === '--mesures') {
93
+ mesuresSeules = true;
73
94
  } else if (a === '--tranche') {
74
95
  texte = args[++i] ?? '';
75
96
  } else if (a.startsWith('--tranche=')) {
76
97
  texte = a.slice('--tranche='.length);
77
98
  } else {
78
- return { horsDuPoste, erreur: `⛔ tests-de-nuit : argument inconnu « ${a} » (usage : tests-de-nuit [--hors-du-poste [--tranche ${LA_FORME}]]).` };
99
+ return { horsDuPoste, erreur: `⛔ tests-de-nuit : argument inconnu « ${a} » (usage : tests-de-nuit [--hors-du-poste [--sans-equipement] [--tranche ${LA_FORME}] | --du-poste | --mesures]).` };
79
100
  }
80
101
  }
81
102
  const tranche = texte === undefined ? undefined : (lireLaTranche(texte) ?? undefined);
@@ -85,7 +106,13 @@ export function lireLesArguments(args) {
85
106
  if (tranche && !horsDuPoste) {
86
107
  return { horsDuPoste, erreur: '⛔ --tranche découpe la nuit d\'une machine partagée : elle se donne avec --hors-du-poste ; la nuit du poste se joue entière.' };
87
108
  }
88
- return { horsDuPoste, tranche };
109
+ if (sansEquipement && !horsDuPoste) {
110
+ return { horsDuPoste, erreur: '⛔ --sans-equipement choisit la nuit d\'une machine sans équipement : elle se donne avec --hors-du-poste.' };
111
+ }
112
+ if ((duPoste || mesuresSeules) && (horsDuPoste || (duPoste && mesuresSeules))) {
113
+ return { horsDuPoste, erreur: '⛔ --du-poste, --mesures et --hors-du-poste sont trois nuits à part : une seule à la fois.' };
114
+ }
115
+ return { horsDuPoste, sansEquipement, duPoste, mesuresSeules, tranche };
89
116
  }
90
117
 
91
118
  const CONFIGURATION = fileURLToPath(new URL('./vitest.nuit.config.mjs', import.meta.url));
@@ -113,9 +140,24 @@ function enTient(dossier, est) {
113
140
  * @param {{ horsDuPoste?: boolean }} [options] the night of a shared machine
114
141
  * @returns {string[]}
115
142
  */
116
- export function runsDeLaNuit(racine, { horsDuPoste = false } = {}) {
143
+ export function runsDeLaNuit(
144
+ racine,
145
+ { horsDuPoste = false, sansEquipement = false, duPoste = false, mesuresSeules = false } = {}
146
+ ) {
117
147
  if (horsDuPoste) {
118
- return enTient(racine, estUnTestDeNuit) ? ['hors-poste'] : [];
148
+ return enTient(racine, estUnTestDeNuit)
149
+ ? [sansEquipement ? 'hors-poste-sans-equipement' : 'hors-poste']
150
+ : [];
151
+ }
152
+ if (duPoste) {
153
+ // The night of the poste leaves the flow of the project the measures it declares it plays.
154
+ const mesures =
155
+ (enTient(racine, estUnBanc) || fichiersTemoins(racine).length > 0) &&
156
+ !fluxDuProjetJoueLesMesures(racine);
157
+ return [testsDuPoste(racine).length > 0 && 'du-poste', mesures && 'mesures'].filter(Boolean);
158
+ }
159
+ if (mesuresSeules) {
160
+ return enTient(racine, estUnBanc) || fichiersTemoins(racine).length > 0 ? ['mesures'] : [];
119
161
  }
120
162
  return [
121
163
  enTient(racine, estUnTestDeNuit) && 'nuit',
@@ -136,27 +178,31 @@ export function testsDeNuit(racine, options = {}) {
136
178
  if (runs.length === 0) {
137
179
  return 0;
138
180
  }
139
- // The night tests and the measures of time ask for the whole budget as their part: they play
140
- // alone, once the room of the temporary directory and of the copy is there.
141
- try {
142
- return avecLaPasse(() => jouerLesRuns(racine, runs, options), {
143
- lourde: false,
144
- entiere: true,
145
- racine,
146
- sorte: 'Tests de nuit',
147
- });
148
- } catch (e) {
149
- if (e?.name !== 'AttenteDeLaMachine') {
150
- throw e;
181
+ // The night tests play on the part of the project, as a pass; the measures of time play on
182
+ // dedicated cores (`grillhouse.mesure`) that nobody else touches, once the temporary directory
183
+ // and the disk of the copy have room.
184
+ const codes = runs.map(choix => {
185
+ const mesure = choix === 'mesures';
186
+ try {
187
+ return avecLaPasse(() => jouerLeRun(racine, choix, options), {
188
+ lourde: false,
189
+ mesure,
190
+ racine,
191
+ sorte: mesure ? 'Mesures de nuit' : 'Nuit',
192
+ });
193
+ } catch (e) {
194
+ if (e?.name !== 'AttenteDeLaMachine') {
195
+ throw e;
196
+ }
197
+ process.stdout.write(`${e.message}\n`);
198
+ return e.code;
151
199
  }
152
- process.stdout.write(`${e.message}\n`);
153
- return e.code;
154
- }
200
+ });
201
+ return plierLesCodes(codes);
155
202
  }
156
203
 
157
- // The runs <runs> of Vitest of the night, in the copy at <racine>: the code of the first red one,
158
- // 75 when every red is « à repasser ».
159
- function jouerLesRuns(racine, runs, options) {
204
+ // The run <choix> of Vitest of the night, in the copy at <racine>: its exit code.
205
+ function jouerLeRun(racine, choix, options) {
160
206
  const { tranche } = options;
161
207
  const rapports = path.join(racine, RAPPORTS);
162
208
  if (tranche) {
@@ -167,18 +213,38 @@ function jouerLesRuns(racine, runs, options) {
167
213
  const enTranche = tranche
168
214
  ? { [NUIT_TRANCHE]: JSON.stringify({ tranche: `${tranche.index}/${tranche.count}`, rapports }) }
169
215
  : {};
170
- const codes = runs.map(choix => {
216
+ // One run per unit, each under the configuration of its package; the code of the unit runs
217
+ // folds as the runs' do: 0, 75 when every red one is at 75, else the first red code.
218
+ const codes = unitesDeLaNuit(racine).map(({ dossier, config, exclus }) => {
171
219
  const r = spawnSync(
172
220
  'npx',
173
- ['--no-install', 'vitest', 'run', '--root', racine, '--config', CONFIGURATION],
221
+ [
222
+ '--no-install',
223
+ 'vitest',
224
+ 'run',
225
+ '--root',
226
+ dossier,
227
+ '--config',
228
+ CONFIGURATION,
229
+ ],
174
230
  {
175
231
  cwd: racine,
176
232
  stdio: 'inherit',
177
- env: { ...process.env, [NUIT_VARIABLE]: choix, ...enTranche },
233
+ env: {
234
+ ...process.env,
235
+ [NUIT_VARIABLE]: choix,
236
+ [NUIT_PAQUET]: JSON.stringify({ config, exclus }),
237
+ ...enTranche,
238
+ },
178
239
  }
179
240
  );
180
241
  return r.status ?? 1;
181
242
  });
243
+ return plierLesCodes(codes);
244
+ }
245
+
246
+ // The code of <codes>: 0 when all are, 75 when every red one is, else the first red code.
247
+ function plierLesCodes(codes) {
182
248
  const rouges = codes.filter(c => c !== 0);
183
249
  if (rouges.length === 0) {
184
250
  return 0;
@@ -186,12 +252,72 @@ function jouerLesRuns(racine, runs, options) {
186
252
  return rouges.every(c => c === A_REPASSER) ? A_REPASSER : rouges.find(c => c !== A_REPASSER);
187
253
  }
188
254
 
255
+ const SAUTES_DES_UNITES = new Set(['node_modules', 'dist', '.git', '.turbo', '.claude']);
256
+ const CONFIGURATIONS = ['vitest.config', 'vite.config'];
257
+ const EXTENSIONS = ['ts', 'mts', 'cts', 'js', 'mjs', 'cjs'];
258
+
259
+ // The Vitest configuration of the directory <dossier>, as Vitest looks for it: the first
260
+ // `vitest.config.*`, else the first `vite.config.*`; undefined when it has none.
261
+ function configurationDe(dossier) {
262
+ for (const nom of CONFIGURATIONS) {
263
+ for (const ext of EXTENSIONS) {
264
+ const f = path.join(dossier, `${nom}.${ext}`);
265
+ if (existsSync(f)) {
266
+ return f;
267
+ }
268
+ }
269
+ }
270
+ return undefined;
271
+ }
272
+
273
+ /**
274
+ * The units a run of the night plays in the copy at <racine>: the root, under the frame's
275
+ * configuration alone, and each directory below it that holds a Vitest configuration, under that
276
+ * configuration. Each unit leaves out the directories of the units below it.
277
+ * @param {string} racine the root of the copy
278
+ * @returns {{ dossier: string, config?: string, exclus: string[] }[]}
279
+ */
280
+ export function unitesDeLaNuit(racine) {
281
+ const configures = [];
282
+ const parcourir = dossier => {
283
+ for (const e of readdirSync(dossier, { withFileTypes: true })) {
284
+ if (e.isDirectory() && !SAUTES_DES_UNITES.has(e.name)) {
285
+ const d = path.join(dossier, e.name);
286
+ const config = configurationDe(d);
287
+ if (config) {
288
+ configures.push({ dossier: d, config });
289
+ }
290
+ parcourir(d);
291
+ }
292
+ }
293
+ };
294
+ parcourir(racine);
295
+ const unites = [{ dossier: racine }, ...configures];
296
+ const dessous = (parent, d) => {
297
+ const r = path.relative(parent, d);
298
+ return r !== '' && !r.startsWith('..') && !path.isAbsolute(r);
299
+ };
300
+ return unites
301
+ .map(u => ({
302
+ ...u,
303
+ exclus: configures
304
+ .filter(c => dessous(u.dossier, c.dossier))
305
+ .map(c => `${path.relative(u.dossier, c.dossier).split(path.sep).join('/')}/**`),
306
+ }))
307
+ .filter(
308
+ u =>
309
+ u.dossier === racine ||
310
+ enTient(u.dossier, f => estUnTestDeNuit(f) || estUnBanc(f)) ||
311
+ fichiersTemoins(u.dossier).length > 0
312
+ );
313
+ }
314
+
189
315
  if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
190
- const { horsDuPoste, tranche, erreur } = lireLesArguments(process.argv.slice(2));
316
+ const { erreur, ...options } = lireLesArguments(process.argv.slice(2));
191
317
  if (erreur) {
192
318
  process.stderr.write(`${erreur}\n`);
193
319
  process.exitCode = 2;
194
320
  } else {
195
- process.exitCode = testsDeNuit(process.cwd(), { horsDuPoste, tranche });
321
+ process.exitCode = testsDeNuit(process.cwd(), options);
196
322
  }
197
323
  }
@@ -21,6 +21,13 @@
21
21
  // keyring, the session of the user (`/run/user/`), or the command claude started for more than
22
22
  // `plugin` or `--version` (a session, a model). A mark the reading does not see (a path built at
23
23
  // run time, a dependency of the product's code) escapes it: such a test takes the tag by hand.
24
+ // - A night test that plays other night tests by their name carries what they ask, as a tag of
25
+ // Bazel reaches the target that runs the tagged one: a string of its code, or of its material's,
26
+ // that ends with the name of a night test (`tests/enveloppe.nuit.spec.ts`) names each night
27
+ // test of the repository whose path is that string or ends with it from a directory. A test
28
+ // named that bears the tag `@poste`, or shows a mark of the poste, is a mark of the poste of
29
+ // the one that names it; one tagged `@equipee`, or showing a mark of equipment, a mark of
30
+ // equipment. A name built at run time is not read.
24
31
  // - A night test that depends on the poste without the tag is a finding,
25
32
  // `{ fichier, regle: 'poste-sans-etiquette', message }`, naming its marks; a tag without a mark
26
33
  // passes. A finding inscribed in the project's debt (`grillhouse-dette.json`, ../../dette.mjs)
@@ -30,7 +37,11 @@ import path from 'node:path';
30
37
  import { pathToFileURL } from 'node:url';
31
38
  import { MODE, trancher } from '../../dette.mjs';
32
39
  import { testsDuDepot } from './tailles-des-tests.mjs';
33
- import { estUnTestDeNuit, porteLEtiquetteDuPoste } from './vitest-config/cibles.mjs';
40
+ import {
41
+ estUnTestDeNuit,
42
+ porteLEtiquetteDuPoste,
43
+ porteLEtiquetteEquipee,
44
+ } from './vitest-config/cibles.mjs';
34
45
  import {
35
46
  code,
36
47
  IMPORT,
@@ -42,6 +53,7 @@ import {
42
53
 
43
54
  export const GARDE = 'tests-du-poste';
44
55
  export const REGLE = 'poste-sans-etiquette';
56
+ export const REGLE_EQUIPEE = 'equipee-sans-etiquette';
45
57
 
46
58
  // A call that starts the command claude, its arguments to the end of the line.
47
59
  const CLAUDE =
@@ -49,37 +61,58 @@ const CLAUDE =
49
61
  // The subcommands of claude a shared machine plays: the plugins of the frame and its version.
50
62
  const CLAUDE_PARTAGE = new Set(['plugin', '--version']);
51
63
 
52
- /** The marks of what a shared machine does not have, each `{ nom, voit(code) }`. */
64
+ /**
65
+ * The marks of what a shared machine does not have, each `{ nom, classe, voit(code) }`: the class
66
+ * `equipee` is the equipment of a machine (the tag `@equipee`: the envelope, a Temporal server,
67
+ * sccache, the binaries of the module cargo), the class `poste` what only the poste has (the tag
68
+ * `@poste`: the real bd, systemd, the keyring, the session of the user, a session of claude).
69
+ */
53
70
  export const DEPENDANCES = [
54
71
  {
55
72
  nom: "l'enveloppe bwrap",
73
+ classe: 'equipee',
56
74
  voit: c =>
57
75
  /\bcanWrap\b|['"`]bwrap['"`]|['"`/]enveloppe\/(?:lancer\.sh|enveloppe\.mjs)['"`]|['"`/]enveloppe(?:\.[\w-]+)?['"`]/.test(
58
76
  c
59
77
  ),
60
78
  },
61
- { nom: 'le bd réel', voit: c => /\bhasBd\b/.test(c) },
79
+ { nom: 'le bd réel', classe: 'poste', voit: c => /\bhasBd\b/.test(c) },
62
80
  {
63
81
  nom: 'un serveur Temporal',
82
+ classe: 'equipee',
64
83
  voit: c => /['"`]server['"`]\s*,\s*['"`]start-dev['"`]/.test(c),
65
84
  },
66
- { nom: 'sccache', voit: c => /['"`]sccache['"`]/.test(c) },
67
- { nom: 'les binaires du module cargo', voit: c => /['"`/]templates\/cargo\b/.test(c) },
68
- { nom: 'systemd', voit: c => /['"`](?:systemctl|systemd-run)['"`]/.test(c) },
69
- { nom: 'le trousseau', voit: c => /\bkeyrings\b/.test(c) },
70
- { nom: 'la session de l’utilisateur', voit: c => /\/run\/user\//.test(c) },
85
+ { nom: 'sccache', classe: 'equipee', voit: c => /['"`]sccache['"`]/.test(c) },
86
+ {
87
+ nom: 'les binaires du module cargo',
88
+ classe: 'equipee',
89
+ voit: c => /['"`/]templates\/cargo\b/.test(c),
90
+ },
91
+ { nom: 'systemd', classe: 'poste', voit: c => /['"`](?:systemctl|systemd-run)['"`]/.test(c) },
92
+ { nom: 'le trousseau', classe: 'poste', voit: c => /\bkeyrings\b/.test(c) },
93
+ { nom: 'la session de l’utilisateur', classe: 'poste', voit: c => /\/run\/user\//.test(c) },
71
94
  {
72
95
  nom: 'une séance de claude',
96
+ classe: 'poste',
73
97
  voit: c => [...c.matchAll(CLAUDE)].some(m => !m[1] || !CLAUDE_PARTAGE.has(m[2])),
74
98
  },
75
99
  ];
76
100
 
101
+ // A string of the code that ends with the name of a night test, to the end of its string.
102
+ const TEST_NOMME = /['"`]((?:[\w.@-]+\/)*[\w.@-]+\.nuit\.(?:test|spec)\.[cm]?[jt]sx?)['"`]/g;
103
+
77
104
  /**
78
105
  * The marks of the poste the test file <fichier> (absolute) shows, with the test material it
79
106
  * imports by a relative path, read by <lire> (a path → its text, null when it does not read), in
80
107
  * the repository at <racine>: the names of DEPENDANCES, each once, in their order.
81
108
  */
82
109
  export function dependancesDu(fichier, lire = lireLeDisque, racine = path.parse(fichier).root) {
110
+ return DEPENDANCES.filter(d => d.voit(codeDu(fichier, lire, racine))).map(d => d.nom);
111
+ }
112
+
113
+ // The code of the test file <fichier> and of the test material it imports by a relative path,
114
+ // from file to file, their comments and imports left out.
115
+ function codeDu(fichier, lire, racine) {
83
116
  const vus = new Set();
84
117
  const codes = [];
85
118
  const suivre = f => {
@@ -102,40 +135,87 @@ export function dependancesDu(fichier, lire = lireLeDisque, racine = path.parse(
102
135
  }
103
136
  };
104
137
  suivre(fichier);
105
- const tout = codes.join('\n');
106
- return DEPENDANCES.filter(d => d.voit(tout)).map(d => d.nom);
138
+ return codes.join('\n');
139
+ }
140
+
141
+ // The night tests of <fichiers> (each from the root) the code <tout> of <fichier> names: those
142
+ // whose path is a string of the code, or ends with it from a directory; itself left out.
143
+ function nommesPar(fichier, tout, fichiers) {
144
+ const noms = new Set([...tout.matchAll(TEST_NOMME)].map(m => m[1].replace(/^(?:\.\/)+/, '')));
145
+ return fichiers.filter(f => f !== fichier && [...noms].some(n => f === n || f.endsWith(`/${n}`)));
107
146
  }
108
147
 
109
148
  /**
110
- * Each night test of the repository at <racine>: `[{ fichier, etiquete, dependances }]`, `fichier`
111
- * from its root, `etiquete` whether it bears the tag `@poste`, `dependances` the marks of the poste
112
- * it shows.
149
+ * Each night test of the repository at <racine>: `[{ fichier, etiquete, equipee, marques }]`,
150
+ * `fichier` from its root, `etiquete` whether it bears the tag `@poste`, `equipee` whether it bears
151
+ * the tag `@equipee`, `marques` the marks it shows, `{ nom, classe }` each: those of
152
+ * DEPENDANCES, then one per class for each night test it names that asks for that class.
153
+ * @param {string} racine the root of the repository
154
+ * @returns {{ fichier: string, etiquete: boolean, equipee: boolean, marques: { nom: string, classe: string }[] }[]}
113
155
  */
114
156
  export function testsDeNuitDuDepot(racine) {
115
- return testsDuDepot(racine)
116
- .filter(estUnTestDeNuit)
117
- .map(fichier => {
118
- const abs = path.join(racine, fichier);
119
- return {
120
- fichier,
121
- etiquete: porteLEtiquetteDuPoste(lireLeDisque(abs) ?? ''),
122
- dependances: dependancesDu(abs, lireLeDisque, racine),
123
- };
124
- });
157
+ const fichiers = testsDuDepot(racine).filter(estUnTestDeNuit);
158
+ const lus = fichiers.map(fichier => {
159
+ const abs = path.join(racine, fichier);
160
+ const texte = lireLeDisque(abs) ?? '';
161
+ const tout = codeDu(abs, lireLeDisque, racine);
162
+ return {
163
+ fichier,
164
+ etiquete: porteLEtiquetteDuPoste(texte),
165
+ equipee: porteLEtiquetteEquipee(texte),
166
+ marques: DEPENDANCES.filter(d => d.voit(tout)).map(({ nom, classe }) => ({ nom, classe })),
167
+ nommes: nommesPar(fichier, tout, fichiers),
168
+ };
169
+ });
170
+ const parFichier = new Map(lus.map(t => [t.fichier, t]));
171
+ // Whether the night test <t> asks for the class <classe>: its tag, or a mark it shows itself.
172
+ const demande = (t, classe) =>
173
+ (classe === 'poste' ? t.etiquete : t.equipee) || t.marques.some(m => m.classe === classe);
174
+ return lus.map(({ nommes, ...t }) => ({
175
+ ...t,
176
+ marques: [
177
+ ...t.marques,
178
+ ...['poste', 'equipee'].flatMap(classe =>
179
+ nommes
180
+ .filter(n => demande(parFichier.get(n), classe))
181
+ .map(n => ({
182
+ nom: `${n}, ${classe === 'poste' ? 'test du poste' : 'test équipé'} joué par son nom`,
183
+ classe,
184
+ }))
185
+ ),
186
+ ],
187
+ }));
125
188
  }
126
189
 
127
190
  /**
128
191
  * The findings of the repository at <racine>, in the debt's form (../../dette.mjs): one
129
- * `{ fichier, regle, message }` per night test that depends on the poste without the tag `@poste`.
192
+ * `{ fichier, regle, message }` per night test that shows a mark of the poste without the tag
193
+ * `@poste` (REGLE), and one per night test that shows a mark of equipment without the tag
194
+ * `@equipee` (REGLE_EQUIPEE).
130
195
  */
131
196
  export function verifier(racine, tous = testsDeNuitDuDepot(racine)) {
132
- return tous
133
- .filter(t => !t.etiquete && t.dependances.length > 0)
134
- .map(({ fichier, dependances }) => ({
135
- fichier,
136
- regle: REGLE,
137
- message: `${fichier} : ce test de nuit dépend du poste (${dependances.join(', ')}), qu'une machine partagée n'a pas ; il porte l'étiquette « // @poste: <raison> » dans le commentaire de sa tête, et la nuit de la CI le laisse au poste.`,
138
- }));
197
+ const noms = (marques, classe) => marques.filter(m => m.classe === classe).map(m => m.nom);
198
+ return tous.flatMap(({ fichier, etiquete, equipee, marques }) => {
199
+ /** @type {{ fichier: string, regle: string, message: string }[]} */
200
+ const constats = [];
201
+ const poste = noms(marques, 'poste');
202
+ if (!etiquete && poste.length > 0) {
203
+ constats.push({
204
+ fichier,
205
+ regle: REGLE,
206
+ message: `${fichier} : ce test de nuit dépend du poste (${poste.join(', ')}), qu'aucun exécuteur n'a ; il porte l'étiquette « // @poste: <raison> » dans le commentaire de sa tête, et la nuit de PC3 seule le joue.`,
207
+ });
208
+ }
209
+ const equipement = noms(marques, 'equipee');
210
+ if (!equipee && equipement.length > 0) {
211
+ constats.push({
212
+ fichier,
213
+ regle: REGLE_EQUIPEE,
214
+ message: `${fichier} : ce test de nuit exige l'équipement d'une machine (${equipement.join(', ')}) ; il porte l'étiquette « // @equipee: <raison> » dans le commentaire de sa tête, et un exécuteur sans équipement le laisse.`,
215
+ });
216
+ }
217
+ return constats;
218
+ });
139
219
  }
140
220
 
141
221
  /**
@@ -157,7 +237,7 @@ export function rapport(racine, env = process.env) {
157
237
  lignes: [
158
238
  ...refus.map(r => `⛔ ${r.message}`),
159
239
  ...lignes,
160
- `ℹ️ ${GARDE} : ${tous.length} test(s) de nuit, ${tous.filter(t => t.etiquete).length} laissé(s) au poste (@poste).`,
240
+ `ℹ️ ${GARDE} : ${tous.length} test(s) de nuit, ${tous.filter(t => t.etiquete).length} laissé(s) au poste (@poste), ${tous.filter(t => t.equipee).length} équipé(s) (@equipee).`,
161
241
  ],
162
242
  code: refus.length ? 1 : 0,
163
243
  };
@@ -22,12 +22,14 @@
22
22
  // above its debt, or absent from the debt with a title counted, is refused by its name; a debt
23
23
  // above the real count is refused too, so that the lot lowers it by `npm run
24
24
  // grillhouse:dette:elaguer`. A test file moved or renamed by the lot, its content kept (or
25
- // nearly), takes the debt of its former name (`renommesDuLot`).
25
+ // nearly), takes the debt of its former name (`renommesDuLot`). In the envelope of a plan, a debt
26
+ // above its count is judged in the files of the plan's packages alone (`mesureDuPlan` of
27
+ // ../../dette.mjs); the final pass judges the others.
26
28
  import { spawnSync } from 'node:child_process';
27
29
  import { readFileSync, writeFileSync } from 'node:fs';
28
30
  import path from 'node:path';
29
31
  import { pathToFileURL } from 'node:url';
30
- import { FICHIER, lire as lireDette, trancher } from '../../dette.mjs';
32
+ import { FICHIER, lire as lireDette, mesureDuPlan, trancher } from '../../dette.mjs';
31
33
  import { A_ELAGUER, ecrireSarif } from '../../resultats.mjs';
32
34
  import { prefixe } from '../../services-du-noyau.mjs';
33
35
  import { testsDuDepot } from './tailles-des-tests.mjs';
@@ -206,9 +208,11 @@ export function renommesDuLot(racine) {
206
208
  * The refusals of the findings <constats> against the <dette> read from the file: one
207
209
  * `{ fichier, message }` per file whose count rises above its debt (a file absent from the debt
208
210
  * has none) and per file whose debt stays above its count. <renommes> (`{ nouveau: ancien }`)
209
- * gives a file moved or renamed the debt of its former name.
211
+ * gives a file moved or renamed the debt of its former name. <mesure> says whether the run
212
+ * measures a file for the debt (`mesureDuPlan` of ../../dette.mjs; every file by default): a debt
213
+ * above its count is judged among those files alone.
210
214
  */
211
- export function jugerLesTitres(dette, constats, renommes = {}) {
215
+ export function jugerLesTitres(dette, constats, renommes = {}, mesure = () => true) {
212
216
  const inscrite = dette?.[GARDE] ?? {};
213
217
  const permis = f => inscrite[f]?.[REGLE]?.count ?? 0;
214
218
  const comptes = new Map();
@@ -225,7 +229,7 @@ export function jugerLesTitres(dette, constats, renommes = {}) {
225
229
  regle: REGLE,
226
230
  message: `${fichier} : ${trouve} titre(s) nomment un ticket ou un « critère N » pour ${droit} inscrit(s) dans ${FICHIER} : ${MESSAGE_FIN}`,
227
231
  });
228
- } else if (trouve < droit) {
232
+ } else if (trouve < droit && mesure(fichier)) {
229
233
  refus.push({
230
234
  fichier,
231
235
  regle: REGLE,
@@ -236,7 +240,7 @@ export function jugerLesTitres(dette, constats, renommes = {}) {
236
240
  }
237
241
  }
238
242
  for (const fichier of Object.keys(inscrite)) {
239
- if (comptes.has(fichier) || reprises.has(fichier) || !permis(fichier)) {
243
+ if (comptes.has(fichier) || reprises.has(fichier) || !permis(fichier) || !mesure(fichier)) {
240
244
  continue;
241
245
  }
242
246
  refus.push({
@@ -282,7 +286,7 @@ function main() {
282
286
  refus = r.refus;
283
287
  lignes = r.lignes;
284
288
  } else {
285
- refus = jugerLesTitres(lireDette(racine), constats, renommes);
289
+ refus = jugerLesTitres(lireDette(racine), constats, renommes, mesureDuPlan(racine));
286
290
  // Each refusal is a finding in SARIF; a debt above the count is also a note `a-elaguer`, by
287
291
  // which the circuit lowers the debt d'office.
288
292
  ecrireSarif({
@@ -155,7 +155,8 @@
155
155
  // (`TMPDIR`), the base of a pass (scripts/mesure/base-de-passe.mjs), where every task writes
156
156
  // its temporary files and which goes at the end of the pass; the workers of the tests of a task
157
157
  // (`GRILLHOUSE_TRAVAILLEURS`, scripts/places-de-la-machine.mjs), the bound a session or a pass
158
- // sets, which the tool of each language reads. The generator adds each
158
+ // sets, which the tool of each language reads; the Rust toolchain of a runner (`CARGO_HOME`,
159
+ // `RUSTUP_HOME`), which a runner of the repository holds per executor. The generator adds each
159
160
  // one the root lacks, the project's entries kept, and the check refuses a
160
161
  // root without one.
161
162
  //
@@ -182,7 +183,11 @@ import { lecturesDeclarees, testsDuPaquet } from './vitest-config/lances.mjs';
182
183
  import { parcourir } from './parcours.mjs';
183
184
  import { paquets, TYPAGE } from '../../paquets.mjs';
184
185
  import { ecrireSarif, RESULTATS } from '../../resultats.mjs';
185
- import { SCRIPT_DES_TESTS as TESTS, TESTS_CIBLES } from '../../services-du-noyau.mjs';
186
+ import {
187
+ SCRIPT_DES_TESTS as TESTS,
188
+ SCRIPTS_DE_GARDES,
189
+ TESTS_CIBLES,
190
+ } from '../../services-du-noyau.mjs';
186
191
 
187
192
  export const TURBO = 'turbo.json';
188
193
  export const COMMANDE = 'npx grillhouse turbo-des-paquets --ecrire';
@@ -193,7 +198,7 @@ const TOPOLOGIE = ['dependencies', 'devDependencies', 'optionalDependencies'];
193
198
  // The root configuration of Turborepo, in the order Turborepo reads it.
194
199
  const RACINES = ['turbo.json', 'turbo.jsonc'];
195
200
  // The guard tasks of the root: the frame's controls, and the project's own guards.
196
- export const GARDES = ['grillhouse:gardes', 'gardes'];
201
+ export const GARDES = SCRIPTS_DE_GARDES;
197
202
  // The controls of the root the CI used to play beside the verification: the format check and the
198
203
  // lint (grillhouse-61z). A root plays those its package.json holds a script for, none demanded.
199
204
  export const CONTROLES = ['format:check', 'lint'];
@@ -315,8 +320,20 @@ const attenteDuTypage = racine => (paquets(racine).length ? ['build', '^build']
315
320
  // The temporary directory of a process, which names the base of its pass.
316
321
  const TEMPORAIRE = 'TMPDIR';
317
322
  // The variables the root's `globalPassThroughEnv` names, and why, as the check says it.
318
- const PASSAGES = [RESULTATS, CHANGEMENTS, AVANCEMENT, TEMPORAIRE, TRAVAILLEURS];
323
+ const PASSAGES = [
324
+ RESULTATS,
325
+ CHANGEMENTS,
326
+ AVANCEMENT,
327
+ TEMPORAIRE,
328
+ TRAVAILLEURS,
329
+ 'CARGO_HOME',
330
+ 'RUSTUP_HOME',
331
+ ];
319
332
  const POURQUOI = {
333
+ CARGO_HOME:
334
+ "le CARGO_HOME de l'exécuteur, que cargo lit pour trouver sa chaîne ; sans lui un exécuteur à chaîne propre échoue",
335
+ RUSTUP_HOME:
336
+ "le RUSTUP_HOME de l'exécuteur, que rustup lit pour choisir une version de cargo ; sans lui un exécuteur à chaîne propre échoue",
320
337
  [RESULTATS]: "où les gardes, Turborepo et Vitest écrivent les résultats qu'un circuit lit",
321
338
  [CHANGEMENTS]:
322
339
  'les fichiers changés depuis le dernier vert, auxquels Vitest relie les tests que rejoue un paquet',
@@ -43,7 +43,7 @@
43
43
  // `turbo run grillhouse:gardes gardes typecheck test:unit --continue=dependencies-successful
44
44
  // --concurrency=<n> --summarize`, each argument given after it. A red does not stop the pass:
45
45
  // every task whose prerequisites passed plays, and each red is named. <n>, the tasks side by
46
- // side, is half the cores of the pass's part, one at least (`concurrence`): each task of tests is
46
+ // side, is half the cores of the pass's part, one at least (`tachesCoteACote` of the core): each task of tests is
47
47
  // itself parallel (Vitest's workers), as make's `-j` and Bazel's `--local_cpu_resources` bound a
48
48
  // build by the machine; a `--concurrency` among the arguments replaces it. The workers of each
49
49
  // task of tests are the cores shared between the tasks of tests side by side
@@ -136,6 +136,8 @@ import {
136
136
  PASSE_ROUGE,
137
137
  retirerALInterruption,
138
138
  SCRIPT_DES_TESTS,
139
+ SCRIPTS_DE_GARDES as GARDES,
140
+ tachesCoteACote as concurrence,
139
141
  TESTS_CIBLES,
140
142
  testsCibles,
141
143
  travailleursDeLaSeance,
@@ -147,7 +149,6 @@ import { fichiersDeLaTranche, RAPPORTS } from './tranches.mjs';
147
149
  import { garderLesResumes } from './resume-du-lanceur.mjs';
148
150
  import { controlesDuDepot, planifier } from './turbo-des-paquets.mjs';
149
151
 
150
- const GARDES = ['grillhouse:gardes', 'gardes'];
151
152
  const TACHES = [...GARDES, TYPAGE, SCRIPT_DES_TESTS];
152
153
  const CONCURRENCE = /^--concurrency(?:=|$)/;
153
154
  // The variable that names the file of the red tasks, which the night reads.
@@ -161,9 +162,6 @@ const rejeu = id => {
161
162
 
162
163
  const lister = dossier => (existsSync(dossier) ? readdirSync(dossier) : []);
163
164
 
164
- // The tasks a pass plays side by side on a machine of <coeurs> cores: half of them, one at least.
165
- const concurrence = (coeurs = availableParallelism()) => Math.max(1, Math.floor(coeurs / 2));
166
-
167
165
  // The tasks side by side <args> ask for (`--concurrency=<n>`, `--concurrency <n>`), null without
168
166
  // a whole number.
169
167
  function concurrenceDemandee(args) {