@roomi-fields/grillhouse 0.48.0 → 0.49.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 (147) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +68 -0
  3. package/agents/direct.md +9 -0
  4. package/cadre/templates/projet/.github/workflows/ci.yml +6 -0
  5. package/cadre/templates/projet/.github/workflows/nuit.yml +9 -2
  6. package/cadre/templates/projet/CLAUDE.md +9 -5
  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 +40 -14
  11. package/dist/temporal/circuit/appel.d.ts +4 -1
  12. package/dist/temporal/circuit/appel.js +15 -1
  13. package/dist/temporal/circuit/appel.js.map +1 -1
  14. package/dist/temporal/circuit/client.d.ts +7 -1
  15. package/dist/temporal/circuit/client.js +54 -1
  16. package/dist/temporal/circuit/client.js.map +1 -1
  17. package/dist/temporal/circuit/commande.js +30 -57
  18. package/dist/temporal/circuit/commande.js.map +1 -1
  19. package/dist/temporal/circuit/contrat.d.ts +2 -1
  20. package/dist/temporal/circuit/contrat.js +2 -1
  21. package/dist/temporal/circuit/contrat.js.map +1 -1
  22. package/dist/temporal/circuit/deroule.js +9 -2
  23. package/dist/temporal/circuit/deroule.js.map +1 -1
  24. package/dist/temporal/file/contrat.d.ts +16 -2
  25. package/dist/temporal/file/contrat.js +27 -3
  26. package/dist/temporal/file/contrat.js.map +1 -1
  27. package/dist/temporal/file/deroule.js +4 -4
  28. package/dist/temporal/file/deroule.js.map +1 -1
  29. package/dist/temporal/nuits/activites.d.ts +1 -15
  30. package/dist/temporal/nuits/activites.js +3 -62
  31. package/dist/temporal/nuits/activites.js.map +1 -1
  32. package/dist/temporal/nuits/contrat.d.ts +3 -21
  33. package/dist/temporal/nuits/deroule.js +38 -74
  34. package/dist/temporal/nuits/deroule.js.map +1 -1
  35. package/dist/temporal/places/client.d.ts +3 -16
  36. package/dist/temporal/places/client.js +3 -26
  37. package/dist/temporal/places/client.js.map +1 -1
  38. package/dist/temporal/places/contrat.d.ts +15 -51
  39. package/dist/temporal/places/contrat.js +3 -13
  40. package/dist/temporal/places/contrat.js.map +1 -1
  41. package/dist/temporal/places/deroule.js +11 -61
  42. package/dist/temporal/places/deroule.js.map +1 -1
  43. package/dist/temporal/tickets/activites.js +4 -2
  44. package/dist/temporal/tickets/activites.js.map +1 -1
  45. package/dist/temporal/tickets/contrat.d.ts +2 -1
  46. package/docs/ARCHITECTURE.md +310 -115
  47. package/docs/CADRE.md +16 -13
  48. package/docs/INTERFACE.md +90 -25
  49. package/hooks/hooks.json +9 -0
  50. package/hooks/register.tsx +59 -5
  51. package/package.json +1 -1
  52. package/scripts/activites.mjs +271 -42
  53. package/scripts/aiguillage.mjs +4 -1
  54. package/scripts/bilan.mjs +125 -2
  55. package/scripts/circuit.mjs +233 -159
  56. package/scripts/circuits-cles.d.mts +3 -3
  57. package/scripts/circuits-cles.mjs +6 -5
  58. package/scripts/coeurs-dedies.mjs +4 -4
  59. package/scripts/commandes-composees.mjs +12 -5
  60. package/scripts/dette.d.ts +2 -1
  61. package/scripts/dette.mjs +49 -6
  62. package/scripts/direct.mjs +343 -0
  63. package/scripts/droits.mjs +19 -0
  64. package/scripts/effets.mjs +4 -4
  65. package/scripts/engendres.mjs +2 -1
  66. package/scripts/enveloppe/enveloppe.mjs +67 -13
  67. package/scripts/enveloppe/lancer.sh +14 -3
  68. package/scripts/enveloppe/paquets-du-plan.mjs +9 -0
  69. package/scripts/enveloppe/travail-de-la-copie.mjs +119 -21
  70. package/scripts/etapes.mjs +3 -3
  71. package/scripts/faits-du-circuit.mjs +12 -11
  72. package/scripts/fermeture-de-la-machine.d.mts +4 -4
  73. package/scripts/fermeture-de-la-machine.mjs +10 -20
  74. package/scripts/fichiers-nommes.mjs +27 -1
  75. package/scripts/file-des-tickets.d.mts +18 -1
  76. package/scripts/file-des-tickets.mjs +63 -15
  77. package/scripts/grillhouse-maj.mjs +13 -25
  78. package/scripts/groupe-cles.d.mts +6 -0
  79. package/scripts/groupe-cles.mjs +29 -1
  80. package/scripts/integration/file.mjs +148 -37
  81. package/scripts/jointure.d.ts +17 -3
  82. package/scripts/journal-des-etats.d.mts +16 -0
  83. package/scripts/journal-des-etats.mjs +44 -2
  84. package/scripts/journal.mjs +3 -0
  85. package/scripts/langages/c/commandes.mjs +5 -5
  86. package/scripts/langages/c/composants.mjs +13 -5
  87. package/scripts/langages/cargo/commandes.mjs +5 -6
  88. package/scripts/langages/python/commandes.mjs +5 -5
  89. package/scripts/langages/python/composants.mjs +10 -2
  90. package/scripts/langages/typescript/composants.mjs +10 -3
  91. package/scripts/langages/typescript/construire.mjs +2 -0
  92. package/scripts/langages/typescript/exemples.mjs +33 -1
  93. package/scripts/langages/typescript/index.mjs +19 -0
  94. package/scripts/langages/typescript/migrations/0.49.0-tests-equipes.mjs +32 -0
  95. package/scripts/langages/typescript/tests-de-nuit.mjs +152 -32
  96. package/scripts/langages/typescript/tests-du-poste.mjs +65 -23
  97. package/scripts/langages/typescript/titres-de-tests.mjs +11 -7
  98. package/scripts/langages/typescript/turbo-des-paquets.mjs +21 -4
  99. package/scripts/langages/typescript/verifier.mjs +3 -5
  100. package/scripts/langages/typescript/verrou-des-dependances.mjs +161 -0
  101. package/scripts/langages/typescript/vitest-config/cibles.mjs +57 -6
  102. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +11 -5
  103. package/scripts/langages/typescript/vitest.nuit.config.mjs +53 -5
  104. package/scripts/machine.mjs +1 -1
  105. package/scripts/mesure/base-de-passe.mjs +2 -1
  106. package/scripts/migrations/0.49.0-reservation-de-trois-coeurs.mjs +30 -0
  107. package/scripts/migrations.mjs +2 -0
  108. package/scripts/nuit.sh +97 -2
  109. package/scripts/paquet.mjs +16 -5
  110. package/scripts/paquets.d.ts +4 -0
  111. package/scripts/paquets.mjs +57 -0
  112. package/scripts/passe-de-la-machine.mjs +4 -7
  113. package/scripts/places-de-la-machine.mjs +55 -42
  114. package/scripts/places-du-serveur.mjs +2 -2
  115. package/scripts/plafond-de-la-machine.d.mts +7 -13
  116. package/scripts/plafond-de-la-machine.mjs +19 -35
  117. package/scripts/prefixe-des-tickets.mjs +1 -1
  118. package/scripts/references-changees.mjs +159 -0
  119. package/scripts/regles-des-places.d.mts +8 -31
  120. package/scripts/regles-des-places.mjs +14 -64
  121. package/scripts/repli-de-la-nuit.mjs +112 -0
  122. package/scripts/reponses-du-circuit.d.mts +2 -2
  123. package/scripts/reponses-du-circuit.mjs +21 -12
  124. package/scripts/reprise.mjs +27 -8
  125. package/scripts/resultats.mjs +21 -9
  126. package/scripts/seances.mjs +258 -40
  127. package/scripts/services-du-noyau.mjs +3 -0
  128. package/scripts/sous-commandes.mjs +24 -7
  129. package/scripts/superviseur.mjs +185 -39
  130. package/scripts/tableau.mjs +220 -89
  131. package/scripts/taches-du-graphe.mjs +84 -4
  132. package/scripts/ticket.mjs +345 -0
  133. package/scripts/transitions.d.mts +44 -0
  134. package/scripts/transitions.mjs +173 -13
  135. package/scripts/un-commit-par-ticket.mjs +4 -3
  136. package/scripts/verdict-de-la-nuit.mjs +47 -20
  137. package/scripts/verrou-de-fichier.mjs +2 -2
  138. package/scripts/verrous/ecriture-hors-enveloppe.mjs +86 -0
  139. package/scripts/verrous/verrou.mjs +17 -1
  140. package/skills/developpeur/SKILL.md +1 -1
  141. package/skills/direct/SKILL.md +57 -0
  142. package/skills/explorateur/SKILL.md +10 -6
  143. package/skills/pitmaster/SKILL.md +34 -14
  144. package/skills/pitmaster/references/consigne-agent.md +7 -1
  145. package/skills/relecteur/SKILL.md +8 -0
  146. package/skills/testwriter/SKILL.md +10 -0
  147. package/scripts/ticket.sh +0 -25
