@roomi-fields/grillhouse 0.33.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.
@@ -7,9 +7,10 @@
7
7
  // the files that differ from the tree of the last green instead, which Vitest's git cannot read
8
8
  // (a green kept on a copy whose lot is not committed).
9
9
  //
10
- // - The variable `GRILLHOUSE_CHANGEMENTS` names a JSON file, `{ racine, fichiers, supprimes }`: the
11
- // top of the repository, the files changed or added since the last green and the files removed,
12
- // each path from the top. It passes through Turborepo without entering any hash (the root's
10
+ // - The variable `GRILLHOUSE_CHANGEMENTS` names a JSON file, `{ racine, fichiers, supprimes, cible }`:
11
+ // the top of the repository, the files changed or added since the last green and the files
12
+ // removed, each path from the top, and, for a pass of the circuit measured against the base of
13
+ // its lot (scripts/dernier-vert.mjs), the mark `cible`. It passes through Turborepo without entering any hash (the root's
13
14
  // `globalPassThroughEnv`, which scripts/langages/typescript/turbo-des-paquets.mjs writes and checks): a package whose
14
15
  // inputs did not move replays its last green from Turborepo's cache, whatever the last green.
15
16
  // The plugin takes it out of the environment once read: no process the tests start receives it.
@@ -46,7 +47,12 @@
46
47
  // `.mjs`, `.cjs`, `.ts`, `.mts`, `.cts`, `.jsx`, `.tsx`, `.json`): data, a template, a
47
48
  // script of the shell, a document, which a test reads without importing it.
48
49
  // Vitest's own `forceRerunTriggers` (a configuration's, or its default) still apply, as with
49
- // `--changed`.
50
+ // `--changed`. Under the mark `cible`, 5 and 7 do not play the package whole, and no test is
51
+ // related by the paths it reads (`testsQuiLancent`): the tests Vitest relates alone, and the
52
+ // files named, as `vitest --changed` leaves a file out of its graph to the complete pass, the
53
+ // CI's of the ticket's branch and the night's. Witness: grillhouse-4nr.21, whose
54
+ // `scripts/session-start.sh` the reads of 276 of the 282 test files of packages/grillhouse hold
55
+ // (a test that starts the command reads every script of its table).
50
56
  // - Otherwise the tests played are those Vitest relates to the files changed or added (`related`,
51
57
  // absolute), the tests that read one of them by its path, a script they launch or a file they
52
58
  // read, with what it imports and names (`testsQuiLancent`, ./lances.mjs, as Bazel's `data`),
@@ -87,12 +93,18 @@ const sous = (f, dir) => {
87
93
  return r === '' || (!r.startsWith('..') && !path.isAbsolute(r));
88
94
  };
89
95
 
