@roomi-fields/grillhouse 0.55.1 → 0.55.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +28 -2
  3. package/charte/plan.md +8 -0
  4. package/charte/preuve.md +6 -2
  5. package/charte/superviseur.md +19 -0
  6. package/charte/tests.md +15 -0
  7. package/charte.md +1 -1
  8. package/dist/temporal/circuit/activites.js +2 -2
  9. package/dist/temporal/circuit/activites.js.map +1 -1
  10. package/dist/temporal/circuit/client.d.ts +2 -1
  11. package/dist/temporal/circuit/client.js +19 -7
  12. package/dist/temporal/circuit/client.js.map +1 -1
  13. package/dist/temporal/nuits/activites.d.ts +0 -4
  14. package/dist/temporal/nuits/activites.js +1 -7
  15. package/dist/temporal/nuits/activites.js.map +1 -1
  16. package/dist/temporal/nuits/choix.d.ts +0 -15
  17. package/dist/temporal/nuits/choix.js +0 -20
  18. package/dist/temporal/nuits/choix.js.map +1 -1
  19. package/dist/temporal/nuits/contrat.d.ts +0 -8
  20. package/dist/temporal/places/client.d.ts +2 -2
  21. package/dist/temporal/places/client.js +3 -2
  22. package/dist/temporal/places/client.js.map +1 -1
  23. package/dist/temporal/places/deroule.js +7 -1
  24. package/dist/temporal/places/deroule.js.map +1 -1
  25. package/docs/INTERFACE.md +2 -1
  26. package/docs/architecture/circuit.md +3 -3
  27. package/docs/architecture/entree.md +1 -1
  28. package/docs/architecture/greffon.md +2 -3
  29. package/docs/architecture/installation.md +2 -2
  30. package/docs/architecture/machine.md +6 -4
  31. package/docs/architecture/tests.md +51 -7
  32. package/hooks/hooks.json +0 -4
  33. package/package.json +1 -1
  34. package/scripts/aiguillage.mjs +1 -2
  35. package/scripts/bilan.mjs +116 -25
  36. package/scripts/branche-de-nuit.mjs +1 -15
  37. package/scripts/coeurs-dedies.mjs +19 -2
  38. package/scripts/composition-des-langages.mjs +2 -2
  39. package/scripts/consommation-des-passes.mjs +0 -4
  40. package/scripts/consommation.mjs +2 -2
  41. package/scripts/crochets.mjs +1 -1
  42. package/scripts/etapes.mjs +1 -10
  43. package/scripts/integration/file.mjs +2 -12
  44. package/scripts/jointure.d.ts +3 -0
  45. package/scripts/langages/c/index.mjs +2 -0
  46. package/scripts/langages/cargo/index.mjs +2 -0
  47. package/scripts/langages/python/index.mjs +2 -0
  48. package/scripts/langages/typescript/index.mjs +2 -0
  49. package/scripts/machine.mjs +0 -1
  50. package/scripts/mesure-de-la-machine.d.mts +3 -0
  51. package/scripts/mesure-de-la-machine.mjs +10 -2
  52. package/scripts/migrations/nuit-yml-retire.mjs +34 -4
  53. package/scripts/migrations/table-des-consommations.mjs +36 -0
  54. package/scripts/migrations.mjs +2 -0
  55. package/scripts/nuit.sh +3 -14
  56. package/scripts/passe-de-la-machine.mjs +25 -2
  57. package/scripts/places-de-la-machine.mjs +4 -39
  58. package/scripts/places-du-serveur.mjs +18 -4
  59. package/scripts/plafond-de-la-machine.d.mts +1 -1
  60. package/scripts/plafond-de-la-machine.mjs +15 -17
  61. package/scripts/regles-des-places.d.mts +2 -0
  62. package/scripts/regles-des-places.mjs +12 -4
  63. package/scripts/resultats.mjs +18 -14
  64. package/scripts/seances.mjs +7 -1
  65. package/scripts/sous-commandes.mjs +0 -1
  66. package/scripts/suiveur.mjs +96 -19
  67. package/scripts/tableau.mjs +16 -14
  68. package/scripts/transitions.mjs +3 -0
  69. package/scripts/un-commit-par-ticket.mjs +8 -0
  70. package/skills/developpeur/SKILL.md +1 -1
  71. package/skills/explorateur/SKILL.md +2 -2
  72. package/skills/questionneur/SKILL.md +3 -2
  73. package/skills/relecteur/SKILL.md +1 -1
  74. package/skills/testwriter/SKILL.md +1 -1
  75. package/scripts/attente-au-tour.mjs +0 -93
  76. package/scripts/poussee-retiree.mjs +0 -19
package/scripts/bilan.mjs CHANGED
@@ -81,14 +81,7 @@ import os from 'node:os';
81
81
  import path from 'node:path';
82
82
  import { StringDecoder } from 'node:string_decoder';
83
83
  import { REGISTRE } from './adresse-du-registre.mjs';
84
- import {
85
- bilansGardes,
86
- dollars,
87
- dossier,
88
- minutes,
89
- pourcent,
90
- SUFFIXE,
91
- } from './bilans-gardes.mjs';
84
+ import { bilansGardes, dollars, dossier, minutes, pourcent, SUFFIXE } from './bilans-gardes.mjs';
92
85
  import { lireLaConsommation } from './consommation-des-passes.mjs';
93
86
  import { lireLeJournal } from './journal-des-etats.mjs';
94
87
  import { pathToFileURL } from 'node:url';
@@ -105,6 +98,8 @@ import {
105
98
  } from './etapes.mjs';
106
99
  import { lireFichier } from './tableau.mjs';
