@roomi-fields/grillhouse 0.29.0 → 0.30.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 (222) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +739 -0
  3. package/bin/grillhouse.mjs +79 -18
  4. package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
  5. package/cadre/templates/projet/CLAUDE.md +5 -1
  6. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  7. package/cadre/templates/projet/package.json +2 -2
  8. package/charte.md +24 -0
  9. package/dist/temporal/acte.d.ts +24 -0
  10. package/dist/temporal/acte.js +139 -0
  11. package/dist/temporal/acte.js.map +1 -0
  12. package/dist/temporal/attributs.d.ts +6 -0
  13. package/dist/temporal/attributs.js +15 -0
  14. package/dist/temporal/attributs.js.map +1 -0
  15. package/dist/temporal/circuit/activites.d.ts +13 -0
  16. package/dist/temporal/circuit/activites.js +33 -0
  17. package/dist/temporal/circuit/activites.js.map +1 -0
  18. package/dist/temporal/circuit/client.d.ts +72 -0
  19. package/dist/temporal/circuit/client.js +247 -0
  20. package/dist/temporal/circuit/client.js.map +1 -0
  21. package/dist/temporal/circuit/commande.d.ts +2 -0
  22. package/dist/temporal/circuit/commande.js +238 -0
  23. package/dist/temporal/circuit/commande.js.map +1 -0
  24. package/dist/temporal/circuit/contrat.d.ts +305 -0
  25. package/dist/temporal/circuit/contrat.js +24 -0
  26. package/dist/temporal/circuit/contrat.js.map +1 -0
  27. package/dist/temporal/circuit/deroule.d.ts +3 -0
  28. package/dist/temporal/circuit/deroule.js +540 -0
  29. package/dist/temporal/circuit/deroule.js.map +1 -0
  30. package/dist/temporal/client.d.ts +47 -0
  31. package/dist/temporal/client.js +69 -0
  32. package/dist/temporal/client.js.map +1 -0
  33. package/dist/temporal/commande.d.ts +2 -0
  34. package/dist/temporal/commande.js +95 -0
  35. package/dist/temporal/commande.js.map +1 -0
  36. package/dist/temporal/deroules.d.ts +5 -0
  37. package/dist/temporal/deroules.js +10 -0
  38. package/dist/temporal/deroules.js.map +1 -0
  39. package/dist/temporal/etat.d.ts +33 -0
  40. package/dist/temporal/etat.js +59 -0
  41. package/dist/temporal/etat.js.map +1 -0
  42. package/dist/temporal/file/activites.d.ts +10 -0
  43. package/dist/temporal/file/activites.js +25 -0
  44. package/dist/temporal/file/activites.js.map +1 -0
  45. package/dist/temporal/file/client.d.ts +4 -0
  46. package/dist/temporal/file/client.js +6 -0
  47. package/dist/temporal/file/client.js.map +1 -0
  48. package/dist/temporal/file/contrat.d.ts +158 -0
  49. package/dist/temporal/file/contrat.js +14 -0
  50. package/dist/temporal/file/contrat.js.map +1 -0
  51. package/dist/temporal/file/deroule.d.ts +15 -0
  52. package/dist/temporal/file/deroule.js +235 -0
  53. package/dist/temporal/file/deroule.js.map +1 -0
  54. package/dist/temporal/installation.d.ts +124 -0
  55. package/dist/temporal/installation.js +408 -0
  56. package/dist/temporal/installation.js.map +1 -0
  57. package/dist/temporal/places/activites.d.ts +8 -0
  58. package/dist/temporal/places/activites.js +13 -0
  59. package/dist/temporal/places/activites.js.map +1 -0
  60. package/dist/temporal/places/client.d.ts +28 -0
  61. package/dist/temporal/places/client.js +64 -0
  62. package/dist/temporal/places/client.js.map +1 -0
  63. package/dist/temporal/places/contrat.d.ts +106 -0
  64. package/dist/temporal/places/contrat.js +21 -0
  65. package/dist/temporal/places/contrat.js.map +1 -0
  66. package/dist/temporal/places/deroule.d.ts +3 -0
  67. package/dist/temporal/places/deroule.js +198 -0
  68. package/dist/temporal/places/deroule.js.map +1 -0
  69. package/dist/temporal/sonde/activites.d.ts +6 -0
  70. package/dist/temporal/sonde/activites.js +52 -0
  71. package/dist/temporal/sonde/activites.js.map +1 -0
  72. package/dist/temporal/sonde/contrat.d.ts +35 -0
  73. package/dist/temporal/sonde/contrat.js +10 -0
  74. package/dist/temporal/sonde/contrat.js.map +1 -0
  75. package/dist/temporal/sonde/deroule.d.ts +3 -0
  76. package/dist/temporal/sonde/deroule.js +39 -0
  77. package/dist/temporal/sonde/deroule.js.map +1 -0
  78. package/dist/temporal/tickets/activites.d.ts +7 -0
  79. package/dist/temporal/tickets/activites.js +81 -0
  80. package/dist/temporal/tickets/activites.js.map +1 -0
  81. package/dist/temporal/tickets/client.d.ts +10 -0
  82. package/dist/temporal/tickets/client.js +31 -0
  83. package/dist/temporal/tickets/client.js.map +1 -0
  84. package/dist/temporal/tickets/contrat.d.ts +56 -0
  85. package/dist/temporal/tickets/contrat.js +13 -0
  86. package/dist/temporal/tickets/contrat.js.map +1 -0
  87. package/dist/temporal/tickets/deroule.d.ts +3 -0
  88. package/dist/temporal/tickets/deroule.js +94 -0
  89. package/dist/temporal/tickets/deroule.js.map +1 -0
  90. package/dist/temporal/travailleur.d.ts +2 -0
  91. package/dist/temporal/travailleur.js +69 -0
  92. package/dist/temporal/travailleur.js.map +1 -0
  93. package/docs/ARCHITECTURE.md +609 -80
  94. package/docs/CADRE.md +17 -0
  95. package/docs/INTERFACE.md +134 -42
  96. package/hooks/crochet.mjs +19 -2
  97. package/hooks/hooks.json +11 -0
  98. package/package.json +16 -4
  99. package/scripts/activites.mjs +2182 -0
  100. package/scripts/aiguillage.d.mts +37 -0
  101. package/scripts/aiguillage.mjs +7 -3
  102. package/scripts/avancement.mjs +128 -16
  103. package/scripts/bilan.mjs +37 -19
  104. package/scripts/cadre.mjs +11 -2
  105. package/scripts/circuit.mjs +881 -4059
  106. package/scripts/circuits-cles.d.mts +4 -0
  107. package/scripts/circuits-cles.mjs +21 -0
  108. package/scripts/circuits-du-serveur.mjs +105 -0
  109. package/scripts/codes-de-sortie.mjs +9 -0
  110. package/scripts/commandes-composees.mjs +45 -41
  111. package/scripts/commandes-du-path.d.mts +7 -0
  112. package/scripts/commandes-du-path.mjs +25 -0
  113. package/scripts/composition-des-langages.mjs +16 -12
  114. package/scripts/conformite.mjs +6 -13
  115. package/scripts/copies-finies.mjs +52 -47
  116. package/scripts/depart-du-ticket.d.mts +53 -0
  117. package/scripts/depart-du-ticket.mjs +124 -0
  118. package/scripts/dependances-internes.mjs +115 -0
  119. package/scripts/dernier-vert.mjs +7 -15
  120. package/scripts/donnees-cles.mjs +228 -0
  121. package/scripts/droits.mjs +11 -1
  122. package/scripts/effets.mjs +352 -0
  123. package/scripts/enveloppe/enveloppe.mjs +119 -8
  124. package/scripts/enveloppe/lancer.sh +14 -18
  125. package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
  126. package/scripts/enveloppe/travail-de-la-copie.mjs +5 -1
  127. package/scripts/etapes.mjs +5 -2
  128. package/scripts/faits-du-circuit.mjs +493 -0
  129. package/scripts/file-des-tickets.d.mts +21 -0
  130. package/scripts/file-des-tickets.mjs +58 -0
  131. package/scripts/flux-des-paquets.mjs +187 -0
  132. package/scripts/gardes-du-cadre.mjs +12 -2
  133. package/scripts/integration/file.mjs +475 -420
  134. package/scripts/integration/integrer.mjs +17 -19
  135. package/scripts/integration/rejeu.mjs +19 -4
  136. package/scripts/jointure.d.ts +145 -27
  137. package/scripts/langages/cargo/commandes.mjs +289 -109
  138. package/scripts/langages/cargo/composants.mjs +130 -34
  139. package/scripts/langages/cargo/exemples.mjs +12 -21
  140. package/scripts/langages/cargo/index.mjs +18 -8
  141. package/scripts/langages/cargo/sccache.mjs +8 -14
  142. package/scripts/langages/python/commandes.mjs +216 -100
  143. package/scripts/langages/python/composants.mjs +53 -21
  144. package/scripts/langages/python/exemples.mjs +6 -16
  145. package/scripts/langages/python/index.mjs +24 -8
  146. package/scripts/langages/python/lot.mjs +1 -36
  147. package/scripts/langages/typescript/construire.mjs +6 -163
  148. package/scripts/langages/typescript/exemples.mjs +3 -11
  149. package/scripts/langages/typescript/frontieres.mjs +1 -1
  150. package/scripts/langages/typescript/index.mjs +43 -61
  151. package/scripts/langages/typescript/interfaces-contre-code.mjs +4 -4
  152. package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
  153. package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +31 -0
  154. package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
  155. package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
  156. package/scripts/langages/typescript/tailles-des-tests.mjs +40 -9
  157. package/scripts/langages/typescript/tests-de-nuit.mjs +12 -9
  158. package/scripts/langages/typescript/tests.mjs +17 -8
  159. package/scripts/langages/typescript/titres-de-tests.mjs +297 -0
  160. package/scripts/langages/typescript/turbo-des-paquets.mjs +183 -38
  161. package/scripts/langages/typescript/verdict.mjs +1 -1
  162. package/scripts/langages/typescript/verifier.mjs +31 -11
  163. package/scripts/langages/typescript/vitest-config/base.mjs +22 -1
  164. package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
  165. package/scripts/langages/typescript/vitest-config/cibles.mjs +36 -14
  166. package/scripts/langages/typescript/vitest-config/delais.mjs +54 -0
  167. package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
  168. package/scripts/langages/typescript/vitest-config/duree.classement.mjs +100 -0
  169. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +49 -63
  170. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +3 -0
  171. package/scripts/langages/typescript/vitest.nuit.config.mjs +4 -0
  172. package/scripts/mesure/pression.mjs +3 -3
  173. package/scripts/mesure-de-la-machine.d.mts +21 -0
  174. package/scripts/mesure-de-la-machine.mjs +76 -0
  175. package/scripts/migrations/0.23.2-copies-du-cadre.mjs +8 -2
  176. package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +120 -0
  177. package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
  178. package/scripts/migrations.mjs +5 -0
  179. package/scripts/nuit.sh +10 -3
  180. package/scripts/outils-cles.d.mts +24 -0
  181. package/scripts/outils-cles.mjs +0 -1
  182. package/scripts/paquet-npm.mjs +147 -0
  183. package/scripts/paquet.mjs +73 -4
  184. package/scripts/paquets.mjs +34 -6
  185. package/scripts/passe-de-la-machine.mjs +66 -0
  186. package/scripts/places-de-la-machine.mjs +360 -0
  187. package/scripts/places-du-serveur.mjs +170 -0
  188. package/scripts/prefixe-des-tickets.mjs +68 -0
  189. package/scripts/preparation.mjs +10 -3
  190. package/scripts/registre.mjs +3 -2
  191. package/scripts/regles-des-places.d.mts +36 -0
  192. package/scripts/regles-des-places.mjs +70 -0
  193. package/scripts/reponses-du-circuit.d.mts +6 -0
  194. package/scripts/reponses-du-circuit.mjs +28 -0
  195. package/scripts/resultats.mjs +7 -9
  196. package/scripts/retirer-les-copies-finies.mjs +25 -0
  197. package/scripts/sans-reponse.d.mts +4 -0
  198. package/scripts/sans-reponse.mjs +13 -0
  199. package/scripts/seances.mjs +918 -0
  200. package/scripts/services-du-noyau.mjs +26 -8
  201. package/scripts/session-start.sh +2 -2
  202. package/scripts/sortie.mjs +3 -3
  203. package/scripts/sous-commandes.mjs +38 -9
  204. package/scripts/style-a-l-ecriture.mjs +229 -0
  205. package/scripts/superviseur.mjs +122 -111
  206. package/scripts/tableau.mjs +148 -110
  207. package/scripts/taches-du-graphe.mjs +328 -0
  208. package/scripts/ticket-du-circuit.mjs +206 -0
  209. package/scripts/transitions.d.mts +148 -0
  210. package/scripts/transitions.mjs +901 -0
  211. package/scripts/verrou-de-fichier.mjs +2 -2
  212. package/scripts/verrou-de-machine.mjs +28 -13
  213. package/skills/explorateur/SKILL.md +2 -1
  214. package/skills/pitmaster/SKILL.md +17 -18
  215. package/skills/pitmaster/references/consigne-agent.md +5 -1
  216. package/skills/release/SKILL.md +3 -3
  217. package/skills/relecteur/SKILL.md +4 -2
  218. package/skills/testwriter/SKILL.md +36 -24
  219. package/scripts/demon.mjs +0 -251
  220. package/scripts/integration/file-attente.mjs +0 -61
  221. package/scripts/langages/cargo/touches.mjs +0 -93
  222. package/scripts/langages/typescript/script-des-tests.mjs +0 -6