90
- // The changes the file at <chemin> holds, `{ racine, fichiers, supprimes }`; null when it does not
91
- // read.
96
+ // The changes the file at <chemin> holds, `{ racine, fichiers, supprimes, cible? }`; null when it
97
+ // does not read.
92
98
  export function lireChangements(chemin) {
93
99
  const c = lireJson(chemin);
94
100
  const liste = l => Array.isArray(l) && l.every(x => typeof x === 'string');
95
- if (!c || typeof c.racine !== 'string' || !liste(c.fichiers) || !liste(c.supprimes)) {
101
+ if (
102
+ !c ||
103
+ typeof c.racine !== 'string' ||
104
+ !liste(c.fichiers) ||
105
+ !liste(c.supprimes) ||
106
+ (c.cible !== undefined && typeof c.cible !== 'boolean')
107
+ ) {
96
108
  return null;
97
109
  }
98
110
  return c;
@@ -213,11 +225,11 @@ function paquetEntier(ch, dossier, test = {}) {
213
225
  ? 'la configuration du paquet'
214
226
  : preparation.includes(a)
215
227
  ? 'un fichier de préparation des tests'
216
- : lit.some(l => f === l || f.startsWith(`${l}/`))
228
+ : !ch.cible && lit.some(l => f === l || f.startsWith(`${l}/`))
217
229
  ? 'un chemin que ses tests déclarent lire (grillhouse.lit)'
218
230
  : deps.some(d => sous(a, d) && construit(racine, d, a))
219
231
  ? 'le code d’un paquet dont il dépend, que ses tests lisent construit'
220
- : sous(a, dossier) && !MODULE.test(f)
232
+ : !ch.cible && sous(a, dossier) && !MODULE.test(f)
221
233
  ? 'un fichier qu’aucun module n’importe, qu’un test lit sans l’importer'
222
234
  : null;
223
235
  if (raison) {
@@ -238,10 +250,10 @@ export function restreindre(test, dossier, ch, nommes, dire) {
238
250
  return;
239
251
  }
240
252
  const changes = ch.fichiers.map(f => path.join(ch.racine, f));
241
- const lanceurs = testsQuiLancent(dossier, ch.racine, changes);
253
+ const lanceurs = ch.cible ? [] : testsQuiLancent(dossier, ch.racine, changes);
242
254
  test.related = [...new Set([...changes, ...nommes, ...lanceurs])];
243
255
  test.passWithNoTests = true;
244
256
  dire(
245
- `↳ ${nom} : les tests que Vitest relie aux ${ch.fichiers.length} fichier(s) changé(s) depuis le dernier vert${lanceurs.length ? `, et ${lanceurs.length} test(s) qui en lisent un par son chemin` : ''}.`
257
+ `↳ ${nom} : les tests que Vitest relie aux ${ch.fichiers.length} fichier(s) changé(s) depuis ${ch.cible ? 'la base du lot' : 'le dernier vert'}${lanceurs.length ? `, et ${lanceurs.length} test(s) qui en lisent un par son chemin` : ''}.`
246
258
  );
247
259
  }
@@ -37,7 +37,7 @@ export {
37
37
  } from './taches-du-graphe.mjs';
38
38
  export { luUneFois } from './lecture-unique.mjs';
39
39
  export { avecLeFichierDuPoste } from './fichier-du-poste.mjs';
40
- export { CHANGEMENTS, DEPUIS_LE_VERT, garderLeVert, mesure } from './dernier-vert.mjs';
40
+ export { BASE_DU_LOT, CHANGEMENTS, DEPUIS_LE_VERT, garderLeVert, mesure } from './dernier-vert.mjs';
41
41
  export { lireLaListe, paquetsDeLEnveloppe } from './enveloppe/paquets-du-plan.mjs';
42
42
  export { AVANCEMENT, ecrireTache } from './mesure/avancement.mjs';
43
43
  export {
@@ -31,6 +31,10 @@
31
31
  # for the project at another version than the package @roomi-fields/grillhouse, both released under
32
32
  # one version, with the command that aligns the one behind. An agent's copy does not read them.
33
33
  #
34
+ # The worker of Temporal on a former version after a rise of `grillhouse.outil` (see below, the
35
+ # detection `grillhouse temporal perime`): joins « Manque » with `npx grillhouse temporal installer`.
36
+ # An agent's copy does not read it.
37
+ #
34
38
  # The CI of the ticket branches: a project none of whose workflows runs on a push to `agent/**`
35
39
  # (scripts/ci-des-branches.mjs) joins « Manque », with `npx grillhouse maj`, which adds it.
36
40
  #
@@ -127,6 +131,14 @@ if [ -z "$copie_agent" ]; then
127
131
  esac
128
132
  done < <(timeout -k 1 8 node "$ici/greffons.mjs" --absents "$root" 2>/dev/null)
129
133
  fi
134
+ # The worker of Temporal left on a former version after a rise of `grillhouse.outil`
135
+ # (src/temporal/installation.ts, travailleurPerime, read from dist/): the one command that
136
+ # re-points it joins « Manque ». Nothing without an installation of Temporal on the account; an
137
+ # agent's copy does not read it.
138
+ if [ -z "$copie_agent" ] && [ -f "$ici/../dist/temporal/commande.js" ] && [ -f "$root/package.json" ] \
139
+ && [ -n "$(timeout -k 1 8 node "$ici/../dist/temporal/commande.js" perime --racine "$root" 2>/dev/null)" ]; then
140
+ missing+=("le travailleur de Temporal périmé après une montée de version (\`npx grillhouse temporal installer\`)")
141
+ fi
130
142
  # The frame's git hooks absent from the folder git reads (scripts/crochets.mjs), each named.
131
143
  while IFS= read -r crochet; do
132
144
  [ -n "$crochet" ] && missing+=("le crochet git $crochet du cadre")
@@ -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');
@@ -604,17 +604,19 @@ export function lireVivant({ racine, home, prefix, maintenant, ps, cache = {} })
604
604
 
605
605
  /**
606
606
  * Whether the circuit <c>, as scripts/circuits-du-serveur.mjs reads it, waits for the supervisor:
607
- * 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
608
608
  * supervisor's own « arrete », « à repasser » included: the supervisor resumes it once the machine
609
609
  * is free). The
610
610
  * one rule of the questions that wait for the supervisor (grillhouse-pq6), which the board reads,
611
611
  * and `questionsEnAttente` of scripts/superviseur.mjs, the one source of the opening and of the
612
612
  * wait of the questions.
613
- * @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
614
614
  * @returns {boolean}
615
615
  */
616
616
  export const attendLeSuperviseur = c =>
617
- !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'));
618
620
 
619
621
  /**
620
622
  * The key of one stop of the circuit <c>: its ticket, the run of its workflow, the rank of its
@@ -88,8 +88,8 @@ nomme le responsable, ce qui décide, les documents qu'il valide et les commande
88
88
  `npx grillhouse circuit <ticket>`, que je lance une fois, au premier plan. La commande est la
89
89
  cliente du serveur Temporal : elle met le ticket dans la file des tickets du projet et rend la
90
90
  main aussitôt (« ▶ <ticket> est dans la file des tickets du projet »), et son circuit tourne sur
91
- le serveur, hors de ma séance. Sa question me réveille par l'attente des questions, seule voie,
92
- et sa fin normale ne me réveille pas : le panneau la montre. Je ne dis jamais « les circuits
91
+ le serveur, hors de ma séance. Sa question et sa fin me réveillent par l'attente des questions,
92
+ seule voie : un arrêt comme une question, son intégration une fois. Je ne dis jamais « les circuits
93
93
  continuent » sans que l'attente des questions tourne. Lancé en arrière-plan, son lancement me réveillerait pour rien en rendant la main :
94
94
  seule l'attente des questions tourne en arrière-plan. Une file de lancements part d'un coup,
95
95
  au premier plan, chaque lancement rendant la main en quelques secondes ; les questions de ses
@@ -186,7 +186,8 @@ nomme le responsable, ce qui décide, les documents qu'il valide et les commande
186
186
  une seule à la fois, est la seule voie par laquelle une question me réveille. Elle ne se
187
187
  termine pas et reprend l'écoute seule : je ne la relance jamais à la main. Elle imprime un bloc
188
188
  à chaque question neuve d'un circuit, lancé seul, dans une file ou par une autre séance ; ce
189
- bloc donne, par question, le ticket, l'étape, la question et la commande qui répond. Une
189
+ bloc donne, par question, le ticket, l'étape, la question et la commande qui répond ; un circuit
190
+ intégré y vient une fois, sous « Circuit intégré ». Une
190
191
  question qu'aucune réponse n'a levée (son circuit est toujours arrêté sur le même arrêt) revient
191
192
  sur ce flux toutes les 5 min (`--rappel <minutes>` règle l'intervalle), marquée « toujours sans
192
193
  réponse », jusqu'à sa réponse : je la réponds, ou je la porte au responsable. Le tableau montre
@@ -270,6 +271,8 @@ nomme le responsable, ce qui décide, les documents qu'il valide et les commande
270
271
 
271
272
  Le détail de ce que la charte commune résume : le circuit que je lance, et ce qu'il me remonte.
272
273
 
274
+ La montée de version de l'outil est transparente : le travailleur Temporal resté sur l'ancienne version se dit à l'ouverture de séance sous « Manque », avec son seul geste, `npx grillhouse temporal installer`, que je lance.
275
+
273
276
  Une séance de supervision charge le superviseur (`pitmaster`) ; un projet a un seul superviseur,
274
277
  comme Zuul a un seul ordonnanceur : l'ouverture de séance prend le verrou du dépôt, et une seconde
275
278
  séance le dit au responsable et ne lance aucun circuit. Les rôles sont des agents du greffon du
@@ -284,8 +287,10 @@ plan, sur un ticket que son plan dit mécanique : il joue la commande du plan da
284
287
  place de 2 et de 3 ;
285
288
  2 Tests, le `testwriter`, une séance pour tout le ticket, et 2.1 Preuve du rouge, auto, sur tous
286
289
  les tests du lot, trois essais au plus ; 3 Code, le `developpeur`, une séance pour tout le ticket,
287
- et 3.1 Contrôles, auto, sur tout le plan, trois essais au plus ; 4 Passe finale et relecture :
288
- 4.1 Passe finale, auto, trois essais au plus, puis 4.2 Régénération des références, auto : celles
290
+ et 3.1 Contrôles, auto, sur le plan, trois essais au plus ; 4 Passe finale et relecture :
291
+ 4.1 Passe finale, auto, trois essais au plus (les contrôles et la passe finale ne jouent que les
292
+ tests que le lot atteint depuis sa base, la passe complète à la CI de la branche du ticket et à la
293
+ nuit ; un projet sans cette CI les mesure contre le dernier vert), puis 4.2 Régénération des références, auto : celles
289
294
  que le projet tire de la copie entière (`grillhouse.references` de son `package.json`, chacune
290
295
  `{ nom, commande, fichiers, tests, lit, gardes }` : `fichiers`, des chemins, des dossiers ou des
291
296
  motifs `*` et `**`, comme les entrées de Turborepo ; `tests`, les fichiers de test qui la jugent ;