@@ -5,9 +5,11 @@
5
5
  // file) both import.
6
6
  import { existsSync, readdirSync, readFileSync } from 'node:fs';
7
7
  import path from 'node:path';
8
- import { horsCadre } from '../../paquets.mjs';
8
+ import { horsCadre, ignoresParGit } from '../../paquets.mjs';
9
9
 
10
- // Every directory under `packages/` and `src/` of the repository at <racine>: [{ nom, dir }].
10
+ // Every directory under `packages/` and `src/` of the repository at <racine>: [{ nom, dir }], a
11
+ // directory git ignores (the local clone of another repository) left out: its package.json when
12
+ // it holds one, the directory itself otherwise.
11
13
  function tousDossiers(racine) {
12
14
  const found = [];
13
15
  for (const parent of ['packages', 'src']) {
@@ -21,7 +23,12 @@ function tousDossiers(racine) {
21
23
  }
22
24
  }
23
25
  }
24
- return found;
26
+ const lu = d => {
27
+ const manifeste = path.join(d.dir, 'package.json');
28
+ return existsSync(manifeste) ? manifeste : d.dir;
29
+ };
30
+ const ignores = ignoresParGit(racine, found.map(lu));
31
+ return found.filter(d => !ignores.has(lu(d)));
25
32
  }
