@roomi-fields/grillhouse 0.32.0 → 0.33.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 (131) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +32 -0
  3. package/bin/grillhouse.mjs +6 -4
  4. package/cadre/templates/projet/.github/workflows/ci.yml +169 -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/client.d.ts +10 -3
  10. package/dist/temporal/circuit/client.js +8 -4
  11. package/dist/temporal/circuit/client.js.map +1 -1
  12. package/dist/temporal/circuit/contrat.d.ts +25 -0
  13. package/dist/temporal/circuit/contrat.js +31 -0
  14. package/dist/temporal/circuit/contrat.js.map +1 -1
  15. package/dist/temporal/circuit/deroule.js +67 -38
  16. package/dist/temporal/circuit/deroule.js.map +1 -1
  17. package/dist/temporal/commande.js +13 -3
  18. package/dist/temporal/commande.js.map +1 -1
  19. package/dist/temporal/deroules.d.ts +1 -0
  20. package/dist/temporal/deroules.js +3 -1
  21. package/dist/temporal/deroules.js.map +1 -1
  22. package/dist/temporal/file/activites.d.ts +1 -0
  23. package/dist/temporal/file/activites.js +5 -2
  24. package/dist/temporal/file/activites.js.map +1 -1
  25. package/dist/temporal/file/contrat.d.ts +50 -33
  26. package/dist/temporal/file/contrat.js +2 -2
  27. package/dist/temporal/file/contrat.js.map +1 -1
  28. package/dist/temporal/file/deroule.d.ts +3 -1
  29. package/dist/temporal/file/deroule.js +128 -26
  30. package/dist/temporal/file/deroule.js.map +1 -1
  31. package/dist/temporal/installation.d.ts +15 -1
  32. package/dist/temporal/installation.js +57 -15
  33. package/dist/temporal/installation.js.map +1 -1
  34. package/dist/temporal/nuits/activites.d.ts +10 -0
  35. package/dist/temporal/nuits/activites.js +114 -0
  36. package/dist/temporal/nuits/activites.js.map +1 -0
  37. package/dist/temporal/nuits/appel.d.ts +23 -0
  38. package/dist/temporal/nuits/appel.js +40 -0
  39. package/dist/temporal/nuits/appel.js.map +1 -0
  40. package/dist/temporal/nuits/choix.d.ts +14 -0
  41. package/dist/temporal/nuits/choix.js +119 -0
  42. package/dist/temporal/nuits/choix.js.map +1 -0
  43. package/dist/temporal/nuits/client.d.ts +28 -0
  44. package/dist/temporal/nuits/client.js +83 -0
  45. package/dist/temporal/nuits/client.js.map +1 -0
  46. package/dist/temporal/nuits/commande.d.ts +2 -0
  47. package/dist/temporal/nuits/commande.js +107 -0
  48. package/dist/temporal/nuits/commande.js.map +1 -0
  49. package/dist/temporal/nuits/contrat.d.ts +98 -0
  50. package/dist/temporal/nuits/contrat.js +30 -0
  51. package/dist/temporal/nuits/contrat.js.map +1 -0
  52. package/dist/temporal/nuits/deroule.d.ts +5 -0
  53. package/dist/temporal/nuits/deroule.js +100 -0
  54. package/dist/temporal/nuits/deroule.js.map +1 -0
  55. package/dist/temporal/travailleur.js +4 -1
  56. package/dist/temporal/travailleur.js.map +1 -1
  57. package/docs/ARCHITECTURE.md +214 -49
  58. package/docs/CADRE.md +31 -1
  59. package/docs/INTERFACE.md +47 -7
  60. package/hooks/register.tsx +11 -3
  61. package/package.json +4 -1
  62. package/scripts/abi-des-dependances.mjs +105 -0
  63. package/scripts/activites.mjs +113 -42
  64. package/scripts/aiguillage.mjs +1 -0
  65. package/scripts/avancement.mjs +8 -18
  66. package/scripts/ci-des-branches.mjs +91 -0
  67. package/scripts/circuit.mjs +79 -4
  68. package/scripts/circuits-du-serveur.mjs +4 -3
  69. package/scripts/composants-affectes.mjs +24 -7
  70. package/scripts/composition-des-langages.mjs +3 -0
  71. package/scripts/crochets.mjs +4 -0
  72. package/scripts/dernier-vert.mjs +31 -10
  73. package/scripts/enveloppe/enveloppe.mjs +3 -1
  74. package/scripts/enveloppe/lancer.sh +1 -1
  75. package/scripts/enveloppe/travail-de-la-copie.mjs +219 -59
  76. package/scripts/etapes.mjs +18 -1
  77. package/scripts/faits-du-circuit.mjs +43 -20
  78. package/scripts/fichier-du-poste.mjs +87 -0
  79. package/scripts/grillhouse-maj.mjs +15 -1
  80. package/scripts/integration/file.mjs +215 -275
  81. package/scripts/integration/integrer.mjs +82 -41
  82. package/scripts/integration/rejeu.mjs +13 -64
  83. package/scripts/jointure.d.ts +26 -2
  84. package/scripts/langages/cargo/commandes.mjs +81 -19
  85. package/scripts/langages/cargo/exemples.mjs +2 -2
  86. package/scripts/langages/cargo/index.mjs +11 -5
  87. package/scripts/langages/cargo/tailles-des-tests.mjs +19 -11
  88. package/scripts/langages/python/commandes.mjs +11 -7
  89. package/scripts/langages/python/exemples.mjs +1 -1
  90. package/scripts/langages/python/index.mjs +9 -2
  91. package/scripts/langages/python/tailles-des-tests.mjs +19 -11
  92. package/scripts/langages/typescript/code-mort.mjs +41 -24
  93. package/scripts/langages/typescript/consommateurs.mjs +28 -17
  94. package/scripts/langages/typescript/exemples.mjs +2 -0
  95. package/scripts/langages/typescript/index.mjs +22 -3
  96. package/scripts/langages/typescript/migrations/0.33.0-binaire-de-jour.mjs +34 -0
  97. package/scripts/langages/typescript/migrations/0.33.0-tests-du-poste.mjs +31 -0
  98. package/scripts/langages/typescript/resumes.mjs +17 -7
  99. package/scripts/langages/typescript/tailles-des-tests.mjs +251 -22
  100. package/scripts/langages/typescript/tests-de-nuit.mjs +101 -9
  101. package/scripts/langages/typescript/tests-du-poste.mjs +172 -0
  102. package/scripts/langages/typescript/tests.mjs +8 -2
  103. package/scripts/langages/typescript/tranches.mjs +273 -0
  104. package/scripts/langages/typescript/verifier.mjs +140 -31
  105. package/scripts/langages/typescript/vitest-config/changements.mjs +23 -11
  106. package/scripts/langages/typescript/vitest-config/cibles.mjs +78 -7
  107. package/scripts/langages/typescript/vitest-config/lances.mjs +4 -4
  108. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +9 -0
  109. package/scripts/langages/typescript/vitest.nuit.config.mjs +3 -2
  110. package/scripts/lint-des-scripts.mjs +23 -6
  111. package/scripts/migrations/0.33.0-cache-distant.mjs +36 -0
  112. package/scripts/migrations/0.33.0-ci-des-branches-de-ticket.mjs +31 -0
  113. package/scripts/migrations/0.33.0-ci-du-cadre.mjs +31 -0
  114. package/scripts/migrations/0.33.0-node-26.mjs +58 -0
  115. package/scripts/migrations.mjs +8 -0
  116. package/scripts/newday.mjs +18 -0
  117. package/scripts/nuit.sh +35 -17
  118. package/scripts/registre.d.mts +90 -0
  119. package/scripts/registre.mjs +28 -3
  120. package/scripts/reprise.mjs +12 -8
  121. package/scripts/services-du-noyau.mjs +5 -1
  122. package/scripts/session-start.sh +40 -32
  123. package/scripts/sous-commandes.mjs +29 -10
  124. package/scripts/superviseur.mjs +72 -27
  125. package/scripts/tableau.mjs +129 -20
  126. package/scripts/taches-du-graphe.mjs +39 -6
  127. package/scripts/transitions.mjs +42 -3
  128. package/scripts/verrou-de-machine.mjs +1 -2
  129. package/scripts/workflows-du-cadre.mjs +75 -0
  130. package/skills/grill/SKILL.md +8 -6
  131. package/skills/pitmaster/SKILL.md +15 -9
