@roomi-fields/grillhouse 0.38.1 → 0.39.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 +16 -0
- package/charte.md +13 -0
- package/dist/temporal/circuit/client.d.ts +4 -3
- package/dist/temporal/circuit/client.js +4 -3
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/commande.js +6 -4
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/dist/temporal/tickets/deroule.js +16 -4
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/docs/ARCHITECTURE.md +21 -26
- package/docs/INTERFACE.md +15 -34
- package/package.json +1 -1
- package/scripts/activites.mjs +48 -290
- package/scripts/circuit.mjs +6 -22
- package/scripts/composition-des-langages.mjs +1 -16
- package/scripts/conformite.mjs +0 -31
- package/scripts/dernier-vert.mjs +4 -86
- package/scripts/etat-du-depot.mjs +92 -0
- package/scripts/grillhouse-maj.mjs +9 -6
- package/scripts/jointure.d.ts +0 -29
- package/scripts/langages/cargo/commandes.mjs +8 -15
- package/scripts/langages/cargo/composants.mjs +1 -100
- package/scripts/langages/cargo/exemples.mjs +0 -73
- package/scripts/langages/cargo/index.mjs +0 -6
- package/scripts/langages/python/commandes.mjs +2 -11
- package/scripts/langages/python/composants.mjs +2 -13
- package/scripts/langages/python/exemples.mjs +0 -19
- package/scripts/langages/python/index.mjs +2 -14
- package/scripts/langages/typescript/exemples.mjs +0 -16
- package/scripts/langages/typescript/index.mjs +6 -11
- package/scripts/langages/typescript/regle-des-tests.mjs +0 -15
- package/scripts/langages/typescript/verifier.mjs +30 -0
- package/scripts/nuit.sh +7 -1
- package/scripts/recommencer.mjs +5 -3
- package/scripts/registre-des-resultats.mjs +119 -0
- package/scripts/services-du-noyau.mjs +6 -0
- package/scripts/sources.mjs +5 -3
- package/skills/explorateur/SKILL.md +6 -1
- package/scripts/langages/cargo/tests-de-head.mjs +0 -178
|
@@ -50,7 +50,7 @@ import { composants as lesComposants, matieres } from './consommateurs.mjs';
|
|
|
50
50
|
import { elementsDuLot } from './elements-du-lot.mjs';
|
|
51
51
|
import { estNoteDeDette, lireSarif, RESULTATS } from '../../resultats.mjs';
|
|
52
52
|
import { lecteurs } from './lecteurs.mjs';
|
|
53
|
-
import { estUnTest, manifestes
|
|
53
|
+
import { estUnTest, manifestes } from './regle-des-tests.mjs';
|
|
54
54
|
import {
|
|
55
55
|
avecLeFichierDuPoste,
|
|
56
56
|
empreintesDesTaches,
|
|
@@ -208,10 +208,11 @@ export default {
|
|
|
208
208
|
binaires: {},
|
|
209
209
|
// No program the installer of Temporal looks for: Node is a tool of the account.
|
|
210
210
|
executables: [],
|
|
211
|
-
// What its tools write in a project:
|
|
212
|
-
//
|
|
213
|
-
//
|
|
214
|
-
|
|
211
|
+
// What its tools write in a project: Vitest's reports of the tranches of a pass (./tranches.mjs),
|
|
212
|
+
// and the cache of the lint and of the format check of the project (`.cache-outils/`). Turborepo's
|
|
213
|
+
// runs and cache (`.turbo`) are the frame's, every language playing by it: IGNORES_DU_CADRE of
|
|
214
|
+
// scripts/grillhouse-maj.mjs ignores them.
|
|
215
|
+
ignorer: ['.vitest-reports', '.cache-outils'],
|
|
215
216
|
// Where its tools write: the cache of Turborepo in the main tree, shared by every copy, written;
|
|
216
217
|
// the logs of Turborepo's tasks (`.turbo/turbo-<task>.log`, written on every run, a task replayed
|
|
217
218
|
// from its cache included, and which no option of Turborepo sends elsewhere) and the cache of
|
|
@@ -273,16 +274,10 @@ export default {
|
|
|
273
274
|
estUnTest,
|
|
274
275
|
// A night test, a bench or a time witness (./vitest-config/cibles.mjs, `estHorsDuJour`).
|
|
275
276
|
horsDuJour: (chemin, racine) => estHorsDuJour(path.resolve(racine, chemin)),
|
|
276
|
-
soeurDAvant,
|
|
277
277
|
// The summary of a run of Turborepo, which the core serves to the other modules.
|
|
278
278
|
resumesDuLancement,
|
|
279
279
|
garderLesResumes,
|
|
280
280
|
lireLesResumes,
|
|
281
|
-
// Its tool plays HEAD's version of each test file beside it (`soeurDAvant`): no tree, no name
|
|
282
|
-
// to read.
|
|
283
|
-
arbreDAvant: () => false,
|
|
284
|
-
envDArbre: () => ({}),
|
|
285
|
-
testsDeHead: () => null,
|
|
286
281
|
manifestes,
|
|
287
282
|
fichiersEngendres: () => [
|
|
288
283
|
engendre(
|
|
@@ -11,10 +11,6 @@
|
|
|
11
11
|
//
|
|
12
12
|
// Any other file is none of them: null.
|
|
13
13
|
//
|
|
14
|
-
// The sibling of HEAD's version of a test file Vitest plays (`soeurDAvant`), which the proof of
|
|
15
|
-
// the red plays beside it: `<nom>.circuit-avant.<test|spec>.<ext>`, the mark of a night test or of
|
|
16
|
-
// a bench kept before it (`<nom>.circuit-avant.nuit.test.<ext>`), so that it plays as its file.
|
|
17
|
-
//
|
|
18
14
|
// What the testwriter writes of the manifests (`manifestes`): the field that declares what the
|
|
19
15
|
// tests of a package depend on, `devDependencies` of its package.json (npm's docs,
|
|
20
16
|
// « devDependencies »), as the author of a test of Bazel declares the deps of its target; and
|
|
@@ -50,17 +46,6 @@ export function estUnTest(chemin, racine) {
|
|
|
50
46
|
return joue || test || matiere ? { joue, test, matiere } : null;
|
|
51
47
|
}
|
|
52
48
|
|
|
53
|
-
// The sibling of HEAD's version of the test file <chemin> (from the root <racine>), which Vitest
|
|
54
|
-
// plays in the same run: `<nom>.circuit-avant.<test|spec>.<ext>` beside it, a name of NOM_DE_TEST,
|
|
55
|
-
// of its file's kind (`.nuit` or `.budget` kept before `.test`);
|
|
56
|
-
// null for a file Vitest does not play.
|
|
57
|
-
export function soeurDAvant(chemin, racine) {
|
|
58
|
-
if (!estUnTest(chemin, racine)?.joue) {
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
return chemin.replace(/((?:\.nuit|\.budget)?\.(?:test|spec)\.[cm]?[jt]sx?)$/, '.circuit-avant$1');
|
|
62
|
-
}
|
|
63
|
-
|
|
64
49
|
// The field of a manifest that declares what its tests depend on.
|
|
65
50
|
const DES_TESTS = 'devDependencies';
|
|
66
51
|
|
|
@@ -111,10 +111,14 @@ import {
|
|
|
111
111
|
avecLaMachineEtUnePlace,
|
|
112
112
|
BASE_DU_LOT,
|
|
113
113
|
CHANGEMENTS,
|
|
114
|
+
consignerLesRegressions,
|
|
115
|
+
garderLeRegistre,
|
|
114
116
|
garderLeTotal,
|
|
115
117
|
garderLeVert,
|
|
116
118
|
LA_FORME,
|
|
119
|
+
langageDe,
|
|
117
120
|
lireLaTranche,
|
|
121
|
+
lireLeRegistre,
|
|
118
122
|
mesure,
|
|
119
123
|
nommerLAvancement,
|
|
120
124
|
ouvrirAvancement,
|
|
@@ -126,6 +130,7 @@ import {
|
|
|
126
130
|
testsCibles,
|
|
127
131
|
} from '../../services-du-noyau.mjs';
|
|
128
132
|
import { paquets, TYPAGE } from '../../paquets.mjs';
|
|
133
|
+
import { RESULTATS } from '../../resultats.mjs';
|
|
129
134
|
import { fichiersDeLaTranche, RAPPORTS } from './tranches.mjs';
|
|
130
135
|
import { garderLesResumes } from './resume-du-lanceur.mjs';
|
|
131
136
|
import { controlesDuDepot, planifier } from './turbo-des-paquets.mjs';
|
|
@@ -341,6 +346,12 @@ function passe({ racine, demandes, env, dire, coeurs }) {
|
|
|
341
346
|
if (m) {
|
|
342
347
|
dire(m.ligne);
|
|
343
348
|
}
|
|
349
|
+
// A complete pass plays every test for real: when its caller names a results directory
|
|
350
|
+
// (`GRILLHOUSE_RESULTATS`, which the night sets for its pass, scripts/nuit.sh), it keeps the
|
|
351
|
+
// registry of results test by test besides the last green, which the proof of the red reads
|
|
352
|
+
// (scripts/registre-des-resultats.mjs); a pass that names none writes no registry, so the pass
|
|
353
|
+
// itself opens none and its environment is unchanged.
|
|
354
|
+
const complet = tout && !gardesSeules && !sansTests && !tranche && !filtre(args);
|
|
344
355
|
const taches = new Set();
|
|
345
356
|
try {
|
|
346
357
|
// A tranche writes its reports anew.
|
|
@@ -372,6 +383,25 @@ function passe({ racine, demandes, env, dire, coeurs }) {
|
|
|
372
383
|
garder: garderLeVert,
|
|
373
384
|
partielle: Boolean(tranche) || sansTests,
|
|
374
385
|
});
|
|
386
|
+
// The registry of a complete pass whose caller named a results directory, from the reports of
|
|
387
|
+
// every language: green, it keeps the passed tests of its branch; red on main's own branch (the
|
|
388
|
+
// night, or a complete pass on main), it records as regressions the tests the registry held
|
|
389
|
+
// green that turned red, with the moment they did. A red pass on a ticket's branch records none:
|
|
390
|
+
// its reds are the ticket's work.
|
|
391
|
+
if (complet && env[RESULTATS] && m?.etat) {
|
|
392
|
+
const rapports = langageDe(racine).verdict(env[RESULTATS]).rapports;
|
|
393
|
+
if (code === 0) {
|
|
394
|
+
garderLeRegistre(m.etat, rapports);
|
|
395
|
+
} else if (!m.etat.branche || m.etat.branche === m.etat.main) {
|
|
396
|
+
const rouges = rapports.flatMap(r =>
|
|
397
|
+
(r.tests ?? [])
|
|
398
|
+
.filter(t => t.etat === 'failed')
|
|
399
|
+
.map(t => ({ fichier: path.relative(racine, r.fichier), nom: t.nom }))
|
|
400
|
+
);
|
|
401
|
+
const quand = env.GRILLHOUSE_VERIFICATION_SORTE === 'Nuit' ? 'nuit' : 'jour';
|
|
402
|
+
consignerLesRegressions(m.etat, rouges, lireLeRegistre(racine), quand);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
375
405
|
return code;
|
|
376
406
|
} finally {
|
|
377
407
|
m?.retirer();
|
package/scripts/nuit.sh
CHANGED
|
@@ -149,6 +149,12 @@ journal="$dossier/$(date +%Y-%m-%d).log"
|
|
|
149
149
|
# The red tasks of the full pass, written by the verification of the module of the language.
|
|
150
150
|
rouges="$dossier/rouges"
|
|
151
151
|
rm -f "$rouges"
|
|
152
|
+
# The results directory of the full pass: each language writes its reports there, and the pass reads
|
|
153
|
+
# them to keep the registry of results (scripts/registre-des-resultats.mjs), which the proof of the
|
|
154
|
+
# red reads to tell a test main holds green from a new one.
|
|
155
|
+
resultats="$dossier/resultats"
|
|
156
|
+
rm -rf "$resultats"
|
|
157
|
+
mkdir -p "$resultats"
|
|
152
158
|
|
|
153
159
|
tete="$(git -C "$racine" rev-parse HEAD)"
|
|
154
160
|
copie="$racine/.claude/worktrees/nuit"
|
|
@@ -282,7 +288,7 @@ process.exit(paquets(process.argv[2]).some(p => p.pkg.name === "@roomi-fields/gr
|
|
|
282
288
|
# The full pass, played for real: the night replays no log of the cache. Each step plays even
|
|
283
289
|
# when one before it is red; a step à repasser ends the night there, red if a step before it is.
|
|
284
290
|
local code tache avant
|
|
285
|
-
GRILLHOUSE_ROUGES="$rouges" GRILLHOUSE_VERIFICATION_SORTE=Nuit monter npm --prefix "$copie" run verifier -- --force
|
|
291
|
+
GRILLHOUSE_ROUGES="$rouges" GRILLHOUSE_RESULTATS="$resultats" GRILLHOUSE_VERIFICATION_SORTE=Nuit monter npm --prefix "$copie" run verifier -- --force
|
|
286
292
|
code=$?
|
|
287
293
|
if [ "$code" -eq 75 ]; then
|
|
288
294
|
echo "⏱ la passe complète est à repasser (code 75) : l'attente de la machine a atteint sa borne."
|
package/scripts/recommencer.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// `grillhouse circuit <ticket> --recommencer`: the removal of what a ticket's circuit left, so that
|
|
2
|
-
// a fresh launch starts from the testwriter in a fresh copy.
|
|
3
|
-
//
|
|
4
|
-
// working directory go; the ticket, its description, its plan and its comments are Beads'
|
|
2
|
+
// a fresh launch starts from the testwriter in a fresh copy. It resets the copy, not Temporal: the
|
|
3
|
+
// copy (whatever work it carries, the gesture being asked for), its branch, its sheets, its journal
|
|
4
|
+
// and its working directory go; the ticket, its description, its plan and its comments are Beads'
|
|
5
|
+
// and stay. The finished workflow stays on the server, which the queue, counting only the live
|
|
6
|
+
// circuits, no more holds the ticket back for (grillhouse-d0t).
|
|
5
7
|
import { spawnSync } from 'node:child_process';
|
|
6
8
|
import { existsSync, rmSync } from 'node:fs';
|
|
7
9
|
import path from 'node:path';
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// The registry of test results, by branch, of a repository: what the last green pass of
|
|
2
|
+
// `npm run verifier` (scripts/langages/typescript/verifier.mjs) holds, test by test. As Chromium's
|
|
3
|
+
// ResultDB and Mozilla's Treeherder keep the result of each test by version of the main branch, and
|
|
4
|
+
// as `.pytest_cache` keeps the last run's tests, the proof of the red reads here which tests main
|
|
5
|
+
// already holds green, instead of compiling and playing HEAD's version of each test file.
|
|
6
|
+
//
|
|
7
|
+
// - It lives in `<git common dir>/grillhouse/resultats/<branche>.json`, one per branch, beside the
|
|
8
|
+
// last green (scripts/dernier-vert.mjs), written by the same green pass under the same conditions
|
|
9
|
+
// (`poserLeVert`): `{ commit, tests: { "<fichier depuis la racine>": { "<nom complet>":
|
|
10
|
+
// "passed" } } }`, HEAD at that pass and the passed tests of each file.
|
|
11
|
+
// - A pass in a copy reads the registry of its branch when it counts (its commit an ancestor of
|
|
12
|
+
// HEAD), else main's, as `dernier-vert` measures the last green: the proof of a ticket's copy
|
|
13
|
+
// thus reads what main holds green.
|
|
14
|
+
// - A test of the lot whose full name is in the registry of <fichier> existed before the ticket
|
|
15
|
+
// (its green is accepted); one absent is new (a test named in `portent_le_travail` must be red).
|
|
16
|
+
// - A regression is a test the registry held green that a pass of the day (`verifier`) or of the
|
|
17
|
+
// night turns red: it is recorded in `<git common dir>/grillhouse/regressions/<branche>.json`
|
|
18
|
+
// with the moment it turned red — its last green commit and its first red HEAD — for the night to
|
|
19
|
+
// classify and correct (the charter, « Main reste vert »).
|
|
20
|
+
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
21
|
+
import path from 'node:path';
|
|
22
|
+
import { etatDuDepot, fichierSous, git, SHA } from './etat-du-depot.mjs';
|
|
23
|
+
|
|
24
|
+
// Keeps <etat> (etatDuDepot) and the passed tests of the reports <rapports> (`verdict` of the join,
|
|
25
|
+
// each `{ fichier, tests: [{ nom, etat }] }`, `fichier` absolute) as the registry of its branch,
|
|
26
|
+
// of main when HEAD is detached. Only the passed tests, since a green pass holds no other.
|
|
27
|
+
export function garderLeRegistre(etat, rapports) {
|
|
28
|
+
const branche = etat.branche ?? etat.main;
|
|
29
|
+
const f = branche ? fichierSous(etat.racine, 'resultats', branche) : null;
|
|
30
|
+
if (!f) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const tests = {};
|
|
34
|
+
for (const r of rapports) {
|
|
35
|
+
const rel = path.relative(etat.racine, r.fichier);
|
|
36
|
+
for (const t of r.tests ?? []) {
|
|
37
|
+
if (t.etat === 'passed') {
|
|
38
|
+
(tests[rel] ??= {})[t.nom] = 'passed';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
mkdirSync(path.dirname(f), { recursive: true });
|
|
43
|
+
writeFileSync(f, `${JSON.stringify({ commit: etat.commit, tests }, null, 2)}\n`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// The registry that counts for a pass in the repository at <racine>: its branch's when its commit
|
|
47
|
+
// is an ancestor of HEAD, else main's, as `dernier-vert` reads the last green. `{ commit, tests,
|
|
48
|
+
// branche }`, or null when none counts (out of git, or no registry whose commit is an ancestor).
|
|
49
|
+
export function lireLeRegistre(racine) {
|
|
50
|
+
const etat = etatDuDepot(racine);
|
|
51
|
+
if (etat.raison) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
for (const branche of [...new Set([etat.branche, etat.main].filter(Boolean))]) {
|
|
55
|
+
const f = fichierSous(racine, 'resultats', branche);
|
|
56
|
+
let v = null;
|
|
57
|
+
try {
|
|
58
|
+
v = JSON.parse(readFileSync(f, 'utf8'));
|
|
59
|
+
} catch {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (!SHA.test(v?.commit ?? '') || typeof v.tests !== 'object' || v.tests === null) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (git(racine, ['merge-base', '--is-ancestor', v.commit, etat.commit]).status !== 0) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
return { commit: v.commit, tests: v.tests, branche };
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// The green tests of the file <fichier> (from the racine) that the registry <registre> holds, by
|
|
74
|
+
// their full name; an empty set for a file the registry does not hold (a new file of the lot).
|
|
75
|
+
export function vertsDuRegistre(registre, fichier) {
|
|
76
|
+
const t = registre?.tests?.[fichier] ?? {};
|
|
77
|
+
return new Set(Object.keys(t).filter(nom => t[nom] === 'passed'));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Records as regressions, in `regressions/<branche>.json` of <etat>'s branch (of main detached),
|
|
81
|
+
// the red tests <rouges> (`{ fichier, nom }`, `fichier` from the racine) that the registry
|
|
82
|
+
// <registre> held green, from a pass of <quand> ('jour' | 'nuit'): `{ fichier, nom, dernierVert,
|
|
83
|
+
// premierRouge, quand, vu }`, the moment a green test turned red. A regression already recorded
|
|
84
|
+
// for the same test is not duplicated (its first red stays its first).
|
|
85
|
+
export function consignerLesRegressions(etat, rouges, registre, quand) {
|
|
86
|
+
const branche = etat.branche ?? etat.main;
|
|
87
|
+
const f = branche ? fichierSous(etat.racine, 'regressions', branche) : null;
|
|
88
|
+
if (!f || !registre) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
let liste = [];
|
|
92
|
+
try {
|
|
93
|
+
const v = JSON.parse(readFileSync(f, 'utf8'));
|
|
94
|
+
liste = Array.isArray(v) ? v : [];
|
|
95
|
+
} catch {
|
|
96
|
+
liste = [];
|
|
97
|
+
}
|
|
98
|
+
const connu = new Set(liste.map(r => `${r.fichier}\t${r.nom}`));
|
|
99
|
+
let change = false;
|
|
100
|
+
for (const { fichier, nom } of rouges) {
|
|
101
|
+
if (registre.tests?.[fichier]?.[nom] !== 'passed' || connu.has(`${fichier}\t${nom}`)) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
liste.push({
|
|
105
|
+
fichier,
|
|
106
|
+
nom,
|
|
107
|
+
dernierVert: registre.commit,
|
|
108
|
+
premierRouge: etat.commit,
|
|
109
|
+
quand,
|
|
110
|
+
vu: new Date().toISOString(),
|
|
111
|
+
});
|
|
112
|
+
connu.add(`${fichier}\t${nom}`);
|
|
113
|
+
change = true;
|
|
114
|
+
}
|
|
115
|
+
if (change) {
|
|
116
|
+
mkdirSync(path.dirname(f), { recursive: true });
|
|
117
|
+
writeFileSync(f, `${JSON.stringify(liste, null, 2)}\n`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -41,6 +41,12 @@ export {
|
|
|
41
41
|
export { luUneFois } from './lecture-unique.mjs';
|
|
42
42
|
export { avecLeFichierDuPoste } from './fichier-du-poste.mjs';
|
|
43
43
|
export { BASE_DU_LOT, CHANGEMENTS, DEPUIS_LE_VERT, garderLeVert, mesure } from './dernier-vert.mjs';
|
|
44
|
+
export {
|
|
45
|
+
consignerLesRegressions,
|
|
46
|
+
garderLeRegistre,
|
|
47
|
+
lireLeRegistre,
|
|
48
|
+
vertsDuRegistre,
|
|
49
|
+
} from './registre-des-resultats.mjs';
|
|
44
50
|
export { lireLaListe, paquetsDeLEnveloppe } from './enveloppe/paquets-du-plan.mjs';
|
|
45
51
|
export { AVANCEMENT, ecrireTache } from './mesure/avancement.mjs';
|
|
46
52
|
export {
|
package/scripts/sources.mjs
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
// text imports a package (`importe`).
|
|
4
4
|
//
|
|
5
5
|
// - Left out: the directories of the frame's tools and of what npm installs (node_modules, .git,
|
|
6
|
-
// dist, coverage, .claude, .beads, .codegraph, .rtfm
|
|
7
|
-
// language
|
|
8
|
-
// `target`), as git
|
|
6
|
+
// dist, coverage, .claude, .beads, .codegraph, .rtfm, and Turborepo's `.turbo`, the tool every
|
|
7
|
+
// language plays its tasks by), and what the tools of the project's language write (`ignorer` of
|
|
8
|
+
// its module, scripts/jointure.d.ts: typescript's `.vitest-reports`, cargo's `target`), as git
|
|
9
|
+
// leaves out what a `.gitignore` names. A project that declares no language
|
|
9
10
|
// (the column « Langage » of its docs/ARCHITECTURE.md) leaves out what every language of the
|
|
10
11
|
// frame writes.
|
|
11
12
|
import { readdirSync } from 'node:fs';
|
|
@@ -22,6 +23,7 @@ const HORS = [
|
|
|
22
23
|
'.beads',
|
|
23
24
|
'.codegraph',
|
|
24
25
|
'.rtfm',
|
|
26
|
+
'.turbo',
|
|
25
27
|
];
|
|
26
28
|
|
|
27
29
|
/** The directories left out in the project at <racine>: the frame's, and what its language's tools
|
|
@@ -85,7 +85,12 @@ change, et ceux qu'il peut casser.
|
|
|
85
85
|
aucun comportement que ses tests mesurent (un test adapté, un seuil relevé dans un test)
|
|
86
86
|
porte `comportement` `inchangé`, le plan « comportement inchangé » : sa preuve accepte chaque
|
|
87
87
|
vert de son lot, puis le développeur écrit le code (une réorganisation en a), les contrôles
|
|
88
|
-
et la relecture.
|
|
88
|
+
et la relecture. Un ticket dont le lot vit entièrement dans la matière de test (le produit ne
|
|
89
|
+
change pas : l'isolation des tests, une aide partagée, la couverture neuve d'un comportement
|
|
90
|
+
existant) porte aussi `comportement` `inchangé`, mais sans développeur : le testwriter livre
|
|
91
|
+
les tests et les aides, puis les contrôles et la relecture ; aucun rouge-d'abord n'est attendu,
|
|
92
|
+
car aucun comportement produit n'est neuf. Je le reconnais dès l'étape 1 et ne le classe pas
|
|
93
|
+
`comportement`. Une sorte absente, ou sans sa raison, ou mécanique sans sa commande, vaut
|
|
89
94
|
`comportement` : le circuit entier ;
|
|
90
95
|
- `ecartes` : chaque composant du relevé que le plan ne touche pas, avec sa raison (il n'a
|
|
91
96
|
rien à changer, par exemple) ; le circuit l'écrit au ticket. Le circuit rejoue le relevé sur
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
// The names of the tests of HEAD's version of a test file of Rust that cargo cannot play twice in
|
|
2
|
-
// one run, read without playing them (the join, `testsDeHead`; the owner's decision on
|
|
3
|
-
// grillhouse-3e2): a unit test file of `src/` (`src/**/tests.rs`, a file of a folder `tests/` under
|
|
4
|
-
// `src/`), compiled as a module of its crate, and each file of a test target
|
|
5
|
-
// `tests/<dossier>/main.rs`, its root or one of its modules (`tests/it/foo.rs`, grillhouse-pkl.9);
|
|
6
|
-
// and a target `tests/<nom>.rs` whose sibling no longer compiles, read with its modules beside it
|
|
7
|
-
// (grillhouse-3e2.2). The proof of the red holds each name for a green HEAD already holds.
|
|
8
|
-
//
|
|
9
|
-
// - A name is the one the verdict gives (./verdict.mjs), the path nextest reports: the module path
|
|
10
|
-
// of the test in its binary, `<module>::…::<fn>` (tried on 2026-11-02:
|
|
11
|
-
// `access::engines::tests::groupe::interne` for `src/access/engines/tests.rs`, `m::dedans` and
|
|
12
|
-
// `aide::aidant` for `tests/scenario/main.rs` and its `mod aide;`).
|
|
13
|
-
// - A test is a function under an attribute `#[test]`, or `#[<chemin>::test]` (`#[tokio::test]`),
|
|
14
|
-
// in the inline modules that hold it (`mod <nom> { … }`); comments, strings and character
|
|
15
|
-
// literals are read as blanks, so that their braces do not count.
|
|
16
|
-
// - A unit test file of `src/`: its module path is its path under `src/` (`mod.rs` its folder's);
|
|
17
|
-
// the verdict gives each of its out-of-line modules (`mod <nom>;`) to its own file, so they are
|
|
18
|
-
// not read here. A file of a target `tests/<dossier>/main.rs` likewise: its module path is its
|
|
19
|
-
// path under `tests/<dossier>/` (`main.rs` none, `mod.rs` its folder's). A target
|
|
20
|
-
// `tests/<nom>.rs`: the verdict gives it all its binary's tests, so its out-of-line modules are
|
|
21
|
-
// read too, as rustc finds them (`<nom>.rs` beside it or `<nom>/mod.rs`, a module of `<f>.rs`
|
|
22
|
-
// under `<f>/`).
|
|
23
|
-
import path from 'node:path';
|
|
24
|
-
|
|
25
|
-
// The text <t> with its comments, strings and character literals read as blanks.
|
|
26
|
-
export function sansLitteraux(t) {
|
|
27
|
-
let out = '';
|
|
28
|
-
let i = 0;
|
|
29
|
-
while (i < t.length) {
|
|
30
|
-
if (t.startsWith('//', i)) {
|
|
31
|
-
const fin = t.indexOf('\n', i);
|
|
32
|
-
i = fin < 0 ? t.length : fin;
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
if (t.startsWith('/*', i)) {
|
|
36
|
-
let profondeur = 0;
|
|
37
|
-
do {
|
|
38
|
-
if (t.startsWith('/*', i)) {
|
|
39
|
-
profondeur++;
|
|
40
|
-
i += 2;
|
|
41
|
-
} else if (t.startsWith('*/', i)) {
|
|
42
|
-
profondeur--;
|
|
43
|
-
i += 2;
|
|
44
|
-
} else {
|
|
45
|
-
i++;
|
|
46
|
-
}
|
|
47
|
-
} while (profondeur > 0 && i < t.length);
|
|
48
|
-
out += ' ';
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
const brute = /^b?r(#*)"/.exec(t.slice(i, i + 260));
|
|
52
|
-
if (brute && !/\w/.test(t[i - 1] ?? '')) {
|
|
53
|
-
const fin = t.indexOf(`"${brute[1]}`, i + brute[0].length);
|
|
54
|
-
i = fin < 0 ? t.length : fin + 1 + brute[1].length;
|
|
55
|
-
out += ' ';
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
if (t[i] === '"') {
|
|
59
|
-
i++;
|
|
60
|
-
while (i < t.length && t[i] !== '"') {
|
|
61
|
-
i += t[i] === '\\' ? 2 : 1;
|
|
62
|
-
}
|
|
63
|
-
i++;
|
|
64
|
-
out += ' ';
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
if (t[i] === "'") {
|
|
68
|
-
const car = /^'(?:\\(?:u\{[0-9a-fA-F]+\}|x[0-9a-fA-F]{2}|.)|[^\\'])'/.exec(
|
|
69
|
-
t.slice(i, i + 16)
|
|
70
|
-
);
|
|
71
|
-
if (car) {
|
|
72
|
-
i += car[0].length;
|
|
73
|
-
out += ' ';
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
out += t[i];
|
|
78
|
-
i++;
|
|
79
|
-
}
|
|
80
|
-
return out;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// What the text <texte> of a file of Rust holds: `tests`, each test's module path within the
|
|
84
|
-
// file and its name, and `externes`, each out-of-line module's path within the file.
|
|
85
|
-
export function lireLeFichier(texte) {
|
|
86
|
-
const t = sansLitteraux(texte);
|
|
87
|
-
const tests = [];
|
|
88
|
-
const externes = [];
|
|
89
|
-
const pile = [];
|
|
90
|
-
let marque = false;
|
|
91
|
-
const jeton = /#!?\s*\[|\bmod\s+([A-Za-z_]\w*)\s*([{;])|\bfn\s+([A-Za-z_]\w*)|[{}]/g;
|
|
92
|
-
const ici = () => pile.filter(Boolean);
|
|
93
|
-
let m;
|
|
94
|
-
while ((m = jeton.exec(t))) {
|
|
95
|
-
const j = m[0];
|
|
96
|
-
if (j.startsWith('#')) {
|
|
97
|
-
let profondeur = 1;
|
|
98
|
-
let k = jeton.lastIndex;
|
|
99
|
-
while (k < t.length && profondeur > 0) {
|
|
100
|
-
if (t[k] === '[') {
|
|
101
|
-
profondeur++;
|
|
102
|
-
} else if (t[k] === ']') {
|
|
103
|
-
profondeur--;
|
|
104
|
-
}
|
|
105
|
-
k++;
|
|
106
|
-
}
|
|
107
|
-
const attribut = t.slice(jeton.lastIndex, k - 1).trim();
|
|
108
|
-
if (/^(?:\w+\s*::\s*)*test$/.test(attribut)) {
|
|
109
|
-
marque = true;
|
|
110
|
-
}
|
|
111
|
-
jeton.lastIndex = k;
|
|
112
|
-
} else if (m[1]) {
|
|
113
|
-
if (m[2] === '{') {
|
|
114
|
-
pile.push(m[1]);
|
|
115
|
-
} else {
|
|
116
|
-
externes.push([...ici(), m[1]]);
|
|
117
|
-
}
|
|
118
|
-
marque = false;
|
|
119
|
-
} else if (m[3]) {
|
|
120
|
-
if (marque) {
|
|
121
|
-
tests.push([...ici(), m[3]]);
|
|
122
|
-
}
|
|
123
|
-
marque = false;
|
|
124
|
-
} else if (j === '{') {
|
|
125
|
-
pile.push(null);
|
|
126
|
-
} else {
|
|
127
|
-
pile.pop();
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return { tests, externes };
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* The names of the tests of HEAD's version of the test file <chemin> (from the root), as the
|
|
135
|
-
* verdict names them: with <module>, a unit test file of `src/` or a file of a target
|
|
136
|
-
* `tests/<dossier>/main.rs`, its module path; without (null), a target `tests/<nom>.rs`, its
|
|
137
|
-
* out-of-line modules read too. <lire>
|
|
138
|
-
* gives HEAD's text of a file from the root, null for none. Null when HEAD does not hold <chemin>.
|
|
139
|
-
* @param {string} chemin
|
|
140
|
-
* @param {string[] | null} module
|
|
141
|
-
* @param {(f: string) => string | null} lire
|
|
142
|
-
* @returns {string[] | null}
|
|
143
|
-
*/
|
|
144
|
-
export function nomsDeHead(chemin, module, lire) {
|
|
145
|
-
const texte = lire(chemin);
|
|
146
|
-
if (texte === null) {
|
|
147
|
-
return null;
|
|
148
|
-
}
|
|
149
|
-
if (module) {
|
|
150
|
-
return lireLeFichier(texte).tests.map(t => [...module, ...t].join('::'));
|
|
151
|
-
}
|
|
152
|
-
const noms = [];
|
|
153
|
-
const vus = new Set();
|
|
154
|
-
// The file <f> of text <tx>, its modules under <dossier>, its tests under <prefixe>.
|
|
155
|
-
const parcourir = (f, tx, dossier, prefixe) => {
|
|
156
|
-
if (vus.has(f)) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
vus.add(f);
|
|
160
|
-
const { tests, externes } = lireLeFichier(tx);
|
|
161
|
-
noms.push(...tests.map(t => [...prefixe, ...t].join('::')));
|
|
162
|
-
for (const e of externes) {
|
|
163
|
-
const base = path.posix.join(dossier, ...e);
|
|
164
|
-
for (const [g, sous] of [
|
|
165
|
-
[`${base}.rs`, base],
|
|
166
|
-
[path.posix.join(base, 'mod.rs'), base],
|
|
167
|
-
]) {
|
|
168
|
-
const txg = lire(g);
|
|
169
|
-
if (txg !== null) {
|
|
170
|
-
parcourir(g, txg, sous, [...prefixe, ...e]);
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
parcourir(chemin, texte, path.posix.dirname(chemin), []);
|
|
177
|
-
return noms;
|
|
178
|
-
}
|