26
33
 
27
34
  // The component directories of the repository at <racine>: [{ nom, dir }], each directory under
@@ -4,6 +4,8 @@
4
4
  // prepared copy, through its mounts: the session finds built what it reads out of its plan.
5
5
  //
6
6
  // node construire.mjs --echec <fichier> <plan> from the root of the copy
7
+ // node construire.mjs --gardes what the guard tasks wait for, before the
8
+ // guards of the checks of a plan
7
9
  //
8
10
  // - The launcher is the core's, one for every language (`construireDepuisLesArguments` of
9
11
  // scripts/taches-du-graphe.mjs): the plan and its providers by `turbo run build
@@ -7,7 +7,8 @@
7
7
  // interface, and the generated files are written by their own commands (the index of the
8
8
  // interfaces, the turbo.json of the packages): `aJour`; the same with each generated file out
9
9
  // of date: the interface of `a` changed after its index, a fault listed that its code never
10
- // produces (the check of the interfaces against the code), the turbo.json of `b` stale:
10
+ // produces (the check of the interfaces against the code), the turbo.json of `b` stale, a
11
+ // dependency of `a` that the lock does not hold:
11
12
  // `enRetard`; the same where the code of `b` imports `a` and the
12
13
  // code of `c` imports `b`: `lus`; the same with a second commit that changes a file of `a`:
13
14
  // `lot`. A directory whose package.json names no package: `vide`. A
@@ -57,6 +58,29 @@ function depot(dans) {
57
58
  `# ${nom}\n\n${nom.toUpperCase()} rend un nombre.\n`
58
59
  );
59
60
  }
61
+ // The lock npm writes for them: the workspaces linked, each entry with its dependencies.
62
+ ecrire(
63
+ 'package-lock.json',
64
+ json({
65
+ name: 'e',
66
+ lockfileVersion: 3,
67
+ requires: true,
68
+ packages: {
69
+ '': { name: 'e', workspaces: ['packages/*'] },
70
+ ...Object.fromEntries(
71
+ Object.keys(PAQUETS).flatMap(nom => [
72
+ [`node_modules/@e/${nom}`, { resolved: `packages/${nom}`, link: true }],
73
+ [
74
+ `packages/${nom}`,
75
+ Object.fromEntries(
76
+ Object.entries(PAQUETS[nom]).filter(([k]) => k !== 'name' && k !== 'exports')
77
+ ),
78
+ ],
79
+ ])
80
+ ),
81
+ },
82
+ })
83
+ );
60
84
  mkdirSync(path.join(racine, 'docs/agents'), { recursive: true });
61
85
  node(racine, 'turbo-des-paquets.mjs', '--ecrire');
62
86
  node(racine, 'index-interfaces.mjs');
@@ -125,6 +149,11 @@ export default {
125
149
  '# a\n\nA rend un autre nombre.\n\n## Les fautes\n\n- `A_ABSENTE` : jamais produite.\n'
126
150
  );
127
151
  writeFileSync(path.join(enRetard, 'packages/b/turbo.json'), '{}\n');
152
+ // A dependency added to `a` that its lock does not hold.
153
+ writeFileSync(
154
+ path.join(enRetard, 'packages/a/package.json'),
155
+ json({ type: 'module', ...PAQUETS.a, devDependencies: { '@e/m': '*' } })
156
+ );
128
157
  // The specifiers are written apart, so that no reading of the package's imports takes a
129
158
  // trial's for its own.
130
159
  const lus = depot(dans);
@@ -181,6 +210,7 @@ export default {
181
210
  'tests-du-poste',
182
211
  'titres-de-tests',
183
212
  'turbo-des-paquets',
213
+ 'verrou-des-dependances',
184
214
  ],
185
215
  invalide: ['tester', 'deployer'],
186
216
  attendu: ['deployer : absente'],
@@ -234,6 +264,7 @@ export default {
234
264
  "l'index des interfaces : en retard",
235
265
  'les turbo.json des paquets : en retard',
236
266
  "les rapports d'API : en retard",
267
+ 'le verrou des dépendances : en retard',
237
268
  ],
238
269
  },
239
270
  gardes: {
@@ -250,6 +281,7 @@ export default {
250
281
  'titres-de-tests',
251
282
  'chemins-des-tests',
252
283
  'resumes',
284
+ 'verrou-des-dependances',
253
285
  ],
254
286
  },
