@roomi-fields/grillhouse 0.32.0 → 0.33.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 (116) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +22 -0
  3. package/bin/grillhouse.mjs +6 -4
  4. package/cadre/templates/projet/.github/workflows/ci.yml +136 -16
  5. package/cadre/templates/projet/.github/workflows/nuit.yml +111 -0
  6. package/cadre/templates/projet/deployment/docs/01-INSTALL.md +4 -4
  7. package/cadre/templates/projet/package.json +2 -2
  8. package/charte.md +8 -5
  9. package/dist/temporal/circuit/contrat.d.ts +15 -0
  10. package/dist/temporal/circuit/deroule.js +37 -14
  11. package/dist/temporal/circuit/deroule.js.map +1 -1
  12. package/dist/temporal/deroules.d.ts +1 -0
  13. package/dist/temporal/deroules.js +3 -1
  14. package/dist/temporal/deroules.js.map +1 -1
  15. package/dist/temporal/file/activites.d.ts +1 -0
  16. package/dist/temporal/file/activites.js +5 -2
  17. package/dist/temporal/file/activites.js.map +1 -1
  18. package/dist/temporal/file/contrat.d.ts +50 -33
  19. package/dist/temporal/file/contrat.js +2 -2
  20. package/dist/temporal/file/contrat.js.map +1 -1
  21. package/dist/temporal/file/deroule.d.ts +3 -1
  22. package/dist/temporal/file/deroule.js +128 -26
  23. package/dist/temporal/file/deroule.js.map +1 -1
  24. package/dist/temporal/nuits/activites.d.ts +10 -0
  25. package/dist/temporal/nuits/activites.js +114 -0
  26. package/dist/temporal/nuits/activites.js.map +1 -0
  27. package/dist/temporal/nuits/appel.d.ts +23 -0
  28. package/dist/temporal/nuits/appel.js +40 -0
  29. package/dist/temporal/nuits/appel.js.map +1 -0
  30. package/dist/temporal/nuits/choix.d.ts +14 -0
  31. package/dist/temporal/nuits/choix.js +119 -0
  32. package/dist/temporal/nuits/choix.js.map +1 -0
  33. package/dist/temporal/nuits/client.d.ts +28 -0
  34. package/dist/temporal/nuits/client.js +83 -0
  35. package/dist/temporal/nuits/client.js.map +1 -0
  36. package/dist/temporal/nuits/commande.d.ts +2 -0
  37. package/dist/temporal/nuits/commande.js +107 -0
  38. package/dist/temporal/nuits/commande.js.map +1 -0
  39. package/dist/temporal/nuits/contrat.d.ts +98 -0
  40. package/dist/temporal/nuits/contrat.js +30 -0
  41. package/dist/temporal/nuits/contrat.js.map +1 -0
  42. package/dist/temporal/nuits/deroule.d.ts +5 -0
  43. package/dist/temporal/nuits/deroule.js +100 -0
  44. package/dist/temporal/nuits/deroule.js.map +1 -0
  45. package/dist/temporal/travailleur.js +4 -1
  46. package/dist/temporal/travailleur.js.map +1 -1
  47. package/docs/ARCHITECTURE.md +186 -45
  48. package/docs/CADRE.md +31 -1
  49. package/docs/INTERFACE.md +45 -6
  50. package/hooks/register.tsx +11 -3
  51. package/package.json +4 -1
  52. package/scripts/abi-des-dependances.mjs +105 -0
  53. package/scripts/activites.mjs +94 -41
  54. package/scripts/aiguillage.mjs +1 -0
  55. package/scripts/avancement.mjs +8 -18
  56. package/scripts/ci-des-branches.mjs +91 -0
  57. package/scripts/circuit.mjs +79 -4
  58. package/scripts/composants-affectes.mjs +24 -7
  59. package/scripts/composition-des-langages.mjs +3 -0
  60. package/scripts/crochets.mjs +4 -0
  61. package/scripts/enveloppe/enveloppe.mjs +3 -1
  62. package/scripts/enveloppe/lancer.sh +1 -1
  63. package/scripts/enveloppe/travail-de-la-copie.mjs +219 -59
  64. package/scripts/etapes.mjs +18 -1
  65. package/scripts/faits-du-circuit.mjs +43 -20
  66. package/scripts/fichier-du-poste.mjs +87 -0
  67. package/scripts/grillhouse-maj.mjs +15 -1
  68. package/scripts/integration/file.mjs +215 -275
  69. package/scripts/integration/integrer.mjs +82 -41
  70. package/scripts/integration/rejeu.mjs +13 -64
  71. package/scripts/jointure.d.ts +26 -2
  72. package/scripts/langages/cargo/commandes.mjs +81 -19
  73. package/scripts/langages/cargo/exemples.mjs +2 -2
  74. package/scripts/langages/cargo/index.mjs +11 -5
  75. package/scripts/langages/cargo/tailles-des-tests.mjs +19 -11
  76. package/scripts/langages/python/commandes.mjs +11 -7
  77. package/scripts/langages/python/exemples.mjs +1 -1
  78. package/scripts/langages/python/index.mjs +9 -2
  79. package/scripts/langages/python/tailles-des-tests.mjs +19 -11
  80. package/scripts/langages/typescript/code-mort.mjs +41 -24
  81. package/scripts/langages/typescript/consommateurs.mjs +28 -17
  82. package/scripts/langages/typescript/exemples.mjs +2 -0
  83. package/scripts/langages/typescript/index.mjs +22 -3
  84. package/scripts/langages/typescript/migrations/0.33.0-binaire-de-jour.mjs +34 -0
  85. package/scripts/langages/typescript/migrations/0.33.0-tests-du-poste.mjs +31 -0
  86. package/scripts/langages/typescript/resumes.mjs +17 -7
  87. package/scripts/langages/typescript/tailles-des-tests.mjs +251 -22
  88. package/scripts/langages/typescript/tests-de-nuit.mjs +101 -9
  89. package/scripts/langages/typescript/tests-du-poste.mjs +172 -0
  90. package/scripts/langages/typescript/tranches.mjs +273 -0
  91. package/scripts/langages/typescript/verifier.mjs +131 -29
  92. package/scripts/langages/typescript/vitest-config/cibles.mjs +78 -7
  93. package/scripts/langages/typescript/vitest-config/lances.mjs +4 -4
  94. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +9 -0
  95. package/scripts/langages/typescript/vitest.nuit.config.mjs +3 -2
  96. package/scripts/lint-des-scripts.mjs +23 -6
  97. package/scripts/migrations/0.33.0-cache-distant.mjs +36 -0
  98. package/scripts/migrations/0.33.0-ci-des-branches-de-ticket.mjs +31 -0
  99. package/scripts/migrations/0.33.0-ci-du-cadre.mjs +31 -0
  100. package/scripts/migrations/0.33.0-node-26.mjs +58 -0
  101. package/scripts/migrations.mjs +8 -0
  102. package/scripts/newday.mjs +18 -0
  103. package/scripts/nuit.sh +35 -17
  104. package/scripts/registre.d.mts +90 -0
  105. package/scripts/registre.mjs +28 -3
  106. package/scripts/reprise.mjs +12 -8
  107. package/scripts/services-du-noyau.mjs +4 -0
  108. package/scripts/session-start.sh +28 -32
  109. package/scripts/sous-commandes.mjs +29 -10
  110. package/scripts/tableau.mjs +124 -17
  111. package/scripts/taches-du-graphe.mjs +39 -6
  112. package/scripts/transitions.mjs +42 -3
  113. package/scripts/verrou-de-machine.mjs +1 -2
  114. package/scripts/workflows-du-cadre.mjs +75 -0
  115. package/skills/grill/SKILL.md +8 -6
  116. package/skills/pitmaster/SKILL.md +5 -4
