@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
package/scripts/activites.mjs
CHANGED
|
@@ -14,7 +14,6 @@ import { createHash, randomUUID } from 'node:crypto';
|
|
|
14
14
|
import {
|
|
15
15
|
appendFileSync,
|
|
16
16
|
closeSync,
|
|
17
|
-
cpSync,
|
|
18
17
|
existsSync,
|
|
19
18
|
mkdirSync,
|
|
20
19
|
mkdtempSync,
|
|
@@ -23,7 +22,6 @@ import {
|
|
|
23
22
|
readFileSync,
|
|
24
23
|
rmSync,
|
|
25
24
|
statSync,
|
|
26
|
-
symlinkSync,
|
|
27
25
|
writeFileSync,
|
|
28
26
|
} from 'node:fs';
|
|
29
27
|
import path from 'node:path';
|
|
@@ -44,7 +42,7 @@ import { lotSurMain, refusLotAbsent } from './integration/integrer.mjs';
|
|
|
44
42
|
import { RETIRER_COPIE } from './integration/rejeu.mjs';
|
|
45
43
|
import { AUTEUR_DU_VERDICT } from './integration/verdict.mjs';
|
|
46
44
|
import { langageDe } from './langages.mjs';
|
|
47
|
-
import {
|
|
45
|
+
import { lireLeRegistre, vertsDuRegistre } from './registre-des-resultats.mjs';
|
|
48
46
|
import { AVANCEMENT } from './mesure/avancement.mjs';
|
|
49
47
|
import { avecLesOutils } from './outils-cles.mjs';
|
|
50
48
|
import { avecLesDonnees } from './donnees-cles.mjs';
|
|
@@ -932,6 +930,27 @@ export function preuveReussie(
|
|
|
932
930
|
return rouges > 0;
|
|
933
931
|
}
|
|
934
932
|
|
|
933
|
+
// Whether a changed test file of the lot, without a result of its own, is a casse — a real failure
|
|
934
|
+
// to load, the only cause of refusal on `casses`. Before the build (<constructions> present) it
|
|
935
|
+
// cannot load yet and plays at the checks, not a casse. With no result (<res> absent) on a run that
|
|
936
|
+
// ended well (<code> 0, the binary compiled and played), the file loaded and simply holds no test
|
|
937
|
+
// of its own — an aggregator harness (tests/it/main.rs, `mod …;`) or shared test matter; not a
|
|
938
|
+
// casse. With a result but no test (<res> present, 0 tests), it is a casse only when that result
|
|
939
|
+
// itself failed. Returns the kind of casse (`non-joue`, `ne-charge-pas`) or null when there is none.
|
|
940
|
+
export function casseDeChargement({ res, code, constructions }) {
|
|
941
|
+
const tests = res?.tests ?? [];
|
|
942
|
+
if (constructions.length && (!res || tests.length === 0)) {
|
|
943
|
+
return null;
|
|
944
|
+
}
|
|
945
|
+
if (!res) {
|
|
946
|
+
return code === 0 ? null : 'non-joue';
|
|
947
|
+
}
|
|
948
|
+
if (tests.length === 0) {
|
|
949
|
+
return res.etat === 'failed' ? 'ne-charge-pas' : null;
|
|
950
|
+
}
|
|
951
|
+
return null;
|
|
952
|
+
}
|
|
953
|
+
|
|
935
954
|
// The files <fichiers> of the lot, in the copy, split into the ones the day plays (`jour`), the
|
|
936
955
|
// ones only the night plays (`misDeCote`: a night test, a bench, a time witness), by each module's
|
|
937
956
|
// own definition (`horsDuJour` of the join), and the ones out of every package of the language
|
|
@@ -1450,212 +1469,6 @@ function genreDeLaPasse(ctx, etape, args) {
|
|
|
1450
1469
|
: [etape, ...commande].join(' ');
|
|
1451
1470
|
}
|
|
1452
1471
|
|
|
1453
|
-
// Removes from the copy each sibling of HEAD's version a killed process left there, between its
|
|
1454
|
-
// writing and its removal (`avecLesVersionsDAvant`): a file git does not track, the sibling, by
|
|
1455
|
-
// the name the module of its language gives (`soeurDAvant` of the join, a file beside its own:
|
|
1456
|
-
// TypeScript's alone, Rust and Python play HEAD's version in a tree), of a file of its folder that
|
|
1457
|
-
// git tracks and that exists, each named in the ticket's log. A file git tracks, or whose file is
|
|
1458
|
-
// absent, is left. What the module reads at a cost is read once for the sweep (`avecUneLecture`,
|
|
1459
|
-
// ./lecture-unique.mjs), whatever the number of files. Returns the siblings removed, from the
|
|
1460
|
-
// copy, sorted.
|
|
1461
|
-
export function balayerLesSoeurs(ctx) {
|
|
1462
|
-
return avecUneLecture(() => balayer(ctx));
|
|
1463
|
-
}
|
|
1464
|
-
|
|
1465
|
-
// The sibling of HEAD's version of <f> by the module of its language, null for a module that
|
|
1466
|
-
// names none (Rust, Python).
|
|
1467
|
-
function soeurDe(langage, f, racine) {
|
|
1468
|
-
return typeof langage.soeurDAvant === 'function' ? langage.soeurDAvant(f, racine) : null;
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
|
-
// Whether HEAD's version of <f> plays in a tree of its own, by the module of its language.
|
|
1472
|
-
function arbreDe(langage, f, racine) {
|
|
1473
|
-
return typeof langage.arbreDAvant === 'function' && langage.arbreDAvant(f, racine) === true;
|
|
1474
|
-
}
|
|
1475
|
-
|
|
1476
|
-
// The sweep of `balayerLesSoeurs`, in its scope of readings done once.
|
|
1477
|
-
function balayer(ctx) {
|
|
1478
|
-
const git = (...a) =>
|
|
1479
|
-
spawnSync('git', ['-C', ctx.copie, ...a], { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
|
|
1480
|
-
const r = git('ls-files', '-z', '--others', '--exclude-standard');
|
|
1481
|
-
if (r.status !== 0) {
|
|
1482
|
-
return [];
|
|
1483
|
-
}
|
|
1484
|
-
const parDossier = new Map();
|
|
1485
|
-
for (const f of r.stdout.split('\0').filter(Boolean)) {
|
|
1486
|
-
const d = path.posix.dirname(f);
|
|
1487
|
-
parDossier.set(d, [...(parDossier.get(d) ?? []), f]);
|
|
1488
|
-
}
|
|
1489
|
-
const langage = langageDe(ctx.copie);
|
|
1490
|
-
const retirees = [];
|
|
1491
|
-
for (const [dossier, nonSuivis] of parDossier) {
|
|
1492
|
-
const suivis = git('ls-files', '-z', ...(dossier === '.' ? [] : ['--', `${dossier}/`]));
|
|
1493
|
-
const soeurs = new Set(
|
|
1494
|
-
suivis.stdout
|
|
1495
|
-
.split('\0')
|
|
1496
|
-
.filter(f => f && path.posix.dirname(f) === dossier)
|
|
1497
|
-
.filter(f => existsSync(path.join(ctx.copie, f)))
|
|
1498
|
-
.map(f => soeurDe(langage, f, ctx.copie))
|
|
1499
|
-
.filter(n => n !== null)
|
|
1500
|
-
);
|
|
1501
|
-
for (const f of nonSuivis.filter(n => soeurs.has(n))) {
|
|
1502
|
-
rmSync(path.join(ctx.copie, f), { force: true });
|
|
1503
|
-
retirees.push(f);
|
|
1504
|
-
if (ctx.journal) {
|
|
1505
|
-
appendFileSync(ctx.journal, `sœur de la version de HEAD laissée, retirée : ${f}\n`);
|
|
1506
|
-
}
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
return retirees.sort();
|
|
1510
|
-
}
|
|
1511
|
-
|
|
1512
|
-
// What a tree of HEAD's version leaves out of the copy: the history, the builds, the installed
|
|
1513
|
-
// dependencies, none of which a test reads as its own file.
|
|
1514
|
-
const HORS_DE_L_ARBRE = new Set(['.git', 'target', 'node_modules', '.venv']);
|
|
1515
|
-
|
|
1516
|
-
// Removes from the temporary directory of the ticket each tree of HEAD's version (`avant-<pid>-*`)
|
|
1517
|
-
// whose owner, the process that built it, no longer lives: a circuit killed between the building
|
|
1518
|
-
// and the removal (`avecLesVersionsDAvant`) leaves one, no `finally` having played. A tree of a
|
|
1519
|
-
// live process is left.
|
|
1520
|
-
function balayerLesArbres(ctx) {
|
|
1521
|
-
if (!existsSync(ctx.tmp)) {
|
|
1522
|
-
return;
|
|
1523
|
-
}
|
|
1524
|
-
for (const nom of readdirSync(ctx.tmp)) {
|
|
1525
|
-
// The name is written by `batirLArbre`: `avant-`, the pid, `-`, the suffix of mkdtemp.
|
|
1526
|
-
const [prefixe, pid] = nom.split('-');
|
|
1527
|
-
if (prefixe !== 'avant' || !Number.isInteger(Number(pid)) || Number(pid) <= 0) {
|
|
1528
|
-
continue;
|
|
1529
|
-
}
|
|
1530
|
-
try {
|
|
1531
|
-
process.kill(Number(pid), 0);
|
|
1532
|
-
continue;
|
|
1533
|
-
} catch (e) {
|
|
1534
|
-
if (e.code === 'EPERM') {
|
|
1535
|
-
continue;
|
|
1536
|
-
}
|
|
1537
|
-
}
|
|
1538
|
-
rmSync(path.join(ctx.tmp, nom), { recursive: true, force: true });
|
|
1539
|
-
}
|
|
1540
|
-
}
|
|
1541
|
-
|
|
1542
|
-
// Builds under the temporary directory of the ticket the tree of HEAD's version of <f>: the copy
|
|
1543
|
-
// (the code of the lot included), without `.git`, `target`, `node_modules` and `.venv`, where <f>
|
|
1544
|
-
// alone holds <texte>, HEAD's text, under its own name. Returns its root.
|
|
1545
|
-
function batirLArbre(ctx, f, texte) {
|
|
1546
|
-
const racine = mkdtempSync(path.join(ctx.tmp, `avant-${process.pid}-`));
|
|
1547
|
-
try {
|
|
1548
|
-
cpSync(ctx.copie, racine, {
|
|
1549
|
-
recursive: true,
|
|
1550
|
-
filter: src =>
|
|
1551
|
-
src === ctx.copie ||
|
|
1552
|
-
(!HORS_DE_L_ARBRE.has(path.basename(src)) && path.resolve(src) !== path.resolve(ctx.tmp)),
|
|
1553
|
-
});
|
|
1554
|
-
writeFileSync(path.join(racine, f), texte);
|
|
1555
|
-
} catch (e) {
|
|
1556
|
-
rmSync(racine, { recursive: true, force: true });
|
|
1557
|
-
throw e;
|
|
1558
|
-
}
|
|
1559
|
-
return racine;
|
|
1560
|
-
}
|
|
1561
|
-
|
|
1562
|
-
// Runs <jouer> with HEAD's version of each file of <fichiers> that HEAD holds, where the module
|
|
1563
|
-
// of its language puts it: a sibling written beside the file in the copy (`soeurDAvant` of the
|
|
1564
|
-
// join: TypeScript, whose tool plays it in the same run), swept first (`balayerLesSoeurs`) and
|
|
1565
|
-
// removed after the run, a red included; or a tree of its own (`arbreDAvant` of the join: Rust,
|
|
1566
|
-
// Python), the copy's with that file alone replaced by its version of HEAD, under its own name, in
|
|
1567
|
-
// the temporary directory of the ticket (`batirLArbre`), removed after the run, a red included,
|
|
1568
|
-
// the copy getting no file. <jouer> gets the Map file → sibling (from the copy), the Map file →
|
|
1569
|
-
// names of the tests of HEAD's version, read without playing them, of each file its tool cannot
|
|
1570
|
-
// play twice (`testsDeHead` of the join), and the Map file → `{ racine, env }`, the root of its
|
|
1571
|
-
// tree and the environment it plays under (`envDArbre` of the join). With <sansArbres>, no tree
|
|
1572
|
-
// is built: the names of HEAD's tests of each file that would have one are read too. Returns
|
|
1573
|
-
// what <jouer> returns.
|
|
1574
|
-
export function avecLesVersionsDAvant(ctx, fichiers, jouer, { sansArbres = false } = {}) {
|
|
1575
|
-
balayerLesSoeurs(ctx);
|
|
1576
|
-
balayerLesArbres(ctx);
|
|
1577
|
-
return avecUneLecture(() => {
|
|
1578
|
-
const avant = new Map();
|
|
1579
|
-
const lus = new Map();
|
|
1580
|
-
const arbres = new Map();
|
|
1581
|
-
const deHead = f => {
|
|
1582
|
-
const r = spawnSync('git', ['-C', ctx.copie, 'show', `HEAD:${f}`], {
|
|
1583
|
-
encoding: 'utf8',
|
|
1584
|
-
maxBuffer: 64 * 1024 * 1024,
|
|
1585
|
-
});
|
|
1586
|
-
return r.status === 0 ? r.stdout : null;
|
|
1587
|
-
};
|
|
1588
|
-
try {
|
|
1589
|
-
const langage = langageDe(ctx.copie);
|
|
1590
|
-
for (const f of fichiers) {
|
|
1591
|
-
const soeur = soeurDe(langage, f, ctx.copie);
|
|
1592
|
-
if (soeur !== null) {
|
|
1593
|
-
const texte = deHead(f);
|
|
1594
|
-
if (texte === null) {
|
|
1595
|
-
continue;
|
|
1596
|
-
}
|
|
1597
|
-
writeFileSync(path.join(ctx.copie, soeur), texte);
|
|
1598
|
-
avant.set(f, soeur);
|
|
1599
|
-
continue;
|
|
1600
|
-
}
|
|
1601
|
-
if (arbreDe(langage, f, ctx.copie) && !sansArbres) {
|
|
1602
|
-
const texte = deHead(f);
|
|
1603
|
-
if (texte === null) {
|
|
1604
|
-
continue;
|
|
1605
|
-
}
|
|
1606
|
-
const env =
|
|
1607
|
-
typeof langage.envDArbre === 'function' ? langage.envDArbre(f, ctx.copie) : {};
|
|
1608
|
-
arbres.set(f, { racine: batirLArbre(ctx, f, texte), env });
|
|
1609
|
-
continue;
|
|
1610
|
-
}
|
|
1611
|
-
const noms = langage.testsDeHead(f, ctx.copie, deHead);
|
|
1612
|
-
if (noms !== null) {
|
|
1613
|
-
lus.set(f, noms);
|
|
1614
|
-
}
|
|
1615
|
-
}
|
|
1616
|
-
return jouer(avant, lus, arbres);
|
|
1617
|
-
} finally {
|
|
1618
|
-
for (const soeur of avant.values()) {
|
|
1619
|
-
rmSync(path.join(ctx.copie, soeur), { force: true });
|
|
1620
|
-
}
|
|
1621
|
-
for (const { racine } of arbres.values()) {
|
|
1622
|
-
rmSync(racine, { recursive: true, force: true });
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
1625
|
-
});
|
|
1626
|
-
}
|
|
1627
|
-
|
|
1628
|
-
// The run of the files <groupe> of one package of the proof, HEAD's version of each beside it or
|
|
1629
|
-
// in a tree (`avecLesVersionsDAvant`): `{ avant, lus, arbres, code, resultats, constructions }`,
|
|
1630
|
-
// <jouer> given the files to play in the copy and the trees to play, and returning `{ code,
|
|
1631
|
-
// resultats, constructions }`. A tree that does not compile is not a red of the lot (the owner's
|
|
1632
|
-
// decision on grillhouse-3e2.2): when the build fails with trees, the package plays again without
|
|
1633
|
-
// them, and when the lot alone builds, that run is kept, the names of HEAD's tests of those files
|
|
1634
|
-
// read without playing them; a build the lot alone breaks stays a red, the first run kept.
|
|
1635
|
-
export function jouerAvecLesVersionsDAvant(ctx, groupe, jouer) {
|
|
1636
|
-
const avecArbres = avecLesVersionsDAvant(ctx, groupe, (avant, lus, arbres) => ({
|
|
1637
|
-
avant,
|
|
1638
|
-
lus,
|
|
1639
|
-
arbres,
|
|
1640
|
-
...jouer([...groupe, ...avant.values()], arbres),
|
|
1641
|
-
}));
|
|
1642
|
-
if (avecArbres.arbres.size === 0 || avecArbres.constructions.length === 0) {
|
|
1643
|
-
return avecArbres;
|
|
1644
|
-
}
|
|
1645
|
-
const sansArbres = avecLesVersionsDAvant(
|
|
1646
|
-
ctx,
|
|
1647
|
-
groupe,
|
|
1648
|
-
(avant, lus, arbres) => ({
|
|
1649
|
-
avant,
|
|
1650
|
-
lus,
|
|
1651
|
-
arbres,
|
|
1652
|
-
...jouer([...groupe, ...avant.values()], arbres),
|
|
1653
|
-
}),
|
|
1654
|
-
{ sansArbres: true }
|
|
1655
|
-
);
|
|
1656
|
-
return sansArbres.constructions.length === 0 ? sansArbres : avecArbres;
|
|
1657
|
-
}
|
|
1658
|
-
|
|
1659
1472
|
// The log of the task <t> of a summary of Turborepo, its file from the root of the copy: its path,
|
|
1660
1473
|
// and its first lines, the task's own output.
|
|
1661
1474
|
function journalDeTache(ctx, t) {
|
|
@@ -1666,31 +1479,14 @@ function journalDeTache(ctx, t) {
|
|
|
1666
1479
|
return { chemin, debut: sansCouleurs(lire(chemin)).trim().split('\n').slice(0, 80).join('\n') };
|
|
1667
1480
|
}
|
|
1668
1481
|
|
|
1669
|
-
// Runs <jouer> with the installed dependencies of the copy (`node_modules` of its root) linked in
|
|
1670
|
-
// the tree <racine>, which carries none, so that its tool (npm) starts there; the link goes after
|
|
1671
|
-
// the run, a red included.
|
|
1672
|
-
function avecLesDependancesDeLaCopie(ctx, racine, jouer) {
|
|
1673
|
-
const source = path.join(ctx.copie, 'node_modules');
|
|
1674
|
-
const lien = path.join(racine, 'node_modules');
|
|
1675
|
-
if (!existsSync(source) || existsSync(lien)) {
|
|
1676
|
-
return jouer();
|
|
1677
|
-
}
|
|
1678
|
-
symlinkSync(source, lien);
|
|
1679
|
-
try {
|
|
1680
|
-
return jouer();
|
|
1681
|
-
} finally {
|
|
1682
|
-
rmSync(lien, { force: true });
|
|
1683
|
-
}
|
|
1684
|
-
}
|
|
1685
|
-
|
|
1686
1482
|
// The measure of the proof of the red: one run per package, `npm test -- --force <files>` of the
|
|
1687
|
-
// lot that lie in it,
|
|
1688
|
-
//
|
|
1689
|
-
//
|
|
1690
|
-
//
|
|
1691
|
-
//
|
|
1692
|
-
//
|
|
1693
|
-
//
|
|
1483
|
+
// lot that lie in it, or, with no file of the lot, `npm test -- <package>` for each package of the
|
|
1484
|
+
// plan, played whole. Each run `{ groupe, entier, code, resultats, constructions }`. A measure of
|
|
1485
|
+
// the same files on the same tree (`cleDeLaMesure`) is not played again, as Turborepo replays a
|
|
1486
|
+
// task whose inputs and arguments did not move: the last one, <derniere>, its caller keeps.
|
|
1487
|
+
// `{ cle, runs }`. The tests main already holds green are read from the registry of results
|
|
1488
|
+
// (scripts/registre-des-resultats.mjs, `vertsDuRegistre`), not from HEAD's version played beside
|
|
1489
|
+
// the lot.
|
|
1694
1490
|
function mesureDeLaPreuve(ctx, liste, fichiers, derniere = null) {
|
|
1695
1491
|
const cle = cleDeLaMesure(ctx, fichiers);
|
|
1696
1492
|
if (derniere?.cle === cle) {
|
|
@@ -1707,59 +1503,23 @@ function mesureDeLaPreuve(ctx, liste, fichiers, derniere = null) {
|
|
|
1707
1503
|
const entier = entiers.includes(dossier);
|
|
1708
1504
|
// The files of the lot play for real (`--force`): a run replayed from Turborepo's cache, the
|
|
1709
1505
|
// checks' same command on the same inputs, writes no report of Vitest.
|
|
1710
|
-
const
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
...[...arbres].map(([f, arbre]) =>
|
|
1716
|
-
avecLesDependancesDeLaCopie(ctx, arbre.racine, () =>
|
|
1717
|
-
npm(ctx, 'preuve', ['test', '--', '--force', f], arbre.env, arbre.racine)
|
|
1718
|
-
)
|
|
1719
|
-
),
|
|
1720
|
-
];
|
|
1721
|
-
return {
|
|
1722
|
-
code: passes.find(r => r.code !== 0)?.code ?? 0,
|
|
1723
|
-
resultats: passes.flatMap(r => langageDe(ctx.copie).verdict(r.dossier).rapports),
|
|
1724
|
-
// The builds of the plan's packages that failed: each one a red, not compiling is failing.
|
|
1725
|
-
constructions: passes.flatMap(r => constructionsEchouees(ctx, liste, r.dossier)),
|
|
1726
|
-
};
|
|
1727
|
-
});
|
|
1728
|
-
// Its maps as objects, so that the measure is a plain object, which its caller keeps.
|
|
1506
|
+
const pass = npm(ctx, 'preuve', [
|
|
1507
|
+
'test',
|
|
1508
|
+
'--',
|
|
1509
|
+
...(entier ? [dossier] : ['--force', ...groupe]),
|
|
1510
|
+
]);
|
|
1729
1511
|
runs.push({
|
|
1730
1512
|
groupe,
|
|
1731
1513
|
entier,
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1514
|
+
code: pass.code,
|
|
1515
|
+
resultats: langageDe(ctx.copie).verdict(pass.dossier).rapports,
|
|
1516
|
+
// The builds of the plan's packages that failed: each one a red, not compiling is failing.
|
|
1517
|
+
constructions: constructionsEchouees(ctx, liste, pass.dossier),
|
|
1736
1518
|
});
|
|
1737
1519
|
}
|
|
1738
1520
|
return { cle, runs };
|
|
1739
1521
|
}
|
|
1740
1522
|
|
|
1741
|
-
// The green tests of HEAD's version of the file <f> of the lot, by their full name: those of the
|
|
1742
|
-
// report of its sibling (`avant`, file → sibling, from the copy <copie>) or of its tree (`arbres`,
|
|
1743
|
-
// file → `{ racine }`, the file there at the same path: the copy's by the change of root alone)
|
|
1744
|
-
// in the results <resultats> of the run (`verdict` of the join), or, for a file played in neither,
|
|
1745
|
-
// the names of its tests read in HEAD's version (`lus`, file → names), each held green, as main
|
|
1746
|
-
// stays green; empty for a file HEAD does not hold.
|
|
1747
|
-
export function vertsDeHead(resultats, copie, f, avant, lus = new Map(), arbres = new Map()) {
|
|
1748
|
-
if (lus.has(f)) {
|
|
1749
|
-
return new Set(lus.get(f));
|
|
1750
|
-
}
|
|
1751
|
-
const soeur = avant.has(f)
|
|
1752
|
-
? path.join(copie, avant.get(f))
|
|
1753
|
-
: arbres.has(f)
|
|
1754
|
-
? path.join(arbres.get(f).racine, f)
|
|
1755
|
-
: null;
|
|
1756
|
-
return new Set(
|
|
1757
|
-
(resultats.find(t => soeur !== null && t.fichier === soeur)?.tests ?? [])
|
|
1758
|
-
.filter(a => a.etat === 'passed')
|
|
1759
|
-
.map(a => a.nom)
|
|
1760
|
-
);
|
|
1761
|
-
}
|
|
1762
|
-
|
|
1763
1523
|
// The full name of a test <nom> with each separator between a group and what it holds, « > » or
|
|
1764
1524
|
// « › » between blanks, read as the blank that Vitest's full name puts there.
|
|
1765
1525
|
const sansSeparateur = nom =>
|
|
@@ -1811,17 +1571,16 @@ export function preuve(ctx, { mesure: derniere = null, fichiers: seuls = null }
|
|
|
1811
1571
|
// A lot of files put aside alone plays nothing, not the packages whole.
|
|
1812
1572
|
const mesuree =
|
|
1813
1573
|
fichiers.length || !misDeCote.length ? mesureDeLaPreuve(ctx, liste, fichiers, derniere) : null;
|
|
1814
|
-
const mesure =
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
}));
|
|
1574
|
+
const mesure = mesuree?.runs ?? [];
|
|
1575
|
+
// The tests main already holds green, read from the registry of results of the copy's branch, or
|
|
1576
|
+
// main's (scripts/registre-des-resultats.mjs): a test of the lot the registry holds existed, its
|
|
1577
|
+
// green accepted; one absent is new.
|
|
1578
|
+
const registre = lireLeRegistre(ctx.copie);
|
|
1820
1579
|
// A plan « comportement inchangé »: every green of the lot is expected.
|
|
1821
1580
|
const inchange = Boolean(ctx.sorte?.inchange);
|
|
1822
1581
|
// The developpeur already ran after the last testwriter: the code is there, no test can turn red.
|
|
1823
1582
|
const codePresent = codeDejaPresent(ctx);
|
|
1824
|
-
for (const { groupe, entier,
|
|
1583
|
+
for (const { groupe, entier, code, resultats, constructions } of mesure) {
|
|
1825
1584
|
for (const { nom, erreur } of constructions) {
|
|
1826
1585
|
if (reportes.includes(nom)) {
|
|
1827
1586
|
continue;
|
|
@@ -1847,14 +1606,13 @@ export function preuve(ctx, { mesure: derniere = null, fichiers: seuls = null }
|
|
|
1847
1606
|
for (const f of groupe) {
|
|
1848
1607
|
const res = resultats.find(t => t.fichier === path.join(ctx.copie, f));
|
|
1849
1608
|
const tests = res?.tests ?? [];
|
|
1850
|
-
const deHead =
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
} else if (!res) {
|
|
1609
|
+
const deHead = vertsDuRegistre(registre, f);
|
|
1610
|
+
const casse = casseDeChargement({ res, code, constructions });
|
|
1611
|
+
if (casse === 'non-joue') {
|
|
1854
1612
|
casses.push(
|
|
1855
1613
|
`${f} — ne se charge pas : non joué (code ${code}) ; le journal du ticket : ${ctx.journal} (il se cite en pièce, \`${ctx.ticket}.log:<ligne>\`)`
|
|
1856
1614
|
);
|
|
1857
|
-
} else if (
|
|
1615
|
+
} else if (casse === 'ne-charge-pas') {
|
|
1858
1616
|
casses.push(`${f} — ne se charge pas : ${premiereLigne(res.message || res.etat)}`);
|
|
1859
1617
|
}
|
|
1860
1618
|
for (const a of tests) {
|
package/scripts/circuit.mjs
CHANGED
|
@@ -228,22 +228,11 @@
|
|
|
228
228
|
// those in `portent_le_travail` (`fichier` from the root, `test` its full name or its title, or
|
|
229
229
|
// none for every test of the file). A green test the sheet names is a defect of the proof, named
|
|
230
230
|
// in the report; a green test it does not name is accepted with no reason, counted and listed
|
|
231
|
-
// under « Verts non nommés ». A green test
|
|
232
|
-
//
|
|
233
|
-
//
|
|
234
|
-
//
|
|
235
|
-
//
|
|
236
|
-
// Python: the copy with that file alone replaced by its version of HEAD, in the temporary
|
|
237
|
-
// directory of the ticket, removed after the run, a red included, so that no test of the lot
|
|
238
|
-
// sees a file more), and a green test whose full name HEAD's version holds, green there too, is
|
|
239
|
-
// set aside, counted; a body changed under the same name is not told apart. A file its tool
|
|
240
|
-
// cannot play twice in a run (cargo: a unit test of `src/`, a target `tests/<dossier>/main.rs`)
|
|
241
|
-
// has neither: the module reads the names of the tests of its HEAD's version without playing
|
|
242
|
-
// them (`testsDeHead` of the join), and each is held for a green HEAD holds, as main stays
|
|
243
|
-
// green. A tree that no longer compiles (cargo: HEAD's version of a target against the lot's
|
|
244
|
-
// `tests/common`) is not a red of the lot: when the build fails with the trees and the lot
|
|
245
|
-
// alone builds, the package plays without them, the names of HEAD's tests of those files read
|
|
246
|
-
// (`testsDeHead`); a build the lot alone breaks stays a red (`jouerAvecLesVersionsDAvant`). The proof passes with a red (of the lot, existing or of a build), even without
|
|
231
|
+
// under « Verts non nommés ». A green test main already holds has nothing to prove: the registry
|
|
232
|
+
// of results (scripts/registre-des-resultats.mjs), written by the last complete green pass of
|
|
233
|
+
// main, holds the passed tests of each file by their full name; a green test of the lot whose
|
|
234
|
+
// full name the registry holds for its file is set aside, counted, as main stays green; a body
|
|
235
|
+
// changed under the same name is not told apart. The proof passes with a red (of the lot, existing or of a build), even without
|
|
247
236
|
// a file of the lot: a testwriter with no new test to write says so in his handover, the existing
|
|
248
237
|
// reds are enough. Under a plan « comportement changé » it fails without a red, with a broken file
|
|
249
238
|
// of the lot, or with a green the sheet names; under a plan « comportement
|
|
@@ -659,7 +648,6 @@ import {
|
|
|
659
648
|
import { departDepuis } from './reprise.mjs';
|
|
660
649
|
import {
|
|
661
650
|
arbreDeLaCopie,
|
|
662
|
-
balayerLesSoeurs,
|
|
663
651
|
controles,
|
|
664
652
|
empreinte,
|
|
665
653
|
empreinteDeLEtape,
|
|
@@ -2401,13 +2389,9 @@ export async function ouvrirJusquAuPlan(ctx, e) {
|
|
|
2401
2389
|
return { debut: o.debut, plan: aEcrire ? planAuDebut(ctx) : null };
|
|
2402
2390
|
}
|
|
2403
2391
|
|
|
2404
|
-
/** The end of the opening of <ctx> at the step <d>: the sort of the ticket
|
|
2392
|
+
/** The end of the opening of <ctx> at the step <d>: the sort of the ticket. `{ debut }`. */
|
|
2405
2393
|
export function finirLOuverture(ctx, d) {
|
|
2406
2394
|
// The sort of the ticket its plan says, which the run reads at each step.
|
|
2407
2395
|
ctx.sorte = sorteDuTicket(ctx);
|
|
2408
|
-
// A sibling of HEAD's version a killed circuit left in the copy never enters the lot.
|
|
2409
|
-
if (existsSync(ctx.copie)) {
|
|
2410
|
-
balayerLesSoeurs(ctx);
|
|
2411
|
-
}
|
|
2412
2396
|
return { debut: d };
|
|
2413
2397
|
}
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
// is refused, named with both languages: a package has one language. A file belongs to the
|
|
9
9
|
// module of the component that holds it, the deepest (`moduleDuFichier`); a file out of every
|
|
10
10
|
// component stays the core's, as with one language: the first module, in the order of the
|
|
11
|
-
// declaration, whose answer is not null judges it (`estUnTest`, `
|
|
12
|
-
// `testsDeHead`, `manifestes.horsDesTests`).
|
|
11
|
+
// declaration, whose answer is not null judges it (`estUnTest`, `manifestes.horsDesTests`).
|
|
13
12
|
// - Whether a component plays tests, the readers of components and the components touched are
|
|
14
13
|
// each module's on its own components, the results joined: a name without supplier is without
|
|
15
14
|
// supplier in every module, a file out of the graph is out of every module's graph.
|
|
@@ -270,20 +269,6 @@ export function composer(modules) {
|
|
|
270
269
|
premiereReponse(modules, racine, chemin, m => m.estUnTest(chemin, racine)),
|
|
271
270
|
horsDuJour: (chemin, racine) =>
|
|
272
271
|
Boolean(premiereReponse(modules, racine, chemin, m => m.horsDuJour(chemin, racine))),
|
|
273
|
-
soeurDAvant: (chemin, racine) =>
|
|
274
|
-
premiereReponse(modules, racine, chemin, m =>
|
|
275
|
-
typeof m.soeurDAvant === 'function' ? m.soeurDAvant(chemin, racine) : null
|
|
276
|
-
),
|
|
277
|
-
arbreDAvant: (chemin, racine) =>
|
|
278
|
-
Boolean(
|
|
279
|
-
premiereReponse(modules, racine, chemin, m =>
|
|
280
|
-
typeof m.arbreDAvant === 'function' ? m.arbreDAvant(chemin, racine) : null
|
|
281
|
-
)
|
|
282
|
-
),
|
|
283
|
-
envDArbre: (chemin, racine) =>
|
|
284
|
-
moduleDuFichier(modules, racine, chemin)?.envDArbre?.(chemin, racine) ?? {},
|
|
285
|
-
testsDeHead: (chemin, racine, lire, options) =>
|
|
286
|
-
premiereReponse(modules, racine, chemin, m => m.testsDeHead(chemin, racine, lire, options)),
|
|
287
272
|
manifestes: {
|
|
288
273
|
verrous: unique(modules.flatMap(m => m.manifestes.verrous)),
|
|
289
274
|
horsDesTests: (chemin, racine, avant, apres) =>
|
package/scripts/conformite.mjs
CHANGED
|
@@ -22,11 +22,6 @@
|
|
|
22
22
|
// - verdict: each task neither green nor unplayed (« à repasser » at 75, red otherwise), the one
|
|
23
23
|
// that plays the tests marked, and each test failed;
|
|
24
24
|
// - estUnTest: each path the testwriter writes, with what it is (`joue`, `test`, `matiere`);
|
|
25
|
-
// - versionDeHead (`soeurDAvant`, `arbreDAvant`, `testsDeHead`): each path whose HEAD's version
|
|
26
|
-
// plays in a tree (`→ un arbre`), and each that has a sibling for it, with it, said when the sibling is the path itself or lies in another folder, and each path
|
|
27
|
-
// whose names of tests the module reads in HEAD's version (the entry a path, or `{ chemin,
|
|
28
|
-
// textes }`, HEAD's text of each file by its path), with them, said when it has both; the
|
|
29
|
-
// entry's expected siblings are names the module's tool plays, of their file's class;
|
|
30
25
|
// - fichiersEngendres: each generated file whose check finds a gap;
|
|
31
26
|
// - gardes: each guard named that the module does not play, and each script it plays that does
|
|
32
27
|
// not exist;
|
|
@@ -168,32 +163,6 @@ export function cas(langage, exemples, { dans = tmpdir() } = {}) {
|
|
|
168
163
|
}
|
|
169
164
|
return [`${chemin} : ${['joue', 'test', 'matiere'].filter(k => c[k]).join(', ')}`];
|
|
170
165
|
}),
|
|
171
|
-
versionDeHead: entrees =>
|
|
172
|
-
entrees.flatMap(x => {
|
|
173
|
-
const { chemin, textes = {} } = typeof x === 'string' ? { chemin: x } : x;
|
|
174
|
-
const s =
|
|
175
|
-
typeof langage.soeurDAvant === 'function' ? langage.soeurDAvant(chemin, e.racine) : null;
|
|
176
|
-
const arbre =
|
|
177
|
-
typeof langage.arbreDAvant === 'function' && langage.arbreDAvant(chemin, e.racine);
|
|
178
|
-
const noms = langage.testsDeHead(chemin, e.racine, f => textes[f] ?? null);
|
|
179
|
-
if (s !== null && arbre) {
|
|
180
|
-
return [`${chemin} : une sœur et un arbre`];
|
|
181
|
-
}
|
|
182
|
-
if (arbre) {
|
|
183
|
-
return [`${chemin} → un arbre`];
|
|
184
|
-
}
|
|
185
|
-
if (s !== null && noms !== null) {
|
|
186
|
-
return [`${chemin} : une sœur et des noms lus`];
|
|
187
|
-
}
|
|
188
|
-
if (noms !== null) {
|
|
189
|
-
return [`${chemin} : ${noms.join(', ') || 'aucun test'}`];
|
|
190
|
-
}
|
|
191
|
-
if (s === null) {
|
|
192
|
-
return [];
|
|
193
|
-
}
|
|
194
|
-
const aCote = s !== chemin && path.dirname(s) === path.dirname(chemin);
|
|
195
|
-
return [aCote ? `${chemin} → ${s}` : `${chemin} → ${s} : pas à côté du fichier`];
|
|
196
|
-
}),
|
|
197
166
|
fichiersEngendres: racine =>
|
|
198
167
|
langage
|
|
199
168
|
.fichiersEngendres(racine)
|
package/scripts/dernier-vert.mjs
CHANGED
|
@@ -47,19 +47,10 @@
|
|
|
47
47
|
// (the tests of a crate or a Python project are tasks of Turborepo, which its cache selects).
|
|
48
48
|
// The green is kept by the one pass of the verification (scripts/langages/typescript/verifier.mjs),
|
|
49
49
|
// once, when every task of every language of the graph is green, and never when one is red.
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
copyFileSync,
|
|
53
|
-
existsSync,
|
|
54
|
-
mkdirSync,
|
|
55
|
-
mkdtempSync,
|
|
56
|
-
readFileSync,
|
|
57
|
-
realpathSync,
|
|
58
|
-
rmSync,
|
|
59
|
-
writeFileSync,
|
|
60
|
-
} from 'node:fs';
|
|
50
|
+
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
61
51
|
import os from 'node:os';
|
|
62
52
|
import path from 'node:path';
|
|
53
|
+
import { etatDuDepot, fichierSous, git, SHA, sortie } from './etat-du-depot.mjs';
|
|
63
54
|
// The variable that names the file of the changes since the last green, which the runner of the
|
|
64
55
|
// tests of the module of the language reads in each package.
|
|
65
56
|
export const CHANGEMENTS = 'GRILLHOUSE_CHANGEMENTS';
|
|
@@ -67,84 +58,11 @@ export const DEPUIS_LE_VERT = 'GRILLHOUSE_DEPUIS_LE_VERT';
|
|
|
67
58
|
// The variable that gives a pass of the circuit the base of its lot, against which it measures
|
|
68
59
|
// itself, targeted.
|
|
69
60
|
export const BASE_DU_LOT = 'GRILLHOUSE_BASE_DU_LOT';
|
|
70
|
-
const SHA = /^[0-9a-f]{40,64}$/;
|
|
71
|
-
|
|
72
|
-
const git = (racine, args, env = process.env) =>
|
|
73
|
-
spawnSync('git', ['-C', racine, ...args], {
|
|
74
|
-
encoding: 'utf8',
|
|
75
|
-
env,
|
|
76
|
-
maxBuffer: 256 * 1024 * 1024,
|
|
77
|
-
});
|
|
78
|
-
const sortie = (racine, args, env) => {
|
|
79
|
-
const r = git(racine, args, env);
|
|
80
|
-
return r.status === 0 ? r.stdout.trim() : null;
|
|
81
|
-
};
|
|
82
61
|
|
|
83
62
|
// The file of the last green of the branch <branche> of the repository at <racine>, null out of
|
|
84
|
-
// git.
|
|
63
|
+
// git (`fichierSous` of scripts/etat-du-depot.mjs).
|
|
85
64
|
function fichierDuVert(racine, branche) {
|
|
86
|
-
|
|
87
|
-
return commun ? path.join(commun, 'grillhouse', 'dernier-vert', `${branche}.json`) : null;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Main, the branch of the main tree of the repository at <racine> (HEAD of git's common
|
|
91
|
-
// directory); null when that tree is detached.
|
|
92
|
-
function brancheDeMain(racine) {
|
|
93
|
-
const commun = sortie(racine, ['rev-parse', '--path-format=absolute', '--git-common-dir']);
|
|
94
|
-
return commun
|
|
95
|
-
? sortie(racine, [`--git-dir=${commun}`, 'symbolic-ref', '--short', '-q', 'HEAD'])
|
|
96
|
-
: null;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Whether a submodule of the repository at <racine> differs from the commit its parent records.
|
|
100
|
-
function sousModuleModifie(racine) {
|
|
101
|
-
const r = git(racine, ['status', '--porcelain=v2', '-z', '--ignore-submodules=none']);
|
|
102
|
-
if (r.status !== 0) {
|
|
103
|
-
return true;
|
|
104
|
-
}
|
|
105
|
-
// An entry of a changed path: `1 <XY> <sub> …` (or `2` for a rename), <sub> `S<c><m><u>` for a
|
|
106
|
-
// submodule whose commit, tracked files or untracked files changed, `N...` for any other path.
|
|
107
|
-
return r.stdout.split('\0').some(e => /^[12] \S+ S/.test(e));
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// The state of the repository at <racine> as it stands: `{ racine, commit, arbre, branche, main }`,
|
|
111
|
-
// its top (its real path), HEAD, the tree of its working tree, the branch of HEAD (null when
|
|
112
|
-
// detached) and main (brancheDeMain); `{ raison }` when no last green can count.
|
|
113
|
-
function etatDuDepot(racine) {
|
|
114
|
-
const haut = sortie(racine, ['rev-parse', '--show-toplevel']);
|
|
115
|
-
if (!haut) {
|
|
116
|
-
return { raison: 'hors de git' };
|
|
117
|
-
}
|
|
118
|
-
const top = realpathSync(haut);
|
|
119
|
-
const commit = sortie(top, ['rev-parse', '--verify', '-q', 'HEAD^{commit}']);
|
|
120
|
-
if (!commit) {
|
|
121
|
-
return { raison: 'aucun commit' };
|
|
122
|
-
}
|
|
123
|
-
if (sousModuleModifie(top)) {
|
|
124
|
-
return { raison: 'un sous-module diffère de son commit' };
|
|
125
|
-
}
|
|
126
|
-
const dir = mkdtempSync(path.join(os.tmpdir(), 'grillhouse-vert-'));
|
|
127
|
-
try {
|
|
128
|
-
const index = path.join(dir, 'index');
|
|
129
|
-
const reel = sortie(top, ['rev-parse', '--path-format=absolute', '--git-path', 'index']);
|
|
130
|
-
const env = { ...process.env, GIT_INDEX_FILE: index };
|
|
131
|
-
if (reel && existsSync(reel)) {
|
|
132
|
-
copyFileSync(reel, index);
|
|
133
|
-
} else if (git(top, ['read-tree', 'HEAD'], env).status !== 0) {
|
|
134
|
-
return { raison: 'git échoue' };
|
|
135
|
-
}
|
|
136
|
-
if (git(top, ['add', '-A'], env).status !== 0) {
|
|
137
|
-
return { raison: 'git échoue' };
|
|
138
|
-
}
|
|
139
|
-
const arbre = sortie(top, ['write-tree'], env);
|
|
140
|
-
if (!arbre) {
|
|
141
|
-
return { raison: 'git échoue' };
|
|
142
|
-
}
|
|
143
|
-
const branche = sortie(top, ['symbolic-ref', '--short', '-q', 'HEAD']);
|
|
144
|
-
return { racine: top, commit, arbre, branche, main: brancheDeMain(top) };
|
|
145
|
-
} finally {
|
|
146
|
-
rmSync(dir, { recursive: true, force: true });
|
|
147
|
-
}
|
|
65
|
+
return fichierSous(racine, 'dernier-vert', branche);
|
|
148
66
|
}
|
|
149
67
|
|
|
150
68
|
// The last green that a pass in the state <etat> (etatDuDepot) measures itself against: its
|