@@ -13,6 +13,8 @@
13
13
  // (scripts/langages.mjs); each other command it describes is a subcommand by its name
14
14
  // (`frontieres`, `index-interfaces`, `typer`, `construire`), as a backend of Pants brings its
15
15
  // goals.
16
+ // - `nuit` runs the build of src/temporal/nuits/commande.ts, which plays the night's pass
17
+ // (`nuit.sh`) when called alone: the script it replaces is that pass (`PASSES`).
16
18
  // - `temporal` runs the build of src/temporal/commande.ts (dist/temporal/commande.js), the
17
19
  // package's TypeScript, which Turborepo builds before the tests and the package publishes.
18
20
  import { existsSync } from 'node:fs';
@@ -48,7 +50,8 @@ export const SOUS_COMMANDES = {
48
50
  journal: 'journal.mjs',
49
51
  'ligne-etat': 'ligne-etat/ligne-etat.mjs',
50
52
  maj: 'grillhouse-maj.mjs',
51
- nuit: 'nuit.sh',
53
+ newday: 'newday.mjs',
54
+ nuit: '../dist/temporal/nuits/commande.js',
52
55
  outil: 'outil.mjs',
53
56
  paquet: 'paquet.mjs',
54
57
  pression: 'mesure/pression.mjs',
@@ -71,6 +74,10 @@ export const SOUS_COMMANDES = {
71
74
  verrou: 'verrous/verrou.mjs',
72
75
  };
73
76
 
77
+ // The script a subcommand plays when called alone, where its command is a client of Temporal that
78
+ // runs it: `nuit`, the night's pass.
79
+ const PASSES = { nuit: 'nuit.sh' };
80
+
74
81
  // The commands of the module of the language that serve the project at <racine> and are no
75
82
  // subcommand by their name: the ones `tests` and `verifier` run.
76
83
  const DU_NOYAU = new Set(['tester', 'verifier']);
@@ -126,10 +133,13 @@ export function scriptAbsent(nom, script) {
126
133
  }
127
134
 
128
135
  /**
129
- * The environment the subcommand <nom> runs under, in the project at <racine>, from <env>:
130
- * `verifier` gets the tools of the project (`grillhouse.outils`, scripts/outils-cles.mjs) and its
131
- * data (`grillhouse.donnees`, scripts/donnees-cles.mjs), each variable set to its path, whatever
132
- * <env> holds; every other subcommand gets <env>.
136
+ * The environment the subcommand <nom> runs under, in the project at <racine>, from <env>: a
137
+ * command of the module of the project's language (`tests`, `verifier`, `construire`…), the
138
+ * ones that run its task runner, gets the module's environment of the poste
139
+ * (`environnementDuPoste`, scripts/jointure.d.ts: the remote cache read-only, when the poste holds
140
+ * its file); `verifier` also gets the tools of the project (`grillhouse.outils`,
141
+ * scripts/outils-cles.mjs) and its data (`grillhouse.donnees`, scripts/donnees-cles.mjs), each
142
+ * variable set to its path, whatever <env> holds; a subcommand of the core gets <env>.
133
143
  * @param {string} nom the subcommand
134
144
  * @param {string} [racine] the root of the project, the working directory by default
135
145
  * @param {Record<string, string | undefined>} [env]
@@ -137,20 +147,29 @@ export function scriptAbsent(nom, script) {
137
147
  * @throws {Error} the faults of the key, for `verifier`
138
148
  */
139
149
  export function environnementDe(nom, racine = process.cwd(), env = process.env) {
150
+ if (typeof SOUS_COMMANDES[nom] === 'string') {
151
+ return env;
152
+ }
153
+ const poste = langageDe(racine).environnementDuPoste(env);
140
154
  return nom === 'verifier'
141
- ? avecLesDonnees(donneesDe(racine), avecLesOutils(outilsDe(racine), env))
142
- : env;
155
+ ? avecLesDonnees(donneesDe(racine), avecLesOutils(outilsDe(racine), poste))
156
+ : poste;
143
157
  }
144
158
 
145
159
  // The script of each subcommand in the project at <racine>, where a former copy of the frame lay
146
160
  // (`scripts/<script>`): what the migrations name, a former copy becoming its subcommand. A script
147
- // of the core is named from `scripts/`, one of a module of language by its file's name, where the
148
- // frame kept it before its module.
161
+ // of the core is named from `scripts/` (the pass it plays alone, `PASSES`, for a client of
162
+ // Temporal), one of a module of language by its file's name, where the frame kept it before its
163
+ // module.
149
164
  export function scriptsDesSousCommandes(racine) {
150
165
  return Object.fromEntries(
151
166
  Object.entries(sousCommandes(racine)).map(([n, s]) => [
152
167
  n,
153
- typeof s === 'string' ? s : path.basename(commandeDe(n, racine).script),
168
+ Object.hasOwn(PASSES, n)
169
+ ? PASSES[n]
170
+ : typeof s === 'string'
171
+ ? s
172
+ : path.basename(commandeDe(n, racine).script),
154
173
  ])
155
174
  );
156
175
  }
@@ -48,6 +48,8 @@
48
48
  // `.claude/worktrees/questions-remontees.json`, each one by its ticket, the run of its workflow,
49
49
  // the rank of its question in that run and its stop: one never wakes the session twice, a
50
50
  // session closed then opened again finds every one that waits, and one answered leaves them.
51
+ // The end of a circuit wakes it too: a stop as a question; a circuit integrated once, its end
52
+ // after the start of the wait (`integre`), so that the supervisor goes on to the next ticket.
51
53
  // Exit 0 on its
52
54
  // questions, 1 when another wait already runs (`.claude/worktrees/attente-des-questions.lock`).
53
55
  import { spawnSync } from 'node:child_process';
@@ -214,6 +216,17 @@ const enQuestion = c => ({
214
216
  arret: c.arret,
215
217
  });
216
218
 
219
+ // The end of the circuit <c> integrated, given once by the wait: its ticket, its step, and its key.
220
+ const enFin = c => ({
221
+ ticket: c.ticket,
222
+ etape: '5 Intégration',
223
+ question: 'son lot est sur main.',
224
+ qui: SUPERVISEUR,
225
+ commande: '',
226
+ cle: cleDe(c),
227
+ integre: true,
228
+ });
229
+
217
230
  // Of the circuits <lus> of the repository at <racine>, those whose ticket <fermes> does not give
218
231
  // closed, sorted by ticket.
219
232
  function enAttente(lus, racine, fermes) {
@@ -265,15 +278,17 @@ const aucunFerme = () => new Set();
265
278
  * (`questionsEnAttente`), whatever launched its circuit, once it never went up, and again, marked
266
279
  * `representee`, every <rappel> minutes (5 by default) while its circuit stands on the same stop,
267
280
  * as SQS gives a message not acknowledged again after its visibility timeout; a question
268
- * answered (its circuit left the stop) leaves those gone up and is not given again, and the normal
269
- * end of a circuit is never one. A stop whose key changes is a new question, given at once. The
281
+ * answered (its circuit left the stop) leaves those gone up and is not given again. A stop whose
282
+ * key changes is a new question, given at once. The end of a circuit integrated after the start of
283
+ * the wait is given once, marked `integre`, never again (the circuits integrated read too, by
284
+ * `{ integres: true }`); the supervisor's own « arrete » is never one. The
270
285
  * times are those of <maintenant> (`Date.now` by default). It reads the circuits every <pas> ms by
271
286
  * <circuitsDe> (one call to the Temporal server, scripts/circuits-du-serveur.mjs, by default), as
272
287
  * the UI of Temporal refreshes its list; a reading that fails (the server down) is tried again at
273
288
  * the next step, the questions gone up kept. One wait at a time per repository: a second one is
274
289
  * refused while the first runs. Its <signal> ends it.
275
- * @param {{ racine: string, fermes?: (racine: string, ids: string[]) => Set<string>, pas?: number, signal?: AbortSignal, circuitsDe?: (racine: string) => Promise<import('./circuits-du-serveur.mjs').CircuitDuServeur[]>, maintenant?: () => number, rappel?: number }} options
276
- * @returns {AsyncGenerator<{ ticket: string, etape: string, question: string, qui: string, commande: string, cle: string, representee?: boolean }[], void, void>}
290
+ * @param {{ racine: string, fermes?: (racine: string, ids: string[]) => Set<string>, pas?: number, signal?: AbortSignal, circuitsDe?: (racine: string, options?: { integres?: boolean }) => Promise<import('./circuits-du-serveur.mjs').CircuitDuServeur[]>, maintenant?: () => number, rappel?: number }} options
291
+ * @returns {AsyncGenerator<{ ticket: string, etape: string, question: string, qui: string, commande: string, cle: string, representee?: boolean, integre?: boolean }[], void, void>}
277
292
  * @throws {Error} another wait runs
278
293
  */
279
294
  export async function* attendreUneQuestion({
@@ -298,20 +313,36 @@ export async function* attendreUneQuestion({
298
313
  `Une attente des questions tourne déjà pour ce dépôt${qui}, ${verrou} : une seule à la fois.`
299
314
  );
300
315
  }
316
+ // The circuits integrated since the start of the wait, each given once.
317
+ const debut = maintenant();
318
+ const finis = new Set();
301
319
  try {
302
320
  while (!signal?.aborted) {
303
321
  let circuits = null;
304
322
  try {
305
- circuits = await circuitsDe(racine);
323
+ circuits = await circuitsDe(racine, { integres: true });
306
324
  } catch {
307
325
  circuits = null;
308
326
  }
309
327
  if (circuits && !signal?.aborted) {
310
- const lot = relever(racine, circuits, {
311
- fermes,
312
- maintenant: maintenant(),
313
- rappelMs: rappel * 60_000,
314
- });
328
+ const integres = circuits
329
+ .filter(c => c.integre && c.fin !== null && c.fin >= debut && !finis.has(cleDe(c)))
330
+ .map(enFin);
331
+ for (const f of integres) {
332
+ finis.add(f.cle);
333
+ }
334
+ const lot = [
335
+ ...relever(
336
+ racine,
337
+ circuits.filter(c => !c.integre),
338
+ {
339
+ fermes,
340
+ maintenant: maintenant(),
341
+ rappelMs: rappel * 60_000,
342
+ }
343
+ ),
344
+ ...integres,
345
+ ];
315
346
  if (lot.length) {
316
347
  yield lot;
317
348
  }
@@ -336,30 +367,44 @@ const attendre = (ms, signal) =>
336
367
 
337
368
  /**
338
369
  * The text that wakes the session of supervision on the questions <questions>: for each one, its
339
- * ticket, step, who must answer it, its question and the command that answers it. The wait goes
340
- * on by itself: the text asks for no relaunch. A question presented again (`representee`) says that
341
- * it still waits for an answer.
342
- * @param {{ ticket: string, etape: string, question: string, qui: string, commande: string, representee?: boolean }[]} questions
370
+ * ticket, step, who must answer it, its question and the command that answers it; then each end of
371
+ * a circuit integrated (`integre`), its ticket and its step. The wait goes on by itself: the text
372
+ * asks for no relaunch. A question presented again (`representee`) says that it still waits for an
373
+ * answer.
374
+ * @param {{ ticket: string, etape: string, question: string, qui: string, commande: string, representee?: boolean, integre?: boolean }[]} questions
343
375
  * @returns {string}
344
376
  */
345
377
  export function texteDesQuestions(questions) {
346
- const neuves = questions.filter(q => !q.representee);
378
+ const fins = questions.filter(q => q.integre);
379
+ const attente = questions.filter(q => !q.integre);
380
+ const neuves = attente.filter(q => !q.representee);
347
381
  const titre = neuves.length
348
- ? questions.length > 1
382
+ ? attente.length > 1
349
383
  ? '## Questions neuves des circuits'
350
384
  : "## Question neuve d'un circuit"
351
- : questions.length > 1
385
+ : attente.length > 1
352
386
  ? '## Questions toujours sans réponse'
353
387
  : '## Question toujours sans réponse';
354
- return [
355
- titre,
356
- ...questions.map(q =>
357
- [
358
- `- ${q.ticket}, à ${q.etape}, au ${q.qui}${q.representee ? ' (toujours sans réponse)' : ''} : ${q.question.replace(/\n/g, '\n ')}`,
359
- ` La réponse : \`${q.commande}\`.`,
360
- ].join('\n')
361
- ),
362
- ].join('\n');
388
+ const enQuestions = attente.length
389
+ ? [
390
+ titre,
391
+ ...attente.map(q =>
392
+ [
393
+ `- ${q.ticket}, à ${q.etape}, au ${q.qui}${q.representee ? ' (toujours sans réponse)' : ''} : ${q.question.replace(/\n/g, '\n ')}`,
394
+ ` La réponse : \`${q.commande}\`.`,
395
+ ].join('\n')
396
+ ),
397
+ ]
398
+ : [];
399
+ const enFins = fins.length
400
+ ? [
401
+ fins.length > 1 ? '## Circuits intégrés' : '## Circuit intégré',
402
+ ...fins.map(q => `- ${q.ticket} est intégré, à ${q.etape} : son lot est sur main.`),
403
+ ]
404
+ : [];
405
+ return [...enQuestions, ...(enQuestions.length && enFins.length ? [''] : []), ...enFins].join(
406
+ '\n'
407
+ );
363
408
  }
364
409
 
365
410
  /**
@@ -420,7 +465,7 @@ export async function circuitsALOuverture(
420
465
  );
421
466
  return [
422
467
  "## L'attente des questions",
423
- "Dès ta première réponse, sans attendre le mot du responsable, lance l'attente des questions en arrière-plan (`run_in_background`) et surveille sa sortie en continu (l'outil `Monitor`) : `npx grillhouse superviseur --attendre`. Elle ne se termine pas : elle imprime un lot à chaque question neuve d'un circuit, quel que soit son lanceur, et te réveille ainsi ; elle reprend l'écoute seule, sans relance. Une question sans réponse revient toutes les 5 min (`--rappel <minutes>` règle l'intervalle) jusqu'à sa réponse. Un lancement de circuit rend la main tout de suite, et la fin normale d'un circuit ne te réveille pas : le panneau la montre.",
468
+ "Dès ta première réponse, sans attendre le mot du responsable, lance l'attente des questions en arrière-plan (`run_in_background`) et surveille sa sortie en continu (l'outil `Monitor`) : `npx grillhouse superviseur --attendre`. Elle ne se termine pas : elle imprime un lot à chaque question neuve d'un circuit, quel que soit son lanceur, et te réveille ainsi ; elle reprend l'écoute seule, sans relance. Une question sans réponse revient toutes les 5 min (`--rappel <minutes>` règle l'intervalle) jusqu'à sa réponse. Un lancement de circuit rend la main tout de suite ; la fin d'un circuit te réveille aussi, un arrêt comme une question, une intégration une fois.",
424
469
  ...(panne ? ['', '## Les circuits du dépôt', panne] : []),
425
470
  ...(nommes.length ? ['', '## Les circuits du dépôt', ...nommes.map(n => n.ligne)] : []),
426
471
  ].join('\n');
@@ -133,6 +133,9 @@ const PLACE_DU_SUJET = 10;
133
133
  // The role of a register line that a step of a circuit writes (scripts/circuit.mjs): no agent,
134
134
  // no role of the flow.
135
135
  export const ROLE_DU_CIRCUIT = 'circuit';
136
+ // The role of a register line that the workflow of the nights writes for a night it skips
137
+ // (src/temporal/nuits/): no agent, no ticket, no turn; the board counts it nowhere.
138
+ export const ROLE_DE_LA_NUIT = 'nuit';
136
139
  // A sub-agent's role from its meta file: the type it was spawned as; a named agent's `agentType`
137
140
  // is its name.
138
141
  export const roleDuMeta = m =>
@@ -601,17 +604,19 @@ export function lireVivant({ racine, home, prefix, maintenant, ps, cache = {} })
601
604
 
602
605
  /**
603
606
  * Whether the circuit <c>, as scripts/circuits-du-serveur.mjs reads it, waits for the supervisor:
604
- * not running on its own, and ended without its issue, on a question, or stopped (any stop but the
607
+ * not running on its own, not integrated, and ended without its issue, on a question, or stopped (any stop but the
605
608
  * supervisor's own « arrete », « à repasser » included: the supervisor resumes it once the machine
606
609
  * is free). The
607
610
  * one rule of the questions that wait for the supervisor (grillhouse-pq6), which the board reads,
608
611
  * and `questionsEnAttente` of scripts/superviseur.mjs, the one source of the opening and of the
609
612
  * wait of the questions.
610
- * @param {{ vivant: boolean, interrompu: boolean, question: string | null, arret: string | null }} c
613
+ * @param {{ vivant: boolean, integre?: boolean, interrompu: boolean, question: string | null, arret: string | null }} c
611
614
  * @returns {boolean}
612
615
  */
613
616
  export const attendLeSuperviseur = c =>
614
- !c.vivant && Boolean(c.interrompu || c.question || (c.arret && c.arret !== 'arrete'));
617
+ !c.vivant &&
618
+ !c.integre &&
619
+ Boolean(c.interrompu || c.question || (c.arret && c.arret !== 'arrete'));
615
620
 
616
621
  /**
617
622
  * The key of one stop of the circuit <c>: its ticket, the run of its workflow, the rank of its
@@ -780,7 +785,9 @@ export function assembler({
780
785
  }) {
781
786
  // A circuit's lines are its steps, no agent's passage.
782
787
  const etapesFinies = lignesDuRegistre.filter(r => r.role === ROLE_DU_CIRCUIT);
783
- const registre = parAgent(lignesDuRegistre.filter(r => r.role !== ROLE_DU_CIRCUIT));
788
+ const registre = parAgent(
789
+ lignesDuRegistre.filter(r => r.role !== ROLE_DU_CIRCUIT && r.role !== ROLE_DE_LA_NUIT)
790
+ );
784
791
  // A living agent runs without an end in the register, or when an incoming message follows its
785
792
  // latest end strictly; the writings of its last turn after that end leave it finished. A running
786
793
  // agent's transcript holds its sessions already in the register.
@@ -938,7 +945,39 @@ export function assembler({
938
945
  const duJour = mesures
939
946
  .filter(m => m.quand >= jour)
940
947
  .map(m => (m.tours ? { ...m, travail: partDuJour(m.tours) } : m));
941
- const global = { compteurs, jour: somme(duJour), cumul: somme(mesures) };
948
+ // The discoveries (label `decouverte`, grillhouse-3uv.96): each counts in one case, the first that
949
+ // applies. « rejetés » and « validés » count only since the day's marker <jour>; « new » and
950
+ // « →check », states that await the owner, do not filter by it.
951
+ const aLabel = (t, ...ls) => ls.some(l => (t.labels ?? []).includes(l));
952
+ const estDecouverte = t => aLabel(t, 'decouverte');
953
+ const VERDICTS_DU_TRI = ['traitee', 'doublon', 'sans-suite', 'a-porter', 'non-confirmee'];
954
+ const caseDeLaDecouverte = t => {
955
+ const ferme = t.status === 'closed';
956
+ if (aLabel(t, 'circuit') && (Date.parse(t.updated_at ?? '') || 0) >= jour) {
957
+ return 'valides';
958
+ }
959
+ if (!ferme && aLabel(t, 'a-valider')) {
960
+ return 'check';
961
+ }
962
+ const rejete =
963
+ aLabel(t, 'traitee', 'doublon', 'sans-suite') ||
964
+ (aLabel(t, 'a-porter', 'non-confirmee') && !aLabel(t, 'circuit'));
965
+ if (ferme && rejete && (Date.parse(t.closed_at ?? '') || 0) >= jour) {
966
+ return 'rejetes';
967
+ }
968
+ if (ferme && !aLabel(t, ...VERDICTS_DU_TRI)) {
969
+ return 'new';
970
+ }
971
+ return null;
972
+ };
973
+ const decouvertes = { new: 0, check: 0, rejetes: 0, valides: 0 };
974
+ for (const t of tous.filter(estDecouverte)) {
975
+ const c = caseDeLaDecouverte(t);
976
+ if (c) {
977
+ decouvertes[c]++;
978
+ }
979
+ }
980
+ const global = { compteurs, jour: somme(duJour), cumul: somme(mesures), decouvertes };
942
981
 
943
982
  // Chantiers.
944
983
  const sous = t => [t, ...(enfants.get(t.id) ?? []).flatMap(sous)];
@@ -1067,7 +1106,12 @@ export function assembler({
1067
1106
  const debutJour = jour;
1068
1107
  const faitsDuJour = tous
1069
1108
  .filter(
1070
- t => travail(t) && !actifs.has(t.id) && t.closed_at && Date.parse(t.closed_at) >= debutJour
1109
+ t =>
1110
+ travail(t) &&
1111
+ !actifs.has(t.id) &&
1112
+ !estDecouverte(t) &&
1113
+ t.closed_at &&
1114
+ Date.parse(t.closed_at) >= debutJour
1071
1115
  )
1072
1116
  .sort((a, b) => Date.parse(b.closed_at) - Date.parse(a.closed_at))
1073
1117
  .map(t => ({
@@ -1142,7 +1186,8 @@ export function assembler({
1142
1186
  alertes.push({
1143
1187
  niveau: 'rouge',
1144
1188
  signe: '🔕',
1145
- texte: 'À corriger : une question au superviseur reste sans réponse, aucune attente ne tourne',
1189
+ texte:
1190
+ 'À corriger : une question au superviseur reste sans réponse, aucune attente ne tourne',
1146
1191
  });
1147
1192
  }
1148
1193
  for (const b of blocs) {
@@ -1348,6 +1393,16 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1348
1393
  )
1349
1394
  );
1350
1395
  }
1396
+ // The discoveries of the day, summed across the projects (grillhouse-3uv.96, criterion 14).
1397
+ const d96 = t.decouvertes ?? { new: 0, check: 0, rejetes: 0, valides: 0 };
1398
+ L(
1399
+ cadre(
1400
+ `🔍 ${d96.new} new · ${d96.check} →check · ${d96.rejetes} rejetés · ${d96.valides} validés`,
1401
+ '',
1402
+ largeur
1403
+ ),
1404
+ 'discret'
1405
+ );
1351
1406
  } else {
1352
1407
  const g = t.global;
1353
1408
  const c = g.compteurs;
@@ -1363,6 +1418,17 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1363
1418
  cadre(`${c.sansGo} sans go · ${c.aValider} à valider · ${c.reportes} reportés`, '', largeur),
1364
1419
  c.sansGo || c.aValider ? 'attention' : undefined
1365
1420
  );
1421
+ // The discoveries of the day, one count per case (grillhouse-3uv.96): always shown, at 0 when
1422
+ // nothing counts, like the other head lines.
1423
+ const d = g.decouvertes ?? { new: 0, check: 0, rejetes: 0, valides: 0 };
1424
+ L(
1425
+ cadre(
1426
+ `🔍 ${d.new} new · ${d.check} →check · ${d.rejetes} rejetés · ${d.valides} validés`,
1427
+ '',
1428
+ largeur
1429
+ ),
1430
+ 'discret'
1431
+ );
1366
1432
  L(
1367
1433
  cadre(
1368
1434
  `jour ${duree(g.jour.travail)} · ${k(g.jour.jetons)} · cumul ${duree(g.cumul.travail)} · ${k(g.cumul.jetons)}`,
@@ -1934,6 +2000,48 @@ const bdJson = (racine, ...args) => {
1934
2000
  }
1935
2001
  };
1936
2002
 
2003
+ // The folder git keeps a repository's shared files in (its common dir), absolute; null when
2004
+ // <racine> is no git repository. The board's cache and the day's marker live there.
2005
+ export function dossierCommun(racine) {
2006
+ try {
2007
+ return execFileSync(
2008
+ 'git',
2009
+ ['-C', racine, 'rev-parse', '--path-format=absolute', '--git-common-dir'],
2010
+ { encoding: 'utf8' }
2011
+ ).trim();
2012
+ } catch {
2013
+ return null;
2014
+ }
2015
+ }
2016
+
2017
+ // The file of the day's marker (grillhouse-3uv.96), beside the board's cache; null without a common
2018
+ // dir. Unversioned, out of the worktree: the board does not reset at midnight.
2019
+ const fichierDuRepere = commun => commun && path.join(commun, 'tableau-repere.json');
2020
+
2021
+ // The day's marker of the project whose common dir is <commun>: the number its file holds, else
2022
+ // midnight of <maintenant> (no file, or no number).
2023
+ export function lireLeRepere(commun, maintenant) {
2024
+ const minuit = new Date(maintenant);
2025
+ minuit.setHours(0, 0, 0, 0);
2026
+ try {
2027
+ const { repere } = JSON.parse(readFileSync(fichierDuRepere(commun), 'utf8'));
2028
+ return typeof repere === 'number' ? repere : minuit.getTime();
2029
+ } catch {
2030
+ return minuit.getTime();
2031
+ }
2032
+ }
2033
+
2034
+ // Sets the day's marker of the project at <racine> to <quand> (now by default), purging FAITS
2035
+ // AUJOURD'HUI and the « rejetés » and « validés » cases up to it (grillhouse-3uv.96, /newday).
2036
+ export function poserLeRepere(racine, quand = Date.now()) {
2037
+ const commun = dossierCommun(racine);
2038
+ if (!commun) {
2039
+ throw new Error('newday : le dossier git commun du projet est introuvable.');
2040
+ }
2041
+ writeFileSync(fichierDuRepere(commun), `${JSON.stringify({ repere: quand })}\n`);
2042
+ return quand;
2043
+ }
2044
+
1937
2045
  // What the board reads of the repository at <racine>, its circuits <circuits> read: its tickets,
1938
2046
  // its prefix, its running agents and its assembled board (`t`), with the folder git keeps its
1939
2047
  // shared files in (`commun`).
@@ -1990,16 +2098,7 @@ function lire(
1990
2098
  verdicts[t.id] = v;
1991
2099
  }
1992
2100
  }
1993
- let commun = null;
1994
- try {
1995
- commun = execFileSync(
1996
- 'git',
1997
- ['-C', racine, 'rev-parse', '--path-format=absolute', '--git-common-dir'],
1998
- { encoding: 'utf8' }
1999
- ).trim();
2000
- } catch {
2001
- commun = null;
2002
- }
2101
+ const commun = dossierCommun(racine);
2003
2102
  const fichierCache = commun && path.join(commun, 'tableau-cache.json');
2004
2103
  let cache = {};
2005
2104
  try {
@@ -2025,8 +2124,6 @@ function lire(
2025
2124
  } catch {
2026
2125
  // A read-only place keeps the board working, without its cache.
2027
2126
  }
2028
- const minuit = new Date(maintenant);
2029
- minuit.setHours(0, 0, 0, 0);
2030
2127
  const t = assembler({
2031
2128
  tous,
2032
2129
  prefix,
@@ -2035,7 +2132,7 @@ function lire(
2035
2132
  circuits,
2036
2133
  verdicts,
2037
2134
  maintenant,
2038
- jour: minuit.getTime(),
2135
+ jour: lireLeRepere(commun, maintenant),
2039
2136
  machine,
2040
2137
  places,
2041
2138
  muet,
@@ -2092,6 +2189,18 @@ export function ensemble(lus) {
2092
2189
  machine: premier.t.machine,
2093
2190
  places: premier.t.places,
2094
2191
  faitsDuJour: tous('faitsDuJour'),
2192
+ decouvertes: lisibles.reduce(
2193
+ (s, l) => {
2194
+ const d = l.t.global.decouvertes ?? {};
2195
+ return {
2196
+ new: s.new + (d.new ?? 0),
2197
+ check: s.check + (d.check ?? 0),
2198
+ rejetes: s.rejetes + (d.rejetes ?? 0),
2199
+ valides: s.valides + (d.valides ?? 0),
2200
+ };
2201
+ },
2202
+ { new: 0, check: 0, rejetes: 0, valides: 0 }
2203
+ ),
2095
2204
  etats: premier.t.etats.map(e => ({
2096
2205
  ...e,
2097
2206
  tickets: lisibles.flatMap(l =>
@@ -52,6 +52,31 @@ export const TESTS_CIBLES = 'GRILLHOUSE_TESTS';
52
52
  export const GRAPHE_JOUE = 'GRILLHOUSE_GRAPHE_JOUE';
53
53
  /** The variable that tells a module it plays after a red one: that pass keeps no green. */
54
54
  export const PASSE_ROUGE = 'GRILLHOUSE_PASSE_ROUGE';
55
+ /** The form of a tranche, as Vitest's `--shard` and nextest's `--partition` read it. */
56
+ export const LA_FORME = 'i/n';
57
+
58
+ /**
59
+ * The tranche <texte> reads, `{ index, count }`, or null when it is not `i/n` with 1 ≤ i ≤ n.
60
+ * @param {unknown} texte
61
+ * @returns {{ index: number, count: number } | null}
62
+ */
63
+ export function lireLaTranche(texte) {
64
+ const m = /^([1-9]\d*)\/([1-9]\d*)$/.exec(typeof texte === 'string' ? texte : '');
65
+ if (!m) {
66
+ return null;
67
+ }
68
+ const index = Number(m[1]);
69
+ const count = Number(m[2]);
70
+ return index <= count ? { index, count } : null;
71
+ }
72
+
73
+ /**
74
+ * Whether the tests a tool cannot split play in the tranche <tranche>: in a pass without a tranche,
75
+ * or in the first; so the n tranches together play them once.
76
+ * @param {{ index: number, count: number } | null | undefined} tranche
77
+ */
78
+ export const joueCeQuiNeSeDivisePas = tranche => !tranche || tranche.index === 1;
79
+
55
80
  /** The beginning of the name of a trace task, the output of a package that another's tests read. */
56
81
  export const TRACE = 'trace:';
57
82
  const SANS_INSTALLER = '--no-install';
@@ -115,17 +140,21 @@ export function testsCibles({ arguments: donnes, force = false }) {
115
140
  * The paths and the options of a task of the tests of a package, run by its script: the paths
116
141
  * <donnes> its script names (its own folder), each replaced by the paths of the variable
117
142
  * `TESTS_CIBLES` of <env> that lie in the same component (<dossierDe>, from an absolute path, the
118
- * folder of its component or null), and the options of the variable. A task with no path of the
119
- * variable in its component plays whole what its script names.
143
+ * variable or null), and the options of the variable. A task with no path of the
144
+ * variable in its component plays whole what its script names. `tranche`: the tranche of a pass the
145
+ * variable carries (`verifier --tranche i/n`), `{ index, count }`, or null; the module of the
146
+ * language plays its part of the tests in it.
120
147
  * @param {{ racine: string, donnes: string[], env?: NodeJS.ProcessEnv,
121
148
  * dossierDe: (absolu: string) => string | null }} o
122
- * @returns {{ chemins: string[], options: string[] }}
149
+ * @returns {{ chemins: string[], options: string[], tranche: { index: number, count: number } | null }}
123
150
  */
124
151
  export function cheminsDeLaTache({ racine, donnes, env = process.env, dossierDe }) {
125
152
  let variable = [];
153
+ let tranche = null;
126
154
  try {
127
- const lu = JSON.parse(env[TESTS_CIBLES] ?? '{}')?.arguments;
128
- variable = Array.isArray(lu) ? lu.map(String) : [];
155
+ const lu = JSON.parse(env[TESTS_CIBLES] ?? '{}');
156
+ variable = Array.isArray(lu?.arguments) ? lu.arguments.map(String) : [];
157
+ tranche = lireLaTranche(lu?.tranche);
129
158
  } catch {
130
159
  variable = [];
131
160
  }
@@ -136,7 +165,11 @@ export function cheminsDeLaTache({ racine, donnes, env = process.env, dossierDe
136
165
  const siens = d === null ? [] : nommes.filter(n => dossier(n) === d);
137
166
  return siens.length ? siens : [g];
138
167
  });
139
- return { chemins: [...new Set(chemins)], options: variable.filter(a => a.startsWith('-')) };
168
+ return {
169
+ chemins: [...new Set(chemins)],
170
+ options: variable.filter(a => a.startsWith('-')),
171
+ tranche,
172
+ };
140
173
  }
141
174
 
142
175
  /**
@@ -28,7 +28,6 @@
28
28
  // step the list does not hold `usage`. Each call is played again from the start of its step with
29
29
  // the facts read so far, as Temporal replays a workflow on its history: the same facts give the
30
30
  // same decision.
31
- import { A_REPASSER } from './codes-de-sortie.mjs';
32
31
  import { ARRETS, boucle, RESPONSABLE, SUITE } from './etapes.mjs';
33
32
  import { attribuerLeRouge } from './reprise.mjs';
34
33
 
@@ -277,6 +276,24 @@ function decider({ etat, memoire = {}, ticket, reprend = false }, lire, partiel)
277
276
  ...extra,
278
277
  });
279
278
  const arreter = (nom, r, options = {}) => decision({ arret: { nom, rapport: r, ...options } });
279
+ // A session relaunched on a conflict of the copy's advance (the gesture `conflit-de-l-avance`,
280
+ // `retourDuConflit`) comes back to the pass that met it, not to the step that follows its role:
281
+ // the pass prepares the copy again, and relaunches the other role while one of its files keeps
282
+ // its marks. Whether the decision went back to it.
283
+ const auRetourDuConflit = role => {
284
+ const retour = m('retourDuConflit');
285
+ if (!retour) {
286
+ return false;
287
+ }
288
+ maj.retourDuConflit = null;
289
+ commenter(
290
+ role,
291
+ `séance ${tentative} finie sur le conflit de l'avance : le circuit revient à la passe.`
292
+ );
293
+ ({ etape, tentative, rapport, finale } = retour);
294
+ relanceSurLeRefus = Boolean(retour.relanceSurLeRefus);
295
+ return true;
296
+ };
280
297
  const plan = ticket.paquets.join(', ');
281
298
 
282
299
  // After the plan: the gesture of a mechanical ticket, the developpeur of a plan without tests,
@@ -370,6 +387,9 @@ function decider({ etat, memoire = {}, ticket, reprend = false }, lire, partiel)
370
387
  rapport = illisible.rapport;
371
388
  return decision();
372
389
  }
390
+ if (auRetourDuConflit('testwriter')) {
391
+ return decision();
392
+ }
373
393
  etape = PREUVE;
374
394
  return decision();
375
395
  }
@@ -445,8 +465,10 @@ function decider({ etat, memoire = {}, ticket, reprend = false }, lire, partiel)
445
465
  }
446
466
  if (etape === INTEGRATION) {
447
467
  const r = lire('integration');
448
- if (r.code === A_REPASSER) {
449
- return arreter('a-repasser', fin(r.sortie, 40));
468
+ if (r.nom) {
469
+ // The resumption stops under a name (`lot-absent`, `copie-gardee`), at the code of the
470
+ // integration stop (17, scripts/etapes.mjs), its piece the output.
471
+ return arreter(r.nom, fin(r.sortie, 60), { piece: fin(r.sortie, 30) });
450
472
  }
451
473
  if (r.code !== 0) {
452
474
  return refuser(
@@ -455,6 +477,16 @@ function decider({ etat, memoire = {}, ticket, reprend = false }, lire, partiel)
455
477
  );
456
478
  }
457
479
  maj.refus = null;
480
+ if (r.deja && !r.enFile) {
481
+ // The lot is already on main: nothing waits for the queue, the ticket goes straight to its
482
+ // tri of discoveries and finishes at integre, as a merge queue closes an entry already merged.
483
+ commenter(
484
+ 'integration',
485
+ 'le commit est déjà sur main ; la copie et son dossier de travail sont retirés.'
486
+ );
487
+ lire('tri');
488
+ return decision({ fin: { code: 0 } });
489
+ }
458
490
  const branche = `agent/${ticket.id}`;
459
491
  const commit = lire('commit');
460
492
  commenter(
@@ -537,6 +569,10 @@ function decider({ etat, memoire = {}, ticket, reprend = false }, lire, partiel)
537
569
  );
538
570
  }
539
571
  maj.renvoiAuTestwriter = sortie;
572
+ if (m('retourDuConflit')) {
573
+ // The testwriter the sending relaunches goes on to the proof, not back to a pass.
574
+ maj.retourDuConflit = null;
575
+ }
540
576
  commenter(
541
577
  'developpeur',
542
578
  `séance ${tentative}${fortement} finie ; sa fiche renvoie le rouge au testwriter : le circuit relance le testwriter, puis la preuve et le développeur.`
@@ -610,6 +646,9 @@ function decider({ etat, memoire = {}, ticket, reprend = false }, lire, partiel)
610
646
  inscrire({ etape: CODE, inchange: true }, 'inchange');
611
647
  maj.rienALivrer = `La séance ${tentative} du développeur ne change aucun fichier du plan (${plan}), et les contrôles restent rouges. Sa passation au ticket dit pourquoi :\n\n${lire('passation') ?? 'aucune'}`;
612
648
  }
649
+ if (auRetourDuConflit('developpeur')) {
650
+ return decision();
651
+ }
613
652
  commenter('developpeur', `séance ${tentative}${fortement} finie, sa fiche lue.`);
614
653
  etape = CONTROLES;
615
654
  return decision();
@@ -1,8 +1,7 @@
1
1
  // The lock of the machine for the heavy measure: one heavy measure at a time on the machine,
2
2
  // whatever repository it plays in, as GNU make's job server shares its slots between every make of
3
3
  // one build, and as Bazel holds a test that declares it wants the whole machine. Taken by every
4
- // `npm run verifier` (scripts/langages/typescript/verifier.mjs: the integration's, the queue's, the night's, a
5
- // supervisor's) and by the heavy passes of the circuit of a ticket (scripts/circuit.mjs: the proof
4
+ // `npm run verifier` (scripts/langages/typescript/verifier.mjs: the night's, a supervisor's) and by the heavy passes of the circuit of a ticket (scripts/circuit.mjs: the proof
6
5
  // of the red and the checks), so that a measure gives the result of the code, not that of another
7
6
  // measure beside it.
8
7
  //