255
287
  elementsDuLot: {
@@ -74,6 +74,8 @@ import * as titresNommantUnTicket from './migrations/0.30.0-titres-nommant-un-ti
74
74
  import * as binaireDeJour from './migrations/0.33.0-binaire-de-jour.mjs';
75
75
  import * as testsDuPoste from './migrations/0.33.0-tests-du-poste.mjs';
76
76
  import * as cacheDesOutils from './migrations/0.34.1-cache-des-outils.mjs';
77
+ import * as testsEquipes from './migrations/0.49.0-tests-equipes.mjs';
78
+ import { COMMANDE as COMMANDE_DU_VERROU } from './verrou-des-dependances.mjs';
77
79
 
78
80
  // The scripts of this module, beside this file.
79
81
  const SCRIPTS = path.dirname(fileURLToPath(import.meta.url));
@@ -97,6 +99,7 @@ const OUTILS = [
97
99
  'tests-du-poste',
98
100
  'titres-de-tests',
99
101
  'turbo-des-paquets',
102
+ 'verrou-des-dependances',
100
103
  ];
101
104
 
102
105
  // The component of <liste> that holds <fichier> (absolute, or from <racine>), null for none.
@@ -324,6 +327,20 @@ export default {
324
327
  'interfaces-contre-code.mjs',
325
328
  []
326
329
  ),
330
+ // The lock of npm, written in full by npm on the lot applied, without the audit; the guard
331
+ // compares it with the package.json it locks (./verrou-des-dependances.mjs).
332
+ engendre(
333
+ {
334
+ nom: 'le verrou des dépendances',
335
+ commande: COMMANDE_DU_VERROU,
336
+ fichiers: ['package-lock.json'],
337
+ lit: ['package.json', '**/package.json'],
338
+ gardes: ['verrou-des-dependances'],
339
+ entiers: ['package-lock.json'],
340
+ },
341
+ 'verrou-des-dependances.mjs',
342
+ []
343
+ ),
327
344
  ],
328
345
  // Loaded at the call: ./index-interfaces.mjs imports the services of the core, which import the
329
346
  // join that loads this module.
@@ -341,6 +358,7 @@ export default {
341
358
  [ici('titres-de-tests.mjs')],
342
359
  [ici('chemins-des-tests.mjs')],
343
360
  [ici('resumes.mjs')],
361
+ [ici('verrou-des-dependances.mjs')],
344
362
  ],
