@roomi-fields/grillhouse 0.33.1 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +63 -0
- package/cadre/templates/projet/CLAUDE.md +9 -3
- package/charte.md +23 -6
- package/dist/temporal/circuit/activites.d.ts +3 -1
- package/dist/temporal/circuit/activites.js +25 -1
- package/dist/temporal/circuit/activites.js.map +1 -1
- package/dist/temporal/circuit/appel.d.ts +19 -0
- package/dist/temporal/circuit/appel.js +93 -0
- package/dist/temporal/circuit/appel.js.map +1 -0
- package/dist/temporal/circuit/client.d.ts +7 -0
- package/dist/temporal/circuit/client.js +20 -0
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/commande.js +27 -87
- package/dist/temporal/circuit/commande.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +19 -0
- package/dist/temporal/circuit/contrat.js +2 -0
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +86 -11
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/file/activites.d.ts +3 -0
- package/dist/temporal/file/activites.js +9 -0
- package/dist/temporal/file/activites.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +58 -0
- package/dist/temporal/file/deroule.d.ts +8 -1
- package/dist/temporal/file/deroule.js +100 -2
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/nuits/contrat.d.ts +2 -0
- package/dist/temporal/nuits/deroule.js +3 -0
- package/dist/temporal/nuits/deroule.js.map +1 -1
- package/dist/temporal/places/activites.d.ts +8 -0
- package/dist/temporal/places/activites.js +12 -1
- package/dist/temporal/places/activites.js.map +1 -1
- package/dist/temporal/places/client.d.ts +8 -1
- package/dist/temporal/places/client.js +25 -2
- package/dist/temporal/places/client.js.map +1 -1
- package/dist/temporal/places/contrat.d.ts +35 -3
- package/dist/temporal/places/contrat.js +5 -4
- package/dist/temporal/places/contrat.js.map +1 -1
- package/dist/temporal/places/deroule.js +55 -9
- package/dist/temporal/places/deroule.js.map +1 -1
- package/dist/temporal/tickets/activites.d.ts +3 -0
- package/dist/temporal/tickets/activites.js +73 -4
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/dist/temporal/tickets/contrat.d.ts +31 -0
- package/dist/temporal/tickets/deroule.js +61 -10
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/docs/ARCHITECTURE.md +213 -57
- package/docs/CADRE.md +6 -1
- package/docs/INTERFACE.md +24 -8
- package/hooks/crochet.mjs +17 -2
- package/hooks/hooks.json +24 -0
- package/package.json +1 -1
- package/scripts/activites.mjs +77 -14
- package/scripts/aiguillage.mjs +2 -0
- package/scripts/attente-a-l-arret.mjs +141 -0
- package/scripts/attente-au-tour.mjs +32 -16
- package/scripts/avancement.mjs +5 -3
- package/scripts/branche-de-nuit.mjs +63 -3
- package/scripts/circuit.mjs +57 -4
- package/scripts/circuits-du-serveur.mjs +34 -1
- package/scripts/commandes-composees.mjs +11 -4
- package/scripts/copies-finies.mjs +43 -29
- package/scripts/crochets.mjs +1 -1
- package/scripts/dette.mjs +55 -4
- package/scripts/disque-des-copies.d.mts +28 -0
- package/scripts/disque-des-copies.mjs +155 -0
- package/scripts/droits.mjs +2 -0
- package/scripts/faits-du-circuit.mjs +24 -0
- package/scripts/file-des-tickets.d.mts +16 -0
- package/scripts/file-des-tickets.mjs +65 -7
- package/scripts/gardes-du-cadre.mjs +4 -2
- package/scripts/integration/file.mjs +302 -5
- package/scripts/jointure.d.ts +33 -1
- package/scripts/langages/cargo/commandes.mjs +71 -10
- package/scripts/langages/cargo/composants.mjs +12 -4
- package/scripts/langages/cargo/executables-de-tests.mjs +118 -0
- package/scripts/langages/cargo/exemples.mjs +17 -3
- package/scripts/langages/cargo/index.mjs +8 -3
- package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +2 -2
- package/scripts/langages/cargo/migrations/0.34.0-executables-de-tests.mjs +35 -0
- package/scripts/langages/cargo/squelette.mjs +8 -3
- package/scripts/langages/cargo/tailles-des-tests.mjs +68 -6
- package/scripts/langages/cargo/tests-de-head.mjs +12 -9
- package/scripts/langages/cargo/verdict.mjs +40 -14
- package/scripts/langages/python/commandes.mjs +11 -2
- package/scripts/langages/python/index.mjs +12 -4
- package/scripts/langages/python/verdict.mjs +8 -1
- package/scripts/langages/typescript/index.mjs +9 -2
- package/scripts/langages/typescript/resume-du-lanceur.mjs +86 -0
- package/scripts/langages/typescript/tests.mjs +1 -1
- package/scripts/langages/typescript/verdict.mjs +4 -60
- package/scripts/langages/typescript/verifier.mjs +1 -1
- package/scripts/langages/typescript/vitest-config/changements.mjs +12 -7
- package/scripts/langages/typescript/vitest-config/lances.mjs +45 -0
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +1 -0
- package/scripts/messages-non-lus.mjs +166 -0
- package/scripts/mesure-de-la-machine.mjs +7 -4
- package/scripts/migrations-des-gardes.mjs +168 -0
- package/scripts/places-de-la-machine.mjs +44 -40
- package/scripts/places-du-serveur.mjs +82 -14
- package/scripts/plafond-de-la-machine.d.mts +18 -0
- package/scripts/plafond-de-la-machine.mjs +45 -0
- package/scripts/recommencer.d.mts +4 -0
- package/scripts/recommencer.mjs +29 -0
- package/scripts/regles-des-places.d.mts +35 -0
- package/scripts/regles-des-places.mjs +82 -1
- package/scripts/resultats.mjs +38 -4
- package/scripts/retirer-les-copies-finies.mjs +11 -7
- package/scripts/seances.mjs +1 -1
- package/scripts/services-du-noyau.mjs +1 -0
- package/scripts/sous-commandes.mjs +2 -0
- package/scripts/superviseur.mjs +235 -56
- package/scripts/tableau.mjs +385 -247
- package/scripts/taches-du-graphe.mjs +32 -5
- package/scripts/ticket-du-circuit.mjs +25 -0
- package/scripts/transitions.d.mts +27 -1
- package/scripts/transitions.mjs +96 -4
- package/scripts/verrou-de-machine.mjs +41 -17
- package/skills/explorateur/SKILL.md +8 -2
- package/skills/pitmaster/SKILL.md +18 -15
- package/skills/pitmaster/references/tour.md +3 -1
- package/skills/questionneur/SKILL.md +5 -1
- package/skills/testwriter/SKILL.md +32 -6
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The guard of the migrations of the guards: a guard with a debt arrives with the migration that
|
|
3
|
+
// inscribes the existing debt of the projects (`trancher(projet, GARDE, constats, 'inscrire')`),
|
|
4
|
+
// as the codemods of `nx migrate` or the baselines of ESLint and Betterer; a project that updates
|
|
5
|
+
// then has no gesture to make by hand.
|
|
6
|
+
//
|
|
7
|
+
// npx grillhouse migrations-des-gardes (a guard of `grillhouse:gardes`)
|
|
8
|
+
//
|
|
9
|
+
// - A guard with a debt is a script under scripts/ or scripts/langages/*/ that imports `trancher`
|
|
10
|
+
// of scripts/dette.mjs and calls it; its name is the second argument of the call, a literal or
|
|
11
|
+
// the constant `GARDE` of the script. The definition of `trancher` itself is no guard.
|
|
12
|
+
// - A migration covers a guard when its text, under scripts/migrations/ or
|
|
13
|
+
// scripts/langages/*/migrations/, imports the script of the guard by its resolved path and calls
|
|
14
|
+
// `trancher(` with the same name (a literal, or the `GARDE` it imports from the script), and
|
|
15
|
+
// when scripts/migrations.mjs or a scripts/langages/*/index.mjs imports that migration: it is
|
|
16
|
+
// played.
|
|
17
|
+
// - The guard reads the texts and loads no module. Its findings (rule `garde-sans-migration`) are
|
|
18
|
+
// counted against the debt (scripts/dette.mjs), so the guards without migration at its entry
|
|
19
|
+
// are inscribed, frozen, and the entry of a guard that receives its migration is pruned.
|
|
20
|
+
// - It plays at the frame only: scripts installed under node_modules, or outside the root, are the
|
|
21
|
+
// frame's, whose debt the frame holds; a project that updates sees none refused.
|
|
22
|
+
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
23
|
+
import path from 'node:path';
|
|
24
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
25
|
+
import { MODE, trancher } from './dette.mjs';
|
|
26
|
+
|
|
27
|
+
export const GARDE = 'migrations-des-gardes';
|
|
28
|
+
export const REGLE = 'garde-sans-migration';
|
|
29
|
+
export const SCRIPT = fileURLToPath(import.meta.url);
|
|
30
|
+
|
|
31
|
+
const DOSSIER = path.dirname(SCRIPT);
|
|
32
|
+
const MODELE = '0.30.0-tailles-des-outils-lourds.mjs';
|
|
33
|
+
|
|
34
|
+
const sousDossiers = dir =>
|
|
35
|
+
existsSync(dir)
|
|
36
|
+
? readdirSync(dir, { withFileTypes: true })
|
|
37
|
+
.filter(e => e.isDirectory())
|
|
38
|
+
.map(e => path.join(dir, e.name))
|
|
39
|
+
: [];
|
|
40
|
+
const scriptsDe = dir =>
|
|
41
|
+
existsSync(dir)
|
|
42
|
+
? readdirSync(dir, { withFileTypes: true })
|
|
43
|
+
.filter(e => e.isFile() && e.name.endsWith('.mjs'))
|
|
44
|
+
.map(e => path.join(dir, e.name))
|
|
45
|
+
: [];
|
|
46
|
+
// The text of <fichier> without its whole-line comments.
|
|
47
|
+
const texte = fichier =>
|
|
48
|
+
readFileSync(fichier, 'utf8')
|
|
49
|
+
.split('\n')
|
|
50
|
+
.filter(l => !/^\s*\/\//.test(l))
|
|
51
|
+
.join('\n');
|
|
52
|
+
|
|
53
|
+
// The imports of <t> (the text of the file <de>): each { noms, chemin } with the path resolved.
|
|
54
|
+
function imports(t, de) {
|
|
55
|
+
const out = [];
|
|
56
|
+
const re = /import\s+(?:([^'"]*?)\s+from\s+)?['"]([^'"]+)['"]/g;
|
|
57
|
+
for (const m of t.matchAll(re)) {
|
|
58
|
+
if (m[2].startsWith('.')) {
|
|
59
|
+
out.push({ noms: m[1] ?? '', chemin: path.resolve(path.dirname(de), m[2]) });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return out;
|
|
63
|
+
}
|
|
64
|
+
const importe = (t, de, cible) => imports(t, de).some(i => i.chemin === cible);
|
|
65
|
+
|
|
66
|
+
// The second argument of each call to `trancher(` in <t>: a literal name or the identifier GARDE.
|
|
67
|
+
function secondsArguments(t) {
|
|
68
|
+
const out = [];
|
|
69
|
+
const re = /\btrancher\(\s*[^,()]*(?:\([^()]*\))?[^,()]*,\s*(?:'([^']+)'|"([^"]+)"|(GARDE)\b)/g;
|
|
70
|
+
for (const m of t.matchAll(re)) {
|
|
71
|
+
out.push(m[3] ? { constante: true } : { nom: m[1] ?? m[2] });
|
|
72
|
+
}
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
75
|
+
const constanteGarde = t => /\bconst\s+GARDE\s*=\s*['"]([^'"]+)['"]/.exec(t)?.[1];
|
|
76
|
+
|
|
77
|
+
// The names of the guard <fichier> (text <t>), or [] when it is not a guard with a debt.
|
|
78
|
+
function nomsDeGarde(fichier, t) {
|
|
79
|
+
if (!imports(t, fichier).some(i => /\btrancher\b/.test(i.noms) && /\/dette(\.mjs)?$/.test(i.chemin))) {
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
const noms = new Set();
|
|
83
|
+
for (const a of secondsArguments(t)) {
|
|
84
|
+
const n = a.constante ? constanteGarde(t) : a.nom;
|
|
85
|
+
if (n) {
|
|
86
|
+
noms.add(n);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return [...noms];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// True when the scripts at <scripts> belong to the repository at <racine>: under its root and not
|
|
93
|
+
// installed under node_modules. A project that installs the frame judges none of its scripts.
|
|
94
|
+
function chezLeCadre(racine, scripts) {
|
|
95
|
+
const rel = path.relative(racine, scripts);
|
|
96
|
+
return !rel.startsWith('..') && !path.isAbsolute(rel) && !rel.split(path.sep).includes('node_modules');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// The refusals of the repository at <racine>, its frame's scripts at <scripts>.
|
|
100
|
+
export function verifier(racine, scripts = DOSSIER) {
|
|
101
|
+
if (!chezLeCadre(racine, scripts)) {
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
104
|
+
const langages = sousDossiers(path.join(scripts, 'langages'));
|
|
105
|
+
const gardes = [...scriptsDe(scripts), ...langages.flatMap(scriptsDe)].filter(
|
|
106
|
+
f => path.basename(f) !== 'dette.mjs'
|
|
107
|
+
);
|
|
108
|
+
const dossiersDeMigrations = [
|
|
109
|
+
path.join(scripts, 'migrations'),
|
|
110
|
+
...langages.map(l => path.join(l, 'migrations')),
|
|
111
|
+
];
|
|
112
|
+
const indexs = [
|
|
113
|
+
path.join(scripts, 'migrations.mjs'),
|
|
114
|
+
...langages.map(l => path.join(l, 'index.mjs')),
|
|
115
|
+
].filter(existsSync);
|
|
116
|
+
const textesDesIndex = indexs.map(f => ({ f, t: texte(f) }));
|
|
117
|
+
// The migrations played: imported by the index of the core or of a language.
|
|
118
|
+
const jouees = dossiersDeMigrations
|
|
119
|
+
.flatMap(scriptsDe)
|
|
120
|
+
.filter(m => textesDesIndex.some(({ f, t }) => importe(t, f, m)))
|
|
121
|
+
.map(m => ({ m, t: texte(m) }));
|
|
122
|
+
const constats = [];
|
|
123
|
+
for (const g of gardes) {
|
|
124
|
+
const t = texte(g);
|
|
125
|
+
const noms = nomsDeGarde(g, t);
|
|
126
|
+
for (const nom of noms) {
|
|
127
|
+
const couverte = jouees.some(({ m, t: tm }) => {
|
|
128
|
+
const lien = imports(tm, m).find(i => i.chemin === g || i.chemin === g.replace(/\.mjs$/, ''));
|
|
129
|
+
if (!lien) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
return secondsArguments(tm).some(a =>
|
|
133
|
+
a.constante ? /\bGARDE\b/.test(lien.noms) && nom === constanteGarde(t) : a.nom === nom
|
|
134
|
+
);
|
|
135
|
+
});
|
|
136
|
+
if (!couverte) {
|
|
137
|
+
const fichier = path.relative(racine, g).split(path.sep).join('/');
|
|
138
|
+
constats.push({
|
|
139
|
+
fichier,
|
|
140
|
+
regle: REGLE,
|
|
141
|
+
message: `${fichier} : la garde « ${nom} » a une dette sans migration qui l'inscrive chez les projets ; écris sa migration sur le patron de ${MODELE}, qui inscrit la dette existante des projets par trancher(projet, GARDE, constats, 'inscrire'), et déclare-la dans l'index de son langage (scripts/migrations.mjs pour le cœur).`,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return constats;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// The report of the guard at <racine>: its lines and its exit code, the findings counted against
|
|
150
|
+
// the debt.
|
|
151
|
+
export function rapport(racine, env = process.env, scripts = DOSSIER) {
|
|
152
|
+
const { refus, lignes } = trancher(
|
|
153
|
+
racine,
|
|
154
|
+
GARDE,
|
|
155
|
+
verifier(racine, scripts),
|
|
156
|
+
env[MODE] || undefined,
|
|
157
|
+
env
|
|
158
|
+
);
|
|
159
|
+
return { lignes: [...refus.map(r => `⛔ ${r.message}`), ...lignes], code: refus.length ? 1 : 0 };
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
163
|
+
const { lignes, code } = rapport(process.cwd());
|
|
164
|
+
for (const l of lignes) {
|
|
165
|
+
process.stderr.write(`${l}\n`);
|
|
166
|
+
}
|
|
167
|
+
process.exitCode = code;
|
|
168
|
+
}
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
// (./verrou-de-machine.mjs): the place of the session, taken out of it by the circuit, covers its
|
|
23
23
|
// commands, and the envelope passes on its mark; a number of process there means nothing on
|
|
24
24
|
// the machine.
|
|
25
|
-
// - The ceiling is
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
// starts.
|
|
25
|
+
// - The ceiling is a configuration of the poste (`plafondDe` of ./plafond-de-la-machine.mjs:
|
|
26
|
+
// GRILLHOUSE_PLACES of `~/.config/grillhouse/machine.env`, 3 without it), which the workflow
|
|
27
|
+
// reads again at each judgement; two starts are spaced by ESPACEMENT_MS
|
|
28
|
+
// (GRILLHOUSE_ESPACEMENT_MS names another, in ms), which the workflow reads when it starts.
|
|
29
29
|
// - A wait says its reason (place, rank, load, memory or spacing) when it begins and every 30 s,
|
|
30
30
|
// and is bounded as the wait for the lock of the machine, GRILLHOUSE_ATTENTE_MACHINE_MS: at the
|
|
31
31
|
// bound, « à repasser » (75), the request withdrawn.
|
|
@@ -41,45 +41,24 @@ import { A_REPASSER } from './codes-de-sortie.mjs';
|
|
|
41
41
|
import { paquetsDeLEnveloppe } from './enveloppe/paquets-du-plan.mjs';
|
|
42
42
|
import { ecrireLaTrace, traceDesPlaces } from './journal-des-etats.mjs';
|
|
43
43
|
import { mesureDeLaMachine } from './mesure-de-la-machine.mjs';
|
|
44
|
+
import { plafondDe } from './plafond-de-la-machine.mjs';
|
|
44
45
|
import { AttenteDeLaMachine, avecLaMachine, borneDe } from './verrou-de-machine.mjs';
|
|
45
46
|
|
|
46
|
-
export const VARIABLE_PLACES = 'GRILLHOUSE_PLACES';
|
|
47
47
|
export const VARIABLE_ESPACEMENT = 'GRILLHOUSE_ESPACEMENT_MS';
|
|
48
48
|
export const VARIABLE_TRAVAILLEURS = 'GRILLHOUSE_TRAVAILLEURS';
|
|
49
49
|
/** The mark of a place held, which the children of its holder inherit. */
|
|
50
50
|
export const VARIABLE_TENUE = 'GRILLHOUSE_PLACE_TENUE';
|
|
51
|
-
/** The measure of the machine a trial fixes, in JSON `{ coeurs, charge, memoireLibre }`. */
|
|
51
|
+
/** The measure of the machine a trial fixes, in JSON `{ coeurs, charge, memoireLibre, memoireTotale }`. */
|
|
52
52
|
export const VARIABLE_MESURE_D_ESSAI = 'GRILLHOUSE_MESURE_D_ESSAI';
|
|
53
53
|
// The server of the places of a trial machine.
|
|
54
54
|
const VARIABLE_ESSAI = 'GRILLHOUSE_PLACES_D_ESSAI';
|
|
55
55
|
|
|
56
|
-
/** The ceiling of the places of the machine when GRILLHOUSE_PLACES names none. */
|
|
57
|
-
export const PLAFOND_PAR_DEFAUT = 3;
|
|
58
56
|
/** The gap between two starts when GRILLHOUSE_ESPACEMENT_MS names none, in ms. */
|
|
59
57
|
export const ESPACEMENT_MS = 10_000;
|
|
60
58
|
const RAPPEL_MS = 30_000;
|
|
61
59
|
// The reading and the taking of the places on the server, in a process of their own.
|
|
62
60
|
const PONT = path.join(import.meta.dirname, 'places-du-serveur.mjs');
|
|
63
61
|
|
|
64
|
-
/**
|
|
65
|
-
* The ceiling of the places under <env>.
|
|
66
|
-
* @param {Record<string, string | undefined>} [env]
|
|
67
|
-
* @returns {number}
|
|
68
|
-
* @throws {Error} naming GRILLHOUSE_PLACES when its value is not a positive integer
|
|
69
|
-
*/
|
|
70
|
-
export function plafondDe(env = process.env) {
|
|
71
|
-
const v = env[VARIABLE_PLACES];
|
|
72
|
-
if (v === undefined || v === '') {
|
|
73
|
-
return PLAFOND_PAR_DEFAUT;
|
|
74
|
-
}
|
|
75
|
-
if (!/^[1-9]\d*$/.test(v)) {
|
|
76
|
-
throw new Error(
|
|
77
|
-
`${VARIABLE_PLACES} vaut « ${v} » : un entier positif est attendu (3 par défaut).`
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
return Number(v);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
62
|
/**
|
|
84
63
|
* The gap between two starts under <env>, in ms.
|
|
85
64
|
* @param {Record<string, string | undefined>} [env]
|
|
@@ -132,13 +111,14 @@ export function travailleursDeLaSeance(env = process.env) {
|
|
|
132
111
|
}
|
|
133
112
|
|
|
134
113
|
/**
|
|
135
|
-
* The environment the
|
|
114
|
+
* The environment the server of the machine is read under on <env>: the address of its server
|
|
136
115
|
* (TEMPORAL_ADDRESS), or null where no place is taken (the CI, the envelope of an agent, a trial
|
|
137
|
-
* machine without its server).
|
|
116
|
+
* machine without its server); the places and the night under way (scripts/circuits-du-serveur.mjs
|
|
117
|
+
* `nuitDuServeur`) read there.
|
|
138
118
|
* @param {Record<string, string | undefined>} env
|
|
139
119
|
* @returns {Record<string, string | undefined> | null}
|
|
140
120
|
*/
|
|
141
|
-
function surLeServeur(env) {
|
|
121
|
+
export function surLeServeur(env) {
|
|
142
122
|
if (env.CI || paquetsDeLEnveloppe(env)) {
|
|
143
123
|
return null;
|
|
144
124
|
}
|
|
@@ -162,6 +142,14 @@ function auServeur(env, args, ms = 30_000) {
|
|
|
162
142
|
.split('\n')
|
|
163
143
|
.filter(Boolean)
|
|
164
144
|
.map(l => JSON.parse(l));
|
|
145
|
+
// A server still busy after the bridge's attempts: the measure is to be played again (75), as
|
|
146
|
+
// the bound of a wait is; only `prendre` gives a 75 of its own, its wait said in its lines.
|
|
147
|
+
if (r.status === A_REPASSER && args[0] !== 'prendre') {
|
|
148
|
+
throw new AttenteDeLaMachine(
|
|
149
|
+
`⏳ ${(r.stderr || 'les places de la machine ne répondent pas à temps').trim()}`,
|
|
150
|
+
A_REPASSER
|
|
151
|
+
);
|
|
152
|
+
}
|
|
165
153
|
if (r.status !== 0 && r.status !== A_REPASSER) {
|
|
166
154
|
throw new AttenteDeLaMachine(
|
|
167
155
|
`✗ ${(r.stderr || r.error?.message || `les places de la machine ne se lisent pas, code ${r.status}`).trim()}`,
|
|
@@ -354,7 +342,9 @@ export function avecLaMachineEtUnePlace(mesure, options = {}) {
|
|
|
354
342
|
|
|
355
343
|
/**
|
|
356
344
|
* The places taken and the waits of the machine under <env>, as the server holds them: `{ plafond,
|
|
357
|
-
* prises, attentes }
|
|
345
|
+
* faute, prises, attentes, circuits }` (`faute`, a value of the ceiling the poste names and the
|
|
346
|
+
* server refused, the ceiling read before kept; `circuits`, the places of the circuits, held or
|
|
347
|
+
* waited for, `{ racine, ticket, rang, accordee, depuis, vu }`), `prises` `{ id, pid, depart, ticket, rang, depuis }`, `attentes` in the
|
|
358
348
|
* order of arrival `{ id, pid, ticket, rang, raison, depuis }`; none where no place is taken.
|
|
359
349
|
* @param {{ env?: Record<string, string | undefined> }} [o]
|
|
360
350
|
*/
|
|
@@ -367,9 +357,9 @@ export function lirePlaces({ env = process.env } = {}) {
|
|
|
367
357
|
|
|
368
358
|
/**
|
|
369
359
|
* The machine a trial fixes under <env> (GRILLHOUSE_MESURE_D_ESSAI, JSON `{ coeurs, charge,
|
|
370
|
-
* memoireLibre }`), or null without the variable.
|
|
360
|
+
* memoireLibre, memoireTotale }`), or null without the variable.
|
|
371
361
|
* @param {Record<string, string | undefined>} env
|
|
372
|
-
* @returns {{ coeurs: number, charge: number, memoireLibre: number } | null}
|
|
362
|
+
* @returns {{ coeurs: number, charge: number, memoireLibre: number, memoireTotale: number } | null}
|
|
373
363
|
* @throws {Error} naming GRILLHOUSE_MESURE_D_ESSAI when its value is not that JSON
|
|
374
364
|
*/
|
|
375
365
|
function mesureDEssai(env) {
|
|
@@ -386,35 +376,49 @@ function mesureDEssai(env) {
|
|
|
386
376
|
if (
|
|
387
377
|
!m ||
|
|
388
378
|
typeof m !== 'object' ||
|
|
389
|
-
['coeurs', 'charge', 'memoireLibre'].some(
|
|
379
|
+
['coeurs', 'charge', 'memoireLibre', 'memoireTotale'].some(
|
|
390
380
|
c => typeof m[c] !== 'number' || !Number.isFinite(m[c])
|
|
391
381
|
)
|
|
392
382
|
) {
|
|
393
383
|
throw new Error(
|
|
394
|
-
`${VARIABLE_MESURE_D_ESSAI} vaut « ${v} » : un JSON { coeurs, charge, memoireLibre } de nombres est attendu.`
|
|
384
|
+
`${VARIABLE_MESURE_D_ESSAI} vaut « ${v} » : un JSON { coeurs, charge, memoireLibre, memoireTotale } de nombres est attendu.`
|
|
395
385
|
);
|
|
396
386
|
}
|
|
397
|
-
return {
|
|
387
|
+
return {
|
|
388
|
+
coeurs: m.coeurs,
|
|
389
|
+
charge: m.charge,
|
|
390
|
+
memoireLibre: m.memoireLibre,
|
|
391
|
+
memoireTotale: m.memoireTotale,
|
|
392
|
+
};
|
|
398
393
|
}
|
|
399
394
|
|
|
400
395
|
/**
|
|
401
396
|
* The places as the board shows them: taken and ceiling, the load over one minute and the cores,
|
|
402
|
-
* the free memory in whole GB, and the waits (ticket, since when) in the order of arrival
|
|
397
|
+
* the free memory and the total memory in whole GB, and the waits (ticket, since when) in the order of arrival: those
|
|
398
|
+
* of a place for a session or a pass, then the tickets that wait for a place of a circuit, not
|
|
399
|
+
* started (`circuits` of the server, which the queue of each project reserves). The
|
|
403
400
|
* machine is the one GRILLHOUSE_MESURE_D_ESSAI fixes, else the real one (`mesurer`).
|
|
404
401
|
* @param {{ env?: Record<string, string | undefined>, mesurer?: () => { coeurs: number,
|
|
405
|
-
* charge: number, memoireLibre: number } }} [o]
|
|
402
|
+
* charge: number, memoireLibre: number, memoireTotale: number } }} [o]
|
|
406
403
|
* @throws {Error} naming GRILLHOUSE_MESURE_D_ESSAI when its value is faulty
|
|
407
404
|
*/
|
|
408
405
|
export function etatDesPlaces({ env = process.env, mesurer = mesureDeLaMachine } = {}) {
|
|
409
406
|
const fixee = mesureDEssai(env);
|
|
410
|
-
const { plafond, prises, attentes } = lirePlaces({ env });
|
|
407
|
+
const { plafond, faute = null, prises, attentes, circuits = [] } = lirePlaces({ env });
|
|
411
408
|
const m = fixee ?? mesurer();
|
|
412
409
|
return {
|
|
413
410
|
prises: prises.length,
|
|
414
411
|
plafond,
|
|
412
|
+
faute,
|
|
415
413
|
charge: Math.round(m.charge * 10) / 10,
|
|
416
414
|
coeurs: m.coeurs,
|
|
417
415
|
memoireGo: Math.floor(m.memoireLibre / 1024 ** 3),
|
|
418
|
-
|
|
416
|
+
memoireTotaleGo: Math.floor(m.memoireTotale / 1024 ** 3),
|
|
417
|
+
attentes: [
|
|
418
|
+
...attentes.map(a => ({ ticket: a.ticket, depuis: a.depuis })),
|
|
419
|
+
...circuits
|
|
420
|
+
.filter(c => !c.accordee)
|
|
421
|
+
.map(c => ({ ticket: c.ticket, depuis: c.depuis, disque: c.raison ?? null })),
|
|
422
|
+
],
|
|
419
423
|
};
|
|
420
424
|
}
|
|
@@ -10,36 +10,94 @@
|
|
|
10
10
|
// node places-du-serveur.mjs lire
|
|
11
11
|
//
|
|
12
12
|
// - Each mode first starts the workflow of the machine when none runs (`demarrerLesPlaces`, on the
|
|
13
|
-
// task queue of the worker of the machine), its
|
|
14
|
-
//
|
|
13
|
+
// task queue of the worker of the machine), its spacing GRILLHOUSE_ESPACEMENT_MS
|
|
14
|
+
// (scripts/places-de-la-machine.mjs); it reads its ceiling from the poste itself.
|
|
15
15
|
// - `rang` writes the next rank of arrival of the machine, which a circuit draws at its launch.
|
|
16
16
|
// - `prendre` asks for a place for <demande> (JSON: `{ pid, depart, ticket, rang, borneMs,
|
|
17
17
|
// rappelMs }`, the process that holds it), then waits for it: each line it says, at the start of
|
|
18
18
|
// a wait and every <rappelMs>, is one JSON line `{ dire }` on the standard output, then the place
|
|
19
19
|
// given, `{ id, rang }`. At the bound <borneMs>, the request is withdrawn, its line said, exit 75.
|
|
20
20
|
// - `rendre` gives the place <id> back (or withdraws its request), `rattacher` names the process
|
|
21
|
-
// that holds it; `lire` writes the places as the board reads them (`{ plafond, prises,
|
|
22
|
-
// }`).
|
|
23
|
-
// -
|
|
24
|
-
//
|
|
21
|
+
// that holds it; `lire` writes the places as the board reads them (`{ plafond, faute, prises,
|
|
22
|
+
// attentes }`).
|
|
23
|
+
// - Each call waits DELAI_MS for the server, and is played again ESSAIS times when it fails
|
|
24
|
+
// transiently. Still failing, its port open: the server is busy, said on the error stream, exit
|
|
25
|
+
// 75. A port refused (no server), another failure, or a client not built: said on the error
|
|
26
|
+
// stream, exit 1. A malformed call, exit 2.
|
|
25
27
|
import { randomUUID } from 'node:crypto';
|
|
26
28
|
import { existsSync } from 'node:fs';
|
|
29
|
+
import net from 'node:net';
|
|
27
30
|
import path from 'node:path';
|
|
28
31
|
import { pathToFileURL } from 'node:url';
|
|
29
32
|
import { A_REPASSER } from './codes-de-sortie.mjs';
|
|
30
33
|
import { duree } from './regles-des-places.mjs';
|
|
31
34
|
|
|
32
35
|
const DIST = path.join(import.meta.dirname, '..', 'dist', 'temporal');
|
|
33
|
-
// How long a call waits for the server to answer.
|
|
34
|
-
const DELAI_MS =
|
|
36
|
+
// How long a call waits for the server to answer, each attempt.
|
|
37
|
+
const DELAI_MS = 8_000;
|
|
38
|
+
// The attempts of a call the server fails transiently, and the pause before the next.
|
|
39
|
+
const ESSAIS = 3;
|
|
40
|
+
const RECUL_MS = 1_000;
|
|
41
|
+
|
|
42
|
+
// Whether <x> is a transient failure of the server, which a new attempt may pass: a deadline
|
|
43
|
+
// exceeded, or a call cancelled at its deadline (the connection slow to open under load), or the
|
|
44
|
+
// server unavailable, as Temporal's clients retry them (gRPC codes 1, 4 and 14).
|
|
45
|
+
export const transitoire = x =>
|
|
46
|
+
[1, 4, 14].includes(x?.code ?? x?.cause?.code) ||
|
|
47
|
+
/CANCELLED|DEADLINE_EXCEEDED|UNAVAILABLE/.test(`${x?.message ?? ''} ${x?.cause?.message ?? ''}`);
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Plays <appel> (an async function), again after a pause growing by <reculMs>, while it fails
|
|
51
|
+
* transiently, at most <essais> times; any other failure, or the last, throws.
|
|
52
|
+
* @template T
|
|
53
|
+
* @param {() => Promise<T>} appel
|
|
54
|
+
* @param {{ essais?: number, reculMs?: number, attendre?: (ms: number) => Promise<void> }} [o]
|
|
55
|
+
* @returns {Promise<T>}
|
|
56
|
+
*/
|
|
57
|
+
export async function avecReprises(
|
|
58
|
+
appel,
|
|
59
|
+
{ essais = ESSAIS, reculMs = RECUL_MS, attendre = ms => new Promise(r => setTimeout(r, ms)) } = {}
|
|
60
|
+
) {
|
|
61
|
+
for (let n = 1; ; n++) {
|
|
62
|
+
try {
|
|
63
|
+
return await appel();
|
|
64
|
+
} catch (x) {
|
|
65
|
+
if (n >= essais || !transitoire(x)) {
|
|
66
|
+
throw x;
|
|
67
|
+
}
|
|
68
|
+
await attendre(reculMs * n);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Whether something listens on <adresse> (`hote:port`): false when the connection is refused (no
|
|
74
|
+
* server), true when it opens or does not answer within <delaiMs> (a server busy).
|
|
75
|
+
* @param {string} adresse
|
|
76
|
+
* @param {number} [delaiMs]
|
|
77
|
+
* @returns {Promise<boolean>}
|
|
78
|
+
*/
|
|
79
|
+
export function ecoute(adresse, delaiMs = 2_000) {
|
|
80
|
+
const deux = adresse.lastIndexOf(':');
|
|
81
|
+
return new Promise(ok => {
|
|
82
|
+
const s = net.connect({ host: adresse.slice(0, deux), port: Number(adresse.slice(deux + 1)) });
|
|
83
|
+
const fin = r => {
|
|
84
|
+
s.destroy();
|
|
85
|
+
ok(r);
|
|
86
|
+
};
|
|
87
|
+
s.once('connect', () => fin(true));
|
|
88
|
+
s.once('error', () => fin(false));
|
|
89
|
+
s.setTimeout(delaiMs, () => fin(true));
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
35
93
|
// How often a wait reads its request again.
|
|
36
|
-
const VEILLE_MS =
|
|
94
|
+
const VEILLE_MS = 1_000;
|
|
37
95
|
|
|
38
|
-
// The
|
|
39
|
-
//
|
|
96
|
+
// The spacing of the machine under <env>, as scripts/places-de-la-machine.mjs reads it; the
|
|
97
|
+
// workflow's veille, a second. The ceiling, the workflow reads from the poste at each judgement.
|
|
40
98
|
const entreeDe = async env => {
|
|
41
|
-
const {
|
|
42
|
-
return {
|
|
99
|
+
const { espacementDe } = await import('./places-de-la-machine.mjs');
|
|
100
|
+
return { espacementMs: espacementDe(env), veilleMs: 1_000 };
|
|
43
101
|
};
|
|
44
102
|
|
|
45
103
|
const MODES = { rang: 0, prendre: 1, rendre: 1, rattacher: 3, lire: 0 };
|
|
@@ -101,7 +159,8 @@ async function principal(mode, args) {
|
|
|
101
159
|
const { ID_DES_PLACES, LA_DEMANDE, PRENDRE } = await depuisDist('places', 'contrat.js');
|
|
102
160
|
const places = await depuisDist('places', 'client.js');
|
|
103
161
|
const c = ouvrirLeClient();
|
|
104
|
-
|
|
162
|
+
// Each attempt gets its own deadline, counted from its start.
|
|
163
|
+
const sous = f => avecReprises(() => c.client.connection.withDeadline(Date.now() + DELAI_MS, f));
|
|
105
164
|
try {
|
|
106
165
|
try {
|
|
107
166
|
await sous(async () =>
|
|
@@ -147,6 +206,15 @@ async function principal(mode, args) {
|
|
|
147
206
|
}
|
|
148
207
|
return 0;
|
|
149
208
|
} catch (x) {
|
|
209
|
+
if (transitoire(x) && (await ecoute(c.adresse))) {
|
|
210
|
+
// Still failing transiently after its attempts, its port open: the server is busy, not
|
|
211
|
+
// absent; the measure is to be played again (75), never a red. A port refused is a server
|
|
212
|
+
// absent, required on the poste, below.
|
|
213
|
+
process.stderr.write(
|
|
214
|
+
`les places de la machine ne répondent pas à temps sur le serveur Temporal (${c.adresse}), ${ESSAIS} essais : ${x?.message ?? x} ; à repasser.\n`
|
|
215
|
+
);
|
|
216
|
+
return A_REPASSER;
|
|
217
|
+
}
|
|
150
218
|
process.stderr.write(
|
|
151
219
|
`les places de la machine ne se lisent pas sur le serveur Temporal (${c.adresse}) : ${x?.message ?? x}${x?.cause?.message ? ` (${x.cause.message})` : ''} ; le serveur est requis sur le poste (\`npx grillhouse temporal installer\`).\n`
|
|
152
220
|
);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// The types of the ceiling of the places of the machine (./plafond-de-la-machine.mjs), which the
|
|
2
|
+
// activities of the workflow of the machine (src/temporal/places/activites.ts) import.
|
|
3
|
+
|
|
4
|
+
export const VARIABLE_PLACES: 'GRILLHOUSE_PLACES';
|
|
5
|
+
/** The file of the poste that holds the ceiling, under `~/.config/grillhouse/`. */
|
|
6
|
+
export const FICHIER_DE_LA_MACHINE: 'machine.env';
|
|
7
|
+
/** The ceiling of the places of the machine when nothing names another. */
|
|
8
|
+
export const PLAFOND_PAR_DEFAUT: 3;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The ceiling of the places under <env>: GRILLHOUSE_PLACES of the environment, else of the file of
|
|
12
|
+
* the poste `machine.env`, else 3; throws naming GRILLHOUSE_PLACES on a value that is not a
|
|
13
|
+
* positive integer.
|
|
14
|
+
*/
|
|
15
|
+
export function plafondDe(
|
|
16
|
+
env?: Record<string, string | undefined>,
|
|
17
|
+
o?: { lire?: (f: string) => string | null }
|
|
18
|
+
): number;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// The ceiling of the places of the machine (scripts/places-de-la-machine.mjs), a configuration of
|
|
2
|
+
// the poste read again at each judgement, as Buildkite reads the number of its agents from its
|
|
3
|
+
// configuration and Nomad its `client.reserved`: the workflow of the machine reads it by an
|
|
4
|
+
// activity (src/temporal/places/activites.ts), the board and the number of workers of the tests
|
|
5
|
+
// by this same function, so that a ceiling changed counts without restarting anything.
|
|
6
|
+
//
|
|
7
|
+
// - The file of the poste `machine.env`, under the frame's directory of configuration
|
|
8
|
+
// (`~/.config/grillhouse/`, scripts/fichier-du-poste.mjs), holds `GRILLHOUSE_PLACES=<n>`, as
|
|
9
|
+
// `turbo-cache.env` holds the server of the cache.
|
|
10
|
+
// - The environment wins, as for every file of the poste: GRILLHOUSE_PLACES set (a trial machine,
|
|
11
|
+
// a test) is read instead of the file. Without either, PLAFOND_PAR_DEFAUT, 3.
|
|
12
|
+
// - A value that is not a positive integer is refused by its name and its place.
|
|
13
|
+
import path from 'node:path';
|
|
14
|
+
import { avecLeFichierDuPoste, configurationDuPoste } from './fichier-du-poste.mjs';
|
|
15
|
+
|
|
16
|
+
export const VARIABLE_PLACES = 'GRILLHOUSE_PLACES';
|
|
17
|
+
/** The file of the poste that holds the ceiling, under `~/.config/grillhouse/`. */
|
|
18
|
+
export const FICHIER_DE_LA_MACHINE = 'machine.env';
|
|
19
|
+
/** The ceiling of the places of the machine when nothing names another. */
|
|
20
|
+
export const PLAFOND_PAR_DEFAUT = 3;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The ceiling of the places under <env>: GRILLHOUSE_PLACES of the environment, else of the file
|
|
24
|
+
* of the poste `machine.env`, else 3.
|
|
25
|
+
* @param {Record<string, string | undefined>} [env]
|
|
26
|
+
* @param {{ lire?: (f: string) => string | null }} [o] the reading of the file, for a trial
|
|
27
|
+
* @returns {number}
|
|
28
|
+
* @throws {Error} naming GRILLHOUSE_PLACES and where it is set when its value is not a positive integer
|
|
29
|
+
*/
|
|
30
|
+
export function plafondDe(env = process.env, o = {}) {
|
|
31
|
+
const dedans = env[VARIABLE_PLACES] !== undefined;
|
|
32
|
+
const v = avecLeFichierDuPoste(env, { fichier: FICHIER_DE_LA_MACHINE, ...o })[VARIABLE_PLACES];
|
|
33
|
+
if (v === undefined || v === '') {
|
|
34
|
+
return PLAFOND_PAR_DEFAUT;
|
|
35
|
+
}
|
|
36
|
+
if (!/^[1-9]\d*$/.test(v)) {
|
|
37
|
+
const ou = dedans
|
|
38
|
+
? 'dans l’environnement'
|
|
39
|
+
: `dans ${path.join(configurationDuPoste(env) ?? '~/.config/grillhouse', FICHIER_DE_LA_MACHINE)}`;
|
|
40
|
+
throw new Error(
|
|
41
|
+
`${VARIABLE_PLACES} vaut « ${v} » ${ou} : un entier positif est attendu (${PLAFOND_PAR_DEFAUT} par défaut).`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
return Number(v);
|
|
45
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// The types of ./recommencer.mjs, for the frame's TypeScript (src/temporal/circuit/client.ts).
|
|
2
|
+
|
|
3
|
+
/** Removes the copy of <ticket> in <racine>, its branch, sheets, journal and working directory; returns the copy removed. */
|
|
4
|
+
export function retirerLaCopieDuTicket(racine: string, ticket: string): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// `grillhouse circuit <ticket> --recommencer`: the removal of what a ticket's circuit left, so that
|
|
2
|
+
// a fresh launch starts from the testwriter in a fresh copy. The copy (whatever work it carries, the
|
|
3
|
+
// gesture being asked for, as a reset of Temporal), its branch, its sheets, its journal and its
|
|
4
|
+
// working directory go; the ticket, its description, its plan and its comments are Beads' and stay.
|
|
5
|
+
import { spawnSync } from 'node:child_process';
|
|
6
|
+
import { existsSync, rmSync } from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Removes the copy of <ticket> in the repository <racine> with its branch `agent/<ticket>`, its
|
|
11
|
+
* sheets (`<copie>.fiches.jsonl`), its journal (`<copie>.log`) and its working directory
|
|
12
|
+
* (`<copie>.travail`), and nothing else: the copy of another ticket stays. Returns the copy removed.
|
|
13
|
+
*/
|
|
14
|
+
export function retirerLaCopieDuTicket(racine, ticket) {
|
|
15
|
+
const copie = path.join(racine, '.claude', 'worktrees', ticket);
|
|
16
|
+
const git = (...a) => spawnSync('git', ['-C', racine, ...a], { encoding: 'utf8' });
|
|
17
|
+
if (existsSync(copie)) {
|
|
18
|
+
const r = git('worktree', 'remove', '--force', '--force', copie);
|
|
19
|
+
if (r.status !== 0) {
|
|
20
|
+
rmSync(copie, { recursive: true, force: true });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
git('worktree', 'prune');
|
|
24
|
+
git('branch', '-D', `agent/${ticket}`);
|
|
25
|
+
for (const suite of ['.fiches.jsonl', '.log', '.travail']) {
|
|
26
|
+
rmSync(`${copie}${suite}`, { recursive: true, force: true });
|
|
27
|
+
}
|
|
28
|
+
return copie;
|
|
29
|
+
}
|
|
@@ -34,3 +34,38 @@ export function refusDeLaPlace(
|
|
|
34
34
|
mesurer: () => MesureDeLaMachine;
|
|
35
35
|
}
|
|
36
36
|
): string | null;
|
|
37
|
+
|
|
38
|
+
/** A place of a circuit not given by its project's queue for this long is gone, in ms: 10 min. */
|
|
39
|
+
export const PERIME_MS: number;
|
|
40
|
+
|
|
41
|
+
/** The place of a circuit of the machine: held (`accordee`) or waited for, its rank of arrival. */
|
|
42
|
+
export interface PlaceDeCircuit {
|
|
43
|
+
racine: string;
|
|
44
|
+
ticket: string;
|
|
45
|
+
rang: number;
|
|
46
|
+
accordee: boolean;
|
|
47
|
+
depuis: number;
|
|
48
|
+
vu: number;
|
|
49
|
+
/** A circuit resumed after its question, which asks again by itself. */
|
|
50
|
+
reprise?: boolean;
|
|
51
|
+
/** Why it waits apart from the order of arrival (its disk of copies), null without. */
|
|
52
|
+
raison?: string | null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The places of the circuits once a demand comes: the queue of a project gives its circuits active,
|
|
57
|
+
* the tickets it would start and the reason its disk lacks room; or a circuit resumed asks again by
|
|
58
|
+
* itself (`reprise`). Granted in the order of arrival of every project under the ceiling, a
|
|
59
|
+
* candidate short of disk aside; the tickets of the demand that hold a place.
|
|
60
|
+
*/
|
|
61
|
+
export function reserverDesCircuits(
|
|
62
|
+
places: readonly PlaceDeCircuit[],
|
|
63
|
+
demande: {
|
|
64
|
+
racine: string;
|
|
65
|
+
vivants?: string[];
|
|
66
|
+
candidats?: string[];
|
|
67
|
+
disque?: string | null;
|
|
68
|
+
reprise?: { ticket: string; rang: number | null };
|
|
69
|
+
},
|
|
70
|
+
o: { rang: number; plafond: number; maintenant: number }
|
|
71
|
+
): { circuits: PlaceDeCircuit[]; rang: number; accordes: string[] };
|