@@ -0,0 +1,54 @@
1
+ // The delay of each size of test, on the model of Bazel's test-encyclopedia (a delay per size; a
2
+ // test past it is killed) and of Vitest's `slowTestThreshold`.
3
+ //
4
+ // - The delay of a day test file is deduced from its size by the classification of the guard of
5
+ // the sizes (`classer`, ../tailles-des-tests.mjs), the one address of the rule; the three delays
6
+ // are written once, in ./bornes.mjs.
7
+ // - A file out of the day (a night test, a bench, a time witness) that a targeted run plays has the
8
+ // large delay, whatever its text reads.
9
+ // - A setup file of the base configuration applies the delay of its file to each test file
10
+ // (./delais.setup.mjs).
11
+ import { existsSync } from 'node:fs';
12
+ import path from 'node:path';
13
+ import { lesMatieres, classer } from '../tailles-des-tests.mjs';
14
+ import { DELAI_NUIT_MS, DELAIS_MS, libelleDuDelai } from './bornes.mjs';
15
+ import { estHorsDuJour } from './cibles.mjs';
16
+ import { lireLeDisque } from './lances.mjs';
17
+
18
+ export { DELAI_NUIT_MS, DELAIS_MS, libelleDuDelai };
19
+
20
+ const memoMatieres = new Map();
21
+ const matieresDe = racine => {
22
+ if (!memoMatieres.has(racine)) memoMatieres.set(racine, lesMatieres(racine));
23
+ return memoMatieres.get(racine);
24
+ };
25
+
26
+ /**
27
+ * The delay of the test file <fichier> (absolute), read by <lire> in the repository at <racine>:
28
+ * `{ taille, delai }`, `delai` in ms.
29
+ */
30
+ export function delaisDuFichier(fichier, { lire, racine }) {
31
+ const taille = estHorsDuJour(fichier)
32
+ ? 'grand'
33
+ : classer(fichier, lire, racine, matieresDe(racine)).taille;
34
+ return { taille, delai: DELAIS_MS[taille] };
35
+ }
36
+
37
+ /** The settings Vitest applies to the test file <fichier>: its delay for a test and a hook. */
38
+ export function reglagesDuFichier(fichier, options) {
39
+ const { delai } = delaisDuFichier(fichier, options);
40
+ return { testTimeout: delai, hookTimeout: delai };
41
+ }
42
+
43
+ /** The root of the repository that holds <fichier>: the first directory above with a `.git`. */
44
+ export function racineDuDepot(fichier) {
45
+ for (let d = path.dirname(fichier); ; d = path.dirname(d)) {
46
+ if (existsSync(path.join(d, '.git'))) return d;
47
+ if (path.dirname(d) === d) return process.cwd();
48
+ }
49
+ }
50
+
51
+ /** The delay of <fichier> as the disk of its repository gives it. */
52
+ export function delaisSurLeDisque(fichier) {
53
+ return delaisDuFichier(fichier, { lire: lireLeDisque, racine: racineDuDepot(fichier) });
54
+ }
@@ -0,0 +1,11 @@
1
+ // A setup file of the base configuration: a test file has the delay of its size, as Bazel gives
2
+ // each test the delay of its `size`. It reads the size of the file it sets up (./delais.mjs, by the
3
+ // classification of the guard of the sizes) and gives Vitest its delay for a test and a hook.
4
+ import { vi } from 'vitest';
5
+ import { delaisSurLeDisque } from './delais.mjs';
6
+
7
+ const fichier = globalThis.__vitest_worker__?.filepath;
8
+ if (fichier) {
9
+ const { delai } = delaisSurLeDisque(fichier);
10
+ vi.setConfig({ testTimeout: delai, hookTimeout: delai });
11
+ }
@@ -0,0 +1,100 @@
1
+ // The classification of the duration reporter (./duree.reporter.mjs), a pure function: it takes
2
+ // data (the tasks of the run, the errors outside the tests, the CPU pressures at the start and at
3
+ // the end, Vitest's exit code, and per file its size label, whether it is out of the day and
4
+ // whether it is a time budget bench, by the rules of ./cibles.mjs) and
5
+ // never reads the disk nor the global state. The reporter reads those, calls `classer`, writes the
6
+ // lines and sets the exit code.
7
+ //
8
+ // A failure depends on a duration when it is a failure of a time budget bench (a file
9
+ // `*.budget.test.*`, `*.budget.spec.*`), of a test marked as a measure of time (`mesurerAuRepos`),
10
+ // or a delay past (« Test timed out in <n>ms. », « Hook timed out in <n>ms. ») in a file out of the
11
+ // day; every other failure is a real red, a delay past in a day test included.
12
+ //
13
+ // The verdict is `a-repasser` when every failure depends on a duration and at least one took place
14
+ // under load (pressure at or above the threshold at the start or at the end); `rouge` when they
15
+ // all took place at rest; `vitest` (Vitest's verdict stands) when a failure is real, an error is
16
+ // outside the tests, Vitest's code is not 1, or no pressure reads; no pressure measured at all
17
+ // (no failure of duration) gives no line of conclusion.
18
+ import { A_REPASSER, SEUIL_PRESSION } from '../../../services-du-noyau.mjs';
19
+
20
+ const DELAI = /^(Test|Hook) timed out in \d+ms\./;
21
+
22
+ function* taches(t) {
23
+ yield t;
24
+ for (const c of t.tasks ?? []) yield* taches(c);
25
+ }
26
+ const fichierDe = t => {
27
+ let x = t;
28
+ while (x && !x.filepath) x = x.suite ?? x.file;
29
+ return x?.filepath ?? '';
30
+ };
31
+ const nomDe = t => {
32
+ const noms = [];
33
+ for (let x = t; x && !x.filepath; x = x.suite) noms.unshift(x.name);
34
+ return noms.join(' › ');
35
+ };
36
+
37
+ /**
38
+ * @param {{ files?: any[], errors?: unknown[], debut: number | null, fin: number | null,
39
+ * codeDeSortie: number | undefined, fichiers: Record<string, { horsDuJour: boolean, banc?: boolean, libelleDelai: string }> }} entree
40
+ */
41
+ export function classer({ files = [], errors = [], debut, fin, codeDeSortie, fichiers }) {
42
+ const echecs = [];
43
+ for (const f of files) {
44
+ for (const t of taches(f)) {
45
+ const erreurs = t.result?.errors ?? [];
46
+ if (t.type === 'test' ? t.result?.state !== 'fail' : erreurs.length === 0) continue;
47
+ const fichier = fichierDe(t);
48
+ const info = fichiers[fichier];
49
+ const delaiDepasse = erreurs.length > 0 && erreurs.every(e => DELAI.test(e.message ?? ''));
50
+ const cause =
51
+ t.type === 'test' && t.meta?.mesureDeTemps
52
+ ? 'mesure de temps'
53
+ : info?.banc
54
+ ? 'banc de temps'
55
+ : delaiDepasse && info?.horsDuJour
56
+ ? 'délai dépassé'
57
+ : 'réel';
58
+ echecs.push({
59
+ fichier,
60
+ nom: nomDe(t),
61
+ cause,
62
+ delai: delaiDepasse ? (info?.libelleDelai ?? null) : null,
63
+ pressionDebut: t.type === 'test' ? (t.meta?.pressionDebut ?? debut) : debut,
64
+ pressionFin: t.type === 'test' ? (t.meta?.pressionFin ?? fin) : fin,
65
+ });
66
+ }
67
+ }
68
+ const dependants = echecs.filter(e => e.cause !== 'réel');
69
+ if (dependants.length === 0) {
70
+ // No failure of duration: no pressure measured, so no line of conclusion.
71
+ return { echecs, verdict: 'vitest', conclusion: null };
72
+ }
73
+ if (dependants.length < echecs.length || errors.length > 0 || codeDeSortie !== 1) {
74
+ return {
75
+ echecs,
76
+ verdict: 'vitest',
77
+ conclusion: 'un échec ne dépend pas d’une durée : verdict de Vitest.',
78
+ };
79
+ }
80
+ const lues = dependants.flatMap(e => [e.pressionDebut, e.pressionFin]).filter(p => p !== null);
81
+ if (lues.length === 0) {
82
+ return {
83
+ echecs,
84
+ verdict: 'vitest',
85
+ conclusion: 'pression CPU illisible (/proc/pressure/cpu) : verdict de Vitest.',
86
+ };
87
+ }
88
+ if (lues.some(p => p >= SEUIL_PRESSION)) {
89
+ return {
90
+ echecs,
91
+ verdict: 'a-repasser',
92
+ conclusion: `à repasser (code ${A_REPASSER}) : chaque échec dépend d’une durée, et au moins un a eu lieu sous charge ; ni vert ni rouge, la mesure se rejoue au repos.`,
93
+ };
94
+ }
95
+ return {
96
+ echecs,
97
+ verdict: 'rouge',
98
+ conclusion: `échecs de durée au repos (pression CPU sous ${SEUIL_PRESSION} %) : rouge.`,
99
+ };
100
+ }
@@ -26,25 +26,33 @@ import {
26
26
  lirePression,
27
27
  SEUIL_PRESSION,
28
28
  } from '../../../services-du-noyau.mjs';