345
363
  migrations: [
346
364
  configVitest,
@@ -355,6 +373,7 @@ export default {
355
373
  binaireDeJour,
356
374
  testsDuPoste,
357
375
  cacheDesOutils,
376
+ testsEquipes,
358
377
  ],
359
378
  miseAJour: miseAJour(joueDesTests),
360
379
  squelette,
@@ -0,0 +1,32 @@
1
+ // From 0.49.0 the guard of the night tests of the poste (scripts/langages/typescript/tests-du-poste.mjs)
2
+ // asks the tag `@equipee` of a night test that needs the equipment of a machine (the envelope, a
3
+ // Temporal server, sccache, the binaries of the module cargo), and `@poste` stays for what only the
4
+ // poste has (the real bd, systemd, the keyring, the user's session, a session of claude). A project
5
+ // whose night tests need equipment without the tag would turn red at its next pass; the update
6
+ // inscribes them as the project's known debt (scripts/dette.mjs), frozen: the count never rises and
7
+ // a new one is refused.
8
+ //
9
+ // - The migration inscribes the findings of the guard that the debt does not hold yet; the debt
10
+ // already inscribed (the guard's, the other guards') stays.
11
+ // - It rewrites no test of the project: the project tags each one (`// @equipee: <raison>` at its
12
+ // head), and the debt comes down with it.
13
+ // - Replayable without effect: once every finding is inscribed, nothing.
14
+ import { FICHIER, lire, trancher } from '../../../dette.mjs';
15
+ import { GARDE, verifier } from '../tests-du-poste.mjs';
16
+
17
+ export const version = '0.49.0';
18
+ export const nom = 'tests equipes';
19
+
20
+ /** Inscribes the night tests of equipment without the tag that the debt of <projet> lacks. */
21
+ export function migrer(projet) {
22
+ const inscrite = lire(projet)[GARDE] ?? {};
23
+ const constats = verifier(projet);
24
+ const neufs = constats.filter(c => !inscrite[c.fichier]?.[c.regle]);
25
+ if (neufs.length === 0) {
26
+ return [];
27
+ }
28
+ trancher(projet, GARDE, constats, 'inscrire', {});
29
+ return [
30
+ `${FICHIER} : ${neufs.length} test(s) de nuit qui exige(nt) l'équipement d'une machine sans l'étiquette @equipee inscrit(s) dans la dette de ${GARDE}, gelée ; un neuf est refusé, et chacun porte « // @equipee: <raison> » en tête`,
31
+ ];
32
+ }
@@ -4,7 +4,10 @@
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 alone (the night of PC3)
10
+ // node tests-de-nuit.mjs --mesures the benches and the time witnesses alone
8
11
  // node tests-de-nuit.mjs --hors-du-poste --tranche i/n its tranche i of n
9
12
  //
10
13
  // - The files `*.nuit.test.*` and `*.nuit.spec.*` of the copy, outside node_modules, dist and
@@ -18,6 +21,10 @@
18
21
  // time (GRILLHOUSE_TESTS_DE_NUIT=mesures), as Bazel plays a test tagged `exclusive` after the
19
22
  // others, nothing beside it, and as the module cargo plays its benches after its night tests
20
23
  // (grillhouse-bd7). Each run plays when the copy holds its files.
24
+ // - Each run plays one Vitest per unit: the root under the frame's configuration alone, and each
25
+ // directory below it that holds a Vitest configuration (`vitest.config.*`, else `vite.config.*`)
26
+ // with `--root` at that directory, under that configuration merged with the frame's, what the
27
+ // night sets winning (./vitest.nuit.config.mjs, `unitesDeLaNuit`).
21
28
  // - With `--hors-du-poste`, the night of a shared machine: the night tests alone, but those that
22
29
  // bear the tag `@poste` (`porteLEtiquetteDuPoste` of ./vitest-config/cibles.mjs, which the guard
23
30
  // ./tests-du-poste.mjs asks of a night test that depends on the poste), in one run
@@ -36,11 +43,12 @@
36
43
  // - The exit code: 0 when every run is green; 75, « à repasser », when every red run is at 75
37
44
  // (every failure depended on a duration, one under load, ./vitest-config/duree.reporter.mjs);
38
45
  // 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.
46
+ // - The night tests play on the part of their project (`avecLaPasse` of
47
+ // scripts/passe-de-la-machine.mjs, the sort « Nuit »), the measures of time on dedicated cores
48
+ // (`mesure`, `grillhouse.mesure`), once the temporary directory and the disk of the copy have
49
+ // room, as every pass: a wait that reaches its bound ends at 75.
42
50
  import { spawnSync } from 'node:child_process';
43
- import { readdirSync, rmSync } from 'node:fs';
51
+ import { existsSync, readdirSync, rmSync } from 'node:fs';
44
52
  import path from 'node:path';
45
53
  import { fileURLToPath, pathToFileURL } from 'node:url';
46
54
  import {
@@ -53,8 +61,10 @@ import {
53
61
  estUnBanc,
54
62
  estUnTestDeNuit,
55
63
  fichiersTemoins,
64
+ NUIT_PAQUET,
56
65
  NUIT_TRANCHE,
57
66
  NUIT_VARIABLE,
67
+ testsDuPoste,
58
68
  } from './vitest-config/cibles.mjs';
59
69
  import { fichiersDeLaTranche, RAPPORTS } from './tranches.mjs';
60
70
 
@@ -65,17 +75,26 @@ import { fichiersDeLaTranche, RAPPORTS } from './tranches.mjs';
65
75
  */
66
76
  export function lireLesArguments(args) {
67
77
  let horsDuPoste = false;
78
+ let sansEquipement = false;
79
+ let duPoste = false;
80
+ let mesuresSeules = false;
68
81
  let texte;
69
82
  for (let i = 0; i < args.length; i++) {
70
83
  const a = args[i];
71
84
  if (a === '--hors-du-poste') {
72
85
  horsDuPoste = true;
86
+ } else if (a === '--sans-equipement') {
87
+ sansEquipement = true;
88
+ } else if (a === '--du-poste') {
89
+ duPoste = true;
90
+ } else if (a === '--mesures') {
91
+ mesuresSeules = true;
73
92
  } else if (a === '--tranche') {
74
93
  texte = args[++i] ?? '';
75
94
  } else if (a.startsWith('--tranche=')) {
76
95
  texte = a.slice('--tranche='.length);
77
96
  } else {
78
- return { horsDuPoste, erreur: `⛔ tests-de-nuit : argument inconnu « ${a} » (usage : tests-de-nuit [--hors-du-poste [--tranche ${LA_FORME}]]).` };
97
+ 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
98
  }
80
99
  }
81
100
  const tranche = texte === undefined ? undefined : (lireLaTranche(texte) ?? undefined);
@@ -85,7 +104,13 @@ export function lireLesArguments(args) {
85
104
  if (tranche && !horsDuPoste) {
86
105
  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
106
  }
88
- return { horsDuPoste, tranche };
107
+ if (sansEquipement && !horsDuPoste) {
108
+ return { horsDuPoste, erreur: '⛔ --sans-equipement choisit la nuit d\'une machine sans équipement : elle se donne avec --hors-du-poste.' };
109
+ }
110
+ if ((duPoste || mesuresSeules) && (horsDuPoste || (duPoste && mesuresSeules))) {
111
+ return { horsDuPoste, erreur: '⛔ --du-poste, --mesures et --hors-du-poste sont trois nuits à part : une seule à la fois.' };
112
+ }
113
+ return { horsDuPoste, sansEquipement, duPoste, mesuresSeules, tranche };
89
114
  }
90
115
 
91
116
  const CONFIGURATION = fileURLToPath(new URL('./vitest.nuit.config.mjs', import.meta.url));
@@ -113,9 +138,20 @@ function enTient(dossier, est) {
113
138
  * @param {{ horsDuPoste?: boolean }} [options] the night of a shared machine
114
139
  * @returns {string[]}
115
140
  */
116
- export function runsDeLaNuit(racine, { horsDuPoste = false } = {}) {
141
+ export function runsDeLaNuit(
142
+ racine,
143
+ { horsDuPoste = false, sansEquipement = false, duPoste = false, mesuresSeules = false } = {}
144
+ ) {
117
145
  if (horsDuPoste) {
118
- return enTient(racine, estUnTestDeNuit) ? ['hors-poste'] : [];
146
+ return enTient(racine, estUnTestDeNuit)
147
+ ? [sansEquipement ? 'hors-poste-sans-equipement' : 'hors-poste']
148
+ : [];
149
+ }
150
+ if (duPoste) {
151
+ return testsDuPoste(racine).length > 0 ? ['du-poste'] : [];
152
+ }
153
+ if (mesuresSeules) {
154
+ return enTient(racine, estUnBanc) || fichiersTemoins(racine).length > 0 ? ['mesures'] : [];
119
155
  }
120
156
  return [
121
157
  enTient(racine, estUnTestDeNuit) && 'nuit',
@@ -136,27 +172,31 @@ export function testsDeNuit(racine, options = {}) {
136
172
  if (runs.length === 0) {
137
173
  return 0;
138
174
  }
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;
175
+ // The night tests play on the part of the project, as a pass; the measures of time play on
176
+ // dedicated cores (`grillhouse.mesure`) that nobody else touches, once the temporary directory
177
+ // and the disk of the copy have room.
178
+ const codes = runs.map(choix => {
179
+ const mesure = choix === 'mesures';
180
+ try {
181
+ return avecLaPasse(() => jouerLeRun(racine, choix, options), {
182
+ lourde: false,
183
+ mesure,
184
+ racine,
185
+ sorte: mesure ? 'Mesures de nuit' : 'Nuit',
186
+ });
187
+ } catch (e) {
188
+ if (e?.name !== 'AttenteDeLaMachine') {
189
+ throw e;
190
+ }
191
+ process.stdout.write(`${e.message}\n`);
192
+ return e.code;
151
193
  }
152
- process.stdout.write(`${e.message}\n`);
153
- return e.code;
154
- }
194
+ });
195
+ return plierLesCodes(codes);
155
196
  }
156
197
 
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) {
198
+ // The run <choix> of Vitest of the night, in the copy at <racine>: its exit code.
199
+ function jouerLeRun(racine, choix, options) {
160
200
  const { tranche } = options;
161
201
  const rapports = path.join(racine, RAPPORTS);
162
202
  if (tranche) {
@@ -167,18 +207,38 @@ function jouerLesRuns(racine, runs, options) {
167
207
  const enTranche = tranche
168
208
  ? { [NUIT_TRANCHE]: JSON.stringify({ tranche: `${tranche.index}/${tranche.count}`, rapports }) }
169
209
  : {};
170
- const codes = runs.map(choix => {
210
+ // One run per unit, each under the configuration of its package; the code of the unit runs
211
+ // folds as the runs' do: 0, 75 when every red one is at 75, else the first red code.
212
+ const codes = unitesDeLaNuit(racine).map(({ dossier, config, exclus }) => {
171
213
  const r = spawnSync(
172
214
  'npx',
173
- ['--no-install', 'vitest', 'run', '--root', racine, '--config', CONFIGURATION],
215
+ [
216
+ '--no-install',
217
+ 'vitest',
218
+ 'run',
219
+ '--root',
220
+ dossier,
221
+ '--config',
222
+ CONFIGURATION,
223
+ ],
174
224
  {
175
225
  cwd: racine,
176
226
  stdio: 'inherit',
177
- env: { ...process.env, [NUIT_VARIABLE]: choix, ...enTranche },
227
+ env: {
228
+ ...process.env,
229
+ [NUIT_VARIABLE]: choix,
230
+ [NUIT_PAQUET]: JSON.stringify({ config, exclus }),
231
+ ...enTranche,
232
+ },
178
233
  }
179
234
  );
180
235
  return r.status ?? 1;
181
236
  });
237
+ return plierLesCodes(codes);
238
+ }
239
+
240
+ // The code of <codes>: 0 when all are, 75 when every red one is, else the first red code.
241
+ function plierLesCodes(codes) {
182
242
  const rouges = codes.filter(c => c !== 0);
183
243
  if (rouges.length === 0) {
184
244
  return 0;
@@ -186,12 +246,72 @@ function jouerLesRuns(racine, runs, options) {
186
246
  return rouges.every(c => c === A_REPASSER) ? A_REPASSER : rouges.find(c => c !== A_REPASSER);
187
247
  }
188
248
 
249
+ const SAUTES_DES_UNITES = new Set(['node_modules', 'dist', '.git', '.turbo', '.claude']);
250
+ const CONFIGURATIONS = ['vitest.config', 'vite.config'];
251
+ const EXTENSIONS = ['ts', 'mts', 'cts', 'js', 'mjs', 'cjs'];
252
+
253
+ // The Vitest configuration of the directory <dossier>, as Vitest looks for it: the first
254
+ // `vitest.config.*`, else the first `vite.config.*`; undefined when it has none.
255
+ function configurationDe(dossier) {
256
+ for (const nom of CONFIGURATIONS) {
257
+ for (const ext of EXTENSIONS) {
258
+ const f = path.join(dossier, `${nom}.${ext}`);
259
+ if (existsSync(f)) {
260
+ return f;
261
+ }
262
+ }
263
+ }
264
+ return undefined;
265
+ }
266
+
267
+ /**
268
+ * The units a run of the night plays in the copy at <racine>: the root, under the frame's
269
+ * configuration alone, and each directory below it that holds a Vitest configuration, under that
270
+ * configuration. Each unit leaves out the directories of the units below it.
271
+ * @param {string} racine the root of the copy
272
+ * @returns {{ dossier: string, config?: string, exclus: string[] }[]}
273
+ */
274
+ export function unitesDeLaNuit(racine) {
275
+ const configures = [];
276
+ const parcourir = dossier => {
277
+ for (const e of readdirSync(dossier, { withFileTypes: true })) {
278
+ if (e.isDirectory() && !SAUTES_DES_UNITES.has(e.name)) {
279
+ const d = path.join(dossier, e.name);
280
+ const config = configurationDe(d);
281
+ if (config) {
282
+ configures.push({ dossier: d, config });
283
+ }
284
+ parcourir(d);
285
+ }
286
+ }
287
+ };
288
+ parcourir(racine);
289
+ const unites = [{ dossier: racine }, ...configures];
290
+ const dessous = (parent, d) => {
291
+ const r = path.relative(parent, d);
292
+ return r !== '' && !r.startsWith('..') && !path.isAbsolute(r);
293
+ };
294
+ return unites
295
+ .map(u => ({
296
+ ...u,
297
+ exclus: configures
298
+ .filter(c => dessous(u.dossier, c.dossier))
299
+ .map(c => `${path.relative(u.dossier, c.dossier).split(path.sep).join('/')}/**`),
300
+ }))
301
+ .filter(
302
+ u =>
303
+ u.dossier === racine ||
304
+ enTient(u.dossier, f => estUnTestDeNuit(f) || estUnBanc(f)) ||
305
+ fichiersTemoins(u.dossier).length > 0
306
+ );
307
+ }
308
+
189
309
  if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
190
- const { horsDuPoste, tranche, erreur } = lireLesArguments(process.argv.slice(2));
310
+ const { erreur, ...options } = lireLesArguments(process.argv.slice(2));
191
311
  if (erreur) {
192
312
  process.stderr.write(`${erreur}\n`);
193
313
  process.exitCode = 2;
194
314
  } else {
195
- process.exitCode = testsDeNuit(process.cwd(), { horsDuPoste, tranche });
315
+ process.exitCode = testsDeNuit(process.cwd(), options);
196
316
  }
197
317
  }
@@ -30,7 +30,11 @@ import path from 'node:path';
30
30
  import { pathToFileURL } from 'node:url';
31
31
  import { MODE, trancher } from '../../dette.mjs';
32
32
  import { testsDuDepot } from './tailles-des-tests.mjs';
33
- import { estUnTestDeNuit, porteLEtiquetteDuPoste } from './vitest-config/cibles.mjs';
33
+ import {
34
+ estUnTestDeNuit,
35
+ porteLEtiquetteDuPoste,
36
+ porteLEtiquetteEquipee,
37
+ } from './vitest-config/cibles.mjs';
34
38
  import {
35
39
  code,
36
40
  IMPORT,
@@ -42,6 +46,7 @@ import {
42
46
 
43
47
  export const GARDE = 'tests-du-poste';
44
48
  export const REGLE = 'poste-sans-etiquette';
49
+ export const REGLE_EQUIPEE = 'equipee-sans-etiquette';
45
50
 
46
51
  // A call that starts the command claude, its arguments to the end of the line.
47
52
  const CLAUDE =
@@ -49,27 +54,39 @@ const CLAUDE =
49
54
  // The subcommands of claude a shared machine plays: the plugins of the frame and its version.
50
55
  const CLAUDE_PARTAGE = new Set(['plugin', '--version']);
51
56
 
52
- /** The marks of what a shared machine does not have, each `{ nom, voit(code) }`. */
57
+ /**
58
+ * The marks of what a shared machine does not have, each `{ nom, classe, voit(code) }`: the class
59
+ * `equipee` is the equipment of a machine (the tag `@equipee`: the envelope, a Temporal server,
60
+ * sccache, the binaries of the module cargo), the class `poste` what only the poste has (the tag
61
+ * `@poste`: the real bd, systemd, the keyring, the session of the user, a session of claude).
62
+ */
53
63
  export const DEPENDANCES = [
54
64
  {
55
65
  nom: "l'enveloppe bwrap",
66
+ classe: 'equipee',
56
67
  voit: c =>
57
68
  /\bcanWrap\b|['"`]bwrap['"`]|['"`/]enveloppe\/(?:lancer\.sh|enveloppe\.mjs)['"`]|['"`/]enveloppe(?:\.[\w-]+)?['"`]/.test(
58
69
  c
59
70
  ),
60
71
  },
61
- { nom: 'le bd réel', voit: c => /\bhasBd\b/.test(c) },
72
+ { nom: 'le bd réel', classe: 'poste', voit: c => /\bhasBd\b/.test(c) },
62
73
  {
63
74
  nom: 'un serveur Temporal',
75
+ classe: 'equipee',
64
76
  voit: c => /['"`]server['"`]\s*,\s*['"`]start-dev['"`]/.test(c),
65
77
  },
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) },
78
+ { nom: 'sccache', classe: 'equipee', voit: c => /['"`]sccache['"`]/.test(c) },
79
+ {
80
+ nom: 'les binaires du module cargo',
81
+ classe: 'equipee',
82
+ voit: c => /['"`/]templates\/cargo\b/.test(c),
83
+ },
84
+ { nom: 'systemd', classe: 'poste', voit: c => /['"`](?:systemctl|systemd-run)['"`]/.test(c) },
85
+ { nom: 'le trousseau', classe: 'poste', voit: c => /\bkeyrings\b/.test(c) },
86
+ { nom: 'la session de l’utilisateur', classe: 'poste', voit: c => /\/run\/user\//.test(c) },
71
87
  {
72
88
  nom: 'une séance de claude',
89
+ classe: 'poste',
73
90
  voit: c => [...c.matchAll(CLAUDE)].some(m => !m[1] || !CLAUDE_PARTAGE.has(m[2])),
74
91
  },
75
92
  ];
@@ -80,6 +97,11 @@ export const DEPENDANCES = [
80
97
  * the repository at <racine>: the names of DEPENDANCES, each once, in their order.
81
98
  */
82
99
  export function dependancesDu(fichier, lire = lireLeDisque, racine = path.parse(fichier).root) {
100
+ return marquesDu(fichier, lire, racine).map(d => d.nom);
101
+ }
102
+
103
+ // The marks (the entries of DEPENDANCES) the test file <fichier> shows, as `dependancesDu` reads them.
104
+ function marquesDu(fichier, lire, racine) {
83
105
  const vus = new Set();
84
106
  const codes = [];
85
107
  const suivre = f => {
@@ -103,39 +125,59 @@ export function dependancesDu(fichier, lire = lireLeDisque, racine = path.parse(
103
125
  };
104
126
  suivre(fichier);
105
127
  const tout = codes.join('\n');
106
- return DEPENDANCES.filter(d => d.voit(tout)).map(d => d.nom);
128
+ return DEPENDANCES.filter(d => d.voit(tout));
107
129
  }
108
130
 
109
131
  /**
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.
132
+ * Each night test of the repository at <racine>: `[{ fichier, etiquete, equipee, marques }]`,
133
+ * `fichier` from its root, `etiquete` whether it bears the tag `@poste`, `equipee` whether it bears
134
+ * the tag `@equipee`, `marques` the marks it shows, `{ nom, classe }` each.
113
135
  */
114
136
  export function testsDeNuitDuDepot(racine) {
115
137
  return testsDuDepot(racine)
116
138
  .filter(estUnTestDeNuit)
117
139
  .map(fichier => {
118
140
  const abs = path.join(racine, fichier);
141
+ const texte = lireLeDisque(abs) ?? '';
119
142
  return {
120
143
  fichier,
121
- etiquete: porteLEtiquetteDuPoste(lireLeDisque(abs) ?? ''),
122
- dependances: dependancesDu(abs, lireLeDisque, racine),
144
+ etiquete: porteLEtiquetteDuPoste(texte),
145
+ equipee: porteLEtiquetteEquipee(texte),
146
+ marques: marquesDu(abs, lireLeDisque, racine).map(({ nom, classe }) => ({ nom, classe })),
123
147
  };
124
148
  });
125
149
  }
126
150
 
127
151
  /**
128
152
  * 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`.
153
+ * `{ fichier, regle, message }` per night test that shows a mark of the poste without the tag
154
+ * `@poste` (REGLE), and one per night test that shows a mark of equipment without the tag
155
+ * `@equipee` (REGLE_EQUIPEE).
130
156
  */
131
157
  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
- }));
158
+ const noms = (marques, classe) =>
159
+ marques.filter(m => m.classe === classe).map(m => m.nom);
160
+ return tous.flatMap(({ fichier, etiquete, equipee, marques }) => {
161
+ /** @type {{ fichier: string, regle: string, message: string }[]} */
162
+ const constats = [];
163
+ const poste = noms(marques, 'poste');
164
+ if (!etiquete && poste.length > 0) {
165
+ constats.push({
166
+ fichier,
167
+ regle: REGLE,
168
+ 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.`,
169
+ });
170
+ }
171
+ const equipement = noms(marques, 'equipee');
172
+ if (!equipee && equipement.length > 0) {
173
+ constats.push({
174
+ fichier,
175
+ regle: REGLE_EQUIPEE,
176
+ 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.`,
177
+ });
178
+ }
179
+ return constats;
180
+ });
139
181
  }
140
182
 
141
183
  /**
@@ -157,7 +199,7 @@ export function rapport(racine, env = process.env) {
157
199
  lignes: [
158
200
  ...refus.map(r => `⛔ ${r.message}`),
159
201
  ...lignes,
160
- `ℹ️ ${GARDE} : ${tous.length} test(s) de nuit, ${tous.filter(t => t.etiquete).length} laissé(s) au poste (@poste).`,
202
+ `ℹ️ ${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
203
  ],
162
204
  code: refus.length ? 1 : 0,
163
205
  };