@roomi-fields/grillhouse 0.33.1 → 0.34.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 (129) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +81 -0
  3. package/cadre/templates/projet/CLAUDE.md +9 -3
  4. package/charte.md +23 -6
  5. package/dist/temporal/acte.d.ts +7 -0
  6. package/dist/temporal/acte.js +19 -2
  7. package/dist/temporal/acte.js.map +1 -1
  8. package/dist/temporal/circuit/activites.d.ts +3 -1
  9. package/dist/temporal/circuit/activites.js +25 -1
  10. package/dist/temporal/circuit/activites.js.map +1 -1
  11. package/dist/temporal/circuit/appel.d.ts +19 -0
  12. package/dist/temporal/circuit/appel.js +93 -0
  13. package/dist/temporal/circuit/appel.js.map +1 -0
  14. package/dist/temporal/circuit/client.d.ts +7 -0
  15. package/dist/temporal/circuit/client.js +20 -0
  16. package/dist/temporal/circuit/client.js.map +1 -1
  17. package/dist/temporal/circuit/commande.js +27 -87
  18. package/dist/temporal/circuit/commande.js.map +1 -1
  19. package/dist/temporal/circuit/contrat.d.ts +19 -0
  20. package/dist/temporal/circuit/contrat.js +2 -0
  21. package/dist/temporal/circuit/contrat.js.map +1 -1
  22. package/dist/temporal/circuit/deroule.js +86 -11
  23. package/dist/temporal/circuit/deroule.js.map +1 -1
  24. package/dist/temporal/file/activites.d.ts +3 -0
  25. package/dist/temporal/file/activites.js +9 -0
  26. package/dist/temporal/file/activites.js.map +1 -1
  27. package/dist/temporal/file/contrat.d.ts +58 -0
  28. package/dist/temporal/file/deroule.d.ts +8 -1
  29. package/dist/temporal/file/deroule.js +100 -2
  30. package/dist/temporal/file/deroule.js.map +1 -1
  31. package/dist/temporal/nuits/contrat.d.ts +2 -0
  32. package/dist/temporal/nuits/deroule.js +3 -0
  33. package/dist/temporal/nuits/deroule.js.map +1 -1
  34. package/dist/temporal/places/activites.d.ts +8 -0
  35. package/dist/temporal/places/activites.js +12 -1
  36. package/dist/temporal/places/activites.js.map +1 -1
  37. package/dist/temporal/places/client.d.ts +8 -1
  38. package/dist/temporal/places/client.js +25 -2
  39. package/dist/temporal/places/client.js.map +1 -1
  40. package/dist/temporal/places/contrat.d.ts +35 -3
  41. package/dist/temporal/places/contrat.js +5 -4
  42. package/dist/temporal/places/contrat.js.map +1 -1
  43. package/dist/temporal/places/deroule.js +55 -9
  44. package/dist/temporal/places/deroule.js.map +1 -1
  45. package/dist/temporal/tickets/activites.d.ts +3 -0
  46. package/dist/temporal/tickets/activites.js +73 -4
  47. package/dist/temporal/tickets/activites.js.map +1 -1
  48. package/dist/temporal/tickets/contrat.d.ts +31 -0
  49. package/dist/temporal/tickets/deroule.js +61 -10
  50. package/dist/temporal/tickets/deroule.js.map +1 -1
  51. package/docs/ARCHITECTURE.md +225 -57
  52. package/docs/CADRE.md +6 -1
  53. package/docs/INTERFACE.md +24 -8
  54. package/hooks/crochet.mjs +17 -2
  55. package/hooks/hooks.json +24 -0
  56. package/package.json +1 -1
  57. package/scripts/activites.mjs +77 -14
  58. package/scripts/aiguillage.mjs +2 -0
  59. package/scripts/attente-a-l-arret.mjs +141 -0
  60. package/scripts/attente-au-tour.mjs +32 -16
  61. package/scripts/avancement.mjs +5 -3
  62. package/scripts/branche-de-nuit.mjs +63 -3
  63. package/scripts/ci-des-branches.mjs +4 -2
  64. package/scripts/circuit.mjs +57 -4
  65. package/scripts/circuits-du-serveur.mjs +34 -1
  66. package/scripts/commandes-composees.mjs +11 -4
  67. package/scripts/copies-finies.mjs +43 -29
  68. package/scripts/crochets.mjs +1 -1
  69. package/scripts/dette.mjs +55 -4
  70. package/scripts/disque-des-copies.d.mts +28 -0
  71. package/scripts/disque-des-copies.mjs +155 -0
  72. package/scripts/droits.mjs +2 -0
  73. package/scripts/etapes.mjs +6 -4
  74. package/scripts/faits-du-circuit.mjs +24 -0
  75. package/scripts/file-des-tickets.d.mts +16 -0
  76. package/scripts/file-des-tickets.mjs +65 -7
  77. package/scripts/gardes-du-cadre.mjs +4 -2
  78. package/scripts/integration/file.mjs +308 -10
  79. package/scripts/jointure.d.ts +41 -2
  80. package/scripts/langages/cargo/commandes.mjs +81 -12
  81. package/scripts/langages/cargo/composants.mjs +12 -4
  82. package/scripts/langages/cargo/executables-de-tests.mjs +118 -0
  83. package/scripts/langages/cargo/exemples.mjs +17 -3
  84. package/scripts/langages/cargo/index.mjs +8 -3
  85. package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +2 -2
  86. package/scripts/langages/cargo/migrations/0.34.0-executables-de-tests.mjs +35 -0
  87. package/scripts/langages/cargo/squelette.mjs +8 -3
  88. package/scripts/langages/cargo/tailles-des-tests.mjs +68 -6
  89. package/scripts/langages/cargo/tests-de-head.mjs +12 -9
  90. package/scripts/langages/cargo/verdict.mjs +40 -14
  91. package/scripts/langages/python/commandes.mjs +14 -2
  92. package/scripts/langages/python/index.mjs +12 -4
  93. package/scripts/langages/python/verdict.mjs +8 -1
  94. package/scripts/langages/typescript/index.mjs +9 -2
  95. package/scripts/langages/typescript/resume-du-lanceur.mjs +92 -0
  96. package/scripts/langages/typescript/tests.mjs +1 -1
  97. package/scripts/langages/typescript/verdict.mjs +4 -60
  98. package/scripts/langages/typescript/verifier.mjs +1 -1
  99. package/scripts/langages/typescript/vitest-config/changements.mjs +12 -7
  100. package/scripts/langages/typescript/vitest-config/lances.mjs +45 -0
  101. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +1 -0
  102. package/scripts/messages-non-lus.mjs +166 -0
  103. package/scripts/mesure-de-la-machine.mjs +7 -4
  104. package/scripts/migrations-des-gardes.mjs +179 -0
  105. package/scripts/places-de-la-machine.mjs +44 -40
  106. package/scripts/places-du-serveur.mjs +82 -14
  107. package/scripts/plafond-de-la-machine.d.mts +18 -0
  108. package/scripts/plafond-de-la-machine.mjs +45 -0
  109. package/scripts/recommencer.d.mts +4 -0
  110. package/scripts/recommencer.mjs +29 -0
  111. package/scripts/regles-des-places.d.mts +35 -0
  112. package/scripts/regles-des-places.mjs +82 -1
  113. package/scripts/resultats.mjs +38 -4
  114. package/scripts/retirer-les-copies-finies.mjs +11 -7
  115. package/scripts/seances.mjs +1 -1
  116. package/scripts/services-du-noyau.mjs +1 -0
  117. package/scripts/sous-commandes.mjs +2 -0
  118. package/scripts/superviseur.mjs +235 -56
  119. package/scripts/tableau.mjs +468 -267
  120. package/scripts/taches-du-graphe.mjs +49 -8
  121. package/scripts/ticket-du-circuit.mjs +25 -0
  122. package/scripts/transitions.d.mts +27 -1
  123. package/scripts/transitions.mjs +96 -4
  124. package/scripts/verrou-de-machine.mjs +41 -17
  125. package/skills/explorateur/SKILL.md +8 -2
  126. package/skills/pitmaster/SKILL.md +18 -15
  127. package/skills/pitmaster/references/tour.md +3 -1
  128. package/skills/questionneur/SKILL.md +5 -1
  129. package/skills/testwriter/SKILL.md +32 -6
@@ -0,0 +1,118 @@
1
+ #!/usr/bin/env node
2
+ // One executable of integration tests per crate and per moment, on the model of Cargo's own
3
+ // testsuite (`tests/testsuite/main.rs`, each test file a module) and of matklad's « Delete Cargo
4
+ // Integration Tests »: each file of `tests/` is an executable cargo links apart, with every
5
+ // dependency (62 of about 90 MB in a copy of SyntHub, grillhouse-pkl.9); one entry point links one.
6
+ //
7
+ // npx grillhouse executables-de-tests run from the repository root (a guard of grillhouse:gardes)
8
+ //
9
+ // - The executables are the test targets of each crate of the workspace (./composants.mjs,
10
+ // `crates`), each one cargo describes (`tests/<nom>.rs`, `tests/<dossier>/main.rs`, a `[[test]]`
11
+ // of the manifest), counted per moment: the day, the night (a target whose name ends with
12
+ // `_nuit`), the time budget benches (`_budget`) (`horsDuJour`, ./commandes.mjs). The unit tests
13
+ // of `src/` are compiled into the library's own test executable, and never counted.
14
+ // - A crate with more than one executable of a moment gives one finding per executable of that
15
+ // moment, `{ fichier, regle: 'executable-de-trop', message }`, the source of its target from the
16
+ // root, except the one of the frame's address (`ADRESSES`: `tests/it/main.rs`, the target `it`;
17
+ // `it_nuit` for the night, `it_budget` for the benches), each test file a module of it. A crate
18
+ // with a single executable of a moment, whatever its name, gives none.
19
+ // - A finding inscribed in the project's debt (`grillhouse-dette.json`, ../../dette.mjs) passes:
20
+ // the executables a project holds when the rule arrives are inscribed there by the update
21
+ // (./migrations/0.34.0-executables-de-tests.mjs), the count never rises, and a new one is
22
+ // refused.
23
+ // - The guard writes on its error stream the count of the crates and of their executables.
24
+ import path from 'node:path';
25
+ import { pathToFileURL } from 'node:url';
26
+ import { MODE, trancher } from '../../dette.mjs';
27
+ import { horsDuJour } from './commandes.mjs';
28
+ import { crates } from './composants.mjs';
29
+
30
+ // The name of its findings and of its debt.
31
+ export const GARDE = 'executables-de-tests';
32
+ export const DE_TROP = 'executable-de-trop';
33
+
34
+ /** The target of each moment at the frame's address, `tests/<cible>/main.rs`. */
35
+ export const ADRESSES = { jour: 'it', nuit: 'it_nuit', banc: 'it_budget' };
36
+
37
+ // The words of each moment in a message.
38
+ const MOMENTS = { jour: 'de jour', nuit: 'de nuit', banc: 'de banc' };
39
+
40
+ /**
41
+ * @typedef {{ nom: string, fichier: string }} Executable
42
+ * @typedef {{ crate: string, jour: Executable[], nuit: Executable[], banc: Executable[] }} DuCrate
43
+ * @typedef {{ fichier: string, regle: string, message: string }} Constat
44
+ */
45
+
46
+ /**
47
+ * The executables of integration tests of each crate of the workspace at <racine>, per moment:
48
+ * `[{ crate, jour, nuit, banc }]`, each executable its target's name and its source from the root.
49
+ * @param {string} racine
50
+ * @returns {DuCrate[]}
51
+ */
52
+ export function executables(racine) {
53
+ return crates(racine).map(c => {
54
+ /** @type {{ jour: Executable[], nuit: Executable[], banc: Executable[] }} */
55
+ const parMoment = { jour: [], nuit: [], banc: [] };
56
+ for (const t of c.cibles.filter(x => x.kind.includes('test'))) {
57
+ parMoment[horsDuJour(t) ?? 'jour'].push({
58
+ nom: t.name,
59
+ fichier: path.relative(racine, t.src).split(path.sep).join('/'),
60
+ });
61
+ }
62
+ return { crate: c.composant.nom, ...parMoment };
63
+ });
64
+ }
65
+
66
+ /**
67
+ * The findings of the workspace at <racine>: one per executable of a moment beyond the one.
68
+ * @param {string} racine
69
+ * @returns {Constat[]}
70
+ */
71
+ export function verifier(racine) {
72
+ return executables(racine).flatMap(e =>
73
+ /** @type {('jour' | 'nuit' | 'banc')[]} */ (['jour', 'nuit', 'banc']).flatMap(moment => {
74
+ const liste = e[moment];
75
+ if (liste.length < 2) {
76
+ return [];
77
+ }
78
+ const adresse = ADRESSES[moment];
79
+ return liste
80
+ .filter(x => x.nom !== adresse)
81
+ .map(({ fichier }) => ({
82
+ fichier,
83
+ regle: DE_TROP,
84
+ message: `${fichier} : ${e.crate} a ${liste.length} exécutables de tests ${MOMENTS[moment]}, chacun lié à part avec toutes ses dépendances ; un crate en a un seul, tests/${adresse}/main.rs, chaque fichier de tests un module de tests/${adresse}/ (mod <fichier>;).`,
85
+ }));
86
+ })
87
+ );
88
+ }
89
+
90
+ // The report of the check at <racine>: `lignes`, what the command writes on stderr (each refusal
91
+ // prefixed with `⛔`, then the debt's lines, then the count), and `code`, its exit code (1 on a
92
+ // refusal). The functional core of the command: it reads the repository and the project's debt
93
+ // and writes nothing to the standard streams; the command below is its shell. The refusals reach
94
+ // SARIF through `trancher` under the results directory <env> names (scripts/resultats.mjs);
95
+ // without it none is written, and the debt's mode is <env>'s `GRILLHOUSE_DETTE`.
96
+ /**
97
+ * @param {string} racine
98
+ * @param {Record<string, string | undefined>} [env]
99
+ * @returns {{ lignes: string[], code: number }}
100
+ */
101
+ export function rapport(racine, env = process.env) {
102
+ const tous = executables(racine);
103
+ const total = tous.reduce((n, e) => n + e.jour.length + e.nuit.length + e.banc.length, 0);
104
+ const { refus, lignes } = trancher(racine, GARDE, verifier(racine), env[MODE] || undefined, env);
105
+ const resume = `ℹ️ ${GARDE} : ${tous.length} crate(s), ${total} exécutable(s) de tests d'intégration.`;
106
+ return {
107
+ lignes: [...refus.map(r => `⛔ ${r.message}`), ...lignes, resume],
108
+ code: refus.length ? 1 : 0,
109
+ };
110
+ }
111
+
112
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
113
+ const { lignes, code } = rapport(process.cwd());
114
+ for (const l of lignes) {
115
+ process.stderr.write(`${l}\n`);
116
+ }
117
+ process.exitCode = code;
118
+ }
@@ -380,7 +380,8 @@ export default {
380
380
  'crates/core/tests/t_budget.rs',
381
381
  // A unit test of `src/` and a target `tests/<dossier>/main.rs` have no tree: the
382
382
  // names of HEAD's tests are read, as nextest reports them (its module path), the
383
- // braces of a comment, a string or a character not counted, a `mod` of main.rs read.
383
+ // braces of a comment, a string or a character not counted; each file of the target
384
+ // its own, as the verdict gives them: main.rs its tests, a module of it its own.
384
385
  {
385
386
  chemin: 'crates/core/src/rendu/tests.rs',
386
387
  textes: { 'crates/core/src/rendu/tests.rs': UNITAIRE },
@@ -392,13 +393,18 @@ export default {
392
393
  'crates/core/tests/scenario/aide.rs': '#[test]\nfn aidant() {}\n',
393
394
  },
394
395
  },
396
+ {
397
+ chemin: 'crates/core/tests/scenario/aide.rs',
398
+ textes: { 'crates/core/tests/scenario/aide.rs': '#[test]\nfn aidant() {}\n' },
399
+ },
395
400
  ],
396
401
  attendu: [
397
402
  'crates/core/tests/t.rs → un arbre',
398
403
  'crates/core/tests/t_nuit.rs → un arbre',
399
404
  'crates/core/tests/t_budget.rs → un arbre',
400
405
  'crates/core/src/rendu/tests.rs : rendu::tests::ancien, rendu::tests::groupe::interne',
401
- 'crates/core/tests/scenario/main.rs : principal, m::dedans, aide::aidant',
406
+ 'crates/core/tests/scenario/main.rs : principal, m::dedans',
407
+ 'crates/core/tests/scenario/aide.rs : aide::aidant',
402
408
  ],
403
409
  },
404
410
  fichiersEngendres: {
@@ -406,7 +412,15 @@ export default {
406
412
  invalide: enRetard,
407
413
  attendu: ["l'index des interfaces : en retard"],
408
414
  },
409
- gardes: { valide: ['tailles-des-tests', 'clippy', 'frontieres', 'index-interfaces'] },
415
+ gardes: {
416
+ valide: [
417
+ 'tailles-des-tests',
418
+ 'executables-de-tests',
419
+ 'clippy',
420
+ 'frontieres',
421
+ 'index-interfaces',
422
+ ],
423
+ },
410
424
  elementsDuLot: {
411
425
  valide: { racine: aJour, avant: 'HEAD', apres: 'HEAD' },
412
426
  invalide: { racine: lot, avant: avantLeLot, apres: 'HEAD' },
@@ -25,12 +25,14 @@
25
25
  // TMPDIR, TMP and TEMP, and fail naming what the tests left there (./commandes.mjs).
26
26
  // - The generated file, the index of the interfaces (./index-interfaces.mjs), its command and its
27
27
  // check; the guards of structure, in the order they play: the sizes of the tests
28
- // (./tailles-des-tests.mjs), clippy (./clippy.mjs), the boundaries between crates
28
+ // (./tailles-des-tests.mjs), one executable of integration tests per crate and per moment
29
+ // (./executables-de-tests.mjs), clippy (./clippy.mjs), the boundaries between crates
29
30
  // (./frontieres.mjs), the index of the interfaces up to date, each a command by its name too
30
31
  // (./commandes.mjs), which the line of a red guard names; the entries of the index of each
31
32
  // interface (`entreesDeLIndex`), which the core assembles in a project of several languages.
32
33
  // - Its migrations (./migrations/): 0.28.4, the large tests of the day a project holds inscribed
33
- // in its debt when the guard of the sizes arrives.
34
+ // in its debt when the guard of the sizes arrives; 0.34.0, the executables of tests too many
35
+ // inscribed when the guard of the executables arrives.
34
36
  // - Its share of the update (./mise-a-jour.mjs, `miseAJour`): the template of a project of cargo
35
37
  // (`templates/cargo/`) and its test scripts.
36
38
  // - The skeleton of a new crate (./squelette.mjs, `squelette`), which `grillhouse paquet` writes.
@@ -58,6 +60,7 @@ import { elementsDuLot } from './elements-du-lot.mjs';
58
60
  import { enRetard, entreesDeLIndex, SORTIE } from './index-interfaces.mjs';
59
61
  import { miseAJour } from './mise-a-jour.mjs';
60
62
  import * as taillesDesTests from './migrations/0.28.4-tailles-des-tests.mjs';
63
+ import * as executablesDeTests from './migrations/0.34.0-executables-de-tests.mjs';
61
64
  import { squelette } from './squelette.mjs';
62
65
  import { CACHE, CIBLES } from './sccache.mjs';
63
66
  import { verdict } from './verdict.mjs';
@@ -67,6 +70,8 @@ const ici = nom => path.join(path.dirname(fileURLToPath(import.meta.url)), nom);
67
70
 
68
71
  export default {
69
72
  nom: 'cargo',
73
+ // The expected size of a copy before any is measured: its target/, 2 to 7.6 GB (2026-11-11).
74
+ tailleDUneCopie: 8 * 1024 ** 3,
70
75
  manifeste: 'Cargo.toml',
71
76
  nomDuManifeste,
72
77
  liensDuManifeste,
@@ -154,7 +159,7 @@ export default {
154
159
  ],
155
160
  entreesDeLIndex,
156
161
  gardes: () => GARDES.map(({ script, args }) => [script, ...args]),
157
- migrations: [taillesDesTests],
162
+ migrations: [taillesDesTests, executablesDeTests],
158
163
  miseAJour,
159
164
  squelette,
160
165
  };
@@ -10,7 +10,7 @@
10
10
  // - The migration writes the section of the guard in `grillhouse-dette.json` when the guard finds a
11
11
  // large test of the day and the file holds no section of it yet; the rest of the debt stays.
12
12
  // - It rewrites no test of the project: the project moves each one to the night
13
- // (`tests/<nom>_nuit.rs`) or reduces it, and the debt comes down with it.
13
+ // (a module of `tests/it_nuit/`) or reduces it, and the debt comes down with it.
14
14
  // - Replayable without effect: once the section is written, nothing (a debt lowered since never
15
15
  // rises again).
16
16
  import { FICHIER, lire, trancher } from '../../../dette.mjs';
@@ -30,6 +30,6 @@ export function migrer(projet) {
30
30
  }
31
31
  trancher(projet, GARDE, constats, 'inscrire', {});
32
32
  return [
33
- `${FICHIER} : ${constats.length} grand(s) test(s) de jour inscrit(s) dans la dette de ${GARDE}, gelée ; un grand test de jour neuf est refusé, et chacun passe à la nuit (tests/<nom>_nuit.rs) ou se réduit`,
33
+ `${FICHIER} : ${constats.length} grand(s) test(s) de jour inscrit(s) dans la dette de ${GARDE}, gelée ; un grand test de jour neuf est refusé, et chacun passe à la nuit (un module de tests/it_nuit/) ou se réduit`,
34
34
  ];
35
35
  }
@@ -0,0 +1,35 @@
1
+ // From 0.34.0 the guard of the executables of tests in Rust (../executables-de-tests.mjs) refuses a
2
+ // crate with more than one executable of integration tests of a moment (the day, the night, the
3
+ // benches). A project of cargo that updates holds such crates already (SyntHub, OSC Bridge, one
4
+ // executable per file of `tests/`), and its main would turn red at its next pass. As the migration
5
+ // of the sizes (./0.28.4-tailles-des-tests.mjs) and ESLint's `--suppress-all` do once at the
6
+ // passage of a rule, the update inscribes them as the project's known debt (scripts/dette.mjs),
7
+ // frozen: the count never rises, a new executable is refused, and its verification does not change
8
+ // that day.
9
+ //
10
+ // - The migration writes the section of the guard in `grillhouse-dette.json` when the guard finds
11
+ // an executable too many and the file holds no section of it yet; the rest of the debt stays.
12
+ // - It moves no test of the project: the project gathers its files as modules of `tests/it/`
13
+ // (`tests/it_nuit/`, `tests/it_budget/`), and the debt comes down with it.
14
+ // - Replayable without effect: once the section is written, nothing (a debt lowered since never
15
+ // rises again).
16
+ import { FICHIER, lire, trancher } from '../../../dette.mjs';
17
+ import { GARDE, verifier } from '../executables-de-tests.mjs';
18
+
19
+ export const version = '0.34.0';
20
+ export const nom = 'executables de tests';
21
+
22
+ /** Inscribes the executables of tests too many of the project at <projet> in its debt; what it did. */
23
+ export function migrer(projet) {
24
+ if (lire(projet)[GARDE]) {
25
+ return [];
26
+ }
27
+ const constats = verifier(projet);
28
+ if (constats.length === 0) {
29
+ return [];
30
+ }
31
+ trancher(projet, GARDE, constats, 'inscrire', {});
32
+ return [
33
+ `${FICHIER} : ${constats.length} exécutable(s) de tests de trop inscrit(s) dans la dette de ${GARDE}, gelée ; un exécutable neuf est refusé, et chaque fichier de tests devient un module de tests/it/ (tests/it_nuit/, tests/it_budget/)`,
34
+ ];
35
+ }
@@ -5,8 +5,10 @@
5
5
  // - Its files: its Cargo.toml (its name, the folder's; each field of `[workspace.package]` the
6
6
  // workspace holds inherited, `<champ>.workspace = true`, as `cargo new` inherits them in a
7
7
  // workspace, else its version 0.1.0 and its edition 2021; `[lints] workspace = true` when the
8
- // workspace has `[workspace.lints]`); `src/lib.rs`, a library without code; `tests/.gitkeep`, its
9
- // folder of tests by the interface. Cargo needs no configuration of its own for the tests
8
+ // workspace has `[workspace.lints]`); `src/lib.rs`, a library without code; `tests/it/main.rs`,
9
+ // the one executable of its tests by the interface, each test file a module of `tests/it/`
10
+ // (./executables-de-tests.mjs), without a test, and none when the folder already holds a test
11
+ // target (`tests/<nom>.rs`, `tests/<dossier>/main.rs`), which stays its executable. Cargo needs no configuration of its own for the tests
10
12
  // (nextest, the frame's profile) nor for the typing (`cargo check`, clippy).
11
13
  // - A name `cargo new` refuses (a keyword of Rust, `test`, a character out of a package's name) or
12
14
  // warns against (a crate of Rust's standard library, `std`, `core`, `alloc`, `proc_macro`, whose
@@ -159,8 +161,11 @@ export function squelette(racine, { chemin, existants }) {
159
161
  const fichiers = {
160
162
  [`${chemin}/Cargo.toml`]: paquet,
161
163
  [`${chemin}/src/lib.rs`]: `//! The crate ${nom}: its interface, docs/INTERFACE.md, says what it offers.\n`,
162
- [`${chemin}/tests/.gitkeep`]: '',
163
164
  };
165
+ if (!existants.some(f => /^tests\/(?:[^/]+\.rs|[^/]+\/main\.rs)$/.test(f))) {
166
+ fichiers[`${chemin}/tests/it/main.rs`] =
167
+ `//! The integration tests of the crate ${nom}, one executable: each test file a module of\n//! tests/it/, declared here (\`mod <fichier>;\`).\n`;
168
+ }
164
169
  const membres = Array.isArray(espace?.members) ? espace.members : [];
165
170
  const couvert = membres.some(m => typeof m === 'string' && path.matchesGlob(chemin, m));
166
171
  let entree = null;
@@ -9,7 +9,10 @@
9
9
  // test target cargo describes (`tests/<nom>.rs`, `tests/<dossier>/main.rs`), and each unit test
10
10
  // file under `src/` (a `tests.rs`, a file of a folder `tests/`, `unitaire`). A test target whose
11
11
  // name ends with `_nuit` is a night test, with `_budget` a time budget bench (`horsDuJour`,
12
- // ./commandes.mjs); a unit test file is of the day.
12
+ // ./commandes.mjs); a unit test file is of the day. A target `tests/<dossier>/main.rs` (the
13
+ // crate's one executable, `tests/it/main.rs`, ./executables-de-tests.mjs) gives each module of
14
+ // tests it declares as a test file of its own, and its root when it holds a test itself
15
+ // (`fichiersDeLaCible`): one large module is refused by its name, never the whole executable.
13
16
  // - A test is classed by a static reading of its text, of the modules it declares (`mod common;`,
14
17
  // `#[path = "…"] mod x;`), followed from file to file as rustc finds them, and of each crate of
15
18
  // the shared test material (`matiere`) whose name it writes (`ws_essai::`, `use ws_essai`), its
@@ -138,6 +141,57 @@ const rust = dossier =>
138
141
  .map(e => path.join(e.parentPath, e.name))
139
142
  : [];
140
143
 
144
+ // Whether <f> is the root of a test target `tests/<dossier>/main.rs`, whose test files are its
145
+ // modules (`tests/it/main.rs`, ./executables-de-tests.mjs).
146
+ const racineDeDossier = f =>
147
+ path.basename(f) === 'main.rs' && path.basename(path.dirname(path.dirname(f))) === 'tests';
148
+
149
+ // An attribute of a test, `#[test]` or `#[<chemin>::test]`.
150
+ const ATTRIBUT_DE_TEST = /#\[\s*(?:\w+\s*::\s*)*test\s*\]/;
151
+
152
+ // The modules <f> declares, each `{ nom, fichier }`, its file as rustc finds it; none unread.
153
+ const modulesDe = f =>
154
+ [...(lireLeDisque(f) ?? '').matchAll(MODULE)]
155
+ .map(m => ({ nom: m[2], fichier: fichierDuModule(f, m[2], m[1], lireLeDisque) }))
156
+ .filter(m => m.fichier !== null);
157
+
158
+ // The files of <f> and of the modules it declares, followed from file to file.
159
+ function arbreDe(f, vus = new Set()) {
160
+ if (!vus.has(f)) {
161
+ vus.add(f);
162
+ modulesDe(f).forEach(m => arbreDe(m.fichier, vus));
163
+ }
164
+ return [...vus];
165
+ }
166
+
167
+ /**
168
+ * The test files of the target rooted at <main> (`tests/<dossier>/main.rs`), each classed apart,
169
+ * as Cargo's testsuite holds one test file per module: each module it declares that holds a test,
170
+ * its text and its submodules, reading the other modules of the root, its helpers (`mod common;`),
171
+ * only when it writes their name (`common::`), as a crate of the shared test material; and the
172
+ * root when it holds a test of its own, its helpers read, its modules of tests left out.
173
+ * `[{ abs, masques, appuis }]`: `masques` the files a reading leaves out, `appuis` the helpers as
174
+ * `classer` takes the material.
175
+ */
176
+ function fichiersDeLaCible(main) {
177
+ const modules = modulesDe(main).map(m => ({ ...m, arbre: arbreDe(m.fichier) }));
178
+ const appuis = modules.map(m => ({ nom: m.nom, fichiers: m.arbre }));
179
+ const deTests = modules.filter(m =>
180
+ m.arbre.some(f => ATTRIBUT_DE_TEST.test(lireLeDisque(f) ?? ''))
181
+ );
182
+ const racine = ATTRIBUT_DE_TEST.test(lireLeDisque(main) ?? '')
183
+ ? [{ abs: main, masques: new Set(deTests.flatMap(m => m.arbre)), appuis: [] }]
184
+ : [];
185
+ return [
186
+ ...racine,
187
+ ...deTests.map(m => ({
188
+ abs: m.fichier,
189
+ masques: new Set(),
190
+ appuis: appuis.filter(a => a.nom !== m.nom),
191
+ })),
192
+ ];
193
+ }
194
+
141
195
  /** Each test file of the workspace at <racine> and its size: `[{ fichier, taille, nuit }]`. */
142
196
  export function tailles(racine) {
143
197
  const tous = crates(racine);
@@ -154,13 +208,21 @@ export function tailles(racine) {
154
208
  .map(f => ({ abs: f, nuit: false }));
155
209
  const cibles = c.cibles
156
210
  .filter(t => t.kind.includes('test'))
157
- .map(t => ({ abs: t.src, nuit: horsDuJour(t) !== null }));
158
- return [...cibles, ...unitaires];
211
+ .flatMap(t => {
212
+ const nuit = horsDuJour(t) !== null;
213
+ return racineDeDossier(t.src)
214
+ ? fichiersDeLaCible(t.src).map(m => ({ ...m, nuit }))
215
+ : [{ abs: t.src, nuit, masques: new Set(), appuis: [] }];
216
+ });
217
+ return [...cibles, ...unitaires.map(u => ({ ...u, masques: new Set(), appuis: [] }))];
159
218
  });
160
219
  return tests
161
- .map(({ abs, nuit }) => ({
220
+ .map(({ abs, nuit, masques, appuis }) => ({
162
221
  fichier: path.relative(racine, abs).split(path.sep).join('/'),
163
- taille: classer(abs, lireLeDisque, matieres),
222
+ taille: classer(abs, f => (masques.has(f) ? null : lireLeDisque(f)), [
223
+ ...matieres,
224
+ ...appuis,
225
+ ]),
164
226
  nuit,
165
227
  }))
166
228
  .sort((a, b) => a.fichier.localeCompare(b.fichier, 'en'));
@@ -173,7 +235,7 @@ export function verifier(racine) {
173
235
  .map(({ fichier }) => ({
174
236
  fichier,
175
237
  regle: GRAND_DE_JOUR,
176
- message: `${fichier} : un grand test (il monte un dépôt d'essai et y lance le produit ou le cadre) est un test de nuit, jamais joué au fil du travail ; il passe en test de nuit, tests/<nom>_nuit.rs, ou il se réduit à la plus petite taille qui prouve son critère.`,
238
+ message: `${fichier} : un grand test (il monte un dépôt d'essai et y lance le produit ou le cadre) est un test de nuit, jamais joué au fil du travail ; il passe en test de nuit, un module de tests/it_nuit/, ou il se réduit à la plus petite taille qui prouve son critère.`,
177
239
  }));
178
240
  }
179
241
 
@@ -1,10 +1,10 @@
1
1
  // The names of the tests of HEAD's version of a test file of Rust that cargo cannot play twice in
2
2
  // one run, read without playing them (the join, `testsDeHead`; the owner's decision on
3
3
  // grillhouse-3e2): a unit test file of `src/` (`src/**/tests.rs`, a file of a folder `tests/` under
4
- // `src/`), compiled as a module of its crate, and a test target `tests/<dossier>/main.rs`, whose
5
- // modules lie beside it; and a target `tests/<nom>.rs` whose sibling no longer compiles, read as a
6
- // target `tests/<dossier>/main.rs`, its modules beside it (grillhouse-3e2.2). The proof of the red
7
- // holds each name for a green HEAD already holds.
4
+ // `src/`), compiled as a module of its crate, and each file of a test target
5
+ // `tests/<dossier>/main.rs`, its root or one of its modules (`tests/it/foo.rs`, grillhouse-pkl.9);
6
+ // and a target `tests/<nom>.rs` whose sibling no longer compiles, read with its modules beside it
7
+ // (grillhouse-3e2.2). The proof of the red holds each name for a green HEAD already holds.
8
8
  //
9
9
  // - A name is the one the verdict gives (./verdict.mjs), the path nextest reports: the module path
10
10
  // of the test in its binary, `<module>::…::<fn>` (tried on 2026-11-02:
@@ -15,9 +15,11 @@
15
15
  // literals are read as blanks, so that their braces do not count.
16
16
  // - A unit test file of `src/`: its module path is its path under `src/` (`mod.rs` its folder's);
17
17
  // the verdict gives each of its out-of-line modules (`mod <nom>;`) to its own file, so they are
18
- // not read here. A target `tests/<dossier>/main.rs`: the verdict gives it all its binary's tests,
19
- // so its out-of-line modules are read too, as rustc finds them (`<dossier>/<nom>.rs` or
20
- // `<dossier>/<nom>/mod.rs`, a module of `<f>.rs` under `<f>/`).
18
+ // not read here. A file of a target `tests/<dossier>/main.rs` likewise: its module path is its
19
+ // path under `tests/<dossier>/` (`main.rs` none, `mod.rs` its folder's). A target
20
+ // `tests/<nom>.rs`: the verdict gives it all its binary's tests, so its out-of-line modules are
21
+ // read too, as rustc finds them (`<nom>.rs` beside it or `<nom>/mod.rs`, a module of `<f>.rs`
22
+ // under `<f>/`).
21
23
  import path from 'node:path';
22
24
 
23
25
  // The text <t> with its comments, strings and character literals read as blanks.
@@ -130,8 +132,9 @@ export function lireLeFichier(texte) {
130
132
 
131
133
  /**
132
134
  * The names of the tests of HEAD's version of the test file <chemin> (from the root), as the
133
- * verdict names them: with <module>, a unit test file of `src/`, its module path under `src/`;
134
- * without (null), a target `tests/<dossier>/main.rs`, its out-of-line modules read too. <lire>
135
+ * verdict names them: with <module>, a unit test file of `src/` or a file of a target
136
+ * `tests/<dossier>/main.rs`, its module path; without (null), a target `tests/<nom>.rs`, its
137
+ * out-of-line modules read too. <lire>
135
138
  * gives HEAD's text of a file from the root, null for none. Null when HEAD does not hold <chemin>.
136
139
  * @param {string} chemin
137
140
  * @param {string[] | null} module
@@ -2,6 +2,9 @@
2
2
  // (scripts/jointure.d.ts): what ./commandes.mjs left in the results directory of a pass
3
3
  // (`GRILLHOUSE_RESULTATS`, scripts/resultats.mjs).
4
4
  //
5
+ // - The tasks are those of the summary of the task runner (`tachesDuVerdict`, scripts/taches-du-graphe.mjs), a crate or a
6
+ // project the cache replayed included (`code` 0, no report); a task below that the summary
7
+ // lacks is added.
5
8
  // - `<dossier>/cargo/<run>.json`, one per run: `{ taches, cibles }`, each task as the join types
6
9
  // it (`code` null for a task planned that did not run; `tests` true for the runs of nextest and
7
10
  // of the doctests; `journal`, from the root, the log of the task `build`, the build of a crate's
@@ -12,9 +15,12 @@
12
15
  // `failure` or an `error`, skipped when it holds `skipped`; its message, the failure's. A unit
13
16
  // test of a module `tests` that lives in a file of its own (`server::tests::relais`, in
14
17
  // `src/server/tests.rs` beside the library's root, grillhouse-agr) gives that file, so that the
15
- // proof of the red finds the result of a new tests.rs.
18
+ // proof of the red finds the result of a new tests.rs; so does a test of a module of a target
19
+ // `tests/<dossier>/main.rs` (`foo::bar`, in `tests/it/foo.rs`, grillhouse-pkl.9), each test file
20
+ // of `tests/it/` a module of the crate's one executable.
16
21
  import { existsSync, readdirSync, readFileSync } from 'node:fs';
17
22
  import path from 'node:path';
23
+ import { tachesDuVerdict } from '../../services-du-noyau.mjs';
18
24
 
19
25
  export const TACHES = 'cargo';
20
26
  export const JUNIT = 'nextest';
@@ -49,20 +55,36 @@ const attribut = (balise, nom) => {
49
55
  return m ? texte(m[1]) : null;
50
56
  };
51
57
 
52
- // The file of the unit test <nom> (its module path, `server::tests::relais`) of the binary whose
53
- // root is <racine>: the file of its module `tests` that exists, as rustc finds a module's file
54
- // from its crate root's folder — `server/tests.rs` or `server/tests/mod.rs`, a module under it
55
- // `server/tests/<m>.rs` or `server/tests/<m>/mod.rs`, the deepest first; <racine> for a test of
56
- // no such file (an inline module).
58
+ // Whether <racine> is the root of a test target `tests/<dossier>/main.rs`, whose test files are
59
+ // its modules (`tests/it/main.rs`, ./executables-de-tests.mjs).
60
+ const racineDeDossier = racine =>
61
+ path.basename(racine) === 'main.rs' &&
62
+ path.basename(path.dirname(path.dirname(racine))) === 'tests';
63
+
64
+ // The file of the test <nom> (its module path) of the binary whose root is <racine>, as rustc
65
+ // finds a module's file from its crate root's folder, the deepest that exists first: for a target
66
+ // `tests/<dossier>/main.rs`, the file of its module (`foo::bar` in `tests/<dossier>/foo.rs` or
67
+ // `foo/mod.rs`, `foo::sous::bar` in `foo/sous.rs` or `foo/sous/mod.rs`); for a unit test, the file
68
+ // of its module `tests` (`server::tests::relais` in `server/tests.rs` or `server/tests/mod.rs`, a
69
+ // module under it `server/tests/<m>.rs` or `server/tests/<m>/mod.rs`); <racine> for a test of no
70
+ // such file (an inline module, a test of the root).
57
71
  function fichierDuTest(racine, nom) {
58
72
  const parts = nom.split('::').slice(0, -1);
59
- const k = parts.indexOf('tests');
60
- if (k < 0) {
61
- return racine;
73
+ // The folder of the module files and the module path under it; the lowest depth that is a file.
74
+ let dossier;
75
+ let sous;
76
+ let min;
77
+ if (racineDeDossier(racine)) {
78
+ [dossier, sous, min] = [path.dirname(racine), parts, 1];
79
+ } else {
80
+ const k = parts.indexOf('tests');
81
+ if (k < 0) {
82
+ return racine;
83
+ }
84
+ dossier = path.join(path.dirname(racine), ...parts.slice(0, k + 1));
85
+ [sous, min] = [parts.slice(k + 1), 0];
62
86
  }
63
- const dossier = path.join(path.dirname(racine), ...parts.slice(0, k), 'tests');
64
- const sous = parts.slice(k + 1);
65
- for (let j = sous.length; j >= 0; j--) {
87
+ for (let j = sous.length; j >= min; j--) {
66
88
  const d = path.join(dossier, ...sous.slice(0, j));
67
89
  const candidats = [`${d}.rs`, path.join(d, 'mod.rs')];
68
90
  const trouve = candidats.find(f => existsSync(f));
@@ -74,7 +96,8 @@ function fichierDuTest(racine, nom) {
74
96
  }
75
97
 
76
98
  // The test files of the JUnit report <xml>, each binary's file read in <cibles>, each unit test
77
- // under its own file (`fichierDuTest`).
99
+ // and each test of a module of a target `tests/<dossier>/main.rs` under its own file
100
+ // (`fichierDuTest`).
78
101
  function rapportsDe(xml, cibles) {
79
102
  const out = [];
80
103
  for (const s of xml.matchAll(/<testsuite\b([^>]*?)(?:\/>|>([\s\S]*?)<\/testsuite>)/g)) {
@@ -121,6 +144,9 @@ export function verdict(dossier) {
121
144
  rapports: fichiers(path.join(dossier, JUNIT), '.xml').flatMap(f =>
122
145
  rapportsDe(readFileSync(f, 'utf8'), cibles)
123
146
  ),
124
- taches: runs.flatMap(r => r.taches ?? []),
147
+ taches: tachesDuVerdict(
148
+ dossier,
149
+ runs.flatMap(r => r.taches ?? [])
150
+ ),
125
151
  };
126
152
  }
@@ -68,7 +68,9 @@
68
68
  // its end, a failed test included, never `mkdtemp` by hand.
69
69
  // - Python writes its bytecode under one tree at the root, `__pycache__` (PYTHONPYCACHEPREFIX),
70
70
  // which the envelope makes proper to the session (`sorties.propres` of ./index.mjs); uv the
71
- // environment of each package under `.venv/<dossier>` at the root (UV_PROJECT_ENVIRONMENT), and
71
+ // environment of each package under `.venv/<dossier>` at the root (UV_PROJECT_ENVIRONMENT; the
72
+ // tree of HEAD's version of the proof of the red, which `uv run --locked` reconciles with its own
73
+ // manifest and lock, reuses the copy's, under the folder `GRILLHOUSE_VENV_DE_LA_COPIE` names), and
72
74
  // pytest its cache under `.pytest_cache/<dossier>` (`cache_dir`), where the envelope opens them
73
75
  // in writing, rather than in the package's folder, which a session whose plan does not write the
74
76
  // package could not write; uv its cache under ~/.cache/grillhouse/uv (UV_CACHE_DIR), the frame's
@@ -133,6 +135,8 @@ export const DE_NUIT = '*_nuit_test.py';
133
135
  export const PYCACHE = '__pycache__';
134
136
  /** The environments of uv and the caches of pytest, one per package, at the root. */
135
137
  export const VENV = '.venv';
138
+ /** The variable by which a tree of HEAD's version receives the copy's folder of environments. */
139
+ export const VENV_DE_LA_COPIE = 'GRILLHOUSE_VENV_DE_LA_COPIE';
136
140
  export const CACHE_DE_PYTEST = '.pytest_cache';
137
141
 
138
142
  /** The guards of the module: each its name and its script beside this one. */
@@ -204,7 +208,12 @@ function passe(racine, env) {
204
208
  // <vert>, the codes that count green beside 0.
205
209
  jouer({ t, args, cwd, programme }, vert = []) {
206
210
  // The environment of uv of the package, at the root (`sorties` of ./index.mjs).
207
- const venv = path.join(racine, VENV, path.relative(racine, cwd));
211
+ // A tree of HEAD's version receives the copy's folder of environments (`GRILLHOUSE_VENV_DE_LA_COPIE`)
212
+ // and reuses its environment of the package.
213
+ const venv = path.join(
214
+ environnement[VENV_DE_LA_COPIE] || path.join(racine, VENV),
215
+ path.relative(racine, cwd)
216
+ );
208
217
  const r = spawnSync(programme, args, {
209
218
  cwd,
210
219
  env: { ...environnement, UV_PROJECT_ENVIRONMENT: venv },
@@ -421,6 +430,9 @@ function verifier(racine, args, env) {
421
430
  tests: testsCibles({ arguments: [], force: args.includes('--tout') }),
422
431
  env,
423
432
  });
433
+ if (code !== 0) {
434
+ process.stderr.write('⛔ rouge.\n');
435
+ }
424
436
  return code === 0 ? 0 : 1;
425
437
  }
426
438
 
@@ -10,7 +10,8 @@
10
10
  // version (`binaires`, ./binaires.json). What uv, pytest and Python write in a project: `.venv`,
11
11
  // `.pytest_cache`, `__pycache__` (`ignorer`).
12
12
  // - Where they write, which the envelope opens to a session (`sorties`): in writing, `.venv` and
13
- // `.pytest_cache` at the root, where the commands make uv and pytest write for each package
13
+ // `.pytest_cache` at the root (the tree of HEAD's version of the proof of the red reuses the uv
14
+ // environment of the copy, `GRILLHOUSE_VENV_DE_LA_COPIE`, `envDArbre`), where the commands make uv and pytest write for each package
14
15
  // (./commandes.mjs), and uv's cache, `~/.cache/grillhouse/uv` (UV_CACHE_DIR, ./commandes.mjs: the
15
16
  // frame's caches of compilation, never in the temporary directory); proper to the session, the
16
17
  // tree of the bytecode at the root, `__pycache__` (PYTHONPYCACHEPREFIX, ./commandes.mjs); read,
@@ -34,7 +35,7 @@ import { readFileSync } from 'node:fs';
34
35
  import path from 'node:path';
35
36
  import { fileURLToPath } from 'node:url';
36
37
  import { avecLeFichierDuPoste, empreintesDesTaches } from '../../services-du-noyau.mjs';
37
- import { commandes, GARDES, PYCACHE } from './commandes.mjs';
38
+ import { commandes, GARDES, PYCACHE, VENV, VENV_DE_LA_COPIE } from './commandes.mjs';
38
39
  import {
39
40
  composantDans,
40
41
  composants,
@@ -58,6 +59,8 @@ const ici = nom => path.join(path.dirname(fileURLToPath(import.meta.url)), nom);
58
59
 
59
60
  export default {
60
61
  nom: 'python',
62
+ // The expected size of a copy before any is measured: its .venv, about 0.1 GB (2026-11-11).
63
+ tailleDUneCopie: 1024 ** 3,
61
64
  manifeste: 'pyproject.toml',
62
65
  nomDuManifeste,
63
66
  liensDuManifeste,
@@ -107,8 +110,13 @@ export default {
107
110
  // A night test, `*_nuit_test.py` (`estDeNuit`).
108
111
  horsDuJour: chemin => estDeNuit(path.basename(chemin)),
109
112
  arbreDAvant,
110
- // Its tree needs no environment of its own: the virtual environment of a tree is uv's.
111
- envDArbre: () => ({}),
113
+ // Its tree reuses the uv environment of the copy: the folder of the environments, `<copie>/.venv`,
114
+ // under `GRILLHOUSE_VENV_DE_LA_COPIE`, the same for every file of a package (uv reconciles it with
115
+ // the manifest and lock of the tree, `uv run --locked`); a file out of every package gets none.
116
+ envDArbre: (chemin, racine) =>
117
+ composantDans(composants(racine), racine, chemin)
118
+ ? { [VENV_DE_LA_COPIE]: path.join(racine, VENV) }
119
+ : {},
112
120
  // Its tool plays HEAD's version of each test file in a tree (`arbreDAvant`): no name to read.
113
121
  testsDeHead: () => null,
114
122
  manifestes,