@roomi-fields/grillhouse 0.33.1 → 0.34.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 +81 -0
- package/cadre/templates/projet/CLAUDE.md +9 -3
- package/charte.md +23 -6
- package/dist/temporal/acte.d.ts +7 -0
- package/dist/temporal/acte.js +19 -2
- package/dist/temporal/acte.js.map +1 -1
- 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 +225 -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/ci-des-branches.mjs +4 -2
- 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/etapes.mjs +6 -4
- 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 +308 -10
- package/scripts/jointure.d.ts +41 -2
- package/scripts/langages/cargo/commandes.mjs +81 -12
- 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 +14 -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 +92 -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 +179 -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 +468 -267
- package/scripts/taches-du-graphe.mjs +49 -8
- 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
package/scripts/superviseur.mjs
CHANGED
|
@@ -27,7 +27,9 @@
|
|
|
27
27
|
// circuit ended without its issue, with the command that resumes it (`--reprendre` from its last
|
|
28
28
|
// state written, else `--depuis <testwriter|developpeur> --contexte <texte>`), which the
|
|
29
29
|
// supervisor launches without waiting for the owner's word; their ticket open, and the stopped
|
|
30
|
-
// and the ended ones then gone up; a server that does not answer is said
|
|
30
|
+
// and the ended ones then gone up; a server that does not answer is said; then « ## La file des
|
|
31
|
+
// tickets », the tickets of the queue without their section « ## Architecture », which the
|
|
32
|
+
// queue never starts (scripts/file-des-tickets.mjs), for the supervisor to write it. A circuit
|
|
31
33
|
// runs on the worker of the project, apart from the sessions, its launch returns at once, and its
|
|
32
34
|
// question wakes the supervisor by the wait alone (grillhouse-mwz: SyntHub's SH-br0.1 stopped
|
|
33
35
|
// 27 s after a relaunch of its session, read only on a word of the owner). The queue of the
|
|
@@ -36,24 +38,31 @@
|
|
|
36
38
|
//
|
|
37
39
|
// npx grillhouse superviseur --attendre [<dossier>]
|
|
38
40
|
//
|
|
39
|
-
// - The wait of the session of supervision (`attendreUneQuestion`), which the supervisor
|
|
40
|
-
// the background, one at a time, the one way a question of a circuit wakes the session (the
|
|
41
|
-
// owner's decision, grillhouse-pq6): it
|
|
42
|
-
//
|
|
41
|
+
// - The wait of the session of supervision (`attendreUneQuestion`), which the supervisor launches
|
|
42
|
+
// in the background, one at a time, the one way a question of a circuit wakes the session (the
|
|
43
|
+
// owner's decision, grillhouse-pq6): it writes the batch of the questions already due at its
|
|
44
|
+
// start, else waits for one, and ENDS once it has written one batch, as `gh run watch` or
|
|
45
|
+
// `kubectl wait` return on their event: the end of its task wakes the session, whatever pipe
|
|
46
|
+
// follows it, and the session launches it again once the batch is dealt with
|
|
47
|
+
// (grillhouse-d4n.9: a wait that never ended, launched behind `| tail`, was read by no one for
|
|
48
|
+
// 40 min). A batch holds each question of a circuit that never went up or whose re-presentation
|
|
49
|
+
// is due (`questionsEnAttente`, the one source of the questions that wait for the supervisor,
|
|
43
50
|
// which the opening reads too), whatever launched the circuit (alone, in a queue, by another
|
|
44
|
-
// session)
|
|
45
|
-
// the end of its task wakes the session, which spends nothing while it waits (grillhouse-pq6:
|
|
51
|
+
// session): its ticket, step, question and the command that answers it (grillhouse-pq6:
|
|
46
52
|
// SyntHub's SH-ae6.5.2, SH-ae6.5.6 and SH-br0.1.5, launched by a queue, waited hours on their
|
|
47
53
|
// question). The stops gone up, by a wait or named at the opening, are kept in
|
|
48
54
|
// `.claude/worktrees/questions-remontees.json`, each one by its ticket, the run of its workflow,
|
|
49
|
-
// the rank of its question in that run and its stop: one never wakes the session twice
|
|
50
|
-
// session closed then opened again finds every one that waits, and one
|
|
51
|
-
// The end of a circuit wakes it too: a stop as a question; a circuit
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
// the rank of its question in that run and its stop: one never wakes the session twice before
|
|
56
|
+
// its re-presentation, a session closed then opened again finds every one that waits, and one
|
|
57
|
+
// answered leaves them. The end of a circuit wakes it too: a stop as a question; a circuit
|
|
58
|
+
// integrated once (`integre`), its end after the last reading of the previous wait, kept in
|
|
59
|
+
// `.claude/worktrees/integrations-rendues.json` (the opening sets it to its own time), so that
|
|
60
|
+
// an integration between two waits is not lost. Exit 0 on its batch, 1 when another wait
|
|
61
|
+
// already runs (`.claude/worktrees/attente-des-questions.lock`, which names its process: the
|
|
62
|
+
// presence of the wait that the board and the hooks read).
|
|
63
|
+
import { execFile, spawnSync } from 'node:child_process';
|
|
64
|
+
import { promisify } from 'node:util';
|
|
65
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from 'node:fs';
|
|
57
66
|
import path from 'node:path';
|
|
58
67
|
import { pathToFileURL } from 'node:url';
|
|
59
68
|
import { lacherVerrou, prendreVerrou } from './verrou-de-fichier.mjs';
|
|
@@ -68,6 +77,7 @@ import {
|
|
|
68
77
|
verrouDeLAttente,
|
|
69
78
|
} from './tableau.mjs';
|
|
70
79
|
import { etapeDuCircuit, libelle, SUPERVISEUR } from './etapes.mjs';
|
|
80
|
+
import { enFileSansArchitecture, lireLesTickets } from './file-des-tickets.mjs';
|
|
71
81
|
|
|
72
82
|
const VERROU_SUPERVISEUR = 'grillhouse-superviseur.lock';
|
|
73
83
|
const COQUILLES = new Set(['sh', 'bash', 'dash', 'zsh']);
|
|
@@ -133,6 +143,112 @@ const ou = c => {
|
|
|
133
143
|
const etatsDe = racine => path.join(racine, '.claude', 'worktrees');
|
|
134
144
|
export { verrouDeLAttente };
|
|
135
145
|
|
|
146
|
+
// The integrations given by the waits of the repository at <racine>: `depuis`, the time (ms) of
|
|
147
|
+
// the last reading of the last wait, from which an integration is new; `rendues`, the keys of the
|
|
148
|
+
// integrations it gave, ended at that time or after. Absent or unreadable: none since <maintenant>.
|
|
149
|
+
const integrationsDe = racine => path.join(etatsDe(racine), 'integrations-rendues.json');
|
|
150
|
+
function lireLesIntegrations(racine, maintenant) {
|
|
151
|
+
try {
|
|
152
|
+
const lu = JSON.parse(readFileSync(integrationsDe(racine), 'utf8'));
|
|
153
|
+
if (Number.isFinite(lu?.depuis) && Array.isArray(lu?.rendues)) {
|
|
154
|
+
return { depuis: lu.depuis, rendues: new Set(lu.rendues.map(String)) };
|
|
155
|
+
}
|
|
156
|
+
} catch {
|
|
157
|
+
// none yet
|
|
158
|
+
}
|
|
159
|
+
return { depuis: maintenant, rendues: new Set() };
|
|
160
|
+
}
|
|
161
|
+
// The tickets the queue reopened for a red workflow of main (label `flux-rouge`) that wait open, with
|
|
162
|
+
// the address of the run, which the title of the queue's comment (scripts/integration/file.mjs)
|
|
163
|
+
// gives in its second paragraph; none when bd does not read them.
|
|
164
|
+
export async function fluxRougesDe(racine) {
|
|
165
|
+
// A repository without its base of tickets has no ticket to give, and bd is never launched.
|
|
166
|
+
if (!existsSync(path.join(racine, '.beads'))) {
|
|
167
|
+
return [];
|
|
168
|
+
}
|
|
169
|
+
const bd = async (...a) =>
|
|
170
|
+
(
|
|
171
|
+
await promisify(execFile)('bd', a, {
|
|
172
|
+
cwd: racine,
|
|
173
|
+
encoding: 'utf8',
|
|
174
|
+
timeout: 5000,
|
|
175
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
176
|
+
})
|
|
177
|
+
).stdout;
|
|
178
|
+
try {
|
|
179
|
+
const l = JSON.parse(await bd('list', '--label', 'flux-rouge', '--status', 'open', '--json'));
|
|
180
|
+
const lots = await Promise.all(
|
|
181
|
+
l.map(async t => {
|
|
182
|
+
const dits = JSON.parse((await bd('comments', t.id, '--json')) || '[]');
|
|
183
|
+
const c = dits.findLast(x => String(x?.text ?? '').startsWith('## Flux de main rouge'));
|
|
184
|
+
return c ? [{ ticket: t.id, adresse: String(c.text).split('\n\n')[1] ?? '' }] : [];
|
|
185
|
+
})
|
|
186
|
+
);
|
|
187
|
+
return lots.flat();
|
|
188
|
+
} catch {
|
|
189
|
+
return [];
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// The red workflows of main given by the waits of the repository at <racine>, `ticket adresse` keys:
|
|
194
|
+
// those that still stand are kept, so that one is given once and again at another run.
|
|
195
|
+
const fluxRougesRendus = racine => path.join(etatsDe(racine), 'flux-rouges-rendus.json');
|
|
196
|
+
function lireLesFluxRougesRendus(racine) {
|
|
197
|
+
try {
|
|
198
|
+
const lu = JSON.parse(readFileSync(fluxRougesRendus(racine), 'utf8'));
|
|
199
|
+
return new Set(Array.isArray(lu?.rendus) ? lu.rendus.map(String) : []);
|
|
200
|
+
} catch {
|
|
201
|
+
return new Set();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function ecrireLesFluxRougesRendus(racine, cles) {
|
|
205
|
+
const f = fluxRougesRendus(racine);
|
|
206
|
+
try {
|
|
207
|
+
mkdirSync(path.dirname(f), { recursive: true });
|
|
208
|
+
const provisoire = `${f}.${process.pid}`;
|
|
209
|
+
writeFileSync(provisoire, `${JSON.stringify({ rendus: [...cles].sort() })}\n`);
|
|
210
|
+
renameSync(provisoire, f);
|
|
211
|
+
} catch {
|
|
212
|
+
// kept as it was
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// The batch of the tickets reopened by a red workflow of main among <rouges> and not yet given, as
|
|
217
|
+
// questions sorted by ticket; the file of those given keeps the ones that stand.
|
|
218
|
+
function releverLesFluxRouges(racine, rouges) {
|
|
219
|
+
const cleDuRouge = r => `${r.ticket} ${r.adresse}`;
|
|
220
|
+
const avant = lireLesFluxRougesRendus(racine);
|
|
221
|
+
const debout = new Set(rouges.map(cleDuRouge));
|
|
222
|
+
const neufs = rouges.filter(r => !avant.has(cleDuRouge(r)));
|
|
223
|
+
if (neufs.length || debout.size !== avant.size || [...debout].some(k => !avant.has(k))) {
|
|
224
|
+
ecrireLesFluxRougesRendus(racine, debout);
|
|
225
|
+
}
|
|
226
|
+
return neufs
|
|
227
|
+
.sort((a, b) => a.ticket.localeCompare(b.ticket, 'en'))
|
|
228
|
+
.map(r => ({
|
|
229
|
+
ticket: r.ticket,
|
|
230
|
+
etape: '5 Intégration',
|
|
231
|
+
question: `un flux de main est rouge après l'entrée de son lot, le ticket est rouvert : ${r.adresse}`,
|
|
232
|
+
qui: SUPERVISEUR,
|
|
233
|
+
commande: `bd show ${r.ticket}`,
|
|
234
|
+
cle: `flux-rouge ${cleDuRouge(r)}`,
|
|
235
|
+
adresse: r.adresse,
|
|
236
|
+
}));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// A file that cannot be written never costs the batch: the next wait reads the former one.
|
|
240
|
+
function ecrireLesIntegrations(racine, depuis, rendues) {
|
|
241
|
+
const f = integrationsDe(racine);
|
|
242
|
+
try {
|
|
243
|
+
mkdirSync(path.dirname(f), { recursive: true });
|
|
244
|
+
const provisoire = `${f}.${process.pid}`;
|
|
245
|
+
writeFileSync(provisoire, `${JSON.stringify({ depuis, rendues: [...rendues].sort() })}\n`);
|
|
246
|
+
renameSync(provisoire, f);
|
|
247
|
+
} catch {
|
|
248
|
+
// kept as it was
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
136
252
|
// The stops gone up of the repository at <racine>, its circuits <circuits> read, under the lock of
|
|
137
253
|
// their file, at <maintenant> ms. Each stop that waits for the supervisor and never went up, or
|
|
138
254
|
// whose last presentation is <rappelMs> ms old or more (<toutes>: every one), is given, its ticket
|
|
@@ -272,31 +388,36 @@ const aucunFerme = () => new Set();
|
|
|
272
388
|
|
|
273
389
|
/**
|
|
274
390
|
* The wait of the session of supervision of the repository at <racine> (`npx grillhouse
|
|
275
|
-
* superviseur --attendre
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
* the
|
|
284
|
-
* `{ integres: true }`); the supervisor's own « arrete » is
|
|
285
|
-
* times are those of <maintenant> (`Date.now` by default). It reads the circuits
|
|
286
|
-
* <circuitsDe> (one call to the Temporal server, scripts/circuits-du-serveur.mjs,
|
|
287
|
-
* the UI of Temporal refreshes its list; a reading that fails (the server down) is
|
|
288
|
-
* the next step, the questions gone up kept. One wait at a time per repository: a
|
|
289
|
-
* refused while the first runs. Its <signal> ends it.
|
|
290
|
-
*
|
|
291
|
-
*
|
|
391
|
+
* superviseur --attendre`): the first batch of questions, given as soon as one is due, after
|
|
392
|
+
* which the wait ends; the session launches it again once the batch is dealt with. A batch holds
|
|
393
|
+
* each question that waits for the supervisor (`questionsEnAttente`), whatever launched its
|
|
394
|
+
* circuit, once it never went up, and again, marked `representee`, every <rappel> minutes (5 by
|
|
395
|
+
* default) while its circuit stands on the same stop, as SQS gives a message not acknowledged
|
|
396
|
+
* again after its visibility timeout; a question answered (its circuit left the stop) leaves those
|
|
397
|
+
* gone up and is not given again. A stop whose key changes is a new question, given at once. The
|
|
398
|
+
* end of a circuit integrated after the last reading of the previous wait (the file of the
|
|
399
|
+
* integrations given; none, the start of this one) is given once, marked `integre`, never again
|
|
400
|
+
* (the circuits integrated read too, by `{ integres: true }`); the supervisor's own « arrete » is
|
|
401
|
+
* never one. The times are those of <maintenant> (`Date.now` by default). It reads the circuits
|
|
402
|
+
* every <pas> ms by <circuitsDe> (one call to the Temporal server, scripts/circuits-du-serveur.mjs,
|
|
403
|
+
* by default), as the UI of Temporal refreshes its list; a reading that fails (the server down) is
|
|
404
|
+
* tried again at the next step, the questions gone up kept. One wait at a time per repository: a
|
|
405
|
+
* second one is refused while the first runs. Its <signal> ends it with an empty batch. A ticket
|
|
406
|
+
* the queue reopened for a red workflow of main (label `flux-rouge`, waiting open, read by
|
|
407
|
+
* <fluxRouges>: bd by default) is given as a batch of its own, once per run (`adresse`: the
|
|
408
|
+
* workflow, the URL of the run, the commit), and again at another run; taken up or closed, it is
|
|
409
|
+
* no longer given.
|
|
410
|
+
* @param {{ racine: string, fermes?: (racine: string, ids: string[]) => Set<string>, pas?: number, signal?: AbortSignal, circuitsDe?: (racine: string, options?: { integres?: boolean }) => Promise<import('./circuits-du-serveur.mjs').CircuitDuServeur[]>, fluxRouges?: (racine: string) => { ticket: string, adresse: string }[] | Promise<{ ticket: string, adresse: string }[]>, maintenant?: () => number, rappel?: number }} options
|
|
411
|
+
* @returns {Promise<{ ticket: string, etape: string, question: string, qui: string, commande: string, cle: string, representee?: boolean, integre?: boolean }[]>}
|
|
292
412
|
* @throws {Error} another wait runs
|
|
293
413
|
*/
|
|
294
|
-
export async function
|
|
414
|
+
export async function attendreUneQuestion({
|
|
295
415
|
racine,
|
|
296
416
|
fermes = ticketsFermes,
|
|
297
417
|
pas = 5_000,
|
|
298
418
|
signal,
|
|
299
419
|
circuitsDe = circuitsDuServeur,
|
|
420
|
+
fluxRouges = fluxRougesDe,
|
|
300
421
|
maintenant = Date.now,
|
|
301
422
|
rappel = RAPPEL_PAR_DEFAUT,
|
|
302
423
|
}) {
|
|
@@ -313,24 +434,46 @@ export async function* attendreUneQuestion({
|
|
|
313
434
|
`Une attente des questions tourne déjà pour ce dépôt${qui}, ${verrou} : une seule à la fois.`
|
|
314
435
|
);
|
|
315
436
|
}
|
|
316
|
-
// The
|
|
317
|
-
const debut = maintenant();
|
|
318
|
-
|
|
437
|
+
// The integrations new since the last reading of the previous wait, each given once.
|
|
438
|
+
const { depuis: debut, rendues } = lireLesIntegrations(racine, maintenant());
|
|
439
|
+
let lue = debut;
|
|
440
|
+
let lectureDesRouges = null;
|
|
441
|
+
let rougesLus = null;
|
|
319
442
|
try {
|
|
320
443
|
while (!signal?.aborted) {
|
|
444
|
+
const avant = maintenant();
|
|
321
445
|
let circuits = null;
|
|
446
|
+
// Read beside the circuits, never awaited: a slow bd never delays a step, and a reading not
|
|
447
|
+
// yet ended is taken at the next one.
|
|
448
|
+
lectureDesRouges ??= Promise.resolve()
|
|
449
|
+
.then(() => fluxRouges(racine))
|
|
450
|
+
.then(
|
|
451
|
+
r => (rougesLus = Array.isArray(r) ? r : []),
|
|
452
|
+
() => (rougesLus = [])
|
|
453
|
+
);
|
|
322
454
|
try {
|
|
323
455
|
circuits = await circuitsDe(racine, { integres: true });
|
|
324
456
|
} catch {
|
|
325
457
|
circuits = null;
|
|
326
458
|
}
|
|
459
|
+
await new Promise(resolve => setImmediate(resolve));
|
|
460
|
+
let rouges = [];
|
|
461
|
+
if (rougesLus) {
|
|
462
|
+
rouges = releverLesFluxRouges(racine, rougesLus);
|
|
463
|
+
rougesLus = null;
|
|
464
|
+
lectureDesRouges = null;
|
|
465
|
+
}
|
|
466
|
+
if (signal?.aborted) {
|
|
467
|
+
break;
|
|
468
|
+
}
|
|
469
|
+
if (rouges.length && !circuits) {
|
|
470
|
+
return rouges;
|
|
471
|
+
}
|
|
327
472
|
if (circuits && !signal?.aborted) {
|
|
473
|
+
lue = avant;
|
|
328
474
|
const integres = circuits
|
|
329
|
-
.filter(c => c.integre && c.fin !== null && c.fin >= debut && !
|
|
475
|
+
.filter(c => c.integre && c.fin !== null && c.fin >= debut && !rendues.has(cleDe(c)))
|
|
330
476
|
.map(enFin);
|
|
331
|
-
for (const f of integres) {
|
|
332
|
-
finis.add(f.cle);
|
|
333
|
-
}
|
|
334
477
|
const lot = [
|
|
335
478
|
...relever(
|
|
336
479
|
racine,
|
|
@@ -342,13 +485,23 @@ export async function* attendreUneQuestion({
|
|
|
342
485
|
}
|
|
343
486
|
),
|
|
344
487
|
...integres,
|
|
488
|
+
...rouges,
|
|
345
489
|
];
|
|
346
490
|
if (lot.length) {
|
|
347
|
-
|
|
491
|
+
// The integrations given, those ended since this reading kept, so that the next wait
|
|
492
|
+
// gives none of them again.
|
|
493
|
+
const fins = new Map(circuits.map(c => [cleDe(c), c.fin]));
|
|
494
|
+
ecrireLesIntegrations(
|
|
495
|
+
racine,
|
|
496
|
+
lue,
|
|
497
|
+
[...rendues, ...integres.map(i => i.cle)].filter(k => (fins.get(k) ?? -Infinity) >= lue)
|
|
498
|
+
);
|
|
499
|
+
return lot;
|
|
348
500
|
}
|
|
349
501
|
}
|
|
350
502
|
await attendre(pas, signal);
|
|
351
503
|
}
|
|
504
|
+
return [];
|
|
352
505
|
} finally {
|
|
353
506
|
lacherVerrou(verrou);
|
|
354
507
|
}
|
|
@@ -365,12 +518,16 @@ const attendre = (ms, signal) =>
|
|
|
365
518
|
signal?.addEventListener('abort', fin, { once: true });
|
|
366
519
|
});
|
|
367
520
|
|
|
521
|
+
// The relaunch of the wait, which ends on each batch: the last line of a batch.
|
|
522
|
+
const RELANCE =
|
|
523
|
+
"Ce lot traité, relance l'attente en arrière-plan (`run_in_background`), sans tube ni veille à durée : `npx grillhouse superviseur --attendre`. Sa fin te réveille au lot suivant.";
|
|
524
|
+
|
|
368
525
|
/**
|
|
369
526
|
* The text that wakes the session of supervision on the questions <questions>: for each one, its
|
|
370
527
|
* ticket, step, who must answer it, its question and the command that answers it; then each end of
|
|
371
|
-
* a circuit integrated (`integre`), its ticket and its step
|
|
372
|
-
*
|
|
373
|
-
* answer.
|
|
528
|
+
* a circuit integrated (`integre`), its ticket and its step; last, the wait to launch again once
|
|
529
|
+
* the batch is dealt with, since the wait ended on it. A question presented again (`representee`)
|
|
530
|
+
* says that it still waits for an answer.
|
|
374
531
|
* @param {{ ticket: string, etape: string, question: string, qui: string, commande: string, representee?: boolean, integre?: boolean }[]} questions
|
|
375
532
|
* @returns {string}
|
|
376
533
|
*/
|
|
@@ -402,9 +559,13 @@ export function texteDesQuestions(questions) {
|
|
|
402
559
|
...fins.map(q => `- ${q.ticket} est intégré, à ${q.etape} : son lot est sur main.`),
|
|
403
560
|
]
|
|
404
561
|
: [];
|
|
405
|
-
return [
|
|
406
|
-
|
|
407
|
-
|
|
562
|
+
return [
|
|
563
|
+
...enQuestions,
|
|
564
|
+
...(enQuestions.length && enFins.length ? [''] : []),
|
|
565
|
+
...enFins,
|
|
566
|
+
'',
|
|
567
|
+
RELANCE,
|
|
568
|
+
].join('\n');
|
|
408
569
|
}
|
|
409
570
|
|
|
410
571
|
/**
|
|
@@ -414,18 +575,22 @@ export function texteDesQuestions(questions) {
|
|
|
414
575
|
* those whose ticket <fermes> gives closed left out: each one that runs, named; each one stopped on
|
|
415
576
|
* a question (a stop other than the supervisor's own « arrete »), with its question and the command
|
|
416
577
|
* that answers it; each one ended without its issue, with the command that resumes it. The
|
|
417
|
-
* stopped and the ended ones are then gone up: the wait does not give them again.
|
|
578
|
+
* stopped and the ended ones are then gone up: the wait does not give them again. Last, « ## La
|
|
579
|
+
* file des tickets » names the tickets of the queue without their section « ## Architecture »
|
|
580
|
+
* (`enFileSansArchitecture` of scripts/file-des-tickets.mjs, the tickets read by <ticketsDe>,
|
|
581
|
+
* `lireLesTickets` by default; a Beads that fails says nothing), which the queue never starts.
|
|
418
582
|
* @param {string} racine the root of the repository
|
|
419
583
|
* The circuits are read once, by <circuitsDe> (one call to the Temporal server,
|
|
420
584
|
* scripts/circuits-du-serveur.mjs, by default); a server that does not answer is said, and no
|
|
421
585
|
* question goes up.
|
|
422
586
|
* @param {{ fermes?: (racine: string, ids: string[]) => Set<string>,
|
|
423
|
-
* circuitsDe?: (racine: string) => Promise<import('./circuits-du-serveur.mjs').CircuitDuServeur[]
|
|
587
|
+
* circuitsDe?: (racine: string) => Promise<import('./circuits-du-serveur.mjs').CircuitDuServeur[]>,
|
|
588
|
+
* ticketsDe?: (racine: string) => import('./file-des-tickets.mjs').TicketDeBeads[] }} options
|
|
424
589
|
* @returns {Promise<string>}
|
|
425
590
|
*/
|
|
426
591
|
export async function circuitsALOuverture(
|
|
427
592
|
racine,
|
|
428
|
-
{ fermes = ticketsFermes, circuitsDe = circuitsDuServeur } = {}
|
|
593
|
+
{ fermes = ticketsFermes, circuitsDe = circuitsDuServeur, ticketsDe = lireLesTickets } = {}
|
|
429
594
|
) {
|
|
430
595
|
let circuits = null;
|
|
431
596
|
let panne = null;
|
|
@@ -438,6 +603,7 @@ export async function circuitsALOuverture(
|
|
|
438
603
|
? `${e.message} : les circuits ne se lisent pas.`
|
|
439
604
|
: `Les circuits ne se lisent pas : ${message}.`;
|
|
440
605
|
}
|
|
606
|
+
ecrireLesIntegrations(racine, Date.now(), []);
|
|
441
607
|
const questions = circuits
|
|
442
608
|
? relever(racine, circuits, {
|
|
443
609
|
fermes,
|
|
@@ -460,14 +626,29 @@ export async function circuitsALOuverture(
|
|
|
460
626
|
` La réponse : \`${q.commande}\`.`,
|
|
461
627
|
].join('\n'),
|
|
462
628
|
});
|
|
629
|
+
let sansArchitecture = [];
|
|
630
|
+
try {
|
|
631
|
+
sansArchitecture = enFileSansArchitecture(ticketsDe(racine), {
|
|
632
|
+
enCours: new Set((circuits ?? []).map(c => c.ticket)),
|
|
633
|
+
}).map(t => t.id);
|
|
634
|
+
} catch {
|
|
635
|
+
// Beads fails: the board says it, the opening names no ticket.
|
|
636
|
+
}
|
|
463
637
|
const nommes = [...tournent, ...questions.map(enLigne)].sort((a, b) =>
|
|
464
638
|
a.ticket.localeCompare(b.ticket, 'en')
|
|
465
639
|
);
|
|
466
640
|
return [
|
|
467
641
|
"## L'attente des questions",
|
|
468
|
-
"Dès ta première réponse, sans attendre le mot du responsable, lance l'attente des questions en arrière-plan (`run_in_background`)
|
|
642
|
+
"Dès ta première réponse, sans attendre le mot du responsable, lance l'attente des questions en arrière-plan (`run_in_background`), sans tube ni veille à durée : `npx grillhouse superviseur --attendre`. Elle imprime un lot (une question neuve d'un circuit, quel que soit son lanceur, une fin de circuit) et se termine : sa fin te réveille. Relance-la après chaque lot traité. Une question sans réponse revient toutes les 5 min (`--rappel <minutes>` règle l'intervalle) jusqu'à sa réponse. Un lancement de circuit rend la main tout de suite ; la fin d'un circuit te réveille aussi, un arrêt comme une question, une intégration une fois. Tu ne te mets pas en attente du responsable tant qu'une question d'un circuit attend ta réponse, ni tant qu'un circuit tourne sans attente vivante : le crochet de fin de tour te le rappelle.",
|
|
469
643
|
...(panne ? ['', '## Les circuits du dépôt', panne] : []),
|
|
470
644
|
...(nommes.length ? ['', '## Les circuits du dépôt', ...nommes.map(n => n.ligne)] : []),
|
|
645
|
+
...(sansArchitecture.length
|
|
646
|
+
? [
|
|
647
|
+
'',
|
|
648
|
+
'## La file des tickets',
|
|
649
|
+
`En file sans architecture : ${sansArchitecture.join(', ')}. La file ne démarre pas un ticket sans la section « ## Architecture » de sa description : écris-la (le modèle mûr, l'adresse, le mécanisme commun), puis la file le démarre.`,
|
|
650
|
+
]
|
|
651
|
+
: []),
|
|
471
652
|
].join('\n');
|
|
472
653
|
}
|
|
473
654
|
|
|
@@ -545,13 +726,11 @@ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
|
545
726
|
}
|
|
546
727
|
args.splice(i, 2);
|
|
547
728
|
}
|
|
548
|
-
|
|
729
|
+
const lot = await attendreUneQuestion({
|
|
549
730
|
racine: racineDe(args[0] ?? process.cwd()),
|
|
550
731
|
rappel,
|
|
551
|
-
})
|
|
552
|
-
|
|
553
|
-
process.stdout.write(`${texteDesQuestions(questions)}\n\n`);
|
|
554
|
-
}
|
|
732
|
+
});
|
|
733
|
+
process.stdout.write(`${texteDesQuestions(lot)}\n`);
|
|
555
734
|
} catch (e) {
|
|
556
735
|
process.stderr.write(`${e.message}\n`);
|
|
557
736
|
process.exitCode = 1;
|