@roomi-fields/grillhouse 0.33.1 → 0.34.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.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +63 -0
- package/cadre/templates/projet/CLAUDE.md +9 -3
- package/charte.md +23 -6
- package/dist/temporal/circuit/activites.d.ts +3 -1
- package/dist/temporal/circuit/activites.js +25 -1
- package/dist/temporal/circuit/activites.js.map +1 -1
- package/dist/temporal/circuit/appel.d.ts +19 -0
- package/dist/temporal/circuit/appel.js +93 -0
- package/dist/temporal/circuit/appel.js.map +1 -0
- package/dist/temporal/circuit/client.d.ts +7 -0
- package/dist/temporal/circuit/client.js +20 -0
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/commande.js +27 -87
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +19 -0
- package/dist/temporal/circuit/contrat.js +2 -0
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +86 -11
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/file/activites.d.ts +3 -0
- package/dist/temporal/file/activites.js +9 -0
- package/dist/temporal/file/activites.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +58 -0
- package/dist/temporal/file/deroule.d.ts +8 -1
- package/dist/temporal/file/deroule.js +100 -2
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/nuits/contrat.d.ts +2 -0
- package/dist/temporal/nuits/deroule.js +3 -0
- package/dist/temporal/nuits/deroule.js.map +1 -1
- package/dist/temporal/places/activites.d.ts +8 -0
- package/dist/temporal/places/activites.js +12 -1
- package/dist/temporal/places/activites.js.map +1 -1
- package/dist/temporal/places/client.d.ts +8 -1
- package/dist/temporal/places/client.js +25 -2
- package/dist/temporal/places/client.js.map +1 -1
- package/dist/temporal/places/contrat.d.ts +35 -3
- package/dist/temporal/places/contrat.js +5 -4
- package/dist/temporal/places/contrat.js.map +1 -1
- package/dist/temporal/places/deroule.js +55 -9
- package/dist/temporal/places/deroule.js.map +1 -1
- package/dist/temporal/tickets/activites.d.ts +3 -0
- package/dist/temporal/tickets/activites.js +73 -4
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/dist/temporal/tickets/contrat.d.ts +31 -0
- package/dist/temporal/tickets/deroule.js +61 -10
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/docs/ARCHITECTURE.md +213 -57
- package/docs/CADRE.md +6 -1
- package/docs/INTERFACE.md +24 -8
- package/hooks/crochet.mjs +17 -2
- package/hooks/hooks.json +24 -0
- package/package.json +1 -1
- package/scripts/activites.mjs +77 -14
- package/scripts/aiguillage.mjs +2 -0
- package/scripts/attente-a-l-arret.mjs +141 -0
- package/scripts/attente-au-tour.mjs +32 -16
- package/scripts/avancement.mjs +5 -3
- package/scripts/branche-de-nuit.mjs +63 -3
- package/scripts/circuit.mjs +57 -4
- package/scripts/circuits-du-serveur.mjs +34 -1
- package/scripts/commandes-composees.mjs +11 -4
- package/scripts/copies-finies.mjs +43 -29
- package/scripts/crochets.mjs +1 -1
- package/scripts/dette.mjs +55 -4
- package/scripts/disque-des-copies.d.mts +28 -0
- package/scripts/disque-des-copies.mjs +155 -0
- package/scripts/droits.mjs +2 -0
- package/scripts/faits-du-circuit.mjs +24 -0
- package/scripts/file-des-tickets.d.mts +16 -0
- package/scripts/file-des-tickets.mjs +65 -7
- package/scripts/gardes-du-cadre.mjs +4 -2
- package/scripts/integration/file.mjs +302 -5
- package/scripts/jointure.d.ts +33 -1
- package/scripts/langages/cargo/commandes.mjs +71 -10
- package/scripts/langages/cargo/composants.mjs +12 -4
- package/scripts/langages/cargo/executables-de-tests.mjs +118 -0
- package/scripts/langages/cargo/exemples.mjs +17 -3
- package/scripts/langages/cargo/index.mjs +8 -3
- package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +2 -2
- package/scripts/langages/cargo/migrations/0.34.0-executables-de-tests.mjs +35 -0
- package/scripts/langages/cargo/squelette.mjs +8 -3
- package/scripts/langages/cargo/tailles-des-tests.mjs +68 -6
- package/scripts/langages/cargo/tests-de-head.mjs +12 -9
- package/scripts/langages/cargo/verdict.mjs +40 -14
- package/scripts/langages/python/commandes.mjs +11 -2
- package/scripts/langages/python/index.mjs +12 -4
- package/scripts/langages/python/verdict.mjs +8 -1
- package/scripts/langages/typescript/index.mjs +9 -2
- package/scripts/langages/typescript/resume-du-lanceur.mjs +86 -0
- package/scripts/langages/typescript/tests.mjs +1 -1
- package/scripts/langages/typescript/verdict.mjs +4 -60
- package/scripts/langages/typescript/verifier.mjs +1 -1
- package/scripts/langages/typescript/vitest-config/changements.mjs +12 -7
- package/scripts/langages/typescript/vitest-config/lances.mjs +45 -0
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +1 -0
- package/scripts/messages-non-lus.mjs +166 -0
- package/scripts/mesure-de-la-machine.mjs +7 -4
- package/scripts/migrations-des-gardes.mjs +168 -0
- package/scripts/places-de-la-machine.mjs +44 -40
- package/scripts/places-du-serveur.mjs +82 -14
- package/scripts/plafond-de-la-machine.d.mts +18 -0
- package/scripts/plafond-de-la-machine.mjs +45 -0
- package/scripts/recommencer.d.mts +4 -0
- package/scripts/recommencer.mjs +29 -0
- package/scripts/regles-des-places.d.mts +35 -0
- package/scripts/regles-des-places.mjs +82 -1
- package/scripts/resultats.mjs +38 -4
- package/scripts/retirer-les-copies-finies.mjs +11 -7
- package/scripts/seances.mjs +1 -1
- package/scripts/services-du-noyau.mjs +1 -0
- package/scripts/sous-commandes.mjs +2 -0
- package/scripts/superviseur.mjs +235 -56
- package/scripts/tableau.mjs +385 -247
- package/scripts/taches-du-graphe.mjs +32 -5
- package/scripts/ticket-du-circuit.mjs +25 -0
- package/scripts/transitions.d.mts +27 -1
- package/scripts/transitions.mjs +96 -4
- package/scripts/verrou-de-machine.mjs +41 -17
- package/skills/explorateur/SKILL.md +8 -2
- package/skills/pitmaster/SKILL.md +18 -15
- package/skills/pitmaster/references/tour.md +3 -1
- package/skills/questionneur/SKILL.md +5 -1
- package/skills/testwriter/SKILL.md +32 -6
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
// Every comment and change of the queue at a ticket is written under the author `file`, which bd
|
|
72
72
|
// reads in BEADS_ACTOR, as the circuit writes its own lines under `circuit`.
|
|
73
73
|
import { spawnSync } from 'node:child_process';
|
|
74
|
-
import { existsSync, rmSync } from 'node:fs';
|
|
74
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
75
75
|
import { createRequire } from 'node:module';
|
|
76
76
|
import path from 'node:path';
|
|
77
77
|
import { couvertPar, engendresDe, regenerer, touchesPar } from '../engendres.mjs';
|
|
@@ -226,9 +226,27 @@ const VERTE = 'verte';
|
|
|
226
226
|
const SANS_CI = 'sans-ci';
|
|
227
227
|
const NON_LUE = 'non-lue';
|
|
228
228
|
|
|
229
|
-
// The
|
|
230
|
-
//
|
|
231
|
-
function
|
|
229
|
+
// The name GitHub gives the workflow of the file <texte>: its `name` key, its path <chemin> without
|
|
230
|
+
// one (or when the file is not given or its YAML not read).
|
|
231
|
+
function nomDuFlux(chemin, texte) {
|
|
232
|
+
if (texte === null) {
|
|
233
|
+
return chemin;
|
|
234
|
+
}
|
|
235
|
+
try {
|
|
236
|
+
const require = createRequire(import.meta.url);
|
|
237
|
+
const nom = require('yaml').parse(texte)?.name;
|
|
238
|
+
return typeof nom === 'string' && nom !== '' ? nom : chemin;
|
|
239
|
+
} catch {
|
|
240
|
+
return chemin;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* The workflows of the commit <sha> of the repository <racine> that run on a push to <branche>,
|
|
246
|
+
* in the order of the files of their directory: `{ chemin, nom }`, the path and the name GitHub
|
|
247
|
+
* gives the workflow (`workflowName` of `gh run list`).
|
|
248
|
+
*/
|
|
249
|
+
export function fluxDuCommit(racine, sha, branche) {
|
|
232
250
|
const git = (...a) => spawnSync('git', ['-C', racine, ...a], { encoding: 'utf8' });
|
|
233
251
|
const l = git('ls-tree', '--name-only', `${sha}:${DOSSIER_DES_FLUX}`);
|
|
234
252
|
const noms = l.status === 0 ? l.stdout.split('\n').filter(n => EXTENSIONS_DES_FLUX.test(n)) : [];
|
|
@@ -237,7 +255,195 @@ function fluxDuCommit(racine, sha, branche) {
|
|
|
237
255
|
const f = git('show', `${sha}:${chemin}`);
|
|
238
256
|
return { chemin, texte: f.status === 0 ? f.stdout : null };
|
|
239
257
|
});
|
|
240
|
-
|
|
258
|
+
const attendus = new Set(fluxDeLaBranche(fichiers, branche));
|
|
259
|
+
return fichiers
|
|
260
|
+
.filter(({ chemin }) => attendus.has(chemin))
|
|
261
|
+
.map(({ chemin, texte }) => ({ chemin, nom: nomDuFlux(chemin, texte) }));
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* The workflows of the commit <sha> that run on a push to <main> and not on a push to the branch of
|
|
266
|
+
* the ticket <brancheDuTicket>: `{ chemin, nom }`, in the order of the files. The one the CI of the
|
|
267
|
+
* branch already judged is any workflow of the second set, found by its path.
|
|
268
|
+
* @param {string} racine
|
|
269
|
+
* @param {string} sha
|
|
270
|
+
* @param {string} main
|
|
271
|
+
* @param {string} brancheDuTicket
|
|
272
|
+
* @returns {{ chemin: string, nom: string }[]}
|
|
273
|
+
*/
|
|
274
|
+
export function fluxDeMainAbsentsDeLaBranche(racine, sha, main, brancheDuTicket) {
|
|
275
|
+
const jugés = new Set(fluxDuCommit(racine, sha, brancheDuTicket).map(f => f.chemin));
|
|
276
|
+
return fluxDuCommit(racine, sha, main).filter(f => !jugés.has(f.chemin));
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// The file of the readings due of the workflows of main, in the main tree <racine>.
|
|
280
|
+
const lecturesDues = racine => path.join(racine, '.claude', 'worktrees', 'flux-de-main-dus.json');
|
|
281
|
+
|
|
282
|
+
/** The readings due of the workflows of main of <racine>: `{ ticket, commit, branche, flux, poussee }`. */
|
|
283
|
+
export function lecturesDuesDe(racine) {
|
|
284
|
+
try {
|
|
285
|
+
const lu = JSON.parse(readFileSync(lecturesDues(racine), 'utf8'));
|
|
286
|
+
return Array.isArray(lu) ? lu : [];
|
|
287
|
+
} catch {
|
|
288
|
+
return [];
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// The readings due <dues> written whole, atomically.
|
|
293
|
+
function ecrireLesLecturesDues(racine, dues) {
|
|
294
|
+
const f = lecturesDues(racine);
|
|
295
|
+
mkdirSync(path.dirname(f), { recursive: true });
|
|
296
|
+
const provisoire = `${f}.${process.pid}`;
|
|
297
|
+
writeFileSync(provisoire, `${JSON.stringify(dues, null, 2)}\n`);
|
|
298
|
+
renameSync(provisoire, f);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* After the push of the commit <sha> of the ticket <ticket> to <branche> (main) at <poussee> ms, the
|
|
303
|
+
* reading of its workflows of main recorded as due, with the tools <o>: nothing is read, nothing
|
|
304
|
+
* waited for; none is due when every workflow of main is one the CI of <brancheDuTicket> judged.
|
|
305
|
+
* A reading of the same ticket and commit is replaced.
|
|
306
|
+
*/
|
|
307
|
+
export function inscrireLesFluxDeMain(o, { ticket, sha, branche, brancheDuTicket, poussee }) {
|
|
308
|
+
const flux = fluxDeMainAbsentsDeLaBranche(o.racine, sha, branche, brancheDuTicket);
|
|
309
|
+
if (flux.length === 0) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
const autres = lecturesDuesDe(o.racine).filter(l => !(l.ticket === ticket && l.commit === sha));
|
|
313
|
+
ecrireLesLecturesDues(o.racine, [...autres, { ticket, commit: sha, branche, flux, poussee }]);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// The conclusion of the run <id> read by <gh>: `{ fini, conclusion }`, or `{ raison }`.
|
|
317
|
+
function lireUnPassage(gh, id) {
|
|
318
|
+
const v = gh(['run', 'view', id, '--json', 'status,conclusion,jobs'], {
|
|
319
|
+
timeout: 60_000,
|
|
320
|
+
killSignal: 'SIGKILL',
|
|
321
|
+
});
|
|
322
|
+
if (v.error) {
|
|
323
|
+
return { raison: `gh ne se lance pas (${v.error.code ?? v.error.message}).` };
|
|
324
|
+
}
|
|
325
|
+
if (v.status !== 0) {
|
|
326
|
+
return { raison: `gh run view refuse :\n${`${v.stderr}${v.stdout}`.trim()}` };
|
|
327
|
+
}
|
|
328
|
+
try {
|
|
329
|
+
const vue = JSON.parse(v.stdout || '{}');
|
|
330
|
+
return { fini: vue?.status === 'completed', conclusion: vue?.conclusion ?? null };
|
|
331
|
+
} catch {
|
|
332
|
+
return { raison: `gh run view rend une sortie illisible :\n${v.stdout.trim()}` };
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// The runs of the commit <sha> on <branche> read by <gh>: the list, or `{ raison }`.
|
|
337
|
+
function lirePassagesDe(gh, sha, branche) {
|
|
338
|
+
const r = gh([
|
|
339
|
+
'run',
|
|
340
|
+
'list',
|
|
341
|
+
'--commit',
|
|
342
|
+
sha,
|
|
343
|
+
'--branch',
|
|
344
|
+
branche,
|
|
345
|
+
'--json',
|
|
346
|
+
'databaseId,status,conclusion,workflowName',
|
|
347
|
+
]);
|
|
348
|
+
if (r.error) {
|
|
349
|
+
return { raison: `gh ne se lance pas (${r.error.code ?? r.error.message}).` };
|
|
350
|
+
}
|
|
351
|
+
if (r.status !== 0) {
|
|
352
|
+
return { raison: `gh run list refuse :\n${`${r.stderr}${r.stdout}`.trim()}` };
|
|
353
|
+
}
|
|
354
|
+
try {
|
|
355
|
+
const l = JSON.parse(r.stdout || '[]');
|
|
356
|
+
return { passages: Array.isArray(l) ? l : [] };
|
|
357
|
+
} catch {
|
|
358
|
+
return { raison: `gh run list rend une sortie illisible :\n${r.stdout.trim()}` };
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/** The label a ticket reopened by a red workflow of main bears, which the wait of the supervisor reads. */
|
|
363
|
+
export const FLUX_ROUGE = 'flux-rouge';
|
|
364
|
+
/** The title of the comment that gives the address of the red run, whose second paragraph is that address. */
|
|
365
|
+
export const TITRE_DU_FLUX_ROUGE = '## Flux de main rouge';
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Each reading due of the workflows of main read once, without waiting, with the tools <o> at
|
|
369
|
+
* <maintenant> ms and the bounds <ci> (`rechercheMs`, `attenteMs`, from the push of main). A workflow
|
|
370
|
+
* red (any conclusion but `success`) reopens the ticket of the commit pushed under the label
|
|
371
|
+
* `flux-rouge`, a comment giving the address of the run, and closes the reading; green, it says
|
|
372
|
+
* nothing; with no run past the search bound, a run unfinished past the wait bound, or `gh`
|
|
373
|
+
* failing, a comment names the workflow and why, nothing is reopened. A reading with a workflow
|
|
374
|
+
* still to come stays due. `{ dues }`: the readings still due.
|
|
375
|
+
*/
|
|
376
|
+
export function relireLesLecturesDues(o, { maintenant, ci }) {
|
|
377
|
+
const toutes = lecturesDuesDe(o.racine);
|
|
378
|
+
if (toutes.length === 0) {
|
|
379
|
+
return { dues: 0 };
|
|
380
|
+
}
|
|
381
|
+
const restantes = [];
|
|
382
|
+
for (const l of toutes) {
|
|
383
|
+
const court = l.commit.slice(0, 7);
|
|
384
|
+
const ecoule = maintenant - l.poussee;
|
|
385
|
+
const nonJuge = (nom, pourquoi) => {
|
|
386
|
+
commenterAu(
|
|
387
|
+
o,
|
|
388
|
+
l.ticket,
|
|
389
|
+
`## Flux de main non jugé\n\nLe flux ${nom} de ${court} sur ${l.branche} n'a pas été jugé : ${pourquoi}\n\nLa file ne le tient pas pour rouge : le superviseur le lit à la main.`
|
|
390
|
+
);
|
|
391
|
+
o.dire(`⚠ flux ${nom} de ${court} non jugé : ${pourquoi}`);
|
|
392
|
+
};
|
|
393
|
+
const lus = lirePassagesDe(o.gh, l.commit, l.branche);
|
|
394
|
+
if (lus.raison) {
|
|
395
|
+
for (const f of l.flux) {
|
|
396
|
+
nonJuge(f.nom, lus.raison);
|
|
397
|
+
}
|
|
398
|
+
continue;
|
|
399
|
+
}
|
|
400
|
+
const encore = [];
|
|
401
|
+
let rouge = null;
|
|
402
|
+
for (const f of l.flux) {
|
|
403
|
+
const p = lus.passages
|
|
404
|
+
.filter(x => x?.databaseId && x.workflowName === f.nom)
|
|
405
|
+
.reduce((m, x) => (m === null || x.databaseId > m.databaseId ? x : m), null);
|
|
406
|
+
if (p === null) {
|
|
407
|
+
if (ecoule > ci.rechercheMs) {
|
|
408
|
+
nonJuge(f.nom, `aucun passage trouvé en ${Math.round(ci.rechercheMs / 60_000)} min.`);
|
|
409
|
+
} else {
|
|
410
|
+
encore.push(f);
|
|
411
|
+
}
|
|
412
|
+
continue;
|
|
413
|
+
}
|
|
414
|
+
const id = String(p.databaseId);
|
|
415
|
+
const v = lireUnPassage(o.gh, id);
|
|
416
|
+
if (v.raison) {
|
|
417
|
+
nonJuge(f.nom, v.raison);
|
|
418
|
+
} else if (!v.fini) {
|
|
419
|
+
if (ecoule > ci.attenteMs) {
|
|
420
|
+
nonJuge(f.nom, `le passage ${id} n'est pas fini après ${Math.round(ci.attenteMs / 60_000)} min.`);
|
|
421
|
+
} else {
|
|
422
|
+
encore.push(f);
|
|
423
|
+
}
|
|
424
|
+
} else if (v.conclusion !== 'success') {
|
|
425
|
+
rouge = { nom: f.nom, id };
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
if (rouge) {
|
|
430
|
+
const url =
|
|
431
|
+
o.gh(['run', 'view', rouge.id, '--json', 'url', '--jq', '.url']).stdout?.trim() || rouge.id;
|
|
432
|
+
commenterAu(
|
|
433
|
+
o,
|
|
434
|
+
l.ticket,
|
|
435
|
+
`${TITRE_DU_FLUX_ROUGE}\n\n${rouge.nom} : ${url} (commit ${court})\n\nLe flux ${rouge.nom} de ${court} est rouge sur ${l.branche}, après l'entrée du lot : le ticket est rouvert, le superviseur juge la cause.`
|
|
436
|
+
);
|
|
437
|
+
o.bd('update', l.ticket, '--status', 'open', '--add-label', FLUX_ROUGE);
|
|
438
|
+
o.dire(`✗ flux ${rouge.nom} de ${court} rouge sur ${l.branche} : ${l.ticket} rouvert`);
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
if (encore.length > 0) {
|
|
442
|
+
restantes.push({ ...l, flux: encore });
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
ecrireLesLecturesDues(o.racine, restantes);
|
|
446
|
+
return { dues: restantes.length };
|
|
241
447
|
}
|
|
242
448
|
|
|
243
449
|
// The GitHub CLI run in the main tree <racine>.
|
|
@@ -290,6 +496,7 @@ export function lireUneFoisLaCI(o, { sha, branche, passage = null }) {
|
|
|
290
496
|
let id = passage;
|
|
291
497
|
if (id === null) {
|
|
292
498
|
if (fluxDuCommit(o.racine, sha, branche).length === 0) {
|
|
499
|
+
// (the reading of before the CI of every workflow, kept for the replay of `lireLaCI`)
|
|
293
500
|
return { etat: SANS_CI };
|
|
294
501
|
}
|
|
295
502
|
const r = gh([
|
|
@@ -346,6 +553,96 @@ export function lireUneFoisLaCI(o, { sha, branche, passage = null }) {
|
|
|
346
553
|
return { etat: 'en-cours', passage: id };
|
|
347
554
|
}
|
|
348
555
|
|
|
556
|
+
/**
|
|
557
|
+
* One reading of the CI of the commit <sha> pushed to <branche>, every expected workflow
|
|
558
|
+
* (`fluxDuCommit`) read together, with the tools <o>: `{ etat: 'sans-ci' }`; `{ etat: 'non-lue',
|
|
559
|
+
* raison }` (gh absent, refusing, or its output unreadable); `{ etat: 'rouge', passage, flux }`, the
|
|
560
|
+
* first workflow in the order of the files whose run is not a success, whatever the others still
|
|
561
|
+
* do; `{ etat: 'verte', passage }`, every workflow green, `passage` the first workflow's; or `{
|
|
562
|
+
* etat: 'en-cours', flux: [{ nom, passage, fini }] }`, each workflow with its run (null while it
|
|
563
|
+
* is looked for). A run joins its workflow by its name (`workflowName`); one of no expected name
|
|
564
|
+
* does not count, the latest run (the greatest id) of a name decides, and workflows of one name count
|
|
565
|
+
* for one, which `gh run list` does not tell apart. Each run is read at its current attempt (`gh
|
|
566
|
+
* run view <id>` without `--attempt`). Nothing is kept from one reading to the next; nothing is
|
|
567
|
+
* written to the ticket: `conclureLaCI` does.
|
|
568
|
+
*/
|
|
569
|
+
export function lireLesPassagesDeLaCI(o, { sha, branche }) {
|
|
570
|
+
const { gh } = o;
|
|
571
|
+
const attendus = [...new Set(fluxDuCommit(o.racine, sha, branche).map(f => f.nom))];
|
|
572
|
+
if (attendus.length === 0) {
|
|
573
|
+
return { etat: SANS_CI };
|
|
574
|
+
}
|
|
575
|
+
const r = gh([
|
|
576
|
+
'run',
|
|
577
|
+
'list',
|
|
578
|
+
'--commit',
|
|
579
|
+
sha,
|
|
580
|
+
'--branch',
|
|
581
|
+
branche,
|
|
582
|
+
'--json',
|
|
583
|
+
'databaseId,status,conclusion,workflowName',
|
|
584
|
+
]);
|
|
585
|
+
if (r.error) {
|
|
586
|
+
return { etat: NON_LUE, raison: `gh ne se lance pas (${r.error.code ?? r.error.message}).` };
|
|
587
|
+
}
|
|
588
|
+
if (r.status !== 0) {
|
|
589
|
+
return { etat: NON_LUE, raison: `gh run list refuse :\n${`${r.stderr}${r.stdout}`.trim()}` };
|
|
590
|
+
}
|
|
591
|
+
let passages;
|
|
592
|
+
try {
|
|
593
|
+
passages = JSON.parse(r.stdout || '[]');
|
|
594
|
+
} catch {
|
|
595
|
+
return {
|
|
596
|
+
etat: NON_LUE,
|
|
597
|
+
raison: `gh run list rend une sortie illisible :\n${r.stdout.trim()}`,
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
const recent = nom =>
|
|
601
|
+
(Array.isArray(passages) ? passages : [])
|
|
602
|
+
.filter(x => x?.databaseId && x.workflowName === nom)
|
|
603
|
+
.reduce((m, x) => (m === null || x.databaseId > m.databaseId ? x : m), null);
|
|
604
|
+
const lus = [];
|
|
605
|
+
for (const nom of attendus) {
|
|
606
|
+
const p = recent(nom);
|
|
607
|
+
if (p === null) {
|
|
608
|
+
lus.push({ nom, passage: null, fini: false });
|
|
609
|
+
continue;
|
|
610
|
+
}
|
|
611
|
+
const id = String(p.databaseId);
|
|
612
|
+
const v = gh(['run', 'view', id, '--json', 'status,conclusion,jobs'], {
|
|
613
|
+
timeout: 60_000,
|
|
614
|
+
killSignal: 'SIGKILL',
|
|
615
|
+
});
|
|
616
|
+
if (v.error) {
|
|
617
|
+
return { etat: NON_LUE, raison: `gh ne se lance pas (${v.error.code ?? v.error.message}).` };
|
|
618
|
+
}
|
|
619
|
+
if (v.status !== 0) {
|
|
620
|
+
return { etat: NON_LUE, raison: `gh run view refuse :\n${`${v.stderr}${v.stdout}`.trim()}` };
|
|
621
|
+
}
|
|
622
|
+
let vue;
|
|
623
|
+
try {
|
|
624
|
+
vue = JSON.parse(v.stdout || '{}');
|
|
625
|
+
} catch {
|
|
626
|
+
return {
|
|
627
|
+
etat: NON_LUE,
|
|
628
|
+
raison: `gh run view rend une sortie illisible :\n${v.stdout.trim()}`,
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
const fini = vue?.status === 'completed';
|
|
632
|
+
if (!fini) {
|
|
633
|
+
ecrireLesEtapes(o.avancement, vue);
|
|
634
|
+
}
|
|
635
|
+
if (fini && vue.conclusion !== 'success') {
|
|
636
|
+
return { etat: 'rouge', passage: id, flux: nom };
|
|
637
|
+
}
|
|
638
|
+
lus.push({ nom, passage: id, fini });
|
|
639
|
+
}
|
|
640
|
+
if (lus.every(f => f.fini)) {
|
|
641
|
+
return { etat: VERTE, passage: lus[0].passage };
|
|
642
|
+
}
|
|
643
|
+
return { etat: 'en-cours', flux: lus };
|
|
644
|
+
}
|
|
645
|
+
|
|
349
646
|
/**
|
|
350
647
|
* The working directory of the circuit of <ticket> in the main tree of <o> removed, once the queue
|
|
351
648
|
* is done with the ticket closed: as the workspace of a pipeline, it lives as long as the ticket.
|
package/scripts/jointure.d.ts
CHANGED
|
@@ -256,6 +256,15 @@ export interface Composition {
|
|
|
256
256
|
* its class (day, night, bench), which the proof of the red writes, plays and removes; null for
|
|
257
257
|
* a file that has none. */
|
|
258
258
|
soeurDAvant?(chemin: string, racine: string): string | null;
|
|
259
|
+
/** Optional, for the module that drives the task runner (typescript), which the core serves to
|
|
260
|
+
* the others: the names of the summaries of a run present in `racine` before a run. */
|
|
261
|
+
resumesDuLancement?(racine: string): Set<string>;
|
|
262
|
+
/** Optional, typescript's alone: moves the summaries a run in `racine` wrote (absent from
|
|
263
|
+
* `avant`) into the results directory `env` names, or removes them without one. */
|
|
264
|
+
garderLesResumes?(racine: string, avant: Set<string>, env?: NodeJS.ProcessEnv): void;
|
|
265
|
+
/** Optional, typescript's alone: the tasks of the summaries under the results directory
|
|
266
|
+
* `dossier`, in their order, each with its cache status; `code` null for a task that did not run. */
|
|
267
|
+
lireLesResumes?(dossier: string): TacheDuResume[];
|
|
259
268
|
/** Whether HEAD's version of the test file `chemin` (from `racine`) plays in a tree of its own,
|
|
260
269
|
* the copy's with that file alone replaced, under the file's own name, which the proof of the
|
|
261
270
|
* red builds, plays and removes (cargo, python); false for a file the tool cannot play so
|
|
@@ -263,7 +272,8 @@ export interface Composition {
|
|
|
263
272
|
* beside it (typescript: `soeurDAvant`) or does not play. */
|
|
264
273
|
arbreDAvant(chemin: string, racine: string): boolean;
|
|
265
274
|
/** The environment a tree of HEAD's version of `chemin` plays under (cargo: the target
|
|
266
|
-
* directory of the copy's compilations
|
|
275
|
+
* directory of the copy's compilations; python: the copy's folder of uv environments, which the
|
|
276
|
+
* tree reuses, `GRILLHOUSE_VENV_DE_LA_COPIE`); empty for none. */
|
|
267
277
|
envDArbre(chemin: string, racine: string): Record<string, string>;
|
|
268
278
|
/** The names of the tests of HEAD's version of the test file `chemin` (from `racine`), as the
|
|
269
279
|
* verdict names them, read without playing them, for a file whose tree the proof does not play
|
|
@@ -293,6 +303,10 @@ export interface Langage extends Composition {
|
|
|
293
303
|
/** The manifest of a package of this language, in its folder (`package.json`, `Cargo.toml`):
|
|
294
304
|
* the guard of the languages asks it of a package the architecture declares of this language. */
|
|
295
305
|
manifeste: string;
|
|
306
|
+
/** The expected size of a copy of a project of this language before any of its copies is
|
|
307
|
+
* measured, in bytes: the room a circuit's start wants on the disk of the copies, the charter's
|
|
308
|
+
* margin besides (scripts/disque-des-copies.mjs), its dependencies and its builds included. */
|
|
309
|
+
tailleDUneCopie: number;
|
|
296
310
|
/** The name the text of a manifest of this language gives its package (the `name` of a
|
|
297
311
|
* `package.json`, of the `[package]` of a `Cargo.toml`, of the `[project]` of a
|
|
298
312
|
* `pyproject.toml`); null for none. */
|
|
@@ -498,6 +512,24 @@ export function lancerLesTaches(o: {
|
|
|
498
512
|
tests?: { arguments: string[]; rejouer?: string };
|
|
499
513
|
env?: NodeJS.ProcessEnv;
|
|
500
514
|
}): number;
|
|
515
|
+
/** A task of the summary of the task runner, or one a module wrote: `code` null for a task that did not run. */
|
|
516
|
+
export interface TacheDuResume {
|
|
517
|
+
tache: string;
|
|
518
|
+
paquet: string;
|
|
519
|
+
dossier: string;
|
|
520
|
+
script: string;
|
|
521
|
+
tests: boolean;
|
|
522
|
+
code: number | null;
|
|
523
|
+
cache: string | null;
|
|
524
|
+
journal: string | null;
|
|
525
|
+
}
|
|
526
|
+
/** The tasks of the verdict of a language without a reading of the summary of its own (cargo,
|
|
527
|
+
* python): those of the summary under `dossier`, read by the module that drives the runner
|
|
528
|
+
* (`lireLesResumes`), then each of `ecrites` whose id they lack. */
|
|
529
|
+
export function tachesDuVerdict<T extends { tache: string }>(
|
|
530
|
+
dossier: string,
|
|
531
|
+
ecrites: T[]
|
|
532
|
+
): (TacheDuResume | T)[];
|
|
501
533
|
/** The content of the variable `TESTS_CIBLES` for a targeted run: the paths and options it names, and
|
|
502
534
|
* the moment of the run when `force` (the task plays for real); undefined when there is nothing to
|
|
503
535
|
* carry. */
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
// npx grillhouse verifier [--tout | --gardes] verifier
|
|
9
9
|
// node commandes.mjs typer typer
|
|
10
10
|
// npx grillhouse tests-de-nuit tests-de-nuit
|
|
11
|
-
// npx grillhouse tailles-des-tests | clippy | frontieres | index-interfaces
|
|
11
|
+
// npx grillhouse tailles-des-tests | executables-de-tests | clippy | frontieres | index-interfaces
|
|
12
12
|
// each guard, its own script
|
|
13
13
|
//
|
|
14
|
-
// - Each guard of structure of the module (./tailles-des-tests.mjs, ./clippy.mjs,
|
|
14
|
+
// - Each guard of structure of the module (./tailles-des-tests.mjs, ./executables-de-tests.mjs, ./clippy.mjs,
|
|
15
15
|
// ./frontieres.mjs, ./index-interfaces.mjs) is a command by its name too, its own script, as the module typescript's: the line of a red
|
|
16
16
|
// guard (`grillhouse <garde>`, scripts/gardes-du-cadre.mjs) names a command that exists.
|
|
17
17
|
// - `tester` plays the tests of the crates as tasks of Turborepo, the way of the module
|
|
@@ -47,7 +47,9 @@
|
|
|
47
47
|
// `<target>/grillhouse/<crate>-build.log`, the task's `journal` from the root, then to the error
|
|
48
48
|
// stream. The folder of a crate plays it whole; the source of a test target
|
|
49
49
|
// (`<crate>/tests/<nom>.rs`) builds and plays that target alone (`--test <nom>`), without the
|
|
50
|
-
// doctests;
|
|
50
|
+
// doctests; a module of a target `tests/<dossier>/main.rs` (`tests/it/foo.rs`, the crate's one
|
|
51
|
+
// executable) builds that target and plays its tests alone, by the filterset of nextest
|
|
52
|
+
// (`-E 'binary_id(<crate>::it) & test(/^foo::/)'`), as Cargo filters its own testsuite; the paths of the variable `GRILLHOUSE_TESTS` that lie in the crate replace the folder.
|
|
51
53
|
// A path out of every crate, or in a crate without tests, is refused, named, and nothing plays
|
|
52
54
|
// (code 2). `--force` changes nothing here: cargo keeps no result of a test to replay. Another
|
|
53
55
|
// option goes to nextest.
|
|
@@ -227,6 +229,7 @@ const COMPILATIONS = ['test', 'nextest', 'check', 'build'];
|
|
|
227
229
|
* this one, and its arguments as a guard. */
|
|
228
230
|
export const GARDES = [
|
|
229
231
|
{ nom: 'tailles-des-tests', args: [] },
|
|
232
|
+
{ nom: 'executables-de-tests', args: [] },
|
|
230
233
|
{ nom: 'clippy', args: [] },
|
|
231
234
|
{ nom: 'frontieres', args: [] },
|
|
232
235
|
{ nom: 'index-interfaces', args: ['--verifier'] },
|
|
@@ -457,7 +460,7 @@ function jouerLesTests(racine, p, choix, options, temporaire = () => ({}), tranc
|
|
|
457
460
|
const bancs = [];
|
|
458
461
|
// The test executables the builds of the run report, removed once its tests played.
|
|
459
462
|
const executables = [];
|
|
460
|
-
for (const { c, cibles: nommees, jour } of choix) {
|
|
463
|
+
for (const { c, cibles: nommees, jour, modules = new Map() } of choix) {
|
|
461
464
|
// Targets named beside the day of the crate (`jour`, a unit test of `src/` named): the day
|
|
462
465
|
// builds whole, and plays besides the targets named.
|
|
463
466
|
const cibles = jour && nommees.length === 0 ? [] : nommees;
|
|
@@ -492,7 +495,7 @@ function jouerLesTests(racine, p, choix, options, temporaire = () => ({}), tranc
|
|
|
492
495
|
? duC.length
|
|
493
496
|
? [...duC, ...nommes]
|
|
494
497
|
: []
|
|
495
|
-
: nommes;
|
|
498
|
+
: [...nommes, ...filtreDesModules(nom, autres, modules)];
|
|
496
499
|
const args = [...nextest, '-p', nom, ...selection, ...options];
|
|
497
500
|
prevues.push([
|
|
498
501
|
p.prevoir(nom, d, 'nextest', true, args),
|
|
@@ -500,7 +503,13 @@ function jouerLesTests(racine, p, choix, options, temporaire = () => ({}), tranc
|
|
|
500
503
|
]);
|
|
501
504
|
}
|
|
502
505
|
if (desBancs.length && indivisible) {
|
|
503
|
-
const args = [
|
|
506
|
+
const args = [
|
|
507
|
+
...nextestDuBanc,
|
|
508
|
+
'-p',
|
|
509
|
+
nom,
|
|
510
|
+
...desBancs.flatMap(n => ['--test', n]),
|
|
511
|
+
...filtreDesModules(nom, desBancs, modules),
|
|
512
|
+
];
|
|
504
513
|
bancs.push({
|
|
505
514
|
nom,
|
|
506
515
|
d,
|
|
@@ -562,6 +571,46 @@ function duJour(c) {
|
|
|
562
571
|
// The refusal of a night test named in a targeted run: the night alone plays it.
|
|
563
572
|
const REFUS_DE_NUIT = 'un test de nuit se joue la nuit seulement (npx grillhouse nuit le joue)';
|
|
564
573
|
|
|
574
|
+
// The target `tests/<dossier>/main.rs` of the crate <crate> whose module is the file <abs> (out
|
|
575
|
+
// of `tests/common/` and of the target's root), and the module's path in the executable
|
|
576
|
+
// (`tests/it/foo.rs` and `tests/it/foo/mod.rs` → `foo`, `tests/it/foo/sous.rs` → `foo::sous`):
|
|
577
|
+
// `{ cible, module }`, null for any other file.
|
|
578
|
+
function moduleDeCible(crate, abs) {
|
|
579
|
+
const parts = path.relative(crate.composant.dossier, abs).split(path.sep);
|
|
580
|
+
if (parts.length < 3 || parts[0] !== 'tests' || parts[1] === 'common' || !abs.endsWith('.rs')) {
|
|
581
|
+
return null;
|
|
582
|
+
}
|
|
583
|
+
const racine = path.join(crate.composant.dossier, 'tests', parts[1], 'main.rs');
|
|
584
|
+
const cible = crate.cibles.find(t => t.kind.includes('test') && t.src === racine);
|
|
585
|
+
const module = parts.slice(2);
|
|
586
|
+
module[module.length - 1] = module[module.length - 1].replace(/\.rs$/, '');
|
|
587
|
+
if (module.at(-1) === 'mod') {
|
|
588
|
+
module.pop();
|
|
589
|
+
}
|
|
590
|
+
return cible && module.length ? { cible, module: module.join('::') } : null;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
// The filterset of nextest that plays, of the targets <noms> of the crate <nom>, the modules
|
|
594
|
+
// <modules> holds (`Map` target → its modules, or null for the whole target), as Cargo's own
|
|
595
|
+
// testsuite filters one executable by module path: `binary_id(<crate>::<cible>) &
|
|
596
|
+
// test(/^<module>::/)`; none when every target plays whole.
|
|
597
|
+
function filtreDesModules(nom, noms, modules) {
|
|
598
|
+
if (noms.every(n => (modules.get(n) ?? null) === null)) {
|
|
599
|
+
return [];
|
|
600
|
+
}
|
|
601
|
+
const echapper = s => s.replace(/[.*+?^${}()|[\]\\/]/g, '\\$&');
|
|
602
|
+
const parCible = noms.map(n => {
|
|
603
|
+
const binaire = `binary_id(${nom}::${n})`;
|
|
604
|
+
const deN = modules.get(n) ?? null;
|
|
605
|
+
if (deN === null) {
|
|
606
|
+
return binaire;
|
|
607
|
+
}
|
|
608
|
+
const tests = deN.map(m => `test(/^${echapper(m)}::/)`).join(' | ');
|
|
609
|
+
return `(${binaire} & (${tests}))`;
|
|
610
|
+
});
|
|
611
|
+
return ['-E', parCible.join(' | ')];
|
|
612
|
+
}
|
|
613
|
+
|
|
565
614
|
// The crates the paths <chemins> choose in <racine>: `{ choix }`, or `{ refus }` naming each path
|
|
566
615
|
// refused.
|
|
567
616
|
function choisir(racine, tous, chemins) {
|
|
@@ -585,7 +634,9 @@ function choisir(racine, tous, chemins) {
|
|
|
585
634
|
refus.push(`${chemin} : ${c.nom} n'a aucun test, ni dossier tests/, ni tests.rs sous src/`);
|
|
586
635
|
continue;
|
|
587
636
|
}
|
|
588
|
-
const
|
|
637
|
+
const propre = crate.cibles.find(t => t.kind.includes('test') && t.src === abs);
|
|
638
|
+
const duModule = propre ? null : moduleDeCible(crate, abs);
|
|
639
|
+
const cible = propre ?? duModule?.cible;
|
|
589
640
|
// A night test plays at night alone (`tests-de-nuit`): a targeted run refuses it, named.
|
|
590
641
|
if (cible && horsDuJour(cible) === 'nuit') {
|
|
591
642
|
refus.push(`${chemin} : ${REFUS_DE_NUIT}`);
|
|
@@ -593,14 +644,24 @@ function choisir(racine, tous, chemins) {
|
|
|
593
644
|
}
|
|
594
645
|
const deja = parDossier.get(c.dossier);
|
|
595
646
|
// A file with no target of its own (a unit test of `src/`) asks for the day of its crate; a
|
|
596
|
-
// target named stays named, whatever the order of the paths
|
|
597
|
-
|
|
647
|
+
// target named stays named, whatever the order of the paths; a module of a target
|
|
648
|
+
// `tests/<dossier>/main.rs` names its target, its tests alone (`modules`), unless the target
|
|
649
|
+
// is named whole.
|
|
650
|
+
const entree = deja ?? { c: crate, cibles: [], jour: false, modules: new Map() };
|
|
598
651
|
parDossier.set(c.dossier, entree);
|
|
599
652
|
if (!cible) {
|
|
600
653
|
entree.jour = true;
|
|
601
|
-
|
|
654
|
+
continue;
|
|
655
|
+
}
|
|
656
|
+
if (!entree.cibles.includes(cible.name)) {
|
|
602
657
|
entree.cibles.push(cible.name);
|
|
603
658
|
}
|
|
659
|
+
const avant = entree.modules.get(cible.name);
|
|
660
|
+
if (!duModule || avant === null) {
|
|
661
|
+
entree.modules.set(cible.name, null);
|
|
662
|
+
} else {
|
|
663
|
+
entree.modules.set(cible.name, [...(avant ?? []), duModule.module]);
|
|
664
|
+
}
|
|
604
665
|
}
|
|
605
666
|
if (refus.length) {
|
|
606
667
|
return { refus };
|
|
@@ -316,8 +316,10 @@ export function envDArbre(_chemin, racine) {
|
|
|
316
316
|
/**
|
|
317
317
|
* The names of the tests of HEAD's version of the test file <chemin> (from the root <racine>),
|
|
318
318
|
* read without playing them, for a file whose tree the proof does not play: a unit test file of
|
|
319
|
-
* `src/` (`tests.rs`, a file of a folder `tests/` under `src/`, out of `src/bin/`) and
|
|
320
|
-
* `tests/<dossier>/main.rs
|
|
319
|
+
* `src/` (`tests.rs`, a file of a folder `tests/` under `src/`, out of `src/bin/`) and each file
|
|
320
|
+
* of a target `tests/<dossier>/main.rs`, its root and its modules (`tests/it/foo.rs`, the names
|
|
321
|
+
* `foo::…`), each its own tests as the verdict gives them (./tests-de-head.mjs,
|
|
322
|
+
* ./verdict.mjs), and a target `tests/<nom>.rs`, whose tree the
|
|
321
323
|
* proof plays unless it no longer compiles (grillhouse-3e2.2): its names as nextest gives them,
|
|
322
324
|
* without the target, its out-of-line modules read (`mod common;`, `common::<fn>`). <lire> gives
|
|
323
325
|
* HEAD's text of a file from the root. Null for any other file, or one HEAD does not hold.
|
|
@@ -336,8 +338,14 @@ export function testsDeHead(chemin, racine, lire) {
|
|
|
336
338
|
return null;
|
|
337
339
|
}
|
|
338
340
|
const parts = path.relative(c.dossier, abs).split(path.sep);
|
|
339
|
-
|
|
340
|
-
|
|
341
|
+
// A file of a target `tests/<dossier>/main.rs`, out of the helpers of `tests/common/`.
|
|
342
|
+
if (parts.length >= 3 && parts[0] === 'tests' && parts[1] !== 'common') {
|
|
343
|
+
const module = parts.slice(2);
|
|
344
|
+
module[module.length - 1] = module[module.length - 1].replace(/\.rs$/, '');
|
|
345
|
+
if (module.at(-1) === 'mod' || (module.length === 1 && module[0] === 'main')) {
|
|
346
|
+
module.pop();
|
|
347
|
+
}
|
|
348
|
+
return nomsDeHead(chemin, module, lire);
|
|
341
349
|
}
|
|
342
350
|
if (arbreDAvant(chemin, racine)) {
|
|
343
351
|
return nomsDeHead(chemin, null, lire);
|