@@ -36,22 +36,11 @@
36
36
  // file and the manifests the lot leaves (`npm ci`, as the continuous integration runs it); an
37
37
  // install that fails refuses the lot, « Les dépendances de la copie ne s'installent pas. »;
38
38
  // then the references regenerate (below);
39
- // 6. the tests: the preparation the module of the language describes, when it describes one
40
- // (`preparer`, cargo's `cargo fetch --locked`), then `npm run verifier` in the copy, one
41
- // command (TypeScript's, by Turborepo: the build, then the
42
- // guards, the frame's and the project's own (its root script `gardes`), and every test of the
43
- // day beside each other, each task replayed from the cache of the
44
- // main tree when its inputs are unchanged). Green is required: main stays green, and nothing is compared with a base. A test
45
- // known red is put in quarantine in the test itself (`it.skip` or `it.fails`, with its
46
- // ticket), as a mature continuous integration does; the integration admits none. A
47
- // `npm run verifier` « à repasser » (75: the wait for the lock of the machine reached its
48
- // bound, scripts/verrou-de-machine.mjs) is neither green nor red: the run stops there, exit 75,
49
- // nothing committed and nothing refused, the lot where it was, for the same command again;
50
- // any other code than 0 refuses;
51
- // 7. the commit in the copy, its hooks included, under GRILLHOUSE_INTEGRATION=1: a pre-commit
52
- // hook that plays the guards skips them, as step 6 just played them; the commit validated is
53
- // the commit that enters;
54
- // 8. the branch `agent/<ticket>` is set on that commit, the ticket's copy follows it and is
39
+ // 6. the commit in the copy, its hooks included, under GRILLHOUSE_INTEGRATION=1: a pre-commit
40
+ // hook that plays the guards skips them, as the CI of the ticket's branch plays them; nothing
41
+ // is verified here: the queue pushes the branch, and its CI judges the lot before main moves
42
+ // (scripts/integration/file.mjs); the commit committed is the commit the CI judges;
43
+ // 7. the branch `agent/<ticket>` is set on that commit, the ticket's copy follows it and is
55
44
  // removed by `scripts/retirer-copie.sh` (no `--jetable`; `--garder-travail`: the working
56
45
  // directory of the ticket's circuit, `<copie>.travail`, stays for the circuit that still runs,
57
46
  // and the queue removes it at the ticket's closure): a refusal, a locked copy for
@@ -66,7 +55,7 @@
66
55
  // scripts/engendres.mjs reads them). As a genrule of Bazel writes its output again on the merged
67
56
  // tree, and npm install writes package-lock.json again after a merge, a file of the lot a reference
68
57
  // writes in full is not applied: main's version stays, and each reference whose files or reads the
69
- // lot touches plays in the copy, on main of the moment, after the install and before the tests,
58
+ // lot touches plays in the copy, on main of the moment, after the install and before the commit,
70
59
  // through the mounts, with the tools of the project, and what it writes enters the commit
71
60
  // (`regenerer` of scripts/engendres.mjs; BPScript 320.30: refused twice for the one conflict on the
72
61
  // index of the interfaces; OSC Bridge, 2026-10-31: four conflicts in one day on the generated files
@@ -84,7 +73,10 @@
84
73
  // The main tree is not touched. The duration is written at the end.
85
74
  // One integration runs at a time (`.git/integration.lock`): another waits for the end of the
86
75
  // running one; a lock whose process is gone is taken over. Exit code: 0 committed, 1 refused,
87
- // 2 usage, 75 à repasser.
76
+ // 2 usage.
77
+ // Called without a lot to apply (neither `--tests` nor `--code`), it does not commit: the lot is
78
+ // already on main (`lotSurMain`, exit 0, nothing done) or it is refused by the name `lot-absent`
79
+ // (exit 1), the same rule the circuit's resumption reads (scripts/activites.mjs, grillhouse-bf5.2).
88
80
  import { spawnSync } from 'node:child_process';
89
81
  import { existsSync, readFileSync } from 'node:fs';
90
82
  import path from 'node:path';
@@ -92,12 +84,12 @@ import { pathToFileURL } from 'node:url';
92
84
  import { arbitrageTranche, estArbitrage } from '../arbitrages.mjs';
93
85
  import { couvertPar, engendresDe, regenerer, touchesPar } from '../engendres.mjs';
94
86
  import { langageDe } from '../langages.mjs';