107
100
  import { tauxDeRejeu } from './registre-des-entrees.mjs';
101
+ import { langageDe } from './langages.mjs';
102
+ import { ticketDuSujet } from './un-commit-par-ticket.mjs';
108
103
 
109
104
  export { bilansGardes, enBref } from './bilans-gardes.mjs';
110
105
 
@@ -253,7 +248,9 @@ function fusion(l) {
253
248
  // The parts of the disjoint intervals <a> that lie in the intervals <b>.
254
249
  const dans = (a, b) =>
255
250
  fusion(
256
- a.flatMap(([d, f]) => b.map(([x, y]) => [Math.max(d, x), Math.min(f, y)]).filter(([x, y]) => y > x))
251
+ a.flatMap(([d, f]) =>
252
+ b.map(([x, y]) => [Math.max(d, x), Math.min(f, y)]).filter(([x, y]) => y > x)
253
+ )
257
254
  );
258
255
  // The parts of the intervals <a> outside the intervals <b>.
259
256
  function sansLes(a, b) {
@@ -502,10 +499,10 @@ export function bilan({
502
499
  // The causes of « entre deux étapes »: each instant of the gaps goes to the first cause of the
503
500
  // list that a trace covers (a session starting, a place or cores, another circuit, the queue),
504
501
  // the rest unattributed.
505
- const trous = sansLes(
506
- mur ? [[debut, fin]] : [],
507
- [...segments.map(fenetre), ...attentes.map(([d, f]) => [Math.max(d, debut), Math.min(f, fin)])]
508
- );
502
+ const trous = sansLes(mur ? [[debut, fin]] : [], [
503
+ ...segments.map(fenetre),
504
+ ...attentes.map(([d, f]) => [Math.max(d, debut), Math.min(f, fin)]),
505
+ ]);
509
506
  const traces = tracesDuJournal(journal, ticket);
510
507
  const demarrages = entrees
511
508
  .filter(e => e.role === CIRCUIT && e.lancement)
@@ -702,13 +699,13 @@ export function texteDuBilan(b, avant, depassent = []) {
702
699
  const sousLignes =
703
700
  causes && b.categories.intervalles.journale
704
701
  ? [
705
- ["démarrage d'une séance", 'seance'],
706
- ['cœurs ou place', 'place'],
707
- ['autre circuit ou projet', 'autre'],
708
- ['file', 'file'],
709
- ['non attribué', 'nonAttribue'],
710
- ].map(([nom, k]) => ` - ${nom} : ${minutes(causes[k])} min`)
711
- : [];
702
+ ["démarrage d'une séance", 'seance'],
703
+ ['cœurs ou place', 'place'],
704
+ ['autre circuit ou projet', 'autre'],
705
+ ['file', 'file'],
706
+ ['non attribué', 'nonAttribue'],
707
+ ].map(([nom, k]) => ` - ${nom} : ${minutes(causes[k])} min`)
708
+ : [];
712
709
  const lignes = CATEGORIES.flatMap(([k, nom]) => {
713
710
  const c = b.categories[k];
714
711
  const plus =
@@ -894,10 +891,7 @@ function messagesDeLaSeance(seance) {
894
891
  // the owner's messages in the supervisor's sessions its stops name and the first request of each
895
892
  // session it launched, unless <transcriptions> is false: then no transcript is read.
896
893
  function calculer(racine, ticket, fin, { transcriptions = true } = {}) {
897
- const lignes = lignesDuProjet(
898
- existsSync(REGISTRE) ? readFileSync(REGISTRE, 'utf8') : '',
899
- racine
900
- );
894
+ const lignes = lignesDuProjet(existsSync(REGISTRE) ? readFileSync(REGISTRE, 'utf8') : '', racine);
901
895
  const fiches = path.join(dossier(racine), `${ticket}.fiches.jsonl`);
902
896
  const entrees = (existsSync(fiches) ? readFileSync(fiches, 'utf8') : '')
903
897
  .split('\n')
@@ -921,13 +915,110 @@ function calculer(racine, ticket, fin, { transcriptions = true } = {}) {
921
915
  });
922
916
  }
923
917
 
918
+ // The drift sensor of the bilan (docs/architecture/tests.md §5.9): the lines of test a lot adds and
919
+ // removes against the lines of code it adds, compared with the median of the lots before it.
920
+ //
921
+ // - The lot of a ticket is the latest commit of main whose subject names it, measured against its
922
+ // first parent (`git diff --numstat`, renames read as a removal and an addition).
923
+ // - A file counts as a test when the module of its language says so (`estUnTest`), as code when it
924
+ // is no test, no test material and carries a source extension of one of the project's languages;
925
+ // any other file (a document, a JSON, a configuration, an unknown language) counts as neither.
926
+ // - The ratio of a lot is its lines of test added minus removed over its lines of code added;
927
+ // undefined without a line of code added. The median is that of the ratios of the last 20 commits
928
+ // of main that name a ticket, the lot itself left out, the undefined ratios out of it.
929
+ // - A failed reading of git gives no line: the bilan is written without it.
930
+ const FENETRE_DU_CAPTEUR = 20;
931
+
932
+ const gitLu = (racine, ...args) => {
933
+ const r = spawnSync('git', ['-C', racine, ...args], { encoding: 'utf8', maxBuffer: 1 << 28 });
934
+ if (r.status !== 0) {
935
+ throw new Error(`git ${args.join(' ')}`);
936
+ }
937
+ return r.stdout;
938
+ };
939
+
940
+ // The figures { ajoutes, retires, code } of the commit <sha>.
941
+ function chiffres(racine, sha, langage, extensions) {
942
+ const champs = gitLu(racine, 'diff', '--numstat', '--no-renames', '-z', `${sha}^`, sha).split(
943
+ '\0'
944
+ );
945
+ const c = { ajoutes: 0, retires: 0, code: 0 };
946
+ for (const champ of champs) {
947
+ // « <added>\t<removed>\t<path> »; a binary file gives « - » for both counts and is skipped.
948
+ const [add, del, ...reste] = champ.split('\t');
949
+ const fichier = reste.join('\t');
950
+ if (!fichier || add === '-' || del === '-') {
951
+ continue;
952
+ }
953
+ const jugement = langage.estUnTest(fichier, racine);
954
+ if (jugement?.test || jugement?.joue) {
955
+ c.ajoutes += Number(add);
956
+ c.retires += Number(del);
957
+ } else if (!jugement && extensions.some(e => fichier.endsWith(e))) {
958
+ c.code += Number(add);
959
+ }
960
+ }
961
+ return c;
962
+ }
963
+
964
+ const rapportDe = c => (c.code > 0 ? (c.ajoutes - c.retires) / c.code : null);
965
+ const mediane = rs => {
966
+ const t = [...rs].sort((a, b) => a - b);
967
+ const m = t.length >> 1;
968
+ return t.length % 2 ? t[m] : (t[m - 1] + t[m]) / 2;
969
+ };
970
+ const nombreFrancais = n => String(Math.round(n * 100) / 100).replace('.', ',');
971
+
972
+ /**
973
+ * The line of the sensor for <ticket> in the main tree <racine>; null when no commit of main names
974
+ * the ticket or when git cannot be read.
975
+ * @param {string} racine
976
+ * @param {string} ticket
977
+ * @returns {string | null}
978
+ */
979
+ function ligneDuCapteur(racine, ticket) {
980
+ try {
981
+ const langage = langageDe(racine);
982
+ const extensions = langage.extensionsDuCode;
983
+ const commits = gitLu(racine, 'log', '--first-parent', '--format=%H%x09%s', 'main')
984
+ .split('\n')
985
+ .filter(Boolean)
986
+ .map(l => l.split('\t'));
987
+ const lot = commits.find(([, sujet]) => ticketDuSujet(sujet) === ticket);
988
+ if (!lot) {
989
+ return null;
990
+ }
991
+ const c = chiffres(racine, lot[0], langage, extensions);
992
+ const rapport = rapportDe(c);
993
+ const avant = commits
994
+ .filter(([sha, sujet]) => sha !== lot[0] && ticketDuSujet(sujet) !== null)
995
+ .slice(0, FENETRE_DU_CAPTEUR)
996
+ .map(([sha]) => rapportDe(chiffres(racine, sha, langage, extensions)))
997
+ .filter(r => r !== null);
998
+ const med = avant.length ? mediane(avant) : null;
999
+ const chiffre = `+${c.ajoutes} / −${c.retires} de test pour +${c.code} de code`;
1000
+ if (rapport === null) {
1001
+ return `- dérive des tests : ${chiffre}.`;
1002
+ }
1003
+ const suite =
1004
+ med === null
1005
+ ? ''
1006
+ : ` contre une médiane de ${nombreFrancais(med)}${rapport > med ? ' : signal' : ''}`;
1007
+ return `- dérive des tests : ${chiffre}, rapport ${nombreFrancais(rapport)}${suite}.`;
1008
+ } catch {
1009
+ return null;
1010
+ }
1011
+ }
1012
+
924
1013
  // The bilan of <ticket> computed, where its circuit ended <fin> (`calculer`), kept in the main tree
925
1014
  // <racine>, and its text, compared with the bilan before it: what the circuit writes at the ticket.
926
1015
  export function ecrireLeBilan(racine, ticket, fin) {
927
1016
  const b = calculer(racine, ticket, fin);
928
1017
  const avant = precedent(racine, ticket);
929
1018
  garder(racine, b);
930
- return texteDuBilan(b, avant, depassementsDuTicket(racine, ticket));
1019
+ const texte = texteDuBilan(b, avant, depassementsDuTicket(racine, ticket));
1020
+ const capteur = ligneDuCapteur(racine, ticket);
1021
+ return capteur ? `${texte}\n${capteur}` : texte;
931
1022
  }
932
1023
 
933
1024
  // Where the circuit of <ticket> in the repository at <racine> ended, as its workflow's memo on the
@@ -10,16 +10,12 @@
10
10
  // - Only the remote `origin` is watched. Main is the one branch that receives the lots; the queue
11
11
  // pushes such a commit, and the CI of main plays after, by batches. No CI of a ticket's branch is
12
12
  // asked.
13
- // - A project whose package.json carries the retired key `grillhouse.poussee` is refused by its
14
- // name (scripts/poussee-retiree.mjs), whatever its value.
15
13
  // - Exit 0 lets the push go on; exit 1 refuses it, the reason on the standard error.
16
14
  import { execFileSync } from 'node:child_process';
17
- import { existsSync, readFileSync } from 'node:fs';
18
- import path from 'node:path';
15
+ import { readFileSync } from 'node:fs';
19
16
  import { pathToFileURL } from 'node:url';
20
17
  import { commitEstJuge } from './arbres-juges.mjs';
21
18
  import { ecartsDuDossier } from './etat-du-depot.mjs';
22
- import { pousseeRetiree } from './poussee-retiree.mjs';
23
19
 
24
20
  // A sha of zeros: the deletion of the remote branch.
25
21
  const SUPPRESSION = /^0+$/;
@@ -48,13 +44,6 @@ export function refusSurMain(remote, refs, { jugee, tete, ecarts }) {
48
44
  });
49
45
  }
50
46
 
51
- // The refusals for a push to `remote` of `refs` given the package.json object `pkg`: the retired
52
- // key `grillhouse.poussee` refuses it by its name; an empty list lets the push go on.
53
- export function refus(remote, refs, pkg) {
54
- const ligne = remote === 'origin' ? pousseeRetiree(pkg) : null;
55
- return ligne ? [`⛔ ${ligne}`] : [];
56
- }
57
-
58
47
  // The pushed refs of git's standard input.
59
48
  export function lireRefs(texte) {
60
49
  return texte
@@ -68,11 +57,8 @@ export function lireRefs(texte) {
68
57
 
69
58
  if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
70
59
  const racine = execFileSync('git', ['rev-parse', '--show-toplevel'], { encoding: 'utf8' }).trim();
71
- const fichier = path.join(racine, 'package.json');
72
- const pkg = existsSync(fichier) ? JSON.parse(readFileSync(fichier, 'utf8')) : null;
73
60
  const refs = lireRefs(readFileSync(0, 'utf8'));
74
61
  const lignes = [
75
- ...refus(process.argv[2], refs, pkg),
76
62
  ...refusSurMain(process.argv[2], refs, {
77
63
  jugee: sha => commitEstJuge(racine, sha),
78
64
  tete: execFileSync('git', ['-C', racine, 'rev-parse', 'HEAD'], { encoding: 'utf8' }).trim(),
@@ -13,7 +13,7 @@
13
13
  // of the launch, else not at all.
14
14
  // - The rest of the dedicated cores: the load of those cores alone, read from /proc/stat.
15
15
  import { readFileSync } from 'node:fs';
16
- import { availableParallelism } from 'node:os';
16
+ import { coeursDeLaMachine } from './mesure-de-la-machine.mjs';
17
17
  import { spawnSync } from 'node:child_process';
18
18
  import { paquetsDeLEnveloppe } from './enveloppe/paquets-du-plan.mjs';
19
19
  import { COEURS_PAR_DEFAUT } from './plafond-de-la-machine.mjs';
@@ -103,7 +103,7 @@ const lireUnFichier = chemin => {
103
103
  * reading of a file of the system (null when it does not read), for a trial
104
104
  * @returns {{ lisible: boolean, coeurs: { fils: number[], noeud: number }[] }}
105
105
  */
106
- export function lireLaTopologie({ lire = lireUnFichier, nombreDeFils = availableParallelism() } = {}) {
106
+ export function lireLaTopologie({ lire = lireUnFichier, nombreDeFils = coeursDeLaMachine() } = {}) {
107
107
  const cpu = n => `/sys/devices/system/cpu/cpu${n}/topology/thread_siblings_list`;
108
108
  const groupes = new Map();
109
109
  let lisible = true;
@@ -339,6 +339,23 @@ export function ecartDesProgrammes({ dedies, fils: tous }) {
339
339
  };
340
340
  }
341
341
 
342
+ /**
343
+ * Lifts the restriction a measure set on the programs out of the frame (`AllowedCPUs` of
344
+ * `app.slice`): the group may use every core again. Called at the end of a measure, interrupted
345
+ * one included, by the next measure, and when the arbiter opens, so that the restriction of a
346
+ * dead measure never outlives it. True when the system took it.
347
+ * @param {{ lancer?: (cmd: string, args: string[]) => number | null }} [o] the command, for a trial
348
+ * @returns {boolean}
349
+ */
350
+ export function leverLaRestriction({
351
+ lancer = (cmd, args) => spawnSync(cmd, args, { stdio: 'ignore', timeout: 20_000 }).status,
352
+ } = {}) {
353
+ // An empty value resets the group to every core of the machine.
354
+ return (
355
+ lancer('systemctl', ['--user', 'set-property', '--runtime', 'app.slice', 'AllowedCPUs=']) === 0
356
+ );
357
+ }
358
+
342
359
  /**
343
360
  * The busy and the total time of each thread, from the text of /proc/stat (hundredths of a
344
361
  * second): busy is user, nice, system, irq, softirq and steal; idle and iowait are rest. Null
@@ -188,6 +188,7 @@ export function composer(modules) {
188
188
  outils: unique(modules.flatMap(m => m.outils)),
189
189
  binaires: Object.assign({}, ...modules.map(m => m.binaires)),
190
190
  ignorer: unique(modules.flatMap(m => m.ignorer)),
191
+ extensionsDuCode: unique(modules.flatMap(m => m.extensionsDuCode)),
191
192
  sorties: {
192
193
  ecrites: unique(modules.flatMap(m => m.sorties.ecrites)),
193
194
  propres: unique(modules.flatMap(m => m.sorties.propres)),
@@ -199,8 +200,7 @@ export function composer(modules) {
199
200
  matieres: racine => modules.flatMap(m => m.matieres(racine)),
200
201
  joueDesTests: (racine, composant) =>
201
202
  moduleDuComposant(racine, composant)?.joueDesTests(racine, composant) ?? false,
202
- lecturesDesTests: dossier =>
203
- unique(modules.flatMap(m => m.lecturesDesTests(dossier))).sort(),
203
+ lecturesDesTests: dossier => unique(modules.flatMap(m => m.lecturesDesTests(dossier))).sort(),
204
204
  environnementDuPoste: env => modules.reduce((e, m) => m.environnementDuPoste(e), env),
205
205
  empreintes(racine, noms) {
206
206
  const parts = modules.map(m => m.empreintes(racine, noms));
@@ -8,7 +8,6 @@
8
8
  // (§3.1, §5.6).
9
9
  import { spawn, spawnSync } from 'node:child_process';
10
10
  import { appendFileSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
11
- import { cpus } from 'node:os';
12
11
  import path from 'node:path';
13
12
  import { fileURLToPath } from 'node:url';
14
13
 
@@ -165,9 +164,6 @@ export function sorteDeLaPasse(nom) {
165
164
  .replace(/^-|-$/g, '');
166
165
  }
167
166
 
168
- /** The cores of the machine. */
169
- export const coeursDeLaMachine = () => cpus().length;
170
-
171
167
  /**
172
168
  * What the scope <unite> reports now (`lireLeScope` of `systemctl --user show`); null when the
173
169
  * manager does not answer, the scope gone.
@@ -23,7 +23,7 @@ import { AttenteDeLaMachine } from './attente-de-la-machine.mjs';
23
23
  import { bilanDeLaConsommation, lireLaConsommation } from './consommation-des-passes.mjs';
24
24
  import { ecrireAtomique } from './mesure/avancement.mjs';
25
25
  import { budgetDeLaPasse } from './places-de-la-machine.mjs';
26
- import { partDe } from './plafond-de-la-machine.mjs';
26
+ import { partDe, plafondDe } from './plafond-de-la-machine.mjs';
27
27
  import { fichierDeLaTable, lireLaTable } from './table-des-consommations.mjs';
28
28
 
29
29
  const GO = 1024 ** 3;
@@ -54,7 +54,7 @@ const commandeDeLaPlanification = () => import('../dist/temporal/consommation/co
54
54
  function recalculer(racine, lignes) {
55
55
  return calculDeLaTable().tableDesPhases(lignes, {
56
56
  budget: budgetDeLaPasse(process.env),
57
- defaut: partDe({ budget: budgetDeLaPasse(process.env) }),
57
+ defaut: partDe({ budget: budgetDeLaPasse(process.env), places: plafondDe(process.env) }),
58
58
  maintenant: Date.now(),
59
59
  veille: lireLaTable(racine),
60
60
  });
@@ -51,7 +51,7 @@ export const CROCHETS = {
51
51
  'pre-push': {
52
52
  garde: 'branche-de-nuit.mjs',
53
53
  lignes: [
54
- '# Judged main guard (Grillhouse): main receives only a tree a final pass or a verification judged green; a project that carries the retired grillhouse.poussee is refused. Without the package @roomi-fields/grillhouse installed, nothing.',
54
+ '# Judged main guard (Grillhouse): main receives only a tree a final pass or a verification judged green. Without the package @roomi-fields/grillhouse installed, nothing.',
55
55
  COMMANDE,
56
56
  'if [ -x "$_gh_commande" ]; then _gh_entree=$(mktemp) && cat > "$_gh_entree" && "$_gh_commande" hook pre-push "$@" < "$_gh_entree" || { rm -f "$_gh_entree"; exit 1; }; exec < "$_gh_entree"; rm -f "$_gh_entree"; fi',
57
57
  ],
@@ -276,27 +276,23 @@ export const etapeDuRole = role =>
276
276
  // rules (retry, regenerate, skip a job without object) without asking anyone, and as the sheriffs
277
277
  // of Chromium quarantine a flaky test by a rule, not by a judgement. Each gesture: `genre`, its
278
278
  // name as the circuit writes it at the ticket and in the log; `geste`, what the circuit does;
279
- // `regle`, the rule that settles it; `cas`, the case of BPScript it settles (the analysis of 320.3,
280
- // its stop A or its decision D, or that of 320.9). On each one, the circuit writes at the ticket
279
+ // `regle`, the rule that settles it. On each one, the circuit writes at the ticket
281
280
  // `Circuit · geste : <genre> → <geste> (règle : <regle>)`, and the same line in the ticket's log.
282
281
  export const GESTES = [
283
282
  {
284
283
  genre: 'a-repasser',
285
284
  geste: 'le circuit finit à 75, que le superviseur rejoue au repos par --reprendre',
286
285
  regle: 'seul le code 75 du vérificateur dit la charge de la machine',
287
- cas: 'A12, A17, A18 : un vrai rouge pris pour la charge du processeur (D14, D20, D21)',
288
286
  },
289
287
  {
290
288
  genre: 'rejeu',
291
289
  geste: 'la commande joue une seconde fois',
292
290
  regle: 'une commande des contrôles hors de la passe finale à 75 rejoue une fois avant l’arrêt',
293
- cas: 'A12 : un contrôle à 75, rejoué avant de conclure à la charge',
294
291
  },
295
292
  {
296
293
  genre: 'renvoi-au-testwriter',
297
294
  geste: 'au testwriter, que la fiche du développeur nomme, puis la preuve et le développeur',
298
295
  regle: 'le rouge qui reste est dans les tests du lot (`renvoi` de sa fiche)',
299
- cas: 'A5, A7 : « Agent : testwriter » non lu, les tests périmés de 050 et de 130 (D6, D8) ; A2 (D2)',
300
296
  },
301
297
  {
302
298
  genre: 'regeneration',
@@ -304,7 +300,6 @@ export const GESTES = [
304
300
  'à la régénération des références (4.2), puis la passe qui juge l’arbre régénéré : après les contrôles, les contrôles du plan encore quand d’autres rouges s’y mêlent, sinon la passe finale qui est due ; après une passe finale, la passe finale encore, sur toute la bande du lot',
305
301
  regle:
306
302
  'un rouge des contrôles du plan ou de la passe finale est celui d’une référence, même mêlé à d’autres : une que le projet déclare (`grillhouse.references`), ou un fichier que le cadre engendre (l’index des interfaces, les fichiers que le module du langage engendre) ; ou la passe abaisse la dette des gardes (`dette.mjs --abaisser`, depuis ses notes)',
307
- cas: 'BP 320.9 : 292 min autour des références, dont 163 min d’attente pour régénérer à la main l’index des interfaces, le plafond et l’empreinte, des rouges de références mêlés à d’autres ; BP 320.3.9 : le plafond rouge aux contrôles, laissé à une passe finale qui rejoue les mêmes tests sur le même arbre (6,1 min) ; BP 320.6.5 : un test qui lit les références des paquets, rouge à côté de leur garde, envoyé au développeur, qui n’a rien à livrer puis ne peut pas les écrire',
308
303
  },
309
304
  {
310
305
  genre: 'rejeu-des-engendres',
@@ -312,14 +307,12 @@ export const GESTES = [
312
307
  'avant la preuve du rouge, les contrôles et la passe finale, la commande de chaque fichier engendré (`grillhouse.engendres`) dont un motif `lit` couvre un fichier que le lot change, jouée dans la copie ; ses fichiers entrent au lot comme ceux de 4.2',
313
308
  regle:
314
309
  'un fichier engendré se construit avant les tests qui le lisent, et le graphe le rejoue quand ses entrées changent (Bazel, Nx, Turborepo) : aucun test du lot ne lit un fichier engendré périmé',
315
- cas: 'OSD-sf1.25.8 : un ticket qui ajoute des cas de conformité rougit au test qui lit les sommes engendrées, sans-livraison ; OSD-sf1.25.13 : la commande jouée à la main deux fois',
316
310
  },
317
311
  {
318
312
  genre: 'rien-a-livrer',
319
313
  geste: 'aux contrôles, qui jugent le lot',
320
314
  regle:
321
315
  'un développeur qui ne change aucun fichier du plan n’a rien à livrer quand les contrôles sont verts ; rouges, l’arrêt monte (sans-livraison), sauf le rouge d’une référence que le lot fait baisser, la dette des gardes, qui se régénère au lieu d’arrêter, et le rouge qui nomme un fichier de test du lot, qui va au testwriter ; sur le lot que l’intégration refuse, pour un développeur que --depuis developpeur lance, le geste ne joue pas : il est relancé une fois avec le refus',
322
- cas: 'BP 320.9 : 995-tools n’a rien à livrer, 4 montées et 49 min (B5)',
323
316
  },
324
317
  {
325
318
  genre: 'mecanique',
@@ -327,7 +320,6 @@ export const GESTES = [
327
320
  'ni testwriter, ni preuve du rouge, ni développeur : l’explorateur joue dans la copie la commande que le plan nomme (1.1), puis les contrôles, la passe finale, la relecture et l’intégration',
328
321
  regle:
329
322
  'le plan dit le ticket mécanique, avec sa raison et sa commande (`sorte` de la fiche de l’explorateur) : un geste sans comportement neuf ; tant qu’aucun testwriter ni développeur n’a travaillé le lot, un rouge des contrôles ou un RENDU monte, sans relancer personne',
330
- cas: 'BP 320.16 : 38 outils déplacés par mv, 117 commentaires ; BP 320.40.1 : une variable inutilisée, 4 séances ; BP 322.11.1 : l’outil de test monté sur 31 paquets',
331
323
  },
332
324
  {
333
325
  genre: 'conflit-de-l-avance',
@@ -335,7 +327,6 @@ export const GESTES = [
335
327
  'au rôle qui écrit les fichiers en conflit ou au lot gardé, les marques posées dans la copie : le testwriter pour un test ou la matière de test partagée, quelle que soit la sorte du lot, le développeur pour le code, le testwriter d’abord puis le développeur sur les fichiers des deux ; après un lot que l’intégration (5.1) dit ne plus s’appliquer sur main, ou que la file (5.2) rend sur un conflit, le circuit revient à la passe qui juge le lot, dont la préparation joue ce geste',
336
328
  regle:
337
329
  'l’avance d’une copie sur main, avant une passe, ou après le conflit de la file à 5.2, laisse des fichiers en conflit ou un lot gardé : le rôle que `estUnTest` du module du langage désigne pour chacun les écrit ; un conflit que la seconde séance du rôle ne lève pas monte (lancement)',
338
- cas: 'SH-b52.2 : marques dans 2 fichiers de test, résolues à la main par le superviseur ; SH-br0.3 : 8 fichiers de test dans le lot gardé, la copie sur main sans eux',
339
330
  },
340
331
  ];
341
332
 
@@ -66,8 +66,7 @@
66
66
  // circuit the issue « echec », on which it stops with its question; its resumption, once what
67
67
  // holds the closure is lifted, plays the entry again, which closes the ticket; the queue of the
68
68
  // tickets never starts again a ticket whose lot is on main (scripts/file-des-tickets.mjs). Then main is pushed to origin, to the branch
69
- // main, which the pre-push hook lets go as the tree is judged (a main whose package.json carries the
70
- // retired key `grillhouse.poussee` is refused by its name, nothing pushed); a refused push is written to the ticket and does not stop the
69
+ // main, which the pre-push hook lets go as the tree is judged (a refused push is written to the ticket and does not stop the
71
70
  // queue. The working directory of its circuit (`.claude/worktrees/<ticket>.travail`,
72
71
  // scripts/circuit.mjs), which lives as long as the ticket, is removed then (`retirerLeTravail`).
73
72
  // Every comment and change of the queue at a ticket is written under the author `file`, which bd
@@ -88,7 +87,6 @@ import { A_REPASSER } from '../codes-de-sortie.mjs';
88
87
  import { avecLesDonnees, donneesDe } from '../donnees-cles.mjs';
89
88
  import { matieresDeclareesDe } from '../matieres-cles.mjs';
90
89
  import { avecLesOutils, empreintesDe, outilsDe } from '../outils-cles.mjs';
91
- import { pousseeRetiree } from '../poussee-retiree.mjs';
92
90
  import { ouvrirCopie } from './rejeu.mjs';
93
91
  import { jugementDeLaFile, journalDuTicket } from './jugement.mjs';
94
92
  import { releverLEntree } from '../registre-des-entrees.mjs';
@@ -472,8 +470,7 @@ function livrerLesCapacites(o, ticket, labels) {
472
470
  * The ticket of <entree> (`{ ticket, branche, commit }`) entered on main at <commit>, with the
473
471
  * tools <o>: it closes « intégré : <commit> » and loses `en-file` (a ticket already closed is left
474
472
  * as it is), the branch is deleted, then main is pushed to origin on the branch
475
- * main, unless main's package.json carries the retired key `grillhouse.poussee` (refused by its
476
- * name, nothing pushed); the queue is then done with the ticket, and
473
+ * main; the queue is then done with the ticket, and
477
474
  * removes the working directory of its circuit (`retirerLeTravail`). Each of its gestures replays
478
475
  * without harm (a ticket closed is left closed, a branch gone stays gone, a commit pushed is pushed
479
476
  * again as it is), and never reopens the ticket; its comments are effects (`commenterAu`), which
@@ -523,13 +520,6 @@ export function fermerLEntree(o, entree) {
523
520
  if (!fermeture) {
524
521
  retirerLeTravail(o, entree.ticket);
525
522
  }
526
- const paquet = git('show', `refs/heads/${o.principale}:package.json`);
527
- const retiree = pousseeRetiree(paquet.status === 0 ? JSON.parse(paquet.stdout) : null);
528
- if (retiree) {
529
- const raison = `Poussée non faite : ${retiree}`;
530
- commenter(raison);
531
- return { poussee: null, raison: enUneLigne(raison), ...ferme };
532
- }
533
523
  const sansInvite = { encoding: 'utf8', env: { ...process.env, GIT_TERMINAL_PROMPT: '0' } };
534
524
  const pousse = spawnSync(
535
525
  'git',
@@ -218,6 +218,9 @@ export interface Composition {
218
218
  * out, the update writes them in the project's `.gitignore`, and the removal of the finished
219
219
  * copies removes them from a kept copy whose ticket is closed (scripts/copies-finies.mjs). */
220
220
  ignorer: string[];
221
+ /** The extensions of the source files of the language (`.rs`, `.py`…): the drift sensor of the
222
+ * bilan counts a file that is no test and carries one of them as code (scripts/bilan.mjs). */
223
+ extensionsDuCode: string[];
221
224
  /** Where a run of the language's tools writes, which the envelope opens to a session;
222
225
  * Turborepo's outputs are the core's, which no module declares. */
223
226
  sorties: {
@@ -70,6 +70,8 @@ export default {
70
70
  ...JSON.parse(readFileSync(ici('binaires.json'), 'utf8')),
71
71
  },
72
72
  ignorer: [CONSTRUCTION],
73
+ // The extensions of the source files of the language (the drift sensor of the bilan counts them as code).
74
+ extensionsDuCode: ['.c', '.h'],
73
75
  sorties: {
74
76
  ecrites: [`${CONSTRUCTION}/`],
75
77
  propres: [],
@@ -91,6 +91,8 @@ export default {
91
91
  binaires: JSON.parse(readFileSync(ici('binaires.json'), 'utf8')),
92
92
  // What cargo writes in a project: its target directory.
93
93
  ignorer: ['target'],
94
+ // The extensions of the source files of the language (the drift sensor of the bilan counts them as code).
95
+ extensionsDuCode: ['.rs'],
94
96
  // Where cargo writes, in writing: the target directory of the workspace; in its home, the
95
97
  // registry's index and sources, the git dependencies, cargo-deny's advisories, and the files of
96
98
  // its locks and of the SQLite cache of its packages (`.package-cache`, `.package-cache-mutate`,
@@ -80,6 +80,8 @@ export default {
80
80
  executables: ['python3'],
81
81
  binaires: JSON.parse(readFileSync(ici('binaires.json'), 'utf8')),
82
82
  ignorer: ['.venv', '.pytest_cache', PYCACHE],
83
+ // The extensions of the source files of the language (the drift sensor of the bilan counts them as code).
84
+ extensionsDuCode: ['.py'],
83
85
  sorties: {
84
86
  ecrites: ['.venv/', '.pytest_cache/', '~/.cache/grillhouse/uv/'],
85
87
  propres: [PYCACHE],
@@ -223,6 +223,8 @@ export default {
223
223
  // runs and cache (`.turbo`) are the frame's, every language playing by it: IGNORES_DU_CADRE of
224
224
  // scripts/grillhouse-maj.mjs ignores them.
225
225
  ignorer: ['.vitest-reports', '.cache-outils'],
226
+ // The extensions of the source files of the language (the drift sensor of the bilan counts them as code).
227
+ extensionsDuCode: ['.ts', '.mts', '.cts', '.tsx', '.js', '.mjs', '.cjs', '.jsx'],
226
228
  // Where its tools write, Turborepo's outputs being the core's (`sortiesDuLangage` of
227
229
  // scripts/enveloppe/enveloppe.mjs): the cache of Vite, where Vitest writes the results of a run
228
230
  // (`.cache-outils/vite/vitest/`, the `cacheDir` of the base configurations: a copy's
@@ -8,7 +8,6 @@
8
8
  // vide » when nothing plays; played again, it reads that state. With `--attendre` it returns
9
9
  // only once the machine is empty: exit 0.
10
10
  // - `rouvrir`: the circuits go on by themselves at the next step.
11
- // - A night that holds the machine is never doubled nor lifted: the command says so (exit 0).
12
11
  // - The closure lives in the state of the places on the Temporal server: it survives a restart of
13
12
  // the poste, and no circuit starts again before the reopening.
14
13
  import path from 'node:path';
@@ -46,6 +46,9 @@ export function uniteDeLEtape(id: string): string;
46
46
  /** The machine now: its cores, the cores occupied over ten seconds, its free memory in bytes. */
47
47
  export function mesureDeLaMachine(): MesureDeLaMachine;
48
48
 
49
+ /** The cores of the machine, on its topology, never the affinity of the process. */
50
+ export function coeursDeLaMachine(): number;
51
+
49
52
  /** The start of the process <pid> as the system gives it, null when it is gone. */
50
53
  export function departDe(pid: number): string | null;
51
54
 
@@ -8,7 +8,7 @@
8
8
  // (§3.1, §5.2).
9
9
  import { spawnSync } from 'node:child_process';
10
10
  import { readFileSync } from 'node:fs';
11
- import { availableParallelism, freemem, totalmem } from 'node:os';
11
+ import { cpus, freemem, totalmem } from 'node:os';
12
12
  import { departDe, leMemeVivant, vivant } from './mesure/base-de-passe.mjs';
13
13
 
14
14
  export { departDe };
@@ -150,6 +150,14 @@ export function memoireDisponible() {
150
150
  return memoireRestante().disponible ?? freemem();
151
151
  }
152
152
 
153
+ /**
154
+ * The cores of the machine, counted on its topology (the processors the system lists), never on
155
+ * the affinity of the calling process: a process confined to 6 cores sees the same machine, so the
156
+ * budget does not depend on who measures it.
157
+ * @returns {number}
158
+ */
159
+ export const coeursDeLaMachine = () => Math.max(1, cpus().length);
160
+
153
161
  /** The window the cores occupied are read on, in ms: the last ten seconds. */
154
162
  export const FENETRE_DE_CHARGE_MS = 10_000;
155
163
 
@@ -241,7 +249,7 @@ function coeursOccupesMaintenant(coeurs) {
241
249
  * @returns {{ coeurs: number, charge: number, memoireLibre: number, memoireTotale: number }}
242
250
  */
243
251
  export const mesureDeLaMachine = () => {
244
- const coeurs = availableParallelism();
252
+ const coeurs = coeursDeLaMachine();
245
253
  return {
246
254
  coeurs,
247
255
  charge: coeursOccupesMaintenant(coeurs),
@@ -2,7 +2,7 @@
2
2
  // any more (entree.md §5.3). The file of a project that bears the frame's mark on its first line is
3
3
  // removed; one without the mark is the project's own, stays, and is reported. Mechanism:
4
4
  // installation.md §5.4 (packages/grillhouse/docs/architecture/).
5
- import { existsSync, readFileSync, rmSync } from 'node:fs';
5
+ import { existsSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
6
6
  import path from 'node:path';
7
7
  import { estDuCadre, WORKFLOWS } from '../workflows-du-cadre.mjs';
8
8
 
@@ -10,16 +10,46 @@ import { estDuCadre, WORKFLOWS } from '../workflows-du-cadre.mjs';
10
10
  export const version = '0.55.0';
11
11
  export const nom = 'nuit yml retire';
12
12
 
13
- /** The `nuit.yml` of the frame removed from the project at <projet>; returns what it did. */
13
+ /** The entry of `relatif` removed from `grillhouse.flux` of the root package.json; says whether it did. */
14
+ function retirerLEntree(projet, relatif) {
15
+ const fichier = path.join(projet, 'package.json');
16
+ if (!existsSync(fichier)) {
17
+ return false;
18
+ }
19
+ const texte = readFileSync(fichier, 'utf8');
20
+ let pkg;
21
+ try {
22
+ pkg = JSON.parse(texte);
23
+ } catch {
24
+ return false;
25
+ }
26
+ const flux = pkg?.grillhouse?.flux;
27
+ if (flux === null || typeof flux !== 'object' || !Object.hasOwn(flux, relatif)) {
28
+ return false;
29
+ }
30
+ delete flux[relatif];
31
+ const indent = /^[ \t]+(?=")/m.exec(texte)?.[0] ?? 2;
32
+ writeFileSync(fichier, `${JSON.stringify(pkg, null, indent)}${texte.endsWith('\n') ? '\n' : ''}`);
33
+ return true;
34
+ }
35
+
36
+ /** The `nuit.yml` of the frame removed from the project at <projet>, with its entry of `grillhouse.flux`; returns what it did. */
14
37
  export function migrer(projet) {
15
38
  const relatif = `${WORKFLOWS}/nuit.yml`;
16
39
  const fichier = path.join(projet, relatif);
17
40
  if (!existsSync(fichier)) {
18
- return [];
41
+ return retirerLEntree(projet, relatif)
42
+ ? [
43
+ `package.json : l'entrée ${relatif} de grillhouse.flux est retirée, le fichier n'existe plus`,
44
+ ]
45
+ : [];
19
46
  }
20
47
  if (estDuCadre(readFileSync(fichier, 'utf8'))) {
21
48
  rmSync(fichier);
22
- return [`${relatif} : le flux de la nuit du cadre est retiré, la nuit ne tourne plus sur GitHub`];
49
+ retirerLEntree(projet, relatif);
50
+ return [
51
+ `${relatif} : le flux de la nuit du cadre est retiré, avec son entrée de grillhouse.flux, la nuit ne tourne plus sur GitHub`,
52
+ ];
23
53
  }
24
54
  return [`${relatif} : nuit.yml du projet, que le cadre ne lit plus : à retirer ou à garder`];
25
55
  }