@roomi-fields/grillhouse 0.28.3 → 0.29.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/bin/grillhouse.mjs +55 -14
- package/cadre/templates/projet/CLAUDE.md +1 -1
- package/cadre/templates/projet/README.md +11 -11
- package/cadre/templates/projet/_gitignore +2 -5
- package/charte.md +13 -4
- package/docs/ARCHITECTURE.md +260 -29
- package/docs/INTERFACE.md +51 -12
- package/package.json +1 -1
- package/scripts/aiguillage.mjs +324 -0
- package/scripts/avancement.mjs +33 -50
- package/scripts/circuit.mjs +558 -146
- package/scripts/composition-des-langages.mjs +16 -1
- package/scripts/conformite.mjs +16 -0
- package/scripts/copies-finies.mjs +171 -30
- package/scripts/demon.mjs +134 -21
- package/scripts/enveloppe/lancer.sh +13 -14
- package/scripts/enveloppe/travail-de-la-copie.mjs +94 -11
- package/scripts/etapes.mjs +1 -1
- package/scripts/fusion-du-changelog.mjs +0 -1
- package/scripts/grillhouse-maj.mjs +16 -7
- package/scripts/integration/file.mjs +3 -3
- package/scripts/integration/integrer.mjs +3 -3
- package/scripts/jointure.d.ts +39 -17
- package/scripts/langages/cargo/commandes.mjs +152 -25
- package/scripts/langages/cargo/composants.mjs +90 -2
- package/scripts/langages/cargo/exemples.mjs +68 -1
- package/scripts/langages/cargo/index.mjs +17 -8
- package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +35 -0
- package/scripts/langages/cargo/sccache.mjs +54 -2
- package/scripts/langages/cargo/squelette.mjs +72 -3
- package/scripts/langages/cargo/tailles-des-tests.mjs +195 -0
- package/scripts/langages/cargo/tests-de-head.mjs +159 -0
- package/scripts/langages/python/commandes.mjs +44 -7
- package/scripts/langages/python/composants.mjs +33 -3
- package/scripts/langages/python/exemples.mjs +19 -0
- package/scripts/langages/python/index.mjs +4 -0
- package/scripts/langages/python/squelette.mjs +119 -17
- package/scripts/langages/typescript/exemples.mjs +16 -0
- package/scripts/langages/typescript/index.mjs +6 -3
- package/scripts/langages/typescript/regle-des-tests.mjs +13 -0
- package/scripts/langages/typescript/squelette.mjs +18 -2
- package/scripts/langages/typescript/tests-de-nuit.mjs +41 -21
- package/scripts/langages/typescript/verifier.mjs +82 -288
- package/scripts/langages/typescript/vitest-config/base.mjs +8 -9
- package/scripts/langages/typescript/vitest-config/cibles.mjs +92 -53
- package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +11 -5
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +4 -2
- package/scripts/langages/typescript/vitest-config/mesure.mjs +3 -2
- package/scripts/langages/typescript/vitest.nuit.config.mjs +18 -13
- package/scripts/lecture-unique.mjs +51 -0
- package/scripts/mesure/pression.mjs +9 -7
- package/scripts/nuit.sh +19 -12
- package/scripts/outil.mjs +72 -0
- package/scripts/paquet.mjs +39 -10
- package/scripts/resultats.mjs +22 -5
- package/scripts/services-du-noyau.mjs +8 -9
- package/scripts/session-start.sh +10 -1
- package/scripts/sortie.mjs +20 -1
- package/scripts/sources.mjs +3 -3
- package/scripts/sous-commandes.mjs +1 -0
- package/scripts/superviseur.mjs +369 -14
- package/scripts/tableau.mjs +219 -58
- package/scripts/verrou-de-machine.mjs +303 -58
- package/skills/developpeur/SKILL.md +11 -3
- package/skills/pitmaster/SKILL.md +58 -23
- package/skills/relecteur/SKILL.md +18 -6
- package/skills/testwriter/SKILL.md +11 -15
|
@@ -39,14 +39,29 @@
|
|
|
39
39
|
// played in the frame's own repository (one whose workspaces hold the package
|
|
40
40
|
// @roomi-fields/grillhouse in development, its agent copies included: `rangDeLaMesure`) is of
|
|
41
41
|
// the first rank, « mesure du cadre »; a project's (a circuit, a `npm run verifier`) is of the
|
|
42
|
-
// second, « mesure d'un projet ». A measure
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
//
|
|
42
|
+
// second, « mesure d'un projet ». A measure that waits for the lock names its rank among the
|
|
43
|
+
// waits (`<lock>.attentes/`, below); a measure of the second rank does not take the lock, even
|
|
44
|
+
// free, while a live measure of the first waits for it, so a check of the frame, whose next
|
|
45
|
+
// version every project waits for, never waits behind the projects' measures (the verification
|
|
46
|
+
// of 0.26.0 waited 61 min behind five measures of two projects). Between measures of one rank,
|
|
47
|
+
// the first to find the lock free takes it. The bound of the wait is the same for both ranks,
|
|
48
|
+
// and the wait says its rank.
|
|
49
|
+
// - The lock names its holder and its waits, as lslocks names who holds a lock and cargo's
|
|
50
|
+
// « Blocking waiting for file lock » says what a wait waits for. Whoever takes it, a pass out of
|
|
51
|
+
// a ticket or the circuit of a ticket, of any project of the machine, names itself beside it in
|
|
52
|
+
// `<lock>.detenteur.json`: its mark, its process, its project, its ticket or null, its kind
|
|
53
|
+
// (`sorte`: « Mesure » by default, a step's title for a circuit), since when, and its progress
|
|
54
|
+
// directory once it names it (`nommerLAvancement`); the name goes with the lock. Each measure
|
|
55
|
+
// that waits, for the lock or for room in the temporary directory, names itself in the
|
|
56
|
+
// directory `<lock>.attentes/`, one file per waiting process (its process, its rank, its
|
|
57
|
+
// project, ticket and kind, what it waits for `quoi`, since when), removed once it stops
|
|
58
|
+
// waiting. The project is named by the root of the main tree of the repository the measure
|
|
59
|
+
// plays in, its copies included (`depot`, `racineDuDepot`); the board gives it the name it
|
|
60
|
+
// gives that project, its folder's for a project out of the board (scripts/tableau.mjs).
|
|
61
|
+
// `lireLeVerrou` reads them for the board (through `lireLaMesure` of scripts/avancement.mjs): a
|
|
62
|
+
// holder or a wait whose process is gone names no one, and the wait's file goes; a lock a live
|
|
63
|
+
// process holds without naming itself (a frame older than this naming) shows as the repository
|
|
64
|
+
// of its process's directory, of the kind « Verrou ».
|
|
50
65
|
// - The lock is let go at the end of the measure, whether it succeeds or throws.
|
|
51
66
|
// - A measure first wants room in the temporary directory (`os.tmpdir()` under its environment),
|
|
52
67
|
// a disk in memory that the sessions of the machine share: under LIBRE_MIN, 4 GB free
|
|
@@ -58,6 +73,16 @@
|
|
|
58
73
|
// entries, by the blocks their files hold, the temporary directory of a ticket naming its
|
|
59
74
|
// ticket), when it begins and every 30 s, under the same bound as the
|
|
60
75
|
// lock's, then « à repasser » (75).
|
|
76
|
+
// - It then wants room on the disk of the copy it plays in (its root, `racine`), where cargo
|
|
77
|
+
// writes its target directories: under LIBRE_MIN as well (GRILLHOUSE_COPIE_LIBRE names another
|
|
78
|
+
// floor, in bytes; the base configuration of the tests sets 0), it waits the same way, under
|
|
79
|
+
// the same bound counted from the start of the wait, and says what holds that disk: the copies
|
|
80
|
+
// of its repository, the largest first, each with its ticket and its tools' outputs
|
|
81
|
+
// (`occupantsDesCopies` of scripts/copies-finies.mjs: « .claude/worktrees/SH-ae6.2.7 (le
|
|
82
|
+
// ticket SH-ae6.2.7, 5,0 Go, dont target 4,8 Go) »), as Bazel and Buildkite refuse to start a
|
|
83
|
+
// build under a floor of free room rather than fail in its middle (the main disk full on
|
|
84
|
+
// 2026-11-01, three circuits killed without a word, grillhouse-k5y).
|
|
85
|
+
import { spawnSync } from 'node:child_process';
|
|
61
86
|
import { randomUUID } from 'node:crypto';
|
|
62
87
|
import {
|
|
63
88
|
lstatSync,
|
|
@@ -68,13 +93,14 @@ import {
|
|
|
68
93
|
rmSync,
|
|
69
94
|
statfsSync,
|
|
70
95
|
statSync,
|
|
71
|
-
writeFileSync,
|
|
72
96
|
} from 'node:fs';
|
|
73
97
|
import { homedir, tmpdir } from 'node:os';
|
|
74
98
|
import path from 'node:path';
|
|
99
|
+
import { occupantsDesCopies } from './copies-finies.mjs';
|
|
75
100
|
import { paquetsDeLEnveloppe } from './enveloppe/paquets-du-plan.mjs';
|
|
76
101
|
import { paquets } from './paquets.mjs';
|
|
77
102
|
import { attendreUnPeu, lacherVerrou, prendreVerrou } from './verrou-de-fichier.mjs';
|
|
103
|
+
import { ecrireAtomique } from './mesure/avancement.mjs';
|
|
78
104
|
import { ticketDeLaBase, vivant } from './mesure/base-de-passe.mjs';
|
|
79
105
|
import { A_REPASSER } from './mesure/pression.mjs';
|
|
80
106
|
|
|
@@ -82,8 +108,10 @@ const VARIABLE_VERROU = 'GRILLHOUSE_VERROU_MACHINE';
|
|
|
82
108
|
const VARIABLE_TENUE = 'GRILLHOUSE_MESURE_TENUE';
|
|
83
109
|
const VARIABLE_ATTENTE = 'GRILLHOUSE_ATTENTE_MACHINE_MS';
|
|
84
110
|
const VARIABLE_LIBRE = 'GRILLHOUSE_TEMPORAIRE_LIBRE';
|
|
111
|
+
const VARIABLE_COPIE = 'GRILLHOUSE_COPIE_LIBRE';
|
|
85
112
|
|
|
86
|
-
/** The room a heavy measure wants free in the temporary directory,
|
|
113
|
+
/** The room a heavy measure wants free in the temporary directory, and on the disk of its copy,
|
|
114
|
+
* in bytes: 4 GB. */
|
|
87
115
|
export const LIBRE_MIN = 4 * 1024 ** 3;
|
|
88
116
|
|
|
89
117
|
// The name of the frame's package, which a repository of the first rank develops.
|
|
@@ -119,8 +147,8 @@ export class AttenteDeLaMachine extends Error {
|
|
|
119
147
|
}
|
|
120
148
|
}
|
|
121
149
|
|
|
122
|
-
// The lock file of the machine under <env>, beside which
|
|
123
|
-
//
|
|
150
|
+
// The lock file of the machine under <env>, beside which its holder and its waits name
|
|
151
|
+
// themselves.
|
|
124
152
|
export function verrouDeMachine(env = process.env) {
|
|
125
153
|
if (env[VARIABLE_VERROU]) return env[VARIABLE_VERROU];
|
|
126
154
|
const cache = env.XDG_CACHE_HOME || path.join(env.HOME || homedir(), '.cache');
|
|
@@ -180,36 +208,194 @@ function qui(verrou) {
|
|
|
180
208
|
return `${processus(pid)}${depuis}`;
|
|
181
209
|
}
|
|
182
210
|
|
|
183
|
-
|
|
184
|
-
|
|
211
|
+
/**
|
|
212
|
+
* The root of the repository at <racine>: its main tree, its copies included (the parent of its
|
|
213
|
+
* common directory of git); <racine> itself out of git.
|
|
214
|
+
* @param {string} racine
|
|
215
|
+
* @returns {string}
|
|
216
|
+
*/
|
|
217
|
+
export function racineDuDepot(racine) {
|
|
218
|
+
const r = spawnSync(
|
|
219
|
+
'git',
|
|
220
|
+
['-C', racine, 'rev-parse', '--path-format=absolute', '--git-common-dir'],
|
|
221
|
+
{ encoding: 'utf8' }
|
|
222
|
+
);
|
|
223
|
+
return r.status === 0 ? path.dirname(r.stdout.trim()) : path.resolve(racine);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const lireJson = f => {
|
|
227
|
+
try {
|
|
228
|
+
return JSON.parse(readFileSync(f, 'utf8'));
|
|
229
|
+
} catch {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
// The file where the holder of <verrou> names itself, and the directory of its waits.
|
|
235
|
+
const fichierDuDetenteur = verrou => `${verrou}.detenteur.json`;
|
|
236
|
+
const dossierDesAttentes = verrou => `${verrou}.attentes`;
|
|
237
|
+
|
|
238
|
+
// Who a measure is, from its options: `{ depot, ticket, sorte }`, the root of its repository
|
|
239
|
+
// read when first asked.
|
|
240
|
+
function identite({ racine, ticket = null, sorte = 'Mesure' }) {
|
|
241
|
+
let depot = null;
|
|
242
|
+
return {
|
|
243
|
+
get depot() {
|
|
244
|
+
depot ??= racineDuDepot(racine);
|
|
245
|
+
return depot;
|
|
246
|
+
},
|
|
247
|
+
ticket,
|
|
248
|
+
sorte,
|
|
249
|
+
};
|
|
250
|
+
}
|
|
185
251
|
|
|
186
|
-
// Names this process among the
|
|
187
|
-
// removes its name.
|
|
188
|
-
function
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
252
|
+
// Names this process, <id>, among the waits of <verrou>, waiting for <quoi> (« verrou »,
|
|
253
|
+
// « place ») at the rank <rang> (null for room); a function that removes its name.
|
|
254
|
+
function inscrireLAttente(verrou, id, quoi, rang = null) {
|
|
255
|
+
const f = path.join(dossierDesAttentes(verrou), `${process.pid}-${randomUUID()}.json`);
|
|
256
|
+
try {
|
|
257
|
+
ecrireAtomique(f, {
|
|
258
|
+
pid: process.pid,
|
|
259
|
+
rang,
|
|
260
|
+
depot: id.depot,
|
|
261
|
+
ticket: id.ticket,
|
|
262
|
+
sorte: id.sorte,
|
|
263
|
+
quoi,
|
|
264
|
+
depuis: Date.now(),
|
|
265
|
+
});
|
|
266
|
+
} catch {
|
|
267
|
+
return () => {};
|
|
268
|
+
}
|
|
193
269
|
return () => rmSync(f, { force: true });
|
|
194
270
|
}
|
|
195
271
|
|
|
196
|
-
// The
|
|
197
|
-
//
|
|
198
|
-
function
|
|
199
|
-
const dossier =
|
|
272
|
+
// The waits of <verrou> whose process lives, the oldest first; the file of a process that is gone
|
|
273
|
+
// is removed.
|
|
274
|
+
function attentesDe(verrou) {
|
|
275
|
+
const dossier = dossierDesAttentes(verrou);
|
|
200
276
|
let noms;
|
|
201
277
|
try {
|
|
202
278
|
noms = readdirSync(dossier);
|
|
203
279
|
} catch {
|
|
204
280
|
return [];
|
|
205
281
|
}
|
|
206
|
-
const
|
|
282
|
+
const out = [];
|
|
207
283
|
for (const nom of noms) {
|
|
208
284
|
const pid = Number(/^(\d+)-/.exec(nom)?.[1]);
|
|
209
|
-
if (pid
|
|
210
|
-
|
|
285
|
+
if (!pid || !vivant(pid)) {
|
|
286
|
+
rmSync(path.join(dossier, nom), { force: true });
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
const a = nom.endsWith('.json') ? lireJson(path.join(dossier, nom)) : null;
|
|
290
|
+
if (a?.pid === pid) out.push(a);
|
|
291
|
+
}
|
|
292
|
+
return out.sort((a, b) => (a.depuis ?? 0) - (b.depuis ?? 0));
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// The live processes of the measures of the first rank that wait for <verrou>.
|
|
296
|
+
const premiersQuiAttendent = verrou =>
|
|
297
|
+
attentesDe(verrou)
|
|
298
|
+
.filter(a => a.quoi === 'verrou' && a.rang === 1)
|
|
299
|
+
.map(a => a.pid);
|
|
300
|
+
|
|
301
|
+
// Names this process, <id>, holder of <verrou> under the mark it holds; a function that removes
|
|
302
|
+
// the name while it is still this taking's.
|
|
303
|
+
function nommerLeDetenteur(verrou, id) {
|
|
304
|
+
const f = fichierDuDetenteur(verrou);
|
|
305
|
+
const marque = lire(verrou);
|
|
306
|
+
try {
|
|
307
|
+
ecrireAtomique(f, {
|
|
308
|
+
marque,
|
|
309
|
+
pid: process.pid,
|
|
310
|
+
depot: id.depot,
|
|
311
|
+
ticket: id.ticket,
|
|
312
|
+
sorte: id.sorte,
|
|
313
|
+
depuis: Date.now(),
|
|
314
|
+
dossier: null,
|
|
315
|
+
});
|
|
316
|
+
} catch {
|
|
317
|
+
return () => {};
|
|
318
|
+
}
|
|
319
|
+
return () => {
|
|
320
|
+
if (lireJson(f)?.marque === marque) rmSync(f, { force: true });
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Names the progress directory <dossier> of the measure that holds the lock of the machine under
|
|
326
|
+
* <env> (its mark in GRILLHOUSE_MESURE_TENUE), beside the lock, where the board reads it; a
|
|
327
|
+
* function that takes it out. Nothing without a lock this environment holds (in the envelope of
|
|
328
|
+
* an agent).
|
|
329
|
+
* @param {{ env?: Record<string, string | undefined>, dossier: string }} o
|
|
330
|
+
* @returns {() => void}
|
|
331
|
+
*/
|
|
332
|
+
export function nommerLAvancement({ env = process.env, dossier }) {
|
|
333
|
+
const f = fichierDuDetenteur(verrouDeMachine(env));
|
|
334
|
+
const marque = env[VARIABLE_TENUE];
|
|
335
|
+
const ecrire = d => {
|
|
336
|
+
const n = lireJson(f);
|
|
337
|
+
if (!marque || n?.marque !== marque) return false;
|
|
338
|
+
try {
|
|
339
|
+
ecrireAtomique(f, { ...n, dossier: d });
|
|
340
|
+
return true;
|
|
341
|
+
} catch {
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
return ecrire(dossier) ? () => void ecrire(null) : () => {};
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Who holds the lock of the machine under <env> and who waits for it. `detenteur`: its process,
|
|
350
|
+
* repository (`depot`, the root of its main tree, and `projet`, its folder), ticket, kind, since
|
|
351
|
+
* when (ms) and progress directory; null when the lock is free or its process gone; a live process
|
|
352
|
+
* that names nothing beside the lock shows as the repository of its directory, of the kind
|
|
353
|
+
* « Verrou ». `attentes`: each live wait, the oldest first, its process, rank, repository,
|
|
354
|
+
* ticket, kind, what it waits for (`quoi`: « verrou » or « place ») and since when.
|
|
355
|
+
* @param {Record<string, string | undefined>} [env]
|
|
356
|
+
*/
|
|
357
|
+
export function lireLeVerrou(env = process.env) {
|
|
358
|
+
const verrou = verrouDeMachine(env);
|
|
359
|
+
const attentes = attentesDe(verrou).map(({ pid, rang, depot, ticket, sorte, quoi, depuis }) => ({
|
|
360
|
+
pid,
|
|
361
|
+
rang,
|
|
362
|
+
depot,
|
|
363
|
+
projet: path.basename(String(depot)),
|
|
364
|
+
ticket,
|
|
365
|
+
sorte,
|
|
366
|
+
quoi,
|
|
367
|
+
depuis,
|
|
368
|
+
}));
|
|
369
|
+
const marque = lire(verrou);
|
|
370
|
+
const pid = detenteur(verrou);
|
|
371
|
+
if (marque === null || pid === null || !vivant(pid)) return { detenteur: null, attentes };
|
|
372
|
+
const n = lireJson(fichierDuDetenteur(verrou));
|
|
373
|
+
if (n?.marque === marque) {
|
|
374
|
+
const { depot, ticket, sorte, depuis, dossier } = n;
|
|
375
|
+
const projet = path.basename(String(depot));
|
|
376
|
+
return { detenteur: { pid, depot, projet, ticket, sorte, depuis, dossier }, attentes };
|
|
377
|
+
}
|
|
378
|
+
let depuis = null;
|
|
379
|
+
let ou = null;
|
|
380
|
+
try {
|
|
381
|
+
depuis = statSync(verrou).mtimeMs;
|
|
382
|
+
ou = readlinkSync(`/proc/${pid}/cwd`);
|
|
383
|
+
} catch {
|
|
384
|
+
// the lock gone meanwhile, or the directory of its process unreadable: its number names it
|
|
211
385
|
}
|
|
212
|
-
|
|
386
|
+
const depot = ou ? racineDuDepot(ou) : null;
|
|
387
|
+
return {
|
|
388
|
+
detenteur: {
|
|
389
|
+
pid,
|
|
390
|
+
depot,
|
|
391
|
+
projet: depot ? path.basename(depot) : `processus ${pid}`,
|
|
392
|
+
ticket: null,
|
|
393
|
+
sorte: 'Verrou',
|
|
394
|
+
depuis,
|
|
395
|
+
dossier: null,
|
|
396
|
+
},
|
|
397
|
+
attentes,
|
|
398
|
+
};
|
|
213
399
|
}
|
|
214
400
|
|
|
215
401
|
// Whom a measure of the rank <rang> waits for at <verrou>: the holder of the lock, and for the
|
|
@@ -243,10 +429,10 @@ function ancetre(pid) {
|
|
|
243
429
|
return false;
|
|
244
430
|
}
|
|
245
431
|
|
|
246
|
-
// The floor of room under <env>, in bytes.
|
|
247
|
-
function plancherDe(env) {
|
|
248
|
-
const n = Number(env[
|
|
249
|
-
return env[
|
|
432
|
+
// The floor of room the variable <variable> names under <env>, in bytes, LIBRE_MIN by default.
|
|
433
|
+
function plancherDe(env, variable) {
|
|
434
|
+
const n = Number(env[variable]);
|
|
435
|
+
return env[variable] && Number.isFinite(n) && n >= 0 ? n : LIBRE_MIN;
|
|
250
436
|
}
|
|
251
437
|
|
|
252
438
|
// The room free in <dossier>, in bytes; Infinity when it does not read.
|
|
@@ -309,22 +495,55 @@ function occupants(dossier) {
|
|
|
309
495
|
.join(', ');
|
|
310
496
|
}
|
|
311
497
|
|
|
498
|
+
// The disks a heavy pass waits for room on, in order: `{ nom, ou, variable }`, the words of its
|
|
499
|
+
// lines (« le dossier temporaire », « dans le dossier temporaire »), and the variable of its floor.
|
|
500
|
+
const DISQUES = {
|
|
501
|
+
temporaire: {
|
|
502
|
+
nom: 'le dossier temporaire',
|
|
503
|
+
ou: 'dans le dossier temporaire',
|
|
504
|
+
variable: VARIABLE_LIBRE,
|
|
505
|
+
},
|
|
506
|
+
copie: {
|
|
507
|
+
nom: 'le disque de la copie',
|
|
508
|
+
ou: 'sur le disque de la copie',
|
|
509
|
+
variable: VARIABLE_COPIE,
|
|
510
|
+
},
|
|
511
|
+
};
|
|
512
|
+
|
|
312
513
|
// Waits until <dossier> holds <plancher> bytes free (`libre`, a statfs at each turn), saying so
|
|
313
|
-
// (`dire`) with what holds it (`occupe`, counted only when a
|
|
314
|
-
// every <rappelMs
|
|
315
|
-
|
|
316
|
-
|
|
514
|
+
// (`dire`) in the words of <disque> (DISQUES) with what holds it (`occupe`, counted only when a
|
|
515
|
+
// line is written) when it begins and every <rappelMs>, and naming itself among the waits once it
|
|
516
|
+
// waits (`inscrire`, a function that returns the removal of its name). Throws an
|
|
517
|
+
// AttenteDeLaMachine (75) at <borneMs> from <debut> (now by default), the start of the whole wait.
|
|
518
|
+
function attendreLaPlace(dossier, { inscrire, ...o }) {
|
|
519
|
+
let retirer = null;
|
|
520
|
+
try {
|
|
521
|
+
return attendreLaPlaceEnNommant(dossier, {
|
|
522
|
+
...o,
|
|
523
|
+
nommer: () => {
|
|
524
|
+
retirer ??= inscrire();
|
|
525
|
+
},
|
|
526
|
+
});
|
|
527
|
+
} finally {
|
|
528
|
+
retirer?.();
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
function attendreLaPlaceEnNommant(
|
|
533
|
+
dossier,
|
|
534
|
+
{ disque, plancher, libre, occupe, dire, borneMs, rappelMs, nommer, debut = Date.now() }
|
|
535
|
+
) {
|
|
317
536
|
let dit = null;
|
|
318
537
|
for (;;) {
|
|
319
538
|
const l = libre(dossier);
|
|
320
539
|
if (l >= plancher) {
|
|
321
|
-
if (dit !== null)
|
|
322
|
-
dire(`✓ place dans le dossier temporaire après ${duree(Date.now() - debut)}.`);
|
|
540
|
+
if (dit !== null) dire(`✓ place ${disque.ou} après ${duree(Date.now() - debut)}.`);
|
|
323
541
|
return;
|
|
324
542
|
}
|
|
543
|
+
nommer();
|
|
325
544
|
const t = Date.now();
|
|
326
545
|
const etat = () =>
|
|
327
|
-
|
|
546
|
+
`${disque.nom} (${dossier}) n'a que ${go(l)} libres, moins des ${go(plancher)} qu'une passe lourde demande (${disque.variable}) ; l'occupent : ${occupe(dossier)}`;
|
|
328
547
|
if (t - debut >= borneMs)
|
|
329
548
|
throw new AttenteDeLaMachine(
|
|
330
549
|
`⏱ attente de place bornée à ${duree(borneMs)} (${VARIABLE_ATTENTE}) : ${etat()} ; à repasser (code ${A_REPASSER}).`,
|
|
@@ -339,11 +558,16 @@ function attendreLaPlace(dossier, { plancher, libre, occupe, dire, borneMs, rapp
|
|
|
339
558
|
}
|
|
340
559
|
|
|
341
560
|
/**
|
|
342
|
-
* Waits for room in the temporary directory under <env> (`os.tmpdir()` as it reads it)
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
*
|
|
561
|
+
* Waits for room in the temporary directory under <env> (`os.tmpdir()` as it reads it), then on
|
|
562
|
+
* the disk of the copy at <racine>, where the pass writes its target directories: what a heavy
|
|
563
|
+
* pass does before it plays (see the header).
|
|
564
|
+
* @param {{ env?: Record<string, string | undefined>, dire?: (l: string) => void, borneMs?: number,
|
|
565
|
+
* rappelMs?: number, libre?: (dossier: string) => number, occupe?: (dossier: string) => string,
|
|
566
|
+
* occupeLaCopie?: (racine: string) => string, racine?: string, ticket?: string | null,
|
|
567
|
+
* sorte?: string }} [o] `libre` reads the room of each disk, `occupe` what holds the temporary
|
|
568
|
+
* directory, `occupeLaCopie` the copies that hold the disk of the copy; the wait names its
|
|
569
|
+
* project <racine>, its ticket and its kind among the waits of the lock of the machine under
|
|
570
|
+
* <env> while it waits
|
|
347
571
|
* @throws {AttenteDeLaMachine} at the bound of the wait (code 75)
|
|
348
572
|
*/
|
|
349
573
|
export function attendreDeLaPlace({
|
|
@@ -353,15 +577,27 @@ export function attendreDeLaPlace({
|
|
|
353
577
|
rappelMs = RAPPEL_MS,
|
|
354
578
|
libre = libreDans,
|
|
355
579
|
occupe = occupants,
|
|
580
|
+
occupeLaCopie = occupantsDesCopies,
|
|
581
|
+
racine = process.cwd(),
|
|
582
|
+
ticket = null,
|
|
583
|
+
sorte = 'Mesure',
|
|
356
584
|
} = {}) {
|
|
357
585
|
const temporaire = env.TMPDIR || env.TMP || env.TEMP || tmpdir();
|
|
586
|
+
const id = identite({ racine, ticket, sorte });
|
|
587
|
+
const inscrire = () => inscrireLAttente(verrouDeMachine(env), id, 'place');
|
|
588
|
+
const debut = Date.now();
|
|
589
|
+
const commun = { libre, dire, borneMs, rappelMs, inscrire, debut };
|
|
358
590
|
attendreLaPlace(temporaire, {
|
|
359
|
-
|
|
360
|
-
|
|
591
|
+
...commun,
|
|
592
|
+
disque: DISQUES.temporaire,
|
|
593
|
+
plancher: plancherDe(env, VARIABLE_LIBRE),
|
|
361
594
|
occupe,
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
595
|
+
});
|
|
596
|
+
attendreLaPlace(racine, {
|
|
597
|
+
...commun,
|
|
598
|
+
disque: DISQUES.copie,
|
|
599
|
+
plancher: plancherDe(env, VARIABLE_COPIE),
|
|
600
|
+
occupe: occupeLaCopie,
|
|
365
601
|
});
|
|
366
602
|
}
|
|
367
603
|
|
|
@@ -373,10 +609,10 @@ function borneDe(env) {
|
|
|
373
609
|
|
|
374
610
|
// Waits for the lock <verrou> at the rank <rang>, saying so (`dire`) when it begins and every
|
|
375
611
|
// <rappelMs>; returns the time waited, in ms. Throws an AttenteDeLaMachine at once when an ancestor
|
|
376
|
-
// holds the lock, and at the bound <borneMs>.
|
|
377
|
-
//
|
|
378
|
-
function attendreLaMachine(verrou, { rang, dire, borneMs, rappelMs }) {
|
|
379
|
-
const retirer =
|
|
612
|
+
// holds the lock, and at the bound <borneMs>. The measure, <id>, names itself among the waits,
|
|
613
|
+
// with its rank, while it waits.
|
|
614
|
+
function attendreLaMachine(verrou, { id, rang, dire, borneMs, rappelMs }) {
|
|
615
|
+
const retirer = inscrireLAttente(verrou, id, 'verrou', rang);
|
|
380
616
|
try {
|
|
381
617
|
return attendreAuRang(verrou, { rang, dire, borneMs, rappelMs });
|
|
382
618
|
} finally {
|
|
@@ -421,12 +657,15 @@ function attendreAuRang(verrou, { rang, dire, borneMs, rappelMs }) {
|
|
|
421
657
|
* @param {(envEnfant: Record<string, string | undefined>) => T} mesure a synchronous measure
|
|
422
658
|
* @param {{ env?: Record<string, string | undefined>, racine?: string,
|
|
423
659
|
* dire?: (ligne: string) => void, borneMs?: number, rappelMs?: number,
|
|
424
|
-
* libre?: (dossier: string) => number, occupe?: (dossier: string) => string
|
|
660
|
+
* libre?: (dossier: string) => number, occupe?: (dossier: string) => string,
|
|
661
|
+
* ticket?: string | null, sorte?: string }} options `racine`, the
|
|
425
662
|
* root of the repository the measure plays in, which gives its rank (`rangDeLaMesure`; the
|
|
426
663
|
* working directory by default); `borneMs`, the bound of the wait
|
|
427
664
|
* (GRILLHOUSE_ATTENTE_MACHINE_MS, else ATTENTE_MACHINE_MS); `rappelMs`, the gap between two
|
|
428
665
|
* lines that say the wait goes on (30 s); `libre`, the room free in a directory, in bytes
|
|
429
|
-
* (`statfs`, at each turn); `occupe`, what holds it, counted when a line of the wait is written
|
|
666
|
+
* (`statfs`, at each turn); `occupe`, what holds it, counted when a line of the wait is written;
|
|
667
|
+
* `ticket` (null out of a ticket) and `sorte` (« Mesure » by default), who the measure is,
|
|
668
|
+
* named beside the lock while it waits and while it holds it, with its project
|
|
430
669
|
* @returns {T}
|
|
431
670
|
* @throws {AttenteDeLaMachine} at the bound of the wait (code 75), or at once when an ancestor
|
|
432
671
|
* holds the lock (code 1)
|
|
@@ -442,21 +681,27 @@ export function avecLaMachine(
|
|
|
442
681
|
rappelMs = RAPPEL_MS,
|
|
443
682
|
libre = libreDans,
|
|
444
683
|
occupe = occupants,
|
|
684
|
+
ticket = null,
|
|
685
|
+
sorte = 'Mesure',
|
|
445
686
|
} = {}
|
|
446
687
|
) {
|
|
447
688
|
if (paquetsDeLEnveloppe(env)) return mesure(env);
|
|
448
689
|
const verrou = verrouDeMachine(env);
|
|
449
690
|
if (env[VARIABLE_TENUE] && lire(verrou) === env[VARIABLE_TENUE]) return mesure(env);
|
|
450
|
-
attendreDeLaPlace({ env, libre, occupe, dire, borneMs, rappelMs });
|
|
691
|
+
attendreDeLaPlace({ env, libre, occupe, dire, borneMs, rappelMs, racine, ticket, sorte });
|
|
692
|
+
const id = identite({ racine, ticket, sorte });
|
|
451
693
|
mkdirSync(path.dirname(verrou), { recursive: true });
|
|
452
694
|
const rang = rangDeLaMesure(racine);
|
|
453
695
|
if (!(peutPrendre(verrou, rang) && prendreVerrou(verrou, { attendre: false }))) {
|
|
454
|
-
const attendu = attendreLaMachine(verrou, { rang, dire, borneMs, rappelMs });
|
|
696
|
+
const attendu = attendreLaMachine(verrou, { id, rang, dire, borneMs, rappelMs });
|
|
455
697
|
dire(`✓ verrou de la machine pris après ${Math.round(attendu / 1000)} s.`);
|
|
456
698
|
}
|
|
699
|
+
let oublier = () => {};
|
|
457
700
|
try {
|
|
701
|
+
oublier = nommerLeDetenteur(verrou, id);
|
|
458
702
|
return mesure({ ...env, [VARIABLE_TENUE]: lire(verrou) ?? '' });
|
|
459
703
|
} finally {
|
|
704
|
+
oublier();
|
|
460
705
|
lacherVerrou(verrou);
|
|
461
706
|
}
|
|
462
707
|
}
|
|
@@ -83,9 +83,10 @@ partagée, en lecture seule pour toi, arrive construite : `npm test -- <un test
|
|
|
83
83
|
joue sans la construire, et les journaux et le cache du lancement restent dans ta séance. Les
|
|
84
84
|
gardes du cadre (frontières, consommateurs, index des interfaces, rapports d'API) tournent à côté
|
|
85
85
|
des tests, dans la passe complète que l'intégration joue ; le relecteur les joue seules sur la
|
|
86
|
-
copie ; leur refus nomme la commande qui corrige.
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
copie ; leur refus nomme la commande qui corrige. Le jour ne mesure aucun temps : un délai dépassé
|
|
87
|
+
est un rouge. Un lancement qui nomme une mesure de temps (un banc, un témoin de temps) ou un test
|
|
88
|
+
de nuit et sort en 75, « à repasser », n'a vu que des échecs de durée sous charge (la pression CPU
|
|
89
|
+
écrite à chaque échec) : la nuit le juge, et un échec au repos est un vrai rouge.
|
|
89
90
|
|
|
90
91
|
**Un fichier s'écrit par l'outil Write ou Edit**, que ton verrou juge : jamais par un script
|
|
91
92
|
(python3, sed -i, perl -i) ni par une redirection du shell, que ta séance refuse ; un fichier
|
|
@@ -93,6 +94,13 @@ temporaire va dans `$TMPDIR`. Les tests se lancent par `npm test -- <fichiers>`,
|
|
|
93
94
|
de test directement. Ainsi chaque écriture passe par le verrou de ton rôle, et une substitution qui
|
|
94
95
|
ne trouve pas son texte échoue au lieu de passer en silence.
|
|
95
96
|
|
|
97
|
+
**Cargo compile sans compilation incrémentale** (`CARGO_INCREMENTAL=0`, posé par le cadre, comme
|
|
98
|
+
la CI de Rust) : une copie compile une fois, et son `target/` reste petit. Pour déboguer, tu la
|
|
99
|
+
rallumes pour ta propre passe : `CARGO_INCREMENTAL=1 npm test -- <fichiers>` ; la valeur que tu
|
|
100
|
+
poses l'emporte. Un projet garde ses profils de compilation (`[profile.*]` de son `Cargo.toml`) :
|
|
101
|
+
un `incremental` qu'il y écrit reste le sien, et le cadre ne pose rien. Ainsi la place disque reste
|
|
102
|
+
bornée, et le débogage garde son outil.
|
|
103
|
+
|
|
96
104
|
**Tu attends au premier plan ce que tu lances** : ta séance n'a aucune tâche de fond, et elle finit
|
|
97
105
|
avec ta fiche. Ainsi le circuit reprend dès ta fiche rendue.
|
|
98
106
|
|