29
- import { estHorsDuJour } from './cibles.mjs';
29
+ import { estHorsDuJour, estUnBanc } from './cibles.mjs';
30
+ import { classer } from './duree.classement.mjs';
31
+ import { delaisSurLeDisque, libelleDuDelai } from './delais.mjs';
30
32
 
31
- const DELAI = /^(Test|Hook) timed out in \d+ms\./;
32
- const BANC = /\.budget\.(test|spec)\.(c|m)?[jt]sx?$/;
33
+ function aUnEchec(t) {
34
+ if (t.type === 'test' ? t.result?.state === 'fail' : (t.result?.errors ?? []).length > 0)
35
+ return true;
36
+ return (t.tasks ?? []).some(aUnEchec);
37
+ }
33
38
 
34
- function* taches(t) {
35
- yield t;
36
- for (const c of t.tasks ?? []) yield* taches(c);
39
+ // The 20 slowest files of the run, slowest first, each with its share of the total time.
40
+ const PLUS_LENTS = 20;
41
+ function plusLents(files, dire) {
42
+ const duree = f => f.result?.duration ?? 0;
43
+ const total = files.reduce((s, f) => s + duree(f), 0);
44
+ if (total <= 0) return;
45
+ const lents = [...files].sort((a, b) => duree(b) - duree(a)).slice(0, PLUS_LENTS);
46
+ dire(
47
+ `${lents.length === 1 ? '1 fichier le plus lent' : `${lents.length} fichiers les plus lents`} (part du temps total, ${Math.round(total)} ms) :`
48
+ );
49
+ for (const f of lents) {
50
+ const part = ((100 * duree(f)) / total).toFixed(1);
51
+ dire(
52
+ `${part.padStart(5)} % ${Math.round(duree(f))} ms ${path.relative(process.cwd(), f.filepath)}`
53
+ );
54
+ }
37
55
  }
38
- const fichierDe = t => {
39
- let x = t;
40
- while (x && !x.filepath) x = x.suite ?? x.file;
41
- return x?.filepath ?? '';
42
- };
43
- const nomDe = t => {
44
- const noms = [];
45
- for (let x = t; x && !x.filepath; x = x.suite) noms.unshift(x.name);
46
- return noms.join(' › ');
47
- };
48
56
 
49
57
  export default class DureeReporter {
50
58
  onInit() {
@@ -53,59 +61,37 @@ export default class DureeReporter {
53
61
 
54
62
  onFinished(files = [], errors = []) {
55
63
  const fin = lirePression();
56
- const echecs = [];
64
+ const dire = l => process.stdout.write(`⏱ ${l}\n`);
65
+ plusLents(files, dire);
66
+ const fichiers = {};
57
67
  for (const f of files) {
58
- for (const t of taches(f)) {
59
- const erreurs = t.result?.errors ?? [];
60
- if (t.type === 'test' ? t.result?.state === 'fail' : erreurs.length > 0) echecs.push(t);
61
- }
68
+ if (!aUnEchec(f) || f.filepath in fichiers) continue;
69
+ fichiers[f.filepath] = {
70
+ horsDuJour: estHorsDuJour(f.filepath),
71
+ banc: estUnBanc(f.filepath),
72
+ libelleDelai: libelleDuDelai(delaisSurLeDisque(f.filepath).taille),
73
+ };
62
74
  }
63
- if (echecs.length === 0) return;
64
- const dire = l => process.stdout.write(`⏱ ${l}\n`);
65
- let reels = 0;
66
- const pressions = [];
67
- for (const t of echecs) {
68
- const fichier = fichierDe(t);
69
- const erreurs = t.result?.errors ?? [];
70
- const cause =
71
- t.type === 'test' && t.meta?.mesureDeTemps
72
- ? 'mesure de temps'
73
- : BANC.test(fichier)
74
- ? 'banc de temps'
75
- : erreurs.length > 0 &&
76
- erreurs.every(e => DELAI.test(e.message ?? '')) &&
77
- estHorsDuJour(fichier)
78
- ? 'délai dépassé'
79
- : null;
80
- if (!cause) {
81
- reels++;
75
+ const { echecs, verdict, conclusion } = classer({
76
+ files,
77
+ errors,
78
+ debut: this.debut,
79
+ fin,
80
+ codeDeSortie: process.exitCode,
81
+ fichiers,
82
+ });
83
+ for (const e of echecs) {
84
+ const nom = path.relative(process.cwd(), e.fichier) + (e.nom ? ` › ${e.nom}` : '');
85
+ const delai = e.delai ? ` (${e.delai})` : '';
86
+ if (e.cause === 'réel') {
87
+ if (e.delai) dire(`${nom} : délai dépassé${delai}.`);
82
88
  continue;
83
89
  }
84
- const debut = t.type === 'test' ? (t.meta?.pressionDebut ?? this.debut) : this.debut;
85
- const finT = t.type === 'test' ? (t.meta?.pressionFin ?? fin) : fin;
86
- pressions.push(debut, finT);
87
- const nom = nomDe(t);
88
- dire(
89
- `${path.relative(process.cwd(), fichier)}${nom ? ` › ${nom}` : ''} : ${cause}, pression CPU ${ecrirePression(debut)} au début, ${ecrirePression(finT)} à la fin (seuil ${SEUIL_PRESSION} %).`
90
- );
91
- }
92
- if (pressions.length === 0) return;
93
- if (reels > 0 || errors.length > 0 || process.exitCode !== 1) {
94
- dire('un échec ne dépend pas d’une durée : verdict de Vitest.');
95
- return;
96
- }
97
- const lues = pressions.filter(p => p !== null);
98
- if (lues.length === 0) {
99
- dire('pression CPU illisible (/proc/pressure/cpu) : verdict de Vitest.');
100
- return;
101
- }
102
- if (lues.some(p => p >= SEUIL_PRESSION)) {
103
90
  dire(
104
- `à repasser (code ${A_REPASSER}) : chaque échec dépend d’une durée, et au moins un a eu lieu sous charge ; ni vert ni rouge, la mesure se rejoue au repos.`
91
+ `${nom} : ${e.cause}${delai}, pression CPU ${ecrirePression(e.pressionDebut)} au début, ${ecrirePression(e.pressionFin)} à la fin (seuil ${SEUIL_PRESSION} %).`
105
92
  );
106
- process.exitCode = A_REPASSER;
107
- return;
108
93
  }
109
- dire(`échecs de durée au repos (pression CPU sous ${SEUIL_PRESSION} %) : rouge.`);
94
+ if (conclusion) dire(conclusion);
95
+ if (verdict === 'a-repasser') process.exitCode = A_REPASSER;
110
96
  }
111
97
  }
@@ -7,6 +7,9 @@
7
7
  // the temporary directory (GRILLHOUSE_TEMPORAIRE_LIBRE, 0) nor on the disk of their copy
8
8
  // (GRILLHOUSE_COPIE_LIBRE, 0): the room of the machine is the pass's that plays the file, which
9
9
  // waited for it.
10
+ //
11
+ // That trial machine takes no place of the user's machine (scripts/places-de-la-machine.mjs): only
12
+ // the server of trial a test names (GRILLHOUSE_PLACES_D_ESSAI).
10
13
  import { randomUUID } from 'node:crypto';
11
14
  import { tmpdir } from 'node:os';
12
15
  import path from 'node:path';
@@ -16,6 +16,7 @@
16
16
  // under load (scripts/langages/typescript/vitest-config/duree.reporter.mjs).
17
17
  import base from './vitest-config/base.mjs';
18
18
  import { HORS_DU_JOUR, nuit } from './vitest-config/cibles.mjs';
19
+ import { DELAI_NUIT_MS } from './vitest-config/bornes.mjs';
19
20
 
20
21
  export default {
21
22
  plugins: [nuit()],
@@ -26,6 +27,9 @@ export default {
26
27
  setupFiles: base.test.setupFiles,
27
28
  include: HORS_DU_JOUR,
28
29
  exclude: ['**/node_modules/**', '**/dist/**', '**/.git/**'],
30
+ // The large delay of Bazel for a night test: 900 s (./vitest-config/delais.mjs).
31
+ testTimeout: DELAI_NUIT_MS,
32
+ hookTimeout: DELAI_NUIT_MS,
29
33
  watch: false,
30
34
  },
31
35
  };
@@ -10,8 +10,8 @@
10
10
  // - The machine is at rest under SEUIL_PRESSION (25 %); at or above it, it is under load.
11
11
  // - A file that does not read (no pressure stall information on the machine) gives null: whoever
12
12
  // reads it says « pression illisible » and leaves the verdict to the runner of the tests.
13
- // - A_REPASSER, 75, is the exit code of « à repasser » (EX_TEMPFAIL of sysexits.h: try again
14
- // later), neither green nor red: the measure of time of each module of language gives it
13
+ // - A_REPASSER (scripts/codes-de-sortie.mjs), 75, is the exit code of « à repasser » (EX_TEMPFAIL
14
+ // of sysexits.h: try again later), neither green nor red: the measure of time of each module of language gives it
15
15
  // (scripts/langages/typescript/vitest-config/duree.reporter.mjs, the benches of the module cargo),
16
16
  // and the night reads it (scripts/nuit.sh). The day waits for no rest: `npm run verifier` takes a
17
17
  // task at 75 for a red (scripts/langages/typescript/verifier.mjs).
@@ -22,9 +22,9 @@
22
22
  // waits so before it plays its time budget benches again (scripts/nuit.sh).
23
23
  import { readFileSync } from 'node:fs';
24
24
  import { pathToFileURL } from 'node:url';
25
+ import { A_REPASSER } from '../codes-de-sortie.mjs';
25
26
 
26
27
  export const SEUIL_PRESSION = 25;
27
- export const A_REPASSER = 75;
28
28
  export const FICHIER_PRESSION = '/proc/pressure/cpu';
29
29
  // The longest wait for rest, and the shortest gap between two lines that say it waits.
30
30
  export const BORNE_ATTENTE_MS = 15 * 60_000;
@@ -0,0 +1,21 @@
1
+ // The types of the measure of the machine (./mesure-de-la-machine.mjs), which the activity of the workflow of
2
+ // the machine under Temporal (src/temporal/places/activites.ts) imports.
3
+ import type { MesureDeLaMachine } from './regles-des-places.mjs';
4
+
5
+ /** The memory available now, in bytes. */
6
+ export function memoireDisponible(): number;
7
+
8
+ /** The machine now: its cores, its load over one minute, its free memory in bytes. */
9
+ export function mesureDeLaMachine(): MesureDeLaMachine;
10
+
11
+ /** The start of the process <pid> as the system gives it, null when it is gone. */
12
+ export function departDe(pid: number): string | null;
13
+
14
+ /** Whether the process <pid> lives and is the one of its start <depart>. */
15
+ export function processusVivant(p: { pid: number; depart: string | null }): boolean;
16
+
17
+ /** <signal> to the process group <groupe>; false when the group is gone. */
18
+ export function signalerGroupe(groupe: number | null | undefined, signal: NodeJS.Signals | 0): boolean;
19
+
20
+ /** Whether the group a sign of life <vie> names still runs, its leader dead or alive. */
21
+ export function groupeVivant(vie: { pid: number; depart?: string | null } | null | undefined): boolean;
@@ -0,0 +1,76 @@
1
+ // What the machine gives at a moment, which the admission of a start reads
2
+ // (scripts/regles-des-places.mjs): its cores, its load over one minute, its free memory. The
3
+ // activity of the workflow of the machine (src/temporal/places/activites.ts) measures it here, and
4
+ // whether the process of a place still lives; a signal to a process group, and whether the group
5
+ // a sign of life names still runs, which the sessions (scripts/seances.mjs), the circuit and the
6
+ // acts under Temporal (src/temporal/acte.ts) share.
7
+ import { readFileSync } from 'node:fs';
8
+ import { availableParallelism, freemem, loadavg } from 'node:os';
9
+ import { departDe, leMemeVivant, vivant } from './mesure/base-de-passe.mjs';
10
+
11
+ export { departDe };
12
+
13
+ /**
14
+ * The memory available now, in bytes (MemAvailable of the kernel, else the free memory of node).
15
+ * @returns {number}
16
+ */
17
+ export function memoireDisponible() {
18
+ try {
19
+ const kio = /^MemAvailable:\s+(\d+) kB/m.exec(readFileSync('/proc/meminfo', 'utf8'))?.[1];
20
+ if (kio) {
21
+ return Number(kio) * 1024;
22
+ }
23
+ } catch {
24
+ // no /proc/meminfo: the free memory of node
25
+ }
26
+ return freemem();
27
+ }
28
+
29
+ /**
30
+ * The machine now: `{ coeurs, charge, memoireLibre }`, the load over one minute, the memory in bytes.
31
+ * @returns {{ coeurs: number, charge: number, memoireLibre: number }}
32
+ */
33
+ export const mesureDeLaMachine = () => ({
34
+ coeurs: availableParallelism(),
35
+ charge: loadavg()[0],
36
+ memoireLibre: memoireDisponible(),
37
+ });
38
+
39
+ /**
40
+ * Whether the process <pid> lives and is the one of its start <depart> (`departDe`; any process
41
+ * of that number without a start): a place whose process is gone is free.
42
+ * @param {{ pid: number, depart: string | null }} p
43
+ * @returns {boolean}
44
+ */
45
+ export const processusVivant = ({ pid, depart }) =>
46
+ depart ? leMemeVivant(pid, depart) : vivant(pid);
47
+
48
+ /**
49
+ * <signal> to the process group <groupe>; false when the group is gone (or not the caller's).
50
+ * @param {number | null | undefined} groupe
51
+ * @param {NodeJS.Signals | 0} signal
52
+ * @returns {boolean}
53
+ */
54
+ export function signalerGroupe(groupe, signal) {
55
+ if (!groupe) {
56
+ return false;
57
+ }
58
+ try {
59
+ process.kill(-groupe, signal);
60
+ return true;
61
+ } catch {
62
+ return false;
63
+ }
64
+ }
65
+
66
+ /**
67
+ * Whether the group a sign of life <vie> names still runs: its group answers, and its leader, when
68
+ * it lives, is the process of its start (a number reused names another); a group whose leader died
69
+ * runs as long as one of its processes does.
70
+ * @param {{ pid: number, depart?: string | null } | null | undefined} vie
71
+ * @returns {boolean}
72
+ */
73
+ export const groupeVivant = vie =>
74
+ Boolean(vie?.pid) &&
75
+ signalerGroupe(vie.pid, 0) &&
76
+ (!vie.depart || !vivant(vie.pid) || leMemeVivant(vie.pid, vie.depart));
@@ -80,9 +80,15 @@ function formesAnterieures(texte) {
80
80
  const hacher = octets => createHash('sha256').update(octets).digest('hex');
81
81
  const lireJson = f => JSON.parse(readFileSync(f, 'utf8'));
82
82
 
83
- // The subcommand that runs each script of the package, by the path of its former copy.
83
+ // The subcommand that runs each script of the package, by the path of its former copy; a former
84
+ // copy whose subcommand runs another script since (`circuit`, the client of the workflow of a
85
+ // ticket since 0.30.0, src/temporal/circuit/commande.ts) keeps its subcommand.
86
+ const DEPLACEES = [['scripts/circuit.mjs', 'circuit']];
84
87
  const parCopie = projet =>
85
- new Map(Object.entries(scriptsDesSousCommandes(projet)).map(([n, s]) => [`scripts/${s}`, n]));
88
+ new Map([
89
+ ...Object.entries(scriptsDesSousCommandes(projet)).map(([n, s]) => [`scripts/${s}`, n]),
90
+ ...DEPLACEES,
91
+ ]);
86
92
 
87
93
  // The lines of the list that keep a path: a file, or a directory « …/ ».
88
94
  const gardees = texte =>
@@ -0,0 +1,120 @@
1
+ // From 0.30.0 `npm run verifier` plays the format check and the lint beside the guards, the typing
2
+ // and the tests, and the CI calls it alone (grillhouse-61z): a control played in the CI is played
3
+ // at the poste.
4
+ //
5
+ // - The `.github/workflows/ci.yml` of the project that is identical, spaces normalized, to the
6
+ // template of the version before is replaced by the new template.
7
+ // - One that differs (a step the project added) stays, and `aFaire` names the steps to remove from
8
+ // its test job: `format:check`, `lint`, `typecheck` and `build`.
9
+ // - One that already calls the verification alone, and a project without CI, are left, nothing
10
+ // said: a second pass changes nothing.
11
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
12
+ import path from 'node:path';
13
+ import { CADRE } from '../cadre.mjs';
14
+
15
+ export const version = '0.30.0';
16
+ export const nom = 'ci appelle la vérification';
17
+
18
+ const CI = '.github/workflows/ci.yml';
19
+ const GABARIT = path.join(CADRE, 'templates', 'projet');
20
+
21
+ // The template of 0.29.0, the version before this one.
22
+ const D_AVANT = `name: CI
23
+
24
+ on:
25
+ push:
26
+ branches: [main, develop]
27
+ pull_request:
28
+ branches: [main, develop]
29
+
30
+ jobs:
31
+ test:
32
+ runs-on: ubuntu-latest
33
+
34
+ strategy:
35
+ matrix:
36
+ node-version: [22.x, 24.x]
37
+
38
+ steps:
39
+ - name: Checkout
40
+ uses: actions/checkout@v5
41
+
42
+ - name: Setup Node.js \${{ matrix.node-version }}
43
+ uses: actions/setup-node@v5
44
+ with:
45
+ node-version: \${{ matrix.node-version }}
46
+ cache: 'npm'
47
+
48
+ - name: Install dependencies
49
+ run: npm ci
50
+
51
+ - name: Check formatting
52
+ run: npm run format:check
53
+
54
+ - name: Lint
55
+ run: npm run lint
56
+
57
+ - name: Typecheck
58
+ run: npm run typecheck
59
+
60
+ - name: Build
61
+ run: npm run build --if-present
62
+
63
+ - name: Guards and tests
64
+ run: npm run verifier
65
+
66
+ build:
67
+ runs-on: ubuntu-latest
68
+ needs: test
69
+
70
+ steps:
71
+ - name: Checkout
72
+ uses: actions/checkout@v5
73
+
74
+ - name: Setup Node.js
75
+ uses: actions/setup-node@v5
76
+ with:
77
+ node-version: '22'
78
+ cache: 'npm'
79
+
80
+ - name: Install dependencies
81
+ run: npm ci
82
+
83
+ - name: Build
84
+ run: npm run build --if-present
85
+
86
+ - name: Check package
87
+ run: npm pack --dry-run
88
+ `;
89
+
90
+ // The versions before of the template (each one's text, to compare with the project's).
91
+ const ANCIENNES = [D_AVANT];
92
+
93
+ // A text with its blanks normalized: line ends, trailing spaces, runs of blanks.
94
+ const normaliser = t =>
95
+ t
96
+ .split(/\r?\n/)
97
+ .map(l => l.trim().replace(/[ \t]+/g, ' '))
98
+ .filter(l => l !== '')
99
+ .join('\n');
100
+
101
+ /** Replaces the CI of the project by the template's when it is a former one; returns what it did. */
102
+ export function migrer(projet) {
103
+ const f = path.join(projet, CI);
104
+ if (!existsSync(f)) return [];
105
+ const actuel = normaliser(readFileSync(f, 'utf8'));
106
+ const neuf = readFileSync(path.join(GABARIT, CI), 'utf8');
107
+ if (actuel === normaliser(neuf)) return [];
108
+ if (ANCIENNES.some(a => normaliser(a) === actuel)) {
109
+ writeFileSync(f, neuf);
110
+ return [`${CI} : remplacé par celui du gabarit, qui n'appelle que \`npm run verifier\``];
111
+ }
112
+ if (!/^\s*run:\s*npm run (format:check|lint|typecheck|build)\b/m.test(readFileSync(f, 'utf8'))) {
113
+ return [];
114
+ }
115
+ return [
116
+ {
117
+ aFaire: `${CI} : \`npm run verifier\` joue la mise en forme, le lint, le typage et la construction ; retirer du job de test les étapes \`format:check\`, \`lint\`, \`typecheck\` et \`build\`, et ne garder après l'installation que \`npm run verifier\`.`,
118
+ },
119
+ ];
120
+ }