@roomi-fields/grillhouse 0.44.0 → 0.45.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +32 -0
- package/cadre/templates/projet/.claude/settings.json +5 -0
- package/cadre/templates/projet/CLAUDE.md +15 -2
- package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
- package/charte.md +3 -2
- package/dist/temporal/circuit/client.d.ts +7 -0
- package/dist/temporal/circuit/client.js +12 -2
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/commande.js +8 -1
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/installation.d.ts +26 -1
- package/dist/temporal/installation.js +113 -14
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/tickets/activites.js +3 -1
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/docs/ARCHITECTURE.md +207 -68
- package/docs/INTERFACE.md +24 -16
- package/package.json +1 -1
- package/scripts/activites.mjs +66 -46
- package/scripts/aiguillage.mjs +1 -0
- package/scripts/attente-de-la-machine.mjs +312 -0
- package/scripts/avancement.mjs +38 -31
- package/scripts/bilan.mjs +30 -5
- package/scripts/circuit.mjs +10 -7
- package/scripts/codes-de-sortie.mjs +1 -1
- package/scripts/coeurs-dedies.mjs +427 -0
- package/scripts/composants-affectes.mjs +3 -1
- package/scripts/consommation-des-passes.mjs +382 -0
- package/scripts/consommation.mjs +45 -0
- package/scripts/copies-finies.mjs +2 -2
- package/scripts/depart-du-ticket.mjs +3 -1
- package/scripts/disque-des-copies.mjs +1 -1
- package/scripts/echantillonneur-de-la-passe.mjs +103 -0
- package/scripts/enveloppe/enveloppe.mjs +1 -11
- package/scripts/enveloppe/travail-de-la-copie.mjs +3 -2
- package/scripts/grillhouse-maj.mjs +8 -4
- package/scripts/integration/file.mjs +10 -4
- package/scripts/jointure.d.ts +20 -9
- package/scripts/langages/cargo/commandes.mjs +8 -8
- package/scripts/langages/python/commandes.mjs +7 -6
- package/scripts/langages/typescript/tests-de-nuit.mjs +17 -4
- package/scripts/langages/typescript/tests.mjs +15 -6
- package/scripts/langages/typescript/verifier.mjs +23 -17
- package/scripts/langages/typescript/vitest-config/base.mjs +3 -3
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -7
- package/scripts/mesure/base-de-passe.mjs +1 -1
- package/scripts/migrations/0.44.0-seuil-des-codes-de-tickets.mjs +47 -0
- package/scripts/migrations.mjs +2 -0
- package/scripts/passe-de-la-machine.mjs +456 -31
- package/scripts/places-de-la-machine.mjs +508 -61
- package/scripts/plafond-de-la-machine.d.mts +47 -2
- package/scripts/plafond-de-la-machine.mjs +197 -5
- package/scripts/preparation.mjs +1 -0
- package/scripts/regles-des-places.d.mts +40 -0
- package/scripts/regles-des-places.mjs +91 -0
- package/scripts/retirer-les-copies-finies.mjs +1 -1
- package/scripts/seances.mjs +4 -3
- package/scripts/services-du-noyau.mjs +3 -3
- package/scripts/sous-commandes.mjs +6 -7
- package/scripts/tableau.mjs +121 -112
- package/scripts/verrou-de-machine.mjs +0 -829
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
// The waits of a pass for the room of the machine, and the stop they end on: what a pass wants
|
|
2
|
+
// before it plays, besides its part of the budget (scripts/places-de-la-machine.mjs).
|
|
3
|
+
//
|
|
4
|
+
// - A pass first wants room in the temporary directory (`os.tmpdir()` under its environment), a
|
|
5
|
+
// disk in memory that the sessions of the machine share: under LIBRE_MIN, 4 GB free
|
|
6
|
+
// (GRILLHOUSE_TEMPORAIRE_LIBRE names another floor, in bytes; the base configuration of the
|
|
7
|
+
// tests sets 0, scripts/langages/typescript/vitest-config/machine.setup.mjs), it waits for room
|
|
8
|
+
// instead of failing for lack of it (ENOSPC: 25 reds of the night of 2026-11-01, the
|
|
9
|
+
// scratchpads holding 8 GB of 16), as Kubernetes schedules no new pod on a node under
|
|
10
|
+
// DiskPressure. It says so, with what holds the directory (its largest entries, by the blocks
|
|
11
|
+
// their files hold, the temporary directory of a ticket naming its ticket), when it begins and
|
|
12
|
+
// every 30 s, under a bound (GRILLHOUSE_ATTENTE_MACHINE_MS, ATTENTE_MACHINE_MS, 60 min), then
|
|
13
|
+
// « à repasser » (75).
|
|
14
|
+
// - It then wants room on the disk of the copy it plays in (its root, `racine`), where cargo
|
|
15
|
+
// writes its target directories: under LIBRE_MIN as well (GRILLHOUSE_COPIE_LIBRE names another
|
|
16
|
+
// floor, in bytes; the base configuration of the tests sets 0), it waits the same way, under
|
|
17
|
+
// the same bound counted from the start of the wait, and says what holds that disk: the copies
|
|
18
|
+
// of its repository, the largest first, each with its ticket and its tools' outputs
|
|
19
|
+
// (`occupantsDesCopies` of scripts/copies-finies.mjs: « .claude/worktrees/SH-ae6.2.7 (le
|
|
20
|
+
// ticket SH-ae6.2.7, 5,0 Go, dont target 4,8 Go) »), as Bazel and Buildkite refuse to start a
|
|
21
|
+
// build under a floor of free room rather than fail in its middle (the main disk full on
|
|
22
|
+
// 2026-11-01, three circuits killed without a word, grillhouse-k5y).
|
|
23
|
+
// - The stop of a wait is an AttenteDeLaMachine: `code` 75 at the bound, 1 for a server of the
|
|
24
|
+
// places that does not answer.
|
|
25
|
+
// - A pass has a rank: one played in the frame's own repository (one whose workspaces hold the
|
|
26
|
+
// package @roomi-fields/grillhouse in development, its agent copies included: `rangDeLaMesure`)
|
|
27
|
+
// is of the first rank, « mesure du cadre »; a project's is of the second, « mesure d'un
|
|
28
|
+
// projet », as Bazel's `--experimental_local_test_priority` orders the tests that wait for the
|
|
29
|
+
// machine.
|
|
30
|
+
import { spawnSync } from 'node:child_process';
|
|
31
|
+
import { lstatSync, readdirSync, readFileSync, statfsSync } from 'node:fs';
|
|
32
|
+
import { tmpdir } from 'node:os';
|
|
33
|
+
import path from 'node:path';
|
|
34
|
+
import { A_REPASSER } from './codes-de-sortie.mjs';
|
|
35
|
+
import { occupantsDesCopies } from './copies-finies.mjs';
|
|
36
|
+
import { ticketDeLaBase } from './mesure/base-de-passe.mjs';
|
|
37
|
+
import { paquets } from './paquets.mjs';
|
|
38
|
+
import { duree } from './regles-des-places.mjs';
|
|
39
|
+
import { attendreUnPeu } from './verrou-de-fichier.mjs';
|
|
40
|
+
|
|
41
|
+
const VARIABLE_ATTENTE = 'GRILLHOUSE_ATTENTE_MACHINE_MS';
|
|
42
|
+
const VARIABLE_LIBRE = 'GRILLHOUSE_TEMPORAIRE_LIBRE';
|
|
43
|
+
const VARIABLE_COPIE = 'GRILLHOUSE_COPIE_LIBRE';
|
|
44
|
+
|
|
45
|
+
/** The room a pass wants free in the temporary directory, and on the disk of its copy, in bytes:
|
|
46
|
+
* 4 GB. */
|
|
47
|
+
export const LIBRE_MIN = 4 * 1024 ** 3;
|
|
48
|
+
|
|
49
|
+
/** The longest wait of a pass, in ms, unless GRILLHOUSE_ATTENTE_MACHINE_MS names another. */
|
|
50
|
+
export const ATTENTE_MACHINE_MS = 60 * 60_000;
|
|
51
|
+
// The gap between two lines that say the wait goes on.
|
|
52
|
+
const RAPPEL_MS = 30_000;
|
|
53
|
+
|
|
54
|
+
// The name of the frame's package, which a repository of the first rank develops.
|
|
55
|
+
const CADRE = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).name;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The rank of a pass played at <racine>: 1 in the frame's own repository (its workspaces hold
|
|
59
|
+
* the package @roomi-fields/grillhouse in development), 2 elsewhere.
|
|
60
|
+
* @param {string} racine the root of the repository the pass plays in
|
|
61
|
+
* @returns {1 | 2}
|
|
62
|
+
*/
|
|
63
|
+
export function rangDeLaMesure(racine) {
|
|
64
|
+
return paquets(racine).some(p => p.pkg.name === CADRE) ? 1 : 2;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The stop of a wait of the machine: `code` is 75 at the bound, 1 for a server that fails. */
|
|
68
|
+
export class AttenteDeLaMachine extends Error {
|
|
69
|
+
/**
|
|
70
|
+
* @param {string} message what stops the wait
|
|
71
|
+
* @param {number} code the exit code the pass ends on
|
|
72
|
+
*/
|
|
73
|
+
constructor(message, code) {
|
|
74
|
+
super(message);
|
|
75
|
+
this.name = 'AttenteDeLaMachine';
|
|
76
|
+
this.code = code;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The root of the working tree at <racine>, the main tree or a copy (git's top level); <racine>
|
|
82
|
+
* itself out of git.
|
|
83
|
+
* @param {string} racine
|
|
84
|
+
* @returns {string}
|
|
85
|
+
*/
|
|
86
|
+
export function racineDeLaCopie(racine) {
|
|
87
|
+
const r = spawnSync('git', ['-C', racine, 'rev-parse', '--show-toplevel'], { encoding: 'utf8' });
|
|
88
|
+
return r.status === 0 ? r.stdout.trim() : path.resolve(racine);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The root of the repository at <racine>: its main tree, its copies included (the parent of its
|
|
93
|
+
* common directory of git); <racine> itself out of git.
|
|
94
|
+
* @param {string} racine
|
|
95
|
+
* @returns {string}
|
|
96
|
+
*/
|
|
97
|
+
export function racineDuDepot(racine) {
|
|
98
|
+
const r = spawnSync(
|
|
99
|
+
'git',
|
|
100
|
+
['-C', racine, 'rev-parse', '--path-format=absolute', '--git-common-dir'],
|
|
101
|
+
{ encoding: 'utf8' }
|
|
102
|
+
);
|
|
103
|
+
return r.status === 0 ? path.dirname(r.stdout.trim()) : path.resolve(racine);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The bound of a wait under <env>, in ms (GRILLHOUSE_ATTENTE_MACHINE_MS, else ATTENTE_MACHINE_MS);
|
|
108
|
+
* the wait for a place of the machine (scripts/places-de-la-machine.mjs) and for a part has the
|
|
109
|
+
* same.
|
|
110
|
+
* @param {Record<string, string | undefined>} env
|
|
111
|
+
* @returns {number}
|
|
112
|
+
*/
|
|
113
|
+
export function borneDe(env) {
|
|
114
|
+
const n = Number(env[VARIABLE_ATTENTE]);
|
|
115
|
+
return env[VARIABLE_ATTENTE] && Number.isFinite(n) && n >= 0 ? n : ATTENTE_MACHINE_MS;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// The floor of room the variable <variable> names under <env>, in bytes, LIBRE_MIN by default.
|
|
119
|
+
function plancherDe(env, variable) {
|
|
120
|
+
const n = Number(env[variable]);
|
|
121
|
+
return env[variable] && Number.isFinite(n) && n >= 0 ? n : LIBRE_MIN;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// The room free in <dossier>, in bytes; Infinity when it does not read.
|
|
125
|
+
function libreDans(dossier) {
|
|
126
|
+
try {
|
|
127
|
+
const s = statfsSync(dossier);
|
|
128
|
+
return s.bavail * s.bsize;
|
|
129
|
+
} catch {
|
|
130
|
+
return Infinity;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const go = octets => `${(octets / 1024 ** 3).toFixed(1).replace('.', ',')} Go`;
|
|
135
|
+
|
|
136
|
+
// The entries a count of what holds the temporary directory reads at most, so that it stays
|
|
137
|
+
// short on a directory of millions of files: past it, a size is a floor.
|
|
138
|
+
const ENTREES_LUES = 500_000;
|
|
139
|
+
|
|
140
|
+
// The largest entries of <dossier>, the five first, each by the blocks its files hold, as `du`
|
|
141
|
+
// counts them: « claude-1000 (8,0 Go), grillhouse-vitest-x (1,2 Go) ».
|
|
142
|
+
function occupants(dossier) {
|
|
143
|
+
let noms;
|
|
144
|
+
try {
|
|
145
|
+
noms = readdirSync(dossier);
|
|
146
|
+
} catch {
|
|
147
|
+
return 'illisible';
|
|
148
|
+
}
|
|
149
|
+
if (noms.length === 0) {
|
|
150
|
+
return 'rien';
|
|
151
|
+
}
|
|
152
|
+
let budget = ENTREES_LUES;
|
|
153
|
+
const taille = racine => {
|
|
154
|
+
let octets = 0;
|
|
155
|
+
const pile = [racine];
|
|
156
|
+
while (pile.length > 0 && budget-- > 0) {
|
|
157
|
+
const p = pile.pop();
|
|
158
|
+
let e;
|
|
159
|
+
try {
|
|
160
|
+
e = lstatSync(p);
|
|
161
|
+
} catch {
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
octets += e.blocks * 512;
|
|
165
|
+
if (e.isDirectory()) {
|
|
166
|
+
try {
|
|
167
|
+
for (const n of readdirSync(p)) {
|
|
168
|
+
pile.push(path.join(p, n));
|
|
169
|
+
}
|
|
170
|
+
} catch {
|
|
171
|
+
// an unreadable directory counts for itself alone
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return octets;
|
|
176
|
+
};
|
|
177
|
+
return noms
|
|
178
|
+
.map(nom => ({ nom, octets: taille(path.join(dossier, nom)) }))
|
|
179
|
+
.sort((a, b) => b.octets - a.octets)
|
|
180
|
+
.slice(0, 5)
|
|
181
|
+
.map(o => {
|
|
182
|
+
const ticket = ticketDeLaBase(o.nom);
|
|
183
|
+
return `${o.nom} (${ticket ? `le ticket ${ticket}, ` : ''}${go(o.octets)})`;
|
|
184
|
+
})
|
|
185
|
+
.join(', ');
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// The disks a pass waits for room on, in order: `{ nom, ou, variable }`, the words of its lines
|
|
189
|
+
// (« le dossier temporaire », « dans le dossier temporaire »), and the variable of its floor.
|
|
190
|
+
const DISQUES = {
|
|
191
|
+
temporaire: {
|
|
192
|
+
nom: 'le dossier temporaire',
|
|
193
|
+
ou: 'dans le dossier temporaire',
|
|
194
|
+
variable: VARIABLE_LIBRE,
|
|
195
|
+
},
|
|
196
|
+
copie: {
|
|
197
|
+
nom: 'le disque de la copie',
|
|
198
|
+
ou: 'sur le disque de la copie',
|
|
199
|
+
variable: VARIABLE_COPIE,
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
// Waits until <dossier> holds <plancher> bytes free (`libre`, a statfs at each turn), saying so
|
|
204
|
+
// (`dire`) in the words of <disque> (DISQUES) with what holds it (`occupe`, counted only when a
|
|
205
|
+
// line is written) when it begins and every <rappelMs>, and naming its wait once it waits
|
|
206
|
+
// (`inscrire(texte)`, which returns the removal of its name). Throws an AttenteDeLaMachine (75) at
|
|
207
|
+
// <borneMs> from <debut> (now by default), the start of the whole wait.
|
|
208
|
+
function attendreLaPlace(dossier, { inscrire, ...o }) {
|
|
209
|
+
let retirer = null;
|
|
210
|
+
try {
|
|
211
|
+
return attendreLaPlaceEnNommant(dossier, {
|
|
212
|
+
...o,
|
|
213
|
+
nommer: texte => {
|
|
214
|
+
retirer ??= inscrire(texte);
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
} finally {
|
|
218
|
+
retirer?.();
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function attendreLaPlaceEnNommant(
|
|
223
|
+
dossier,
|
|
224
|
+
{
|
|
225
|
+
disque,
|
|
226
|
+
plancher,
|
|
227
|
+
libre,
|
|
228
|
+
occupe,
|
|
229
|
+
dire,
|
|
230
|
+
borneMs,
|
|
231
|
+
rappelMs,
|
|
232
|
+
nommer,
|
|
233
|
+
maintenant = Date.now,
|
|
234
|
+
dormir = attendreUnPeu,
|
|
235
|
+
debut = maintenant(),
|
|
236
|
+
}
|
|
237
|
+
) {
|
|
238
|
+
let dit = null;
|
|
239
|
+
for (;;) {
|
|
240
|
+
const l = libre(dossier);
|
|
241
|
+
if (l >= plancher) {
|
|
242
|
+
if (dit !== null) {
|
|
243
|
+
dire(`✓ place ${disque.ou} après ${duree(maintenant() - debut)}.`);
|
|
244
|
+
}
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const t = maintenant();
|
|
248
|
+
const etat = () =>
|
|
249
|
+
`${disque.nom} (${dossier}) n'a que ${go(l)} libres, moins des ${go(plancher)} qu'une passe lourde demande (${disque.variable}) ; l'occupent : ${occupe(dossier)}`;
|
|
250
|
+
nommer(`${disque.nom} : ${go(l)} libres sur ${go(plancher)}`);
|
|
251
|
+
if (t - debut >= borneMs) {
|
|
252
|
+
throw new AttenteDeLaMachine(
|
|
253
|
+
`⏱ attente de place bornée à ${duree(borneMs)} (${VARIABLE_ATTENTE}) : ${etat()} ; à repasser (code ${A_REPASSER}).`,
|
|
254
|
+
A_REPASSER
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
if (dit === null) {
|
|
258
|
+
dire(`⏳ ${etat()} ; attente de place, ${duree(borneMs)} au plus.`);
|
|
259
|
+
} else if (t - dit >= rappelMs) {
|
|
260
|
+
dire(`⏳ attente de place depuis ${duree(t - debut)} : ${etat()}.`);
|
|
261
|
+
}
|
|
262
|
+
if (dit === null || t - dit >= rappelMs) {
|
|
263
|
+
dit = t;
|
|
264
|
+
}
|
|
265
|
+
dormir(Math.max(1, Math.min(200, borneMs - (maintenant() - debut))));
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Waits for room in the temporary directory under <env> (`os.tmpdir()` as it reads it), then on
|
|
271
|
+
* the disk of the copy at <racine>, where the pass writes its target directories: what a pass does
|
|
272
|
+
* before it plays (see the header).
|
|
273
|
+
* @param {{ env?: Record<string, string | undefined>, dire?: (l: string) => void, borneMs?: number,
|
|
274
|
+
* rappelMs?: number, libre?: (dossier: string) => number, occupe?: (dossier: string) => string,
|
|
275
|
+
* occupeLaCopie?: (racine: string) => string, racine?: string,
|
|
276
|
+
* inscrire?: (texte: string) => () => void, maintenant?: () => number,
|
|
277
|
+
* dormir?: (ms: number) => void }} [o]
|
|
278
|
+
* `maintenant` and `dormir` are the clock (Date.now) and the sleep of the wait, the real ones
|
|
279
|
+
* when left out; `libre` reads the room of each disk, `occupe` what holds the temporary
|
|
280
|
+
* directory, `occupeLaCopie` the copies that hold the disk of the copy; `inscrire` names the
|
|
281
|
+
* wait (what it waits for) while it waits, and returns the removal of its name
|
|
282
|
+
* @throws {AttenteDeLaMachine} at the bound of the wait (code 75)
|
|
283
|
+
*/
|
|
284
|
+
export function attendreDeLaPlace({
|
|
285
|
+
env = process.env,
|
|
286
|
+
dire = l => process.stdout.write(`${l}\n`),
|
|
287
|
+
borneMs = borneDe(env),
|
|
288
|
+
rappelMs = RAPPEL_MS,
|
|
289
|
+
libre = libreDans,
|
|
290
|
+
occupe = occupants,
|
|
291
|
+
occupeLaCopie = occupantsDesCopies,
|
|
292
|
+
racine = process.cwd(),
|
|
293
|
+
inscrire = () => () => {},
|
|
294
|
+
maintenant = Date.now,
|
|
295
|
+
dormir = attendreUnPeu,
|
|
296
|
+
} = {}) {
|
|
297
|
+
const temporaire = env.TMPDIR || env.TMP || env.TEMP || tmpdir();
|
|
298
|
+
const debut = maintenant();
|
|
299
|
+
const commun = { libre, dire, borneMs, rappelMs, inscrire, debut, maintenant, dormir };
|
|
300
|
+
attendreLaPlace(temporaire, {
|
|
301
|
+
...commun,
|
|
302
|
+
disque: DISQUES.temporaire,
|
|
303
|
+
plancher: plancherDe(env, VARIABLE_LIBRE),
|
|
304
|
+
occupe,
|
|
305
|
+
});
|
|
306
|
+
attendreLaPlace(racine, {
|
|
307
|
+
...commun,
|
|
308
|
+
disque: DISQUES.copie,
|
|
309
|
+
plancher: plancherDe(env, VARIABLE_COPIE),
|
|
310
|
+
occupe: occupeLaCopie,
|
|
311
|
+
});
|
|
312
|
+
}
|
package/scripts/avancement.mjs
CHANGED
|
@@ -29,17 +29,16 @@
|
|
|
29
29
|
// copies included, beside the last green (scripts/dernier-vert.mjs): `{ passes, taches }`, the
|
|
30
30
|
// total of the last pass of each kind and the files planned of each task by its hash (the
|
|
31
31
|
// latest TACHES_GARDEES); each pass keeps its own at its end (`garderLeTotal`).
|
|
32
|
-
// -
|
|
33
|
-
// ticket, `npm run verifier` of a supervisor, or a
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
// (`lireLaMesure`).
|
|
32
|
+
// - Each pass that holds a part of the machine (scripts/places-de-la-machine.mjs: a measure out of
|
|
33
|
+
// a ticket, `npm run verifier` of a supervisor, or a pass of the circuit of a ticket) names its
|
|
34
|
+
// progress directory in the file of its part (`nommerLAvancement`); the board reads the parts
|
|
35
|
+
// held with their progress, and the waits for a part or for room (`lireLaMesure`).
|
|
37
36
|
import { spawnSync } from 'node:child_process';
|
|
38
37
|
import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync } from 'node:fs';
|
|
39
38
|
import { tmpdir } from 'node:os';
|
|
40
39
|
import path from 'node:path';
|
|
41
40
|
import { AVANCEMENT, ecrireAtomique, TACHES } from './mesure/avancement.mjs';
|
|
42
|
-
import {
|
|
41
|
+
import { budgetDeLaPasse, dossierDesParts, lireLesParts } from './places-de-la-machine.mjs';
|
|
43
42
|
|
|
44
43
|
const PASSE = 'passe.json';
|
|
45
44
|
const PLAN = 'plan';
|
|
@@ -300,35 +299,43 @@ export function garderLeTotal(dossier) {
|
|
|
300
299
|
}
|
|
301
300
|
|
|
302
301
|
/**
|
|
303
|
-
*
|
|
304
|
-
* (
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
* `
|
|
309
|
-
*
|
|
302
|
+
* The parts of the machine under <env>, as the board shows them (scripts/tableau.mjs): `budget`
|
|
303
|
+
* (the cores and the memory the parts share, null when the reserve of the user is faulty, `faute`
|
|
304
|
+
* then naming it), `prises`, each pass that holds a part (its repository `depot`, the root of its
|
|
305
|
+
* main tree, and `projet`, its folder; its working tree `copie`; ticket, kind, `coeurs` and
|
|
306
|
+
* `memoire` of its part, since when, what it consumes beyond its part `depasse`, and its progress
|
|
307
|
+
* `avancement`: its files done and planned and its last sign, null while it names no progress
|
|
308
|
+
* directory, or that directory does not read), and `attentes`, each live wait in the order of
|
|
309
|
+
* its rank, with what it waits for (`raison`) (`lireLesParts` of scripts/places-de-la-machine.mjs).
|
|
310
310
|
* @param {Record<string, string | undefined>} [env]
|
|
311
311
|
*/
|
|
312
312
|
export function lireLaMesure(env = process.env) {
|
|
313
|
-
const {
|
|
313
|
+
const { prises, attentes } = lireLesParts(dossierDesParts(env));
|
|
314
|
+
let budget = null;
|
|
315
|
+
let faute = null;
|
|
316
|
+
try {
|
|
317
|
+
budget = budgetDeLaPasse(env);
|
|
318
|
+
} catch (e) {
|
|
319
|
+
faute = e.message;
|
|
320
|
+
}
|
|
321
|
+
const nom = ({ depot, copie, projet, ticket, sorte, depuis }) => ({
|
|
322
|
+
depot,
|
|
323
|
+
copie: copie ?? null,
|
|
324
|
+
projet,
|
|
325
|
+
ticket: ticket ?? null,
|
|
326
|
+
sorte,
|
|
327
|
+
depuis,
|
|
328
|
+
});
|
|
314
329
|
return {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
avancement: typeof
|
|
323
|
-
},
|
|
324
|
-
attentes: attentes.map(({ depot, copie, projet, ticket, sorte, quoi, depuis }) => ({
|
|
325
|
-
depot,
|
|
326
|
-
copie: copie ?? null,
|
|
327
|
-
projet,
|
|
328
|
-
ticket,
|
|
329
|
-
sorte,
|
|
330
|
-
quoi,
|
|
331
|
-
depuis,
|
|
330
|
+
budget,
|
|
331
|
+
faute,
|
|
332
|
+
prises: prises.map(p => ({
|
|
333
|
+
...nom(p),
|
|
334
|
+
coeurs: p.coeurs,
|
|
335
|
+
memoire: p.memoire,
|
|
336
|
+
depasse: p.depasse ?? null,
|
|
337
|
+
avancement: typeof p.dossier === 'string' ? lireAvancement(p.dossier) : null,
|
|
332
338
|
})),
|
|
339
|
+
attentes: attentes.map(a => ({ ...nom(a), rang: a.rang, raison: a.raison ?? '' })),
|
|
333
340
|
};
|
|
334
341
|
}
|
package/scripts/bilan.mjs
CHANGED
|
@@ -97,6 +97,7 @@ import os from 'node:os';
|
|
|
97
97
|
import path from 'node:path';
|
|
98
98
|
import { StringDecoder } from 'node:string_decoder';
|
|
99
99
|
import { REGISTRE } from './adresse-du-registre.mjs';
|
|
100
|
+
import { lireLaConsommation } from './consommation-des-passes.mjs';
|
|
100
101
|
import { pathToFileURL } from 'node:url';
|
|
101
102
|
import {
|
|
102
103
|
AGENTS_DU_LOT,
|
|
@@ -531,9 +532,24 @@ const millions = x => ((x ?? 0) / 1e6).toFixed(2).replace('.', ',');
|
|
|
531
532
|
export const enBref = b =>
|
|
532
533
|
`Bilan : ${minutes(b.mur)} min, ${pourcent(b.perdu, b.mur)} % perdus, ${b.seances.total} séances, ${dollars(b.cout)} $.`;
|
|
533
534
|
|
|
535
|
+
/**
|
|
536
|
+
* The passes of <ticket> that consumed clearly more than their part, from the register of the
|
|
537
|
+
* consumption of the project at <racine> (scripts/consommation-des-passes.mjs): each `{ sorte,
|
|
538
|
+
* depasse }`, `depasse` saying what exceeds (« cœurs : 7,5 mesurés pour 4 »).
|
|
539
|
+
* @param {string} racine
|
|
540
|
+
* @param {string} ticket
|
|
541
|
+
* @returns {{ sorte: string, depasse: string }[]}
|
|
542
|
+
*/
|
|
543
|
+
export function depassementsDuTicket(racine, ticket) {
|
|
544
|
+
return lireLaConsommation(racine)
|
|
545
|
+
.filter(l => l.ticket === ticket && typeof l.depasse === 'string')
|
|
546
|
+
.map(l => ({ sorte: l.sorte, depasse: l.depasse }));
|
|
547
|
+
}
|
|
548
|
+
|
|
534
549
|
// The text of the bilan <b> at the ticket, short and in figures, compared with the bilan
|
|
535
|
-
// <avant> (another ticket's, computed again, or null)
|
|
536
|
-
|
|
550
|
+
// <avant> (another ticket's, computed again, or null); <depassent>, the passes of the ticket that
|
|
551
|
+
// consumed clearly more than their part (`depassementsDuTicket`), said on a line of their own.
|
|
552
|
+
export function texteDuBilan(b, avant, depassent = []) {
|
|
537
553
|
const lesRoles = parRole =>
|
|
538
554
|
Object.entries(parRole)
|
|
539
555
|
.map(([r, n]) => `${n} ${nomDuRole(r)}`)
|
|
@@ -582,7 +598,14 @@ export function texteDuBilan(b, avant) {
|
|
|
582
598
|
.map(([nom, ms]) => `${nom} ${minutes(ms)} min`)
|
|
583
599
|
.join(', ');
|
|
584
600
|
const reprise = `Reprise après un rouge : ${minutes(b.reprise.rejoue.ms)} min rejouées${b.reprise.rejoue.ms ? ` (${parEtape(b.reprise.rejoue)})` : ''}, ${minutes(b.reprise.relu.ms)} min relues sans rejouer${b.reprise.relu.ms ? ` (${parEtape(b.reprise.relu)})` : ''}.`;
|
|
585
|
-
|
|
601
|
+
const parts = depassent.length
|
|
602
|
+
? [
|
|
603
|
+
`Passes au-delà de leur part : ${depassent.length} (${depassent.map(d => `${d.sorte}, ${d.depasse}`).join(' ; ')}).`,
|
|
604
|
+
]
|
|
605
|
+
: [];
|
|
606
|
+
return [tete, ...lignes, ...tri, reprise, ...parts, `Arrêts : ${arrets || 'aucun'}.`, base].join(
|
|
607
|
+
'\n'
|
|
608
|
+
);
|
|
586
609
|
}
|
|
587
610
|
|
|
588
611
|
const dossier = racine => path.join(racine, '.claude', 'worktrees');
|
|
@@ -738,7 +761,7 @@ export function ecrireLeBilan(racine, ticket, fin) {
|
|
|
738
761
|
const b = calculer(racine, ticket, fin);
|
|
739
762
|
const avant = precedent(racine, ticket);
|
|
740
763
|
garder(racine, b);
|
|
741
|
-
return texteDuBilan(b, avant);
|
|
764
|
+
return texteDuBilan(b, avant, depassementsDuTicket(racine, ticket));
|
|
742
765
|
}
|
|
743
766
|
|
|
744
767
|
// Where the circuit of <ticket> in the repository at <racine> ended, as its workflow's memo on the
|
|
@@ -775,7 +798,9 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
|
775
798
|
const racine = commun.status === 0 ? path.dirname(commun.stdout.trim()) : process.cwd();
|
|
776
799
|
void finSurLeServeur(racine, ticket).then(fin => {
|
|
777
800
|
const b = calculer(racine, ticket, fin);
|
|
778
|
-
process.stdout.write(
|
|
801
|
+
process.stdout.write(
|
|
802
|
+
`${texteDuBilan(b, precedent(racine, ticket), depassementsDuTicket(racine, ticket))}\n`
|
|
803
|
+
);
|
|
779
804
|
if (options.includes('--garder')) {
|
|
780
805
|
garder(racine, b);
|
|
781
806
|
}
|
package/scripts/circuit.mjs
CHANGED
|
@@ -372,11 +372,11 @@
|
|
|
372
372
|
// (no real failure), its only deviation, after a pass (the checks of the plan or the final pass) that carries reds of the plan,
|
|
373
373
|
// judges the lot, as a ceiling refuses a lot beyond it: the copy restored, those reds go to the
|
|
374
374
|
// developpeur with the end of its output, within his sessions, then that pass again.
|
|
375
|
-
// - The proof, the checks and the final pass
|
|
376
|
-
// (scripts/
|
|
377
|
-
// wait written to the log, while
|
|
378
|
-
// « à repasser ». The pass names itself
|
|
379
|
-
// its progress while it holds it, which the board of every project shows.
|
|
375
|
+
// - The proof, the checks and the final pass each take their part of the budget of the machine
|
|
376
|
+
// (scripts/passe-de-la-machine.mjs), shared by every repository of the machine, and wait, the
|
|
377
|
+
// wait written to the log, while the parts held leave too little; the wait bounded, the pass is
|
|
378
|
+
// at 75, « à repasser ». The pass names itself in the file of its part, its ticket and its
|
|
379
|
+
// step's title, and its progress while it holds it, which the board of every project shows.
|
|
380
380
|
// - The report a developpeur receives names his reds first, each on its line (test or finding,
|
|
381
381
|
// file and line, message, the beginning of a failed build's own log), then the count of the
|
|
382
382
|
// others and the path of the log; the report of a stop names every red with its package.
|
|
@@ -709,7 +709,7 @@ import {
|
|
|
709
709
|
import { preparer, rolesDuConflit } from './enveloppe/travail-de-la-copie.mjs';
|
|
710
710
|
import { refusArbitrage } from './integration/integrer.mjs';
|
|
711
711
|
import { prendreUnRang } from './places-de-la-machine.mjs';
|
|
712
|
-
import { langageDe } from './langages.mjs';
|
|
712
|
+
import { langageDe, langageDeLaCopie } from './langages.mjs';
|
|
713
713
|
import { leTitre, ticketAuLancement } from './depart-du-ticket.mjs';
|
|
714
714
|
import { ouvrirBase } from './mesure/base-de-passe.mjs';
|
|
715
715
|
import { GREFFON } from './cadre.mjs';
|
|
@@ -1411,7 +1411,10 @@ export async function lireLeFait(ctx, fait, parametres, faits) {
|
|
|
1411
1411
|
},
|
|
1412
1412
|
signeDeVie: ctx.ports?.signeDeVie,
|
|
1413
1413
|
seanceId: idDeSeance(ctx, `neuve:${role}`),
|
|
1414
|
-
lectures: {
|
|
1414
|
+
lectures: {
|
|
1415
|
+
lots: () => testsDuLot(ctx, langageDeLaCopie),
|
|
1416
|
+
references: () => lesReferences(ctx),
|
|
1417
|
+
},
|
|
1415
1418
|
});
|
|
1416
1419
|
ctx.constats = constats;
|
|
1417
1420
|
return fiche;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
//
|
|
5
5
|
// - A_REPASSER, 75, is the exit code of « à repasser » (EX_TEMPFAIL of sysexits.h: try again
|
|
6
6
|
// later), neither green nor red: a measure of time under load (scripts/mesure/pression.mjs), the
|
|
7
|
-
// wait
|
|
7
|
+
// wait for the part of the machine at its bound (scripts/places-de-la-machine.mjs), a stop of the
|
|
8
8
|
// circuit that a gesture settles (scripts/etapes.mjs, ARRETS).
|
|
9
9
|
export const A_REPASSER = 75;
|
|
10
10
|
|