87
+ import { commitsDelivering, gitLog } from '../un-commit-par-ticket.mjs';
95
88
  import { avecLesDonnees, donneesDe } from '../donnees-cles.mjs';
96
89
  import { avecLesOutils, outilsDe } from '../outils-cles.mjs';
97
90
  import { lacherVerrou, prendreVerrou } from '../verrou-de-fichier.mjs';
98
91
  import { ouvrirCopie, RETIRER_COPIE } from './rejeu.mjs';
99
92
  import { verdictDe } from './verdict.mjs';
100
- import { A_REPASSER } from '../codes-de-sortie.mjs';
101
93
  import { ouvrirBase } from '../mesure/base-de-passe.mjs';
102
94
 
103
95
  // A file name as git writes it in a patch: a name with a character outside ASCII, a quote, a
@@ -177,8 +169,57 @@ export function refusLots(tests, code, racine) {
177
169
  return null;
178
170
  }
179
171
 
180
- // The options, or { faute } for a usage error.
181
- function lire(argv) {
172
+ /**
173
+ * The commit of main that holds the lot of <ticket>, or null: the one rule that says a lot is on
174
+ * main, which the queue (scripts/integration/file.mjs) and the circuit's resumption
175
+ * (scripts/activites.mjs) import as they import `refusArbitrage`, as a merge queue knows an entry
176
+ * already merged (Zuul). Two ways name the same commit on main:
177
+ * (a) the tip of the branch `agent/<ticket>` is an ancestor of main (`git merge-base --is-ancestor`,
178
+ * the tip the delivered commit) and that commit names the ticket as `messageDeCommit` writes it,
179
+ * `(<ticket>)` — a lot the queue entered by fast-forward; its tip naming the ticket keeps a fresh
180
+ * branch sitting at a commit of main (lancer.sh creates it there, no lot yet) from being taken
181
+ * for a delivered lot (grillhouse-bf5.2.1);
182
+ * (b) a commit of main whose message names the ticket (`commitsDelivering`, the prefix read from bd,
183
+ * a withdrawn one left out) — a lot the queue rebased or merged in a squash, its branch gone or
184
+ * left behind.
185
+ * <o> is `{ racine, principale, bd }` over the main tree.
186
+ */
187
+ export function lotSurMain(o, ticket) {
188
+ const { racine, bd } = o;
189
+ const git = (...a) => spawnSync('git', ['-C', racine, ...a], { encoding: 'utf8' });
190
+ const principale =
191
+ o.principale ?? (git('symbolic-ref', '--short', '-q', 'HEAD').stdout.trim() || 'main');
192
+ const refMain = `refs/heads/${principale}`;
193
+ const surMain = sha =>
194
+ Boolean(sha) && git('merge-base', '--is-ancestor', sha, refMain).status === 0;
195
+ // (a) the delivered tip of the branch, on main and naming the ticket.
196
+ const tip = git(
197
+ 'rev-parse',
198
+ '--verify',
199
+ '-q',
200
+ `refs/heads/agent/${ticket}^{commit}`
201
+ ).stdout.trim();
202
+ if (surMain(tip) && git('show', '-s', '--format=%s', tip).stdout.includes(`(${ticket})`)) {
203
+ return tip;
204
+ }
205
+ // (b) a commit of main that names the ticket, the queue's rebase or squash.
206
+ const prefixe = bd('config', 'get', 'issue_prefix').stdout?.trim() ?? '';
207
+ return (
208
+ commitsDelivering(ticket, prefixe, gitLog(racine))
209
+ .map(c => git('rev-parse', '--verify', '-q', `${c}^{commit}`).stdout.trim())
210
+ .find(surMain) ?? null
211
+ );
212
+ }
213
+
214
+ // The refusal « lot-absent » for <ticket>: no lot to apply (neither --tests nor --code) and no
215
+ // commit of the ticket on main. The one text, which the integrator's direct call and the circuit's
216
+ // resumption both give, the name `lot-absent` first.
217
+ export const refusLotAbsent = ticket =>
218
+ `lot-absent : ${ticket} n'a aucun lot à appliquer (ni --tests ni --code) et aucun commit de ce ticket n'est sur main.`;
219
+
220
+ // The options, or { faute } for a usage error: a ticket always, a message with a lot to apply;
221
+ // without a lot (neither --tests nor --code), the call is judged by `lotSurMain` (see `main`).
222
+ export function lire(argv) {
182
223
  const o = { ticket: null, tests: null, code: null, message: null, references: null };
183
224
  for (let i = 0; i < argv.length; i++) {
184
225
  const v = argv[i + 1];
@@ -212,7 +253,7 @@ function lire(argv) {
212
253
  return { faute: null };
213
254
  }
214
255
  }
215
- if (!o.ticket || !o.message || !(o.tests || o.code)) {
256
+ if (!o.ticket || ((o.tests || o.code) && !o.message)) {
216
257
  return { faute: null };
217
258
  }
218
259
  return o;
@@ -284,6 +325,19 @@ function main(argv) {
284
325
  };
285
326
  const absolu = p => path.resolve(p);
286
327
 
328
+ // Without a lot to apply (neither --tests nor --code): the lot is already on main, nothing to
329
+ // commit (exit 0), or it is absent and the call is refused by its name `lot-absent` — the same
330
+ // rule `lotSurMain` the circuit's resumption reads, not the usage (exit 2), so a resumption that
331
+ // finds no lot and no commit on main gets the one named refusal.
332
+ if (!(o.tests || o.code)) {
333
+ const entre = lotSurMain({ racine, bd }, o.ticket);
334
+ if (!entre) {
335
+ return refuser(refusLotAbsent(o.ticket));
336
+ }
337
+ dire(`✓ le commit ${entre.slice(0, 7)} de ${o.ticket} est déjà sur main`);
338
+ return 0;
339
+ }
340
+
287
341
  // One integration at a time: a second waits for the end of the first; a lock whose process is
288
342
  // gone is taken over.
289
343
  const verrou = path.join(commun, 'integration.lock');
@@ -402,7 +456,7 @@ function main(argv) {
402
456
  if (ouverte.refus) {
403
457
  return refuser(ouverte.refus);
404
458
  }
405
- const { dansCopie, monter, installer, tester } = ouverte;
459
+ const { dansCopie, monter, installer } = ouverte;
406
460
 
407
461
  // 5. The lots, applied in the copy without the files a reference writes in full, then
408
462
  // installed, then the references regenerated.
@@ -443,23 +497,10 @@ function main(argv) {
443
497
  dire(`✓ références régénérées sur main à jour : ${aRegenerer.map(r => r.nom).join(', ')}`);
444
498
  }
445
499
 
446
- // 6. The tests: the build, the guards and every test of the day, green required.
447
- dire('— npm run verifier (construction, gardes, tests)');
448
- const verdict = tester({ sorte: 'Intégration', ticket: o.ticket }).status;
449
- if (verdict === A_REPASSER) {
450
- dire(
451
- `⏱ À repasser (code ${A_REPASSER}) : l'attente de la machine a atteint sa borne. Le lot n'est ni commis ni refusé ; relance la même commande.`
452
- );
453
- return A_REPASSER;
454
- }
455
- if (verdict !== 0) {
456
- return refuser('Les tests refusent le lot (sortie ci-dessus).');
457
- }
458
- dire('✓ tests');
459
-
460
- // 7. The commit, in the copy: the commit validated is the commit that enters.
461
- // The guards have just run (in `npm run verifier`): a pre-commit hook that plays them skips them under
462
- // GRILLHOUSE_INTEGRATION=1; commit-msg (a closed ticket refuses a second commit, a reopened one takes its corrections) runs as always.
500
+ // 6. The commit, in the copy: the commit committed is the commit the CI of the branch judges.
501
+ // The guards run in that CI: a pre-commit hook that plays them skips them under
502
+ // GRILLHOUSE_INTEGRATION=1; commit-msg (a closed ticket refuses a second commit, a reopened one
503
+ // takes its corrections) runs as always.
463
504
  const c = spawnSync(
464
505
  'bash',
465
506
  monter('git', '-C', copie, 'commit', '-q', '-F', absolu(o.message)),
@@ -473,7 +514,7 @@ function main(argv) {
473
514
  }
474
515
  const commit = dansCopie('rev-parse', 'HEAD').stdout.trim();
475
516
 
476
- // 8. The branch of the ticket takes the commit; the ticket's copy follows it (it carried the
517
+ // 7. The branch of the ticket takes the commit; the ticket's copy follows it (it carried the
477
518
  // lot, which the commit now holds) and is removed; the ticket is labelled `en-file`.
478
519
  const pose = git('update-ref', `refs/heads/${branche}`, commit);
479
520
  if (pose.status !== 0) {
@@ -1,12 +1,12 @@
1
- // The replay of a lot in a clean copy, shared by the integration (scripts/integration/integrer.mjs,
1
+ // The clean copy a lot is replayed in, shared by the integration (scripts/integration/integrer.mjs,
2
2
  // a lot on the main of the moment) and the queue (scripts/integration/file.mjs, a branch replaced
3
- // on the main of the moment): the copy made ready, the project's commands, its tests.
3
+ // on the main of the moment): the copy made ready and the project's commands. Neither verifies
4
+ // there: the CI of the ticket's branch judges the lot (scripts/integration/file.mjs).
4
5
  //
5
6
  // - `ouvrirCopie` makes the copy <copie> ready on <ref>: detached, every untracked file removed, its
6
7
  // submodules set (`scripts/sous-modules.sh`, a local modification overwritten; a submodule the
7
8
  // project shares, `grillhouse.partage`, is linked to the main repository's instead), its
8
- // dependencies made to agree with its lock file and manifests (below). It builds nothing: the
9
- // tests build. An existing copy that does not get ready is removed by
9
+ // dependencies made to agree with its lock file and manifests (below). It builds nothing. An existing copy that does not get ready is removed by
10
10
  // `scripts/retirer-copie.sh --jetable` (local work does not hold it, a lock does) and created
11
11
  // again, once; a copy that does not get ready the second time refuses, and so does a removal the
12
12
  // script refuses, with its reason. Every command of the project plays through
@@ -18,19 +18,11 @@
18
18
  // the manifests (every `package.json` git tracks) with the key
19
19
  // `node_modules/.integration-lock`, runs `npm ci` when they differ and writes the key again; a
20
20
  // failing install gives `DEPENDANCES_REFUSEES`, the one form of that refusal. It runs at the
21
- // opening, and the consumer calls `installer` once the lot is in the copy, before the tests: a
22
- // lot that changes the lock file or a manifest is installed as the continuous integration
23
- // installs it (`npm ci` refuses a lock file in disagreement with its manifest). The tests run on
24
- // dependencies in agreement, and they neither read the key nor install.
25
- // - `tester` plays the commands of the verification in the copy (`commandesDeVerification`): the
26
- // preparation the module of its language describes (`preparer` of its `commandes`, cargo's
27
- // `cargo fetch --locked`), as a CI fetches the dependencies of a job before its tests, then
28
- // `npm run verifier`, the command of the module (TypeScript's builds the project with Turborepo,
29
- // then plays its guards and its tests beside each other, each task kept in the cache of the main
30
- // tree, shared by every copy). It gives the result of the first command that is not green, else
31
- // of the last: green (status 0), « à repasser » (75) or red (any other), its output written as it
32
- // comes.
33
- // - Every command of the project run in the copy (`lancer`: the install, the tests) leaves the
21
+ // opening, and the consumer calls `installer` once the lot is in the copy, before the commands
22
+ // that regenerate its files: a lot that changes the lock file or a manifest is installed as the
23
+ // continuous integration installs it (`npm ci` refuses a lock file in disagreement with its
24
+ // manifest).
25
+ // - Every command of the project run in the copy (`lancer`: the install) leaves the
34
26
  // index of its copy up to date, green or red: the consumers that apply a lot with `--index` (the
35
27
  // integration, the queue) read an index that matches the files the command touched, and none
36
28
  // refreshes for its own account.
@@ -39,14 +31,13 @@ import { createHash } from 'node:crypto';
39
31
  import { existsSync, readFileSync, writeFileSync } from 'node:fs';
40
32
  import path from 'node:path';
41
33
  import { fileURLToPath } from 'node:url';
42
- import { langageDe } from '../langages.mjs';
43
34
 
44
35
  const SOUS_MODULES = fileURLToPath(new URL('../sous-modules.sh', import.meta.url));
45
36
  export const RETIRER_COPIE = fileURLToPath(new URL('../retirer-copie.sh', import.meta.url));
46
37
 
47
38
  const VERROU = 'package-lock.json';
48
39
  const DEPENDANCES_REFUSEES = "Les dépendances de la copie ne s'installent pas.";
49
- // The most output a command of the project may write: a whole run of the tests, logs included.
40
+ // The most output a command of the project may write: an install, logs included.
50
41
  const SORTIE_MAX = 256 * 1024 * 1024;
51
42
 
52
43
  // The fingerprint of what `npm ci` reads in <copie>: the lock file at <verrou> and every
@@ -65,24 +56,9 @@ function empreinteDesDependances(copie, verrou, dansCopie) {
65
56
  return h.digest('hex');
66
57
  }
67
58
 
68
- /**
69
- * The commands of the verification of the copy <copie>, in order, each `[commande, args]`: the
70
- * preparation the module of its language describes, when it describes one, then `npm run
71
- * verifier`.
72
- * @param {string} copie the root of the copy
73
- * @returns {[string, string[]][]}
74
- */
75
- export function commandesDeVerification(copie) {
76
- const preparer = langageDe(copie).commandes(copie).preparer;
77
- return [
78
- ...(preparer ? [[process.execPath, [preparer.script, ...preparer.args]]] : []),
79
- ['npm', ['run', 'verifier']],
80
- ];
81
- }
82
-
83
59
  // The copy <copie> ready on <ref>, or `{ refus }`. `dire` writes a progress line. Returns the
84
60
  // copy's tools: `dansCopie` (git in the copy), `monter` (the command line of a mounted command),
85
- // `installer`, `tester`, and `tete`, the commit the copy was made ready on.
61
+ // `installer`, and `tete`, the commit the copy was made ready on.
86
62
  export function ouvrirCopie({ racine, copie, ref, dire }) {
87
63
  const git = (...args) => spawnSync('git', ['-C', racine, ...args], { encoding: 'utf8' });
88
64
  const dansCopie = (...args) => spawnSync('git', ['-C', copie, ...args], { encoding: 'utf8' });
@@ -130,10 +106,9 @@ export function ouvrirCopie({ racine, copie, ref, dire }) {
130
106
  if (montage.status !== 0) {
131
107
  return { refus: montage.stderr.trim() };
132
108
  }
133
- const lancer = (commande, args, envPlus = null) => {
109
+ const lancer = (commande, args) => {
134
110
  const r = spawnSync('bash', monter(commande, ...args), {
135
111
  cwd: copie,
136
- ...(envPlus ? { env: { ...process.env, ...envPlus } } : {}),
137
112
  encoding: 'utf8',
138
113
  maxBuffer: SORTIE_MAX,
139
114
  });
@@ -170,31 +145,5 @@ export function ouvrirCopie({ racine, copie, ref, dire }) {
170
145
  }
171
146
  dire(`✓ copie propre sur ${tete.slice(0, 7)}`);
172
147
 
173
- // The checks of the copy: its preparation, then its verification; the first that is not green
174
- // ends them.
175
- // `identite` (`{ sorte, ticket }`, the ticket null when unknown) is set in the environment of
176
- // `npm run verifier` alone, which names itself so at the lock of the machine; the preparation
177
- // does not receive it.
178
- const tester = identite => {
179
- let r;
180
- const commandes = commandesDeVerification(copie);
181
- for (const [i, [commande, args]] of commandes.entries()) {
182
- const verifier = i === commandes.length - 1 && identite;
183
- r = lancer(
184
- commande,
185
- args,
186
- verifier
187
- ? {
188
- GRILLHOUSE_VERIFICATION_SORTE: identite.sorte,
189
- GRILLHOUSE_VERIFICATION_TICKET: identite.ticket ?? '',
190
- }
191
- : null
192
- );
193
- if (r.status !== 0) {
194
- break;
195
- }
196
- }
197
- return r;
198
- };
199
- return { dansCopie, monter, installer: accorder, tester, tete };
148
+ return { dansCopie, monter, installer: accorder, tete };
200
149
  }
@@ -231,6 +231,11 @@ export interface Composition {
231
231
  * task covers the content of the files it reads and of what it waits for); null when the runner
232
232
  * gives no plan. The fingerprint of a step of the circuit reads them. */
233
233
  empreintes(racine: string, noms: string[]): Record<string, string> | null;
234
+ /** The environment the tools of the language run under on the poste, from `env`: the variables
235
+ * of the file of the poste the module names (`avecLeFichierDuPoste`), the server of the remote
236
+ * cache of its task runner, read-only; `env` itself without the file, or when `env` already
237
+ * names one of its variables (a CI). The commands of the module run under it. */
238
+ environnementDuPoste(env: Record<string, string | undefined>): Record<string, string | undefined>;
234
239
  lecteurs(
235
240
  racine: string,
236
241
  o: { composants: Composant[]; noms: string[]; texte: string; nommes: Composant[] }
@@ -395,6 +400,14 @@ export function dansLeTemporaire(chemin: string, env?: NodeJS.ProcessEnv): boole
395
400
  /** The cache of compilation of `outil`, under `~/.cache/grillhouse/`, never in the temporary
396
401
  * directory. */
397
402
  export function cacheDeCompilation(outil: string, env?: NodeJS.ProcessEnv): string;
403
+ /** The environment <env> with the variables of the file `fichier` of the poste (under
404
+ * `$XDG_CONFIG_HOME/grillhouse/`, `~/.config/grillhouse/` without it), then `ajouts`; <env> itself
405
+ * when the file is absent or <env> already names one of its variables
406
+ * (scripts/fichier-du-poste.mjs). */
407
+ export function avecLeFichierDuPoste<T extends Record<string, string | undefined>>(
408
+ env: T,
409
+ o: { fichier: string; ajouts?: Record<string, string>; lire?: (f: string) => string | null }
410
+ ): T;
398
411
  /** The path of the command <nom> in the PATH of <env>, or null (scripts/commandes-du-path.mjs). */
399
412
  export function trouverDansLePath(nom: string, env?: NodeJS.ProcessEnv): string | null;
400
413
  /** The cache of `outil` for the build rooted at `racine`, swept once `racine` is gone. */
@@ -495,13 +508,24 @@ export function testsCibles(o: {
495
508
  /** The paths and the options of a task of the tests of a package, run by its script: the paths
496
509
  * `donnes` its script names, each replaced by those of the variable `TESTS_CIBLES` of `env` that
497
510
  * lie in the same component (`dossierDe`: the folder of the component of an absolute path, or
498
- * null), and the options of the variable. */
511
+ * null), the options of the variable, and the tranche of a pass it carries, or null. */
499
512
  export function cheminsDeLaTache(o: {
500
513
  racine: string;
501
514
  donnes: string[];
502
515
  env?: NodeJS.ProcessEnv;
503
516
  dossierDe: (absolu: string) => string | null;
504
- }): { chemins: string[]; options: string[] };
517
+ }): { chemins: string[]; options: string[]; tranche: Tranche | null };
518
+ /** A tranche of a pass, the i-th (`index`) of n (`count`) parts of the tests. */
519
+ export interface Tranche {
520
+ index: number;
521
+ count: number;
522
+ }
523
+ /** Whether the tests a tool cannot split play in `tranche`: without a tranche, or in the first. */
524
+ export function joueCeQuiNeSeDivisePas(tranche: Tranche | null | undefined): boolean;
525
+ /** The form of a tranche, `i/n`. */
526
+ export const LA_FORME: string;
527
+ /** The tranche `texte` reads, or null when it is not `i/n` with 1 ≤ i ≤ n. */
528
+ export function lireLaTranche(texte: unknown): Tranche | null;
505
529
  /** The trace tasks of a plan of the runner (`run … --dry=json`, parsed), those `garder` keeps: their
506
530
  * task ids, sorted. */
507
531
  export function tracesDuPlan(
@@ -7,7 +7,6 @@
7
7
  // npx grillhouse tests-du-paquet <chemin>… [--<option>…] tests-du-paquet
8
8
  // npx grillhouse verifier [--tout | --gardes] verifier
9
9
  // node commandes.mjs typer typer
10
- // npx grillhouse preparer preparer
11
10
  // npx grillhouse tests-de-nuit tests-de-nuit
12
11
  // npx grillhouse tailles-des-tests | clippy | frontieres | index-interfaces
13
12
  // each guard, its own script
@@ -34,7 +33,14 @@
34
33
  // (./composants.mjs, `joueDesTests`): the build of its test targets, `cargo test --no-run -p
35
34
  // <crate>`, a task `build` of its own, as Turborepo's `test` depends on `build` (grillhouse-egm);
36
35
  // then `cargo nextest run -p <crate> --no-fail-fast`, which finds them built. Then `cargo test
37
- // --doc -p <crate>` for a crate whose library has doctests, which nextest does not play. A failed
36
+ // --doc -p <crate>` for a crate whose library has doctests, which nextest does not play. Once
37
+ // the tests and the benches played, the run removes the test executables its builds made, each
38
+ // one cargo reports in JSON (`--message-format=json-render-diagnostics`, the `executable` of an
39
+ // artifact of a test profile), as Swatinem/rust-cache keeps the dependencies and drops the
40
+ // workspace's own artifacts: they weighed 3.4 of the 4.6 GiB of a copy of SyntHub
41
+ // (grillhouse-pkl.8), and cargo builds again an executable it misses. The libraries, the
42
+ // dependencies and the binaries of `cargo build` (`target/debug/<bin>`, a datum another package's
43
+ // tests run) stay; only the crate's own task runs its test executables. A failed
38
44
  // build leaves the crate's other tasks not played (`code` null): a test that does not compile is
39
45
  // a red of the build, which the proof of the red reads as one (« construction de <crate> »,
40
46
  // scripts/circuit.mjs), and the tests play at the checks. The output of the build goes to its log,
@@ -85,7 +91,7 @@
85
91
  // - `tests-de-nuit`: the night tests then the benches of each crate that holds some; none, nothing
86
92
  // plays and the code is 0. The night (scripts/nuit.sh) runs it after the full pass, and plays it
87
93
  // again at rest after a 75.
88
- // - `typer`: `cargo check --all-targets`. `preparer`: `cargo fetch --locked`.
94
+ // - `typer`: `cargo check --all-targets`.
89
95
  // - Cargo runs with rustc wrapped by sccache, its cache common to the copies of the machine
90
96
  // (./sccache.mjs), in a copy as in an agent's envelope (grillhouse-cyr), its server started
91
97
  // under the machine's /tmp before each run of cargo that compiles (grillhouse-qmk).
@@ -99,7 +105,7 @@
99
105
  // there what ./verdict.mjs reads: its tasks, each planned before it plays (`code` null until it
100
106
  // ran), and the JUnit report of each run of nextest. A task of the workspace is named after its
101
107
  // root, `//`, as Turborepo names the root's tasks.
102
- // - `tests-du-paquet`, `verifier` and `preparer` refuse, before any run of cargo, a workspace whose
108
+ // - `tests-du-paquet` and `verifier` refuse, before any run of cargo, a workspace whose
103
109
  // Cargo.lock git does not track (grillhouse-rph), in one line that names the file and the
104
110
  // gesture: `git add Cargo.lock`, or `cargo generate-lockfile` first when it is absent. Cargo
105
111
  // recommends committing it for every project, and the verification plays the exact versions of
@@ -136,6 +142,7 @@ import {
136
142
  construireDepuisLesArguments,
137
143
  ecrirePression,
138
144
  GRAPHE_JOUE,
145
+ joueCeQuiNeSeDivisePas,
139
146
  lancerLesTaches,
140
147
  ligneDesRestes,
141
148
  lirePression,
@@ -168,7 +175,6 @@ export const NOMS = [
168
175
  'verifier',
169
176
  'typer',
170
177
  'construire',
171
- 'preparer',
172
178
  'tests-de-nuit',
173
179
  ];
174
180
  // The task runner of the graph of the packages.
@@ -179,9 +185,12 @@ const RACINE = '//';
179
185
  const BUDGET = 'budget';
180
186
  const VERROU = 'Cargo.lock';
181
187
  // The commands that play the exact versions of the repository, refused without its Cargo.lock.
182
- const VERROUILLEES = ['tests-du-paquet', 'verifier', 'preparer', 'tests-de-nuit'];
188
+ const VERROUILLEES = ['tests-du-paquet', 'verifier', 'tests-de-nuit'];
183
189
  // The commands that compile, refused without sccache on the PATH (./sccache.mjs).
184
190
  const COMPILENT = ['tests-du-paquet', 'verifier', 'typer', 'construire', 'tests-de-nuit'];
191
+ // The format of the build of the test targets: the messages of cargo in JSON on its output stream,
192
+ // its diagnostics rendered on its error stream, as without it (`executablesDeTest`).
193
+ const MESSAGES = '--message-format=json-render-diagnostics';
185
194
  // The kinds of a target that are no library.
186
195
  const PAS_UNE_BIBLIOTHEQUE = ['test', 'bin', 'example', 'bench', 'custom-build'];
187
196
 
@@ -288,7 +297,13 @@ function passe(racine, env) {
288
297
  },
289
298
  jouer(
290
299
  { t, args },
291
- { junit = null, journal = null, programme = 'cargo', temporaire = {} } = {}
300
+ {
301
+ junit = null,
302
+ journal = null,
303
+ programme = 'cargo',
304
+ temporaire = {},
305
+ executables = null,
306
+ } = {}
292
307
  ) {
293
308
  // A report of an earlier run is no report of this one, which may write none.
294
309
  if (junit) {
@@ -307,14 +322,20 @@ function passe(racine, env) {
307
322
  mkdirSync(path.dirname(journal), { recursive: true });
308
323
  const fd = openSync(journal, 'w');
309
324
  try {
325
+ // With <executables>, cargo's messages in JSON come on its output stream, read, out of
326
+ // the log (`executablesDeTest`).
310
327
  r = spawnSync(programme, args, {
311
328
  cwd: racine,
312
329
  env: { ...compilation, ...temporaire },
313
- stdio: ['inherit', fd, fd],
330
+ stdio: ['inherit', executables ? 'pipe' : fd, fd],
331
+ maxBuffer: 256 * 1024 * 1024,
314
332
  });
315
333
  } finally {
316
334
  closeSync(fd);
317
335
  }
336
+ if (executables && r.stdout) {
337
+ executables.push(...executablesDeTest(r.stdout.toString('utf8')));
338
+ }
318
339
  process.stderr.write(readFileSync(journal, 'utf8'));
319
340
  t.journal = path.relative(racine, journal);
320
341
  } else {
@@ -355,6 +376,29 @@ function passe(racine, env) {
355
376
  };
356
377
  }
357
378
 
379
+ /**
380
+ * The test executables cargo reports in its messages in JSON <sortie> (`--message-format`, one
381
+ * message a line): the `executable` of each `compiler-artifact` built under a test profile
382
+ * (`profile.test`), fresh or rebuilt; a line that is no message is passed over.
383
+ * @param {string} sortie
384
+ * @returns {string[]}
385
+ */
386
+ export function executablesDeTest(sortie) {
387
+ const vus = [];
388
+ for (const ligne of sortie.split('\n')) {
389
+ let m;
390
+ try {
391
+ m = JSON.parse(ligne);
392
+ } catch {
393
+ continue;
394
+ }
395
+ if (m?.reason === 'compiler-artifact' && m.profile?.test && typeof m.executable === 'string') {
396
+ vus.push(m.executable);
397
+ }
398
+ }
399
+ return vus;
400
+ }
401
+
358
402
  // A red of the time budget benches of the task <t>, the pressures <pressions> measured at its start
359
403
  // and at its end: « à repasser » (75) when one is at or above the threshold, said; else its code
360
404
  // stands, a pressure that does not read said.
@@ -374,13 +418,26 @@ function sousCharge(t, pressions) {
374
418
  t.code = A_REPASSER;
375
419
  }
376
420
 
421
+ /**
422
+ * The arguments of nextest for the tranche <tranche> of a pass (`verifier --tranche i/n`): its own
423
+ * split, `--partition hash:i/n` (each test by the hash of its name, so the n tranches together
424
+ * play each test once), and `--no-tests=warn`, a crate whose part is empty being green; none
425
+ * without a tranche.
426
+ * @param {{ index: number, count: number } | null | undefined} tranche
427
+ * @returns {string[]}
428
+ */
429
+ export const partitionDeNextest = tranche =>
430
+ tranche ? ['--partition', `hash:${tranche.index}/${tranche.count}`, '--no-tests=warn'] : [];
431
+
377
432
  // Plans and plays the tests of the crates <choix> in the run <p>, each `{ c, cibles }`: `cibles`
378
433
  // the test targets named, empty for the whole crate of the day (its night tests and its benches
379
434
  // left out). For a crate that plays tests:
380
435
  // the build of its test targets first, then nextest, then its doctests; a failed build leaves the
381
436
  // crate's other tasks not played. The benches named, each crate's in a task `budget`, are
382
437
  // planned with the rest and played by the function this one returns, after the other tests.
383
- function jouerLesTests(racine, p, choix, options, temporaire = () => ({})) {
438
+ // In a tranche <tranche>, nextest plays its part (`partitionDeNextest`); the doctests and the
439
+ // benches, which nextest does not split, play in the first tranche alone.
440
+ function jouerLesTests(racine, p, choix, options, temporaire = () => ({}), tranche = null) {
384
441
  const m = metadonnees(racine);
385
442
  // Nextest's store is `target/nextest` under the workspace's root (its default `store.dir`),
386
443
  // whatever the target directory of the compilations (./sccache.mjs).
@@ -394,9 +451,12 @@ function jouerLesTests(racine, p, choix, options, temporaire = () => ({})) {
394
451
  // A bench plays on one thread (`--test-threads 1`, which `-j` of nextest is the alias of): it
395
452
  // takes the arguments without `-j`.
396
453
  const nextestDuBanc = [...nextest];
397
- nextest.push(...j);
454
+ nextest.push(...j, ...partitionDeNextest(tranche));
455
+ const indivisible = joueCeQuiNeSeDivisePas(tranche);
398
456
  const parCrate = [];
399
457
  const bancs = [];
458
+ // The test executables the builds of the run report, removed once its tests played.
459
+ const executables = [];
400
460
  for (const { c, cibles: nommees, jour } of choix) {
401
461
  // Targets named beside the day of the crate (`jour`, a unit test of `src/` named): the day
402
462
  // builds whole, and plays besides the targets named.
@@ -416,12 +476,13 @@ function jouerLesTests(racine, p, choix, options, temporaire = () => ({})) {
416
476
  const construction = [
417
477
  'test',
418
478
  '--no-run',
479
+ MESSAGES,
419
480
  ...j,
420
481
  '-p',
421
482
  nom,
422
483
  ...(avecLeJour ? [] : cibles.flatMap(n => ['--test', n])),
423
484
  ];
424
- prevues.push([p.prevoir(nom, d, 'build', false, construction), { journal }]);
485
+ prevues.push([p.prevoir(nom, d, 'build', false, construction), { journal, executables }]);
425
486
  if (cibles.length === 0 || autres.length || avecLeJour) {
426
487
  const duC = duJour(c);
427
488
  const nommes = autres.flatMap(n => ['--test', n]);
@@ -438,7 +499,7 @@ function jouerLesTests(racine, p, choix, options, temporaire = () => ({})) {
438
499
  { junit, temporaire: temporaire(nom) },
439
500
  ]);
440
501
  }
441
- if (desBancs.length) {
502
+ if (desBancs.length && indivisible) {
442
503
  const args = [...nextestDuBanc, '-p', nom, ...desBancs.flatMap(n => ['--test', n])];
443
504
  bancs.push({
444
505
  nom,
@@ -450,7 +511,7 @@ function jouerLesTests(racine, p, choix, options, temporaire = () => ({})) {
450
511
  }
451
512
  }
452
513
  const doctests = c.cibles.some(t => t.kind.includes('lib') && t.doctest !== false);
453
- if ((cibles.length === 0 || avecLeJour) && doctests) {
514
+ if ((cibles.length === 0 || avecLeJour) && doctests && indivisible) {
454
515
  const args = ['test', '--doc', ...j, '-p', nom];
455
516
  prevues.push([p.prevoir(nom, d, 'doctest', true, args), { temporaire: temporaire(nom) }]);
456
517
  }
@@ -475,6 +536,10 @@ function jouerLesTests(racine, p, choix, options, temporaire = () => ({})) {
475
536
  p.jouer(t, { junit, temporaire });
476
537
  }
477
538
  }
539
+ // The copy keeps no test executable between two passes: cargo builds again the one it misses.
540
+ for (const f of executables) {
541
+ rmSync(f, { force: true });
542
+ }
478
543
  };
479
544
  }
480
545
 
@@ -734,10 +799,6 @@ export function lancer(nom, args, { racine = process.cwd(), env = process.env }
734
799
  p.jouer(p.prevoir(RACINE, racine, 'check', false, ['check', '--all-targets']));
735
800
  return p.code();
736
801
  }
737
- if (nom === 'preparer') {
738
- p.jouer(p.prevoir(RACINE, racine, 'fetch', false, ['fetch', '--locked']));
739
- return p.code();
740
- }
741
802
  if (nom === 'verifier') {
742
803
  const dire = l => process.stdout.write(`${l}\n`);
743
804
  try {
@@ -830,7 +891,7 @@ function testsDuPaquet(racine, tous, args, env, parPaquet) {
830
891
  racine,
831
892
  abs
832
893
  )?.dossier ?? null;
833
- const { chemins, options } = cheminsDeLaTache({ racine, donnes, env, dossierDe });
894
+ const { chemins, options, tranche } = cheminsDeLaTache({ racine, donnes, env, dossierDe });
834
895
  const r = choisir(racine, tous, chemins);
835
896
  if (r.refus) {
836
897
  for (const l of r.refus) {
@@ -844,7 +905,8 @@ function testsDuPaquet(racine, tous, args, env, parPaquet) {
844
905
  p,
845
906
  r.choix,
846
907
  [...args.filter(a => a.startsWith('-')), ...options],
847
- parPaquet.temporaire
908
+ parPaquet.temporaire,
909
+ tranche
848
910
  )();
849
911
  restesParPaquet(p, r.choix, parPaquet);
850
912
  return p.code();
@@ -12,7 +12,7 @@
12
12
  // that changes `ws-core`, adds the crate `ws-neuf` and removes `ws-outil`: `lot`; the same, the
13
13
  // interface of `ws-core` then changed, its index late: `enRetard`.
14
14
  // - Each workspace commits its Cargo.lock, the one cargo writes (grillhouse-rph): the commands
15
- // tester, verifier and preparer refuse a workspace whose Cargo.lock git does not track.
15
+ // tester, verifier and tests-de-nuit refuse a workspace whose Cargo.lock git does not track.
16
16
  // - A crate at the root, its workspace `members = ["."]`, with its tests, as OSC Bridge: `seul`;
17
17
  // a crate at the root holding a second crate, `crates/aide`, none with tests: `imbrique`.
18
18
  // - A directory without Cargo.toml: `vide`.
@@ -316,7 +316,7 @@ export default {
316
316
  ],
317
317
  },
318
318
  commandes: {
319
- valide: ['tester', 'verifier', 'typer', 'preparer'],
319
+ valide: ['tester', 'verifier', 'typer', 'tests-de-nuit'],
320
320
  invalide: ['tester', 'deployer'],
321
321
  attendu: ['deployer : absente'],
322
322
  },