@roomi-fields/grillhouse 0.50.3 → 0.51.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 +48 -0
- package/agents/developpeur.md +1 -1
- package/agents/direct.md +1 -1
- package/agents/explorateur.md +1 -1
- package/agents/questionneur.md +1 -1
- package/agents/relecteur.md +1 -1
- package/agents/testwriter.md +1 -1
- package/cadre/templates/c/package.json +1 -0
- package/cadre/templates/cargo/package.json +1 -0
- package/cadre/templates/python/package.json +1 -0
- package/charte.md +17 -12
- package/dist/machine/part-par-sorte.d.ts +16 -0
- package/dist/machine/part-par-sorte.js +36 -0
- package/dist/machine/part-par-sorte.js.map +1 -0
- package/dist/temporal/circuit/appel.js +1 -1
- package/dist/temporal/circuit/appel.js.map +1 -1
- package/dist/temporal/circuit/client.d.ts +5 -4
- package/dist/temporal/circuit/client.js +39 -16
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +11 -7
- package/dist/temporal/circuit/contrat.js +5 -9
- package/dist/temporal/circuit/contrat.js.map +1 -1
- package/dist/temporal/circuit/deroule.js +18 -6
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/commande.js +12 -3
- package/dist/temporal/commande.js.map +1 -1
- package/dist/temporal/installation.d.ts +54 -3
- package/dist/temporal/installation.js +187 -17
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/places/client.d.ts +5 -1
- package/dist/temporal/places/client.js +23 -11
- package/dist/temporal/places/client.js.map +1 -1
- package/docs/ARCHITECTURE.md +23 -2700
- package/docs/INTERFACE.md +23 -8
- package/docs/architecture/circuit.md +59 -12
- package/docs/architecture/entree.md +20 -7
- package/docs/architecture/greffon.md +6 -2
- package/docs/architecture/installation.md +30 -11
- package/docs/architecture/machine.md +50 -37
- package/docs/architecture/tests.md +52 -14
- package/docs/lexique.md +154 -0
- package/hooks/register.tsx +1 -1
- package/package.json +1 -1
- package/scripts/activites.mjs +85 -60
- package/scripts/aiguillage.mjs +15 -7
- package/scripts/attente-de-la-machine.mjs +4 -8
- package/scripts/avancement.mjs +12 -8
- package/scripts/bilan.mjs +10 -7
- package/scripts/branche-de-nuit.mjs +2 -2
- package/scripts/ci-de-main.mjs +18 -21
- package/scripts/circuit.mjs +86 -43
- package/scripts/circuits-du-serveur.mjs +5 -5
- package/scripts/composants-affectes.mjs +30 -12
- package/scripts/composition-des-langages.mjs +5 -3
- package/scripts/conformite.mjs +1 -1
- package/scripts/consommation-des-passes.mjs +8 -6
- package/scripts/copies-finies.mjs +3 -14
- package/scripts/depart-du-ticket.d.mts +8 -2
- package/scripts/depart-du-ticket.mjs +26 -8
- package/scripts/direct.mjs +158 -72
- package/scripts/droits.mjs +63 -185
- package/scripts/engendres.mjs +3 -14
- package/scripts/enveloppe/enveloppe.mjs +75 -30
- package/scripts/enveloppe/lancer.sh +59 -45
- package/scripts/enveloppe/paquets-du-plan.mjs +38 -11
- package/scripts/enveloppe/travail-de-la-copie.mjs +115 -3
- package/scripts/etapes.mjs +84 -22
- package/scripts/faits-du-circuit.mjs +8 -2
- package/scripts/grillhouse-maj.mjs +43 -18
- package/scripts/groupe-cles.d.mts +15 -0
- package/scripts/groupe-cles.mjs +77 -2
- package/scripts/init.mjs +9 -2
- package/scripts/integration/rejeu.mjs +8 -1
- package/scripts/jointure.d.ts +22 -3
- package/scripts/langages/c/index.mjs +5 -2
- package/scripts/langages/cargo/commandes.mjs +35 -15
- package/scripts/langages/cargo/composants.mjs +45 -3
- package/scripts/langages/cargo/index.mjs +6 -3
- package/scripts/langages/python/index.mjs +5 -2
- package/scripts/langages/typescript/chemins-des-tests.mjs +1 -1
- package/scripts/langages/typescript/index.mjs +4 -2
- package/scripts/langages/typescript/mise-a-jour.mjs +1 -1
- package/scripts/langages/typescript/rapports-aux-lignes.mjs +74 -0
- package/scripts/langages/typescript/turbo-des-paquets.mjs +99 -36
- package/scripts/langages/typescript/verdict.mjs +29 -3
- package/scripts/langages/typescript/verifier.mjs +1 -1
- package/scripts/langages/typescript/vitest-config/changements.mjs +8 -6
- package/scripts/langages/typescript/vitest-config/lances.mjs +15 -32
- package/scripts/langages.mjs +54 -4
- package/scripts/matieres-lues.mjs +1 -1
- package/scripts/mesure/base-de-passe.mjs +32 -90
- package/scripts/migrations/serveurs-de-l-index.mjs +79 -0
- package/scripts/migrations.mjs +21 -7
- package/scripts/paquets.d.ts +3 -0
- package/scripts/paquets.mjs +88 -1
- package/scripts/passe-de-la-machine.mjs +109 -36
- package/scripts/places-de-la-machine.mjs +81 -29
- package/scripts/plafond-de-la-machine.d.mts +2 -5
- package/scripts/plafond-de-la-machine.mjs +9 -9
- package/scripts/reprise.mjs +42 -13
- package/scripts/resultats.mjs +76 -54
- package/scripts/retirer-les-copies-finies.mjs +1 -1
- package/scripts/seances.mjs +426 -115
- package/scripts/services-du-noyau.mjs +9 -1
- package/scripts/session-start.sh +14 -1
- package/scripts/sortie.mjs +37 -6
- package/scripts/sous-commandes.mjs +0 -2
- package/scripts/superviseur.mjs +33 -13
- package/scripts/tableau.mjs +61 -16
- package/scripts/transitions.d.mts +25 -2
- package/scripts/transitions.mjs +137 -29
- package/scripts/verrous/ecriture-hors-enveloppe.mjs +31 -9
- package/skills/codebase-design/DESIGN-IT-TWICE.md +1 -1
- package/skills/developpeur/SKILL.md +38 -15
- package/skills/direct/SKILL.md +29 -9
- package/skills/domain-modeling/GLOSSARY-FORMAT.md +9 -9
- package/skills/domain-modeling/SKILL.md +14 -12
- package/skills/explorateur/SKILL.md +30 -6
- package/skills/pitmaster/SKILL.md +12 -16
- package/skills/pitmaster/references/consigne-agent.md +12 -11
- package/skills/relecteur/SKILL.md +12 -5
- package/skills/systematic-debugging/SKILL.md +281 -0
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/systematic-debugging/find-polluter.sh +72 -0
- package/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/testwriter/SKILL.md +35 -29
- package/scripts/verrous/commande.mjs +0 -214
- package/scripts/verrous/verrou.mjs +0 -311
package/scripts/seances.mjs
CHANGED
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
// for it, under the same watch, before it takes its place (`lancer`): the second attempt of
|
|
8
8
|
// `jusquALaFiche`, and the fresh session that follows a failed resumption in `seance`; the id of
|
|
9
9
|
// each session comes from its caller, which gives a new one to each session it launches. `lancer` launches one session, `jusquALaFiche` until its
|
|
10
|
-
// sheet, `seance` the testwriter
|
|
10
|
+
// sheet, `seance` that of the testwriter, the developpeur or the agent direct on the whole ticket, with the instruction of
|
|
11
11
|
// the templates (`consigne`) and the findings of the reviewer open for its role
|
|
12
|
-
// (`constatsDeLaSeance`).
|
|
12
|
+
// (`constatsDeLaSeance`). Each session of a role ends on the judgment of its lot (`jugerLeLot`,
|
|
13
|
+
// machine.md §5.5). The circuit (scripts/circuit.mjs) calls them.
|
|
13
14
|
import { spawn, spawnSync } from 'node:child_process';
|
|
14
15
|
import { createHash, randomUUID } from 'node:crypto';
|
|
15
16
|
import {
|
|
@@ -26,15 +27,32 @@ import {
|
|
|
26
27
|
} from 'node:fs';
|
|
27
28
|
import os from 'node:os';
|
|
28
29
|
import path from 'node:path';
|
|
30
|
+
import { pathToFileURL } from 'node:url';
|
|
29
31
|
import { GREFFON } from './cadre.mjs';
|
|
30
32
|
import { avecLeFichierDuPoste, configurationDuPoste } from './fichier-du-poste.mjs';
|
|
31
|
-
import {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
import {
|
|
34
|
+
changements,
|
|
35
|
+
ecritPar,
|
|
36
|
+
etatDuFichier,
|
|
37
|
+
marquesRestantes,
|
|
38
|
+
photographier,
|
|
39
|
+
texteDeLEtat,
|
|
40
|
+
} from './enveloppe/travail-de-la-copie.mjs';
|
|
41
|
+
import {
|
|
42
|
+
ecrireLaListe,
|
|
43
|
+
paquetQuiTient,
|
|
44
|
+
paquetsDuLangage,
|
|
45
|
+
VARIABLE_TESTS_ETENDUS,
|
|
46
|
+
} from './enveloppe/paquets-du-plan.mjs';
|
|
47
|
+
import { langageDe, langageDeLaCopie } from './langages.mjs';
|
|
48
|
+
import { leRole, nomDuRole } from './etapes.mjs';
|
|
49
|
+
import { departDe, VARIABLE_SEANCE } from './mesure/base-de-passe.mjs';
|
|
36
50
|
import { groupeVivant, signalerGroupe } from './mesure-de-la-machine.mjs';
|
|
37
|
-
import {
|
|
51
|
+
import {
|
|
52
|
+
commandeDuGroupe,
|
|
53
|
+
lancementDeLaPasse,
|
|
54
|
+
mesureDeLaSeance,
|
|
55
|
+
} from './passe-de-la-machine.mjs';
|
|
38
56
|
import { prendreUnePlace } from './places-de-la-machine.mjs';
|
|
39
57
|
import { transcriptionsDeLaCopie } from './registre.mjs';
|
|
40
58
|
import { cleDuConstat, lireFiche, reponsesAuxConstats, schemaDeFiche } from './resultats.mjs';
|
|
@@ -99,6 +117,26 @@ const LANCEUR = path.join(import.meta.dirname, 'enveloppe', 'lancer.sh');
|
|
|
99
117
|
|
|
100
118
|
const REGISTRE = path.join(import.meta.dirname, 'registre.mjs');
|
|
101
119
|
|
|
120
|
+
// The script that opens the temporary directory of a session out of the envelope, the base of a
|
|
121
|
+
// pass whose owner is the process its argument names, and writes it without its end of line.
|
|
122
|
+
const OUVRIR_LE_TEMPORAIRE = `import { ouvrirBase } from ${JSON.stringify(
|
|
123
|
+
pathToFileURL(path.join(import.meta.dirname, 'mesure', 'base-de-passe.mjs')).href
|
|
124
|
+
)}; process.stdout.write(ouvrirBase('seance', { pid: Number(process.argv[1]) }).dossier);`;
|
|
125
|
+
|
|
126
|
+
// The shell that carries a session out of the envelope (`$0` the file of its exit code, `$1` node,
|
|
127
|
+
// `$2` the script above, then the session's command): it opens the session's temporary directory,
|
|
128
|
+
// which it owns, so that it outlives a dead circuit, names it in TMPDIR, TMP and TEMP, whatever
|
|
129
|
+
// CLAUDE_CODE_TMPDIR the poste holds, and removes it at its end, even interrupted.
|
|
130
|
+
const PORTER_LA_SEANCE = [
|
|
131
|
+
"trap 'exit 129' HUP; trap 'exit 130' INT; trap 'exit 143' TERM",
|
|
132
|
+
't=$("$1" --input-type=module -e "$2" "$$" </dev/null) || exit',
|
|
133
|
+
'trap \'rm -rf -- "${t%/t}"\' EXIT',
|
|
134
|
+
'shift 2',
|
|
135
|
+
'export TMPDIR="$t" TMP="$t" TEMP="$t"',
|
|
136
|
+
'unset CLAUDE_CODE_TMPDIR',
|
|
137
|
+
'"$@"; c=$?; echo "$c" > "$0"; exit "$c"',
|
|
138
|
+
].join('\n');
|
|
139
|
+
|
|
102
140
|
// The templates of the instructions, in the skill of the supervisor, which the frame's plugin
|
|
103
141
|
// carries, read at the plugin's root (scripts/cadre.mjs).
|
|
104
142
|
const GABARIT = path.join(GREFFON, 'skills', 'pitmaster', 'references', 'consigne-agent.md');
|
|
@@ -133,7 +171,7 @@ const mtime = f => {
|
|
|
133
171
|
/**
|
|
134
172
|
* Where the session <id> of <ctx> keeps its result, in the working directory of the ticket
|
|
135
173
|
* (`<copie>.travail/seances/<id>/`, as lancer.sh writes it): its exit code (`fin`), claude's JSON
|
|
136
|
-
* result (`resultat.json`), the
|
|
174
|
+
* result (`resultat.json`), the tree the prepared copy held before it (`avant`) and the witness
|
|
137
175
|
* that the envelope started its command (`demarree`).
|
|
138
176
|
*/
|
|
139
177
|
export function rangDeLaSeance(ctx, id) {
|
|
@@ -142,8 +180,7 @@ export function rangDeLaSeance(ctx, id) {
|
|
|
142
180
|
dossier,
|
|
143
181
|
fin: path.join(dossier, 'fin'),
|
|
144
182
|
resultat: path.join(dossier, 'resultat.json'),
|
|
145
|
-
|
|
146
|
-
horsPlanFait: path.join(dossier, 'hors-plan.json'),
|
|
183
|
+
avant: path.join(dossier, 'avant'),
|
|
147
184
|
demarree: path.join(dossier, 'demarree'),
|
|
148
185
|
};
|
|
149
186
|
}
|
|
@@ -158,8 +195,6 @@ function resultatRange(rang, id, { horsEnveloppe = false } = {}) {
|
|
|
158
195
|
code: 0,
|
|
159
196
|
seance: Number(readFileSync(rang.fin, 'utf8').trim()),
|
|
160
197
|
bloque: false,
|
|
161
|
-
horsPlan: existsSync(rang.horsPlan) ? lire(rang.horsPlan).trim() : null,
|
|
162
|
-
ecriture: ecritureRangee(rang),
|
|
163
198
|
erreur: null,
|
|
164
199
|
sortie: lire(rang.resultat).trim(),
|
|
165
200
|
id,
|
|
@@ -180,7 +215,8 @@ function resultatRange(rang, id, { horsEnveloppe = false } = {}) {
|
|
|
180
215
|
// itself, in the ticket's
|
|
181
216
|
// copy (the main tree once the copy is gone), under <droits> (`horsDeLEnveloppe`), the
|
|
182
217
|
// schema of its role's sheet and the options <session> names (its id, or the session it
|
|
183
|
-
// resumes), its instruction on its standard input and its result on its standard output,
|
|
218
|
+
// resumes), its instruction on its standard input and its result on its standard output, in a
|
|
219
|
+
// temporary directory of its own (PORTER_LA_SEANCE), ranged
|
|
184
220
|
// under its id with its exit code as lancer.sh ranges them, added to the log under its header
|
|
185
221
|
// line, then its line written to the register, as lancer.sh does.
|
|
186
222
|
// Its launch is kept with the circuit's results (`lancement`: its role, its session id, and the
|
|
@@ -256,12 +292,16 @@ export async function lancer(
|
|
|
256
292
|
return mort;
|
|
257
293
|
}
|
|
258
294
|
}
|
|
295
|
+
// The lot a dead attempt left unjudged is judged before anything of this launch moves the copy.
|
|
296
|
+
const juge = estJuge(role, horsEnveloppe);
|
|
297
|
+
if (juge) {
|
|
298
|
+
jugerLeLot(ctx, role);
|
|
299
|
+
}
|
|
259
300
|
const rang = rangDeLaSeance(ctx, id);
|
|
260
301
|
mkdirSync(rang.dossier, { recursive: true });
|
|
261
302
|
rmSync(rang.fin, { force: true });
|
|
262
303
|
rmSync(rang.resultat, { force: true });
|
|
263
|
-
rmSync(rang.
|
|
264
|
-
rmSync(rang.horsPlanFait, { force: true });
|
|
304
|
+
rmSync(rang.avant, { force: true });
|
|
265
305
|
rmSync(rang.demarree, { force: true });
|
|
266
306
|
inscrire(ctx, {
|
|
267
307
|
role: AUTEUR_DU_CIRCUIT,
|
|
@@ -292,8 +332,10 @@ export async function lancer(
|
|
|
292
332
|
cmd: 'sh',
|
|
293
333
|
args: [
|
|
294
334
|
'-c',
|
|
295
|
-
|
|
335
|
+
PORTER_LA_SEANCE,
|
|
296
336
|
rang.fin,
|
|
337
|
+
process.execPath,
|
|
338
|
+
OUVRIR_LE_TEMPORAIRE,
|
|
297
339
|
process.env.CLAUDE_BIN || 'claude',
|
|
298
340
|
...['-p', '--agent', role, ...fiche, ...droits, '--add-dir', ctx.tmp, ...session],
|
|
299
341
|
],
|
|
@@ -360,13 +402,28 @@ export async function lancer(
|
|
|
360
402
|
role === 'testwriter' && ctx.testsEtendus?.length
|
|
361
403
|
? { [VARIABLE_TESTS_ETENDUS]: ecrireLaListe(ctx.testsEtendus) }
|
|
362
404
|
: {};
|
|
363
|
-
const
|
|
405
|
+
const marque = horsEnveloppe ? { [VARIABLE_SEANCE]: '1' } : {};
|
|
406
|
+
const env = { ...base, ...place.env, ...testsEtendus, ...marque, [ACTEUR]: role };
|
|
364
407
|
const lancement = horsEnveloppe
|
|
365
408
|
? lancementDeLaPasse({ lourde: false, cmd: commande.cmd, args: commande.args, env })
|
|
366
409
|
: { cmd: commande.cmd, args: commande.args, env };
|
|
410
|
+
// A session out of the envelope runs in a group of its own, which measures its peak into the
|
|
411
|
+
// register (an enveloped one is measured by its envelope): the default weight, no bound.
|
|
412
|
+
const mesure = horsEnveloppe
|
|
413
|
+
? mesureDeLaSeance({ racine: ctx.racine, role, ticket: ctx.ticket, env: lancement.env })
|
|
414
|
+
: null;
|
|
415
|
+
const lancee = mesure
|
|
416
|
+
? commandeDuGroupe({
|
|
417
|
+
part: { coeurs: 1, memoire: 0 },
|
|
418
|
+
cmd: lancement.cmd,
|
|
419
|
+
args: lancement.args,
|
|
420
|
+
unite: mesure.unite,
|
|
421
|
+
memoire: false,
|
|
422
|
+
})
|
|
423
|
+
: lancement;
|
|
367
424
|
const r = await jouerLeGroupe({
|
|
368
|
-
cmd:
|
|
369
|
-
args:
|
|
425
|
+
cmd: lancee.cmd,
|
|
426
|
+
args: lancee.args,
|
|
370
427
|
cwd: commande.cwd,
|
|
371
428
|
env: lancement.env,
|
|
372
429
|
stdio: fds,
|
|
@@ -385,6 +442,11 @@ export async function lancer(
|
|
|
385
442
|
}
|
|
386
443
|
},
|
|
387
444
|
});
|
|
445
|
+
mesure?.garder({
|
|
446
|
+
status: r.code,
|
|
447
|
+
error: r.erreur ?? undefined,
|
|
448
|
+
signal: r.bloque || r.annulee ? 'SIGTERM' : null,
|
|
449
|
+
});
|
|
388
450
|
if (r.pid === null && r.annulee) {
|
|
389
451
|
fermer();
|
|
390
452
|
}
|
|
@@ -394,6 +456,9 @@ export async function lancer(
|
|
|
394
456
|
}
|
|
395
457
|
return r;
|
|
396
458
|
};
|
|
459
|
+
if (juge) {
|
|
460
|
+
ouvrirLeLot(ctx, role, { id, horsEnveloppe, depot: horsEnveloppe ? commande.cwd : ctx.copie });
|
|
461
|
+
}
|
|
397
462
|
let r = await jouer(cle?.env ?? process.env);
|
|
398
463
|
let sortie = lireLaSortie(rang);
|
|
399
464
|
const motif = cle ? motifDeRefus(sortie) : null;
|
|
@@ -415,8 +480,6 @@ export async function lancer(
|
|
|
415
480
|
}
|
|
416
481
|
place.rendre();
|
|
417
482
|
let seance;
|
|
418
|
-
let horsPlan = null;
|
|
419
|
-
let ecriture = null;
|
|
420
483
|
if (horsEnveloppe) {
|
|
421
484
|
seance = existsSync(rang.fin)
|
|
422
485
|
? Number(readFileSync(rang.fin, 'utf8').trim())
|
|
@@ -430,15 +493,11 @@ export async function lancer(
|
|
|
430
493
|
});
|
|
431
494
|
} else {
|
|
432
495
|
seance = existsSync(rang.fin) ? Number(readFileSync(rang.fin, 'utf8').trim()) : null;
|
|
433
|
-
horsPlan = existsSync(rang.horsPlan) ? lire(rang.horsPlan).trim() : null;
|
|
434
|
-
ecriture = ecritureRangee(rang);
|
|
435
496
|
}
|
|
436
497
|
return {
|
|
437
498
|
code: r.code,
|
|
438
499
|
seance,
|
|
439
500
|
bloque: r.bloque,
|
|
440
|
-
horsPlan,
|
|
441
|
-
ecriture,
|
|
442
501
|
erreur: r.erreur ?? lire(erreurs),
|
|
443
502
|
sortie,
|
|
444
503
|
id,
|
|
@@ -653,6 +712,25 @@ export function consigne(valeurs, rang = 0) {
|
|
|
653
712
|
return `${bloc[1].replace(/\{\{(\w+)\}\}/g, (m, k) => (k in valeurs ? valeurs[k] : m))}\n`;
|
|
654
713
|
}
|
|
655
714
|
|
|
715
|
+
// What a direct asks of the reviewer of its lot, written once: the instruction of the circuit's
|
|
716
|
+
// reviewer on a direct circuit and that of the rescue command carry it.
|
|
717
|
+
const EXIGENCE_DU_DIRECT = [
|
|
718
|
+
'CE LOT EST UN DIRECT : un seul agent, le rôle `direct`, a écrit les tests et le code ensemble. Tout constat bloquant lui est adressé : son destinataire est `direct`.',
|
|
719
|
+
"La preuve du rouge n'est pas jouée : tu la tiens. Un défaut corrigé porte un test qui le reproduit, et ce test échoue sans le code du lot ; sans lui, le constat est bloquant. Un ticket de données ou le squelette d'un paquet, qui ne change aucun comportement, n'a pas de test à exiger.",
|
|
720
|
+
].join('\n\n');
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* The instruction of the reviewer of a direct lot: that of the circuit's reviewer (the second
|
|
724
|
+
* template of the supervisor's skill) filled with <valeurs>, then `propre`, what the caller alone
|
|
725
|
+
* says of the lot, then what a direct asks of it.
|
|
726
|
+
* @param {Record<string, string>} valeurs
|
|
727
|
+
* @param {string | null} [propre]
|
|
728
|
+
* @returns {string}
|
|
729
|
+
*/
|
|
730
|
+
export function consigneDuRelecteurDUnLotDirect(valeurs, propre = null) {
|
|
731
|
+
return `${[consigne(valeurs, 1).trim(), propre, EXIGENCE_DU_DIRECT].filter(Boolean).join('\n\n')}\n`;
|
|
732
|
+
}
|
|
733
|
+
|
|
656
734
|
// One session of <role> on the whole ticket: its sheet. A relaunch on its step (<tentative> past
|
|
657
735
|
// 1) that is not the last (<derniere>) resumes the agent's session the circuit keeps
|
|
658
736
|
// (<reprise>, its author and id) with the short instruction (the fourth template); its sheet
|
|
@@ -737,7 +815,12 @@ async function uneSeance(
|
|
|
737
815
|
},
|
|
738
816
|
};
|
|
739
817
|
const plan = ctx.paquets.join(', ');
|
|
740
|
-
|
|
818
|
+
// The sheet of an author of the circuit carries what its lot holds out of the rule of its role.
|
|
819
|
+
const repondu = fiche => {
|
|
820
|
+
const constats = fiche ? repondre(gardes, fiche) : gardes;
|
|
821
|
+
const horsRole = fiche && AUTEURS_JUGES.has(role) ? jugerLeLot(ctx, role) : null;
|
|
822
|
+
return { fiche: horsRole ? { ...fiche, horsRole } : fiche, constats };
|
|
823
|
+
};
|
|
741
824
|
if (reprise) {
|
|
742
825
|
const courte = {
|
|
743
826
|
role: nom,
|
|
@@ -747,9 +830,13 @@ async function uneSeance(
|
|
|
747
830
|
tentative,
|
|
748
831
|
change:
|
|
749
832
|
change ??
|
|
750
|
-
(
|
|
833
|
+
(rapport?.startsWith(TITRE_DU_LOT)
|
|
834
|
+
? 'le jugement du lot, joué après ta séance, trouve ton lot hors de la règle de ton rôle'
|
|
835
|
+
: role === 'testwriter'
|
|
751
836
|
? 'la preuve du rouge, jouée après ta séance, refuse ton lot'
|
|
752
|
-
:
|
|
837
|
+
: role === 'direct'
|
|
838
|
+
? 'la passe finale, jouée après ta séance, est rouge'
|
|
839
|
+
: 'les contrôles, joués après ta séance, sont rouges'),
|
|
753
840
|
rapport: rapport ?? 'aucun',
|
|
754
841
|
tache,
|
|
755
842
|
ouverts,
|
|
@@ -905,6 +992,9 @@ export async function seance(ctx, role, options) {
|
|
|
905
992
|
`Sa séance devait lever un conflit de la copie (${autres.join(', ')}) avant celle du ${nomDuRole(role)}.`
|
|
906
993
|
);
|
|
907
994
|
}
|
|
995
|
+
if (fiche.horsRole) {
|
|
996
|
+
throw new Arret('controles', fiche.horsRole.rapport);
|
|
997
|
+
}
|
|
908
998
|
return uneSeance(ctx, role, { ...options, constats });
|
|
909
999
|
}
|
|
910
1000
|
}
|
|
@@ -912,7 +1002,9 @@ export async function seance(ctx, role, options) {
|
|
|
912
1002
|
/**
|
|
913
1003
|
* The stop for the sheet <fiche> of the session <tentative> of <role>, BLOQUÉ (« hors-portee »)
|
|
914
1004
|
* or BESOIN (« besoin »): its reason or question first, then its handover; the sheet's piece as
|
|
915
|
-
* its own, and the agent's question as its own
|
|
1005
|
+
* its own, and the agent's question as its own, with the package of the file out of the plan a
|
|
1006
|
+
* BESOIN sheet names (`manque`) and the command that extends the plan to it. <suite> says what
|
|
1007
|
+
* follows a BLOQUÉ.
|
|
916
1008
|
*/
|
|
917
1009
|
export function arretDuStatut(
|
|
918
1010
|
ctx,
|
|
@@ -922,13 +1014,18 @@ export function arretDuStatut(
|
|
|
922
1014
|
suite = 'Le circuit ne le relance pas sur ce rouge.'
|
|
923
1015
|
) {
|
|
924
1016
|
const passation = derniereDe(ctx, role)?.text ?? 'aucune';
|
|
925
|
-
const qui =
|
|
1017
|
+
const qui = leRole(role);
|
|
926
1018
|
const { piece } = fiche;
|
|
927
1019
|
return fiche.statut === 'BESOIN'
|
|
928
1020
|
? new Arret(
|
|
929
1021
|
'besoin',
|
|
930
1022
|
`${qui} attend une réponse (séance ${tentative}) : ${fiche.question}\n\nSa passation :\n\n${passation}`,
|
|
931
|
-
{
|
|
1023
|
+
{
|
|
1024
|
+
piece,
|
|
1025
|
+
question: [`${qui} demande : ${fiche.question}`, questionDuManque(ctx, fiche.manque)]
|
|
1026
|
+
.filter(Boolean)
|
|
1027
|
+
.join('\n\n'),
|
|
1028
|
+
}
|
|
932
1029
|
)
|
|
933
1030
|
: new Arret(
|
|
934
1031
|
'hors-portee',
|
|
@@ -937,6 +1034,66 @@ export function arretDuStatut(
|
|
|
937
1034
|
);
|
|
938
1035
|
}
|
|
939
1036
|
|
|
1037
|
+
// The file <manque> of a BESOIN sheet, from the root of the copy, and the package that holds it
|
|
1038
|
+
// (`.` the root), read on the components of the copy; null when it names no path of the copy.
|
|
1039
|
+
function fichierManquant(ctx, manque) {
|
|
1040
|
+
const chemin = manque ? path.posix.normalize(manque.trim()) : '.';
|
|
1041
|
+
if (chemin === '.' || chemin.startsWith('..') || path.isAbsolute(chemin)) {
|
|
1042
|
+
return null;
|
|
1043
|
+
}
|
|
1044
|
+
try {
|
|
1045
|
+
const racine = existsSync(ctx.copie) ? ctx.copie : ctx.racine;
|
|
1046
|
+
const liste = paquetsDuLangage(langageDeLaCopie(racine), racine);
|
|
1047
|
+
return { chemin, paquet: paquetQuiTient(chemin, liste) };
|
|
1048
|
+
} catch {
|
|
1049
|
+
return null;
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
const dansLePlan = (ctx, paquet) => ctx.paquets.some(p => p === '.' || p === paquet);
|
|
1054
|
+
|
|
1055
|
+
// What the question of a BESOIN stop adds on the file <manque> out of the plan, or null.
|
|
1056
|
+
function questionDuManque(ctx, manque) {
|
|
1057
|
+
const f = fichierManquant(ctx, manque);
|
|
1058
|
+
if (!f || dansLePlan(ctx, f.paquet)) {
|
|
1059
|
+
return null;
|
|
1060
|
+
}
|
|
1061
|
+
return f.paquet === '.'
|
|
1062
|
+
? `${f.chemin} est à la racine du dépôt, hors du plan du ticket : aucun paquet ne le porte, l’écriture est-elle refusée (\`--reprendre\` avec son contexte) ?`
|
|
1063
|
+
: `${f.chemin} est dans ${f.paquet}, hors du plan du ticket : le plan s’étend-il à ce paquet (\`--etendre ${f.paquet}\`), ou l’écriture est-elle refusée (\`--reprendre\` avec son contexte) ?`;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
// The extension of the plan the file <manque> of a BESOIN sheet of <role> calls for without a
|
|
1067
|
+
// question: `{ etendre: { paquet, chemin, piece } }` for a file the ticket's description names,
|
|
1068
|
+
// `{ etendreTests: … }` for a test file of a reader package the testwriter asks for (the plan
|
|
1069
|
+
// extends to its tests alone), null for any other (the root and the documents the responsable
|
|
1070
|
+
// owns among them), which goes up.
|
|
1071
|
+
function extensionDemandee(ctx, role, manque) {
|
|
1072
|
+
const f = fichierManquant(ctx, manque);
|
|
1073
|
+
if (!f || f.paquet === '.' || dansLePlan(ctx, f.paquet)) {
|
|
1074
|
+
return null;
|
|
1075
|
+
}
|
|
1076
|
+
const nomme = fichierNommeAuTicket(leTicket(ctx).description, f.chemin);
|
|
1077
|
+
if (nomme) {
|
|
1078
|
+
return { etendre: { ...f, piece: nomme.piece } };
|
|
1079
|
+
}
|
|
1080
|
+
if (role !== 'testwriter' || (ctx.testsEtendus ?? []).includes(f.paquet)) {
|
|
1081
|
+
return null;
|
|
1082
|
+
}
|
|
1083
|
+
const classe = rouleDeTest(ctx)(f.chemin);
|
|
1084
|
+
return classe?.test && !classe.matiere
|
|
1085
|
+
? {
|
|
1086
|
+
etendreTests: {
|
|
1087
|
+
...f,
|
|
1088
|
+
piece: `${f.chemin} est un fichier de test de ${f.paquet}, un paquet lecteur que le lot fait rougir`,
|
|
1089
|
+
},
|
|
1090
|
+
}
|
|
1091
|
+
: null;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
// The authors of the code, whose sheet answers each finding open for them.
|
|
1095
|
+
const REPONDENT = ['developpeur', 'direct'];
|
|
1096
|
+
|
|
940
1097
|
// The findings of the reviewer open for <role> among <constats>, as a session of the run whose
|
|
941
1098
|
// supervisor's context is <contexte> (`--contexte`, with `--depuis`, `--reprendre` or
|
|
942
1099
|
// `--etendre`) receives them, as a review its author relaunches on a change he frames keeps its
|
|
@@ -958,7 +1115,8 @@ export function constatsDeLaSeance(contexte, constats, role, destinataire = null
|
|
|
958
1115
|
const siens = (constats ?? []).filter(c => c.role === role);
|
|
959
1116
|
const anciens = siens.filter(c => c.enContexte);
|
|
960
1117
|
const neufs = siens.filter(c => !c.enContexte);
|
|
961
|
-
const
|
|
1118
|
+
const repondAuxConstats = REPONDENT.includes(role);
|
|
1119
|
+
const titres = repondAuxConstats ? neufs.map(c => c.titre) : [];
|
|
962
1120
|
const enContexte = `les constats ouverts au lancement de la passe du superviseur, donnés en contexte : ta tâche est celle du superviseur, ci-dessus ; chacun reste ouvert jusqu'à la relecture qui le juge levé, et ta fiche n'a pas à répondre à chacun`;
|
|
963
1121
|
const titre =
|
|
964
1122
|
'LES CONSTATS DU RELECTEUR QUI RESTENT OUVERTS pour ton rôle, ' +
|
|
@@ -979,7 +1137,7 @@ export function constatsDeLaSeance(contexte, constats, role, destinataire = null
|
|
|
979
1137
|
constats: texte,
|
|
980
1138
|
valider: f => reponsesAuxConstats(f, titres),
|
|
981
1139
|
repondre: (tous, fiche) =>
|
|
982
|
-
|
|
1140
|
+
repondAuxConstats && siens.length ? avecLesReponses(tous, fiche) : tous,
|
|
983
1141
|
};
|
|
984
1142
|
}
|
|
985
1143
|
|
|
@@ -993,13 +1151,13 @@ export const auLancement = (contexte, constats) =>
|
|
|
993
1151
|
return contexte ? { ...reste, enContexte: true } : reste;
|
|
994
1152
|
});
|
|
995
1153
|
|
|
996
|
-
// The findings <constats>, each finding of the
|
|
1154
|
+
// The findings <constats>, each finding of the author of the code that his sheet <fiche> answers (by its
|
|
997
1155
|
// title, numbered or not: `cleDuConstat`) with its answer `{ etat, raison, piece }`, as a thread
|
|
998
1156
|
// of a review keeps the author's reply under its comment.
|
|
999
1157
|
function avecLesReponses(constats, fiche) {
|
|
1000
1158
|
const parTitre = new Map((fiche.reponses ?? []).map(r => [cleDuConstat(r.titre), r]));
|
|
1001
1159
|
return (constats ?? []).map(c => {
|
|
1002
|
-
const r = c.role
|
|
1160
|
+
const r = REPONDENT.includes(c.role) ? parTitre.get(c.titre) : undefined;
|
|
1003
1161
|
if (!r) {
|
|
1004
1162
|
return c;
|
|
1005
1163
|
}
|
|
@@ -1010,65 +1168,9 @@ function avecLesReponses(constats, fiche) {
|
|
|
1010
1168
|
});
|
|
1011
1169
|
}
|
|
1012
1170
|
|
|
1013
|
-
// The
|
|
1014
|
-
// (
|
|
1015
|
-
function ecritureRangee(rang) {
|
|
1016
|
-
return existsSync(rang.horsPlanFait) ? JSON.parse(lire(rang.horsPlanFait)) : null;
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
// The launch <r> of a session of <role>: `{ etendre: { paquet, chemin, piece } }` for a write out
|
|
1020
|
-
// of the plan in a file the ticket names (the plan extends, the session resumes), nothing for a
|
|
1021
|
-
// session that went its way, or the Arret it is: a session its lock stopped on a
|
|
1022
|
-
// write out of the plan (« hors-plan », the write as its piece), a motionless session
|
|
1023
|
-
// (« bloqué »), a launch that stops before its session (« lancement »).
|
|
1171
|
+
// The launch <r> of a session of <role>: nothing for a session that went its way, or the Arret it
|
|
1172
|
+
// is: a motionless session (« bloqué »), a launch that stops before its session (« lancement »).
|
|
1024
1173
|
export function seanceLancee(ctx, role, r) {
|
|
1025
|
-
if (r.horsPlan) {
|
|
1026
|
-
// The lock's structured write: the first line of the report names the path and its package;
|
|
1027
|
-
// the question carries the command (none for the root, which no package holds).
|
|
1028
|
-
const ecriture = r.ecriture;
|
|
1029
|
-
// A file the ticket's description names (its « Architecture » or a criterion) extends the plan
|
|
1030
|
-
// to its package without a stop; the root, and the documents the responsable owns, still go up.
|
|
1031
|
-
// A ticket that does not read names nothing: the stop goes up as it did.
|
|
1032
|
-
let nomme = null;
|
|
1033
|
-
if (ecriture && !ecriture.racine && typeof ctx.bd === 'function') {
|
|
1034
|
-
try {
|
|
1035
|
-
nomme = fichierNommeAuTicket(leTicket(ctx).description, ecriture.chemin);
|
|
1036
|
-
} catch {
|
|
1037
|
-
nomme = null;
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
if (nomme) {
|
|
1041
|
-
return {
|
|
1042
|
-
etendre: { paquet: ecriture.paquet, chemin: ecriture.chemin, piece: nomme.piece },
|
|
1043
|
-
};
|
|
1044
|
-
}
|
|
1045
|
-
// A test file of a reader package, written by the testwriter, extends the plan to the tests of
|
|
1046
|
-
// that package alone, without a stop: its code stays out of the plan, and no other role writes it.
|
|
1047
|
-
if (role === 'testwriter' && ecriture && !ecriture.racine) {
|
|
1048
|
-
const classe = rouleDeTest(ctx)(ecriture.chemin);
|
|
1049
|
-
if (classe?.test && !classe.matiere) {
|
|
1050
|
-
return {
|
|
1051
|
-
etendreTests: {
|
|
1052
|
-
paquet: ecriture.paquet,
|
|
1053
|
-
chemin: ecriture.chemin,
|
|
1054
|
-
piece: `${ecriture.chemin} est un fichier de test de ${ecriture.paquet}, un paquet lecteur que le lot fait rougir`,
|
|
1055
|
-
},
|
|
1056
|
-
};
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
const nom = ecriture ? (ecriture.racine ? 'la racine du dépôt' : ecriture.paquet) : null;
|
|
1060
|
-
const dit = ecriture ? `${ecriture.chemin} est dans ${nom}` : null;
|
|
1061
|
-
const question = !ecriture
|
|
1062
|
-
? null
|
|
1063
|
-
: ecriture.racine
|
|
1064
|
-
? `La séance écrit ${ecriture.chemin}, que tient la racine du dépôt, hors du plan du ticket : aucun paquet ne le porte, l'écriture est-elle refusée (\`--reprendre\` avec son contexte) ?`
|
|
1065
|
-
: `La séance écrit ${ecriture.chemin}, que tient ${ecriture.paquet}, hors du plan du ticket : le plan s'étend-il à ce paquet (\`--etendre ${ecriture.paquet}\`), ou l'écriture est-elle refusée (\`--reprendre\` avec son contexte) ?`;
|
|
1066
|
-
throw new Arret(
|
|
1067
|
-
'hors-plan',
|
|
1068
|
-
`${dit ? `${dit}, hors du plan du ticket (ses paquets : ${ctx.paquets.join(', ')}).\n\n` : ''}Le crochet de la séance du ${nomDuRole(role)} l'arrête sur une écriture hors du plan du ticket (ses paquets : ${ctx.paquets.join(', ')}) :\n\n${r.horsPlan}`,
|
|
1069
|
-
{ piece: r.horsPlan, ...(question ? { question } : {}) }
|
|
1070
|
-
);
|
|
1071
|
-
}
|
|
1072
1174
|
if (r.bloque) {
|
|
1073
1175
|
const minutes = Math.round(ctx.immobileMs / 60_000);
|
|
1074
1176
|
throw new Arret(
|
|
@@ -1196,9 +1298,10 @@ export async function jusquALaFiche(ctx, role, texte, options = {}) {
|
|
|
1196
1298
|
}
|
|
1197
1299
|
reste.signeDeVie?.(vie);
|
|
1198
1300
|
};
|
|
1199
|
-
// The instruction of a resumption after the plan extended to a
|
|
1200
|
-
// session goes on
|
|
1301
|
+
// The instruction of a resumption after the plan extended to the file a BESOIN sheet names: the
|
|
1302
|
+
// session goes on, and the launch is neither a first nor a second. Each package extends once.
|
|
1201
1303
|
let etendu = null;
|
|
1304
|
+
const etendus = new Set();
|
|
1202
1305
|
// Whether the session already launched afresh for want of a conversation to resume, and
|
|
1203
1306
|
// whether this call launched it: the launch of a dead attempt is taken up as it is (`lancer`).
|
|
1204
1307
|
let repartie = false;
|
|
@@ -1237,10 +1340,12 @@ export async function jusquALaFiche(ctx, role, texte, options = {}) {
|
|
|
1237
1340
|
});
|
|
1238
1341
|
lancee = true;
|
|
1239
1342
|
etendu = null;
|
|
1343
|
+
// The lot of the session, judged as soon as it ends, whatever it ends on.
|
|
1344
|
+
const hors = estJuge(role, reste.horsEnveloppe) ? jugerLeLot(ctx, role) : null;
|
|
1240
1345
|
// The usage limit stops a session that does not end on its own: neither a sheet missing nor a
|
|
1241
1346
|
// sheet to resume, the circuit waits for the hour the usage returns (« limite-d-usage »).
|
|
1242
1347
|
const limite =
|
|
1243
|
-
|
|
1348
|
+
r.seance !== 0
|
|
1244
1349
|
? limiteDUsage({ resultat: r.sortie, journal: finDuJournal(ctx, avantLeJournal) })
|
|
1245
1350
|
: null;
|
|
1246
1351
|
if (limite) {
|
|
@@ -1250,23 +1355,7 @@ export async function jusquALaFiche(ctx, role, texte, options = {}) {
|
|
|
1250
1355
|
{ resultat: limite }
|
|
1251
1356
|
);
|
|
1252
1357
|
}
|
|
1253
|
-
|
|
1254
|
-
const extensionDesTests = suite?.etendreTests;
|
|
1255
|
-
if (extensionDesTests) {
|
|
1256
|
-
ctx.etendreTestsEnVol(extensionDesTests);
|
|
1257
|
-
courante = r.id ?? courante;
|
|
1258
|
-
etendu = `Le plan du ticket s'étend aux tests de ${extensionDesTests.paquet} (${extensionDesTests.piece}) : le crochet qui t'a arrêté sur ${extensionDesTests.chemin} le laisse maintenant passer, les fichiers de test de ce paquet seuls ; son code reste hors du plan. Reprends ta tâche là où il t'a arrêté.`;
|
|
1259
|
-
essai--;
|
|
1260
|
-
continue;
|
|
1261
|
-
}
|
|
1262
|
-
const extension = suite?.etendre;
|
|
1263
|
-
if (extension) {
|
|
1264
|
-
ctx.etendreEnVol(extension);
|
|
1265
|
-
courante = r.id ?? courante;
|
|
1266
|
-
etendu = `Le plan du ticket s'étend à ${extension.paquet} (${extension.piece}) : le crochet qui t'a arrêté sur ${extension.chemin} le laisse maintenant passer. Reprends ta tâche là où il t'a arrêté.`;
|
|
1267
|
-
essai--;
|
|
1268
|
-
continue;
|
|
1269
|
-
}
|
|
1358
|
+
seanceLancee(ctx, role, r);
|
|
1270
1359
|
courante = r.id ?? courante;
|
|
1271
1360
|
if (repli && r.seance !== 0) {
|
|
1272
1361
|
return null;
|
|
@@ -1282,6 +1371,25 @@ export async function jusquALaFiche(ctx, role, texte, options = {}) {
|
|
|
1282
1371
|
if (faute) {
|
|
1283
1372
|
lu = { erreur: lu.erreur ? `${lu.erreur} ; ${faute}` : `fiche non conforme : ${faute}` };
|
|
1284
1373
|
}
|
|
1374
|
+
// A role that writes nothing leaves an empty lot: its files go to the one resumption too.
|
|
1375
|
+
if (hors && reste.horsEnveloppe) {
|
|
1376
|
+
lu = { erreur: [lu.erreur, hors.rapport].filter(Boolean).join(' ; ') };
|
|
1377
|
+
}
|
|
1378
|
+
if (lu.fiche?.statut === 'BESOIN' && lu.fiche.manque && !reste.horsEnveloppe) {
|
|
1379
|
+
const demande = extensionDemandee(ctx, role, lu.fiche.manque);
|
|
1380
|
+
const extension = demande?.etendre ?? demande?.etendreTests;
|
|
1381
|
+
const etendre = demande?.etendre ? ctx.etendreEnVol : ctx.etendreTestsEnVol;
|
|
1382
|
+
if (extension && etendre && !etendus.has(extension.paquet)) {
|
|
1383
|
+
etendus.add(extension.paquet);
|
|
1384
|
+
garder(ctx, role, lu.fiche, avec);
|
|
1385
|
+
etendre(extension);
|
|
1386
|
+
etendu = demande.etendre
|
|
1387
|
+
? `Le plan du ticket s'étend à ${extension.paquet} (${extension.piece}) : ${extension.chemin} s'écrit maintenant. Reprends ta tâche là où tu l'as laissée.`
|
|
1388
|
+
: `Le plan du ticket s'étend aux tests de ${extension.paquet} (${extension.piece}) : ${extension.chemin} s'écrit maintenant, les fichiers de test de ce paquet seuls ; son code reste hors du plan. Reprends ta tâche là où tu l'as laissée.`;
|
|
1389
|
+
essai--;
|
|
1390
|
+
continue;
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1285
1393
|
if (lu.fiche) {
|
|
1286
1394
|
// The session that gave it, which a resumption of it names (the plan's answer).
|
|
1287
1395
|
surLaSeance(courante);
|
|
@@ -1291,12 +1399,16 @@ export async function jusquALaFiche(ctx, role, texte, options = {}) {
|
|
|
1291
1399
|
commenter(ctx, role, `séance finie sans fiche conforme : ${lu.erreur} ; reprise une fois.`);
|
|
1292
1400
|
}
|
|
1293
1401
|
}
|
|
1294
|
-
throw
|
|
1402
|
+
throw arretQuiSeDit(
|
|
1295
1403
|
'sans-fiche',
|
|
1296
1404
|
`Deux fois, la séance du ${nomDuRole(role)} finit sans fiche conforme : ${lu.erreur}. Le journal du ticket : ${ctx.journal} (il se cite en pièce, \`${ctx.ticket}.log:<ligne>\`)`
|
|
1297
1405
|
);
|
|
1298
1406
|
}
|
|
1299
1407
|
|
|
1408
|
+
// The stop <nom> whose error message says its report too, for a caller that reads the error alone.
|
|
1409
|
+
const arretQuiSeDit = (nom, rapport) =>
|
|
1410
|
+
Object.assign(new Arret(nom, rapport), { message: `${nom} : ${rapport}` });
|
|
1411
|
+
|
|
1300
1412
|
// The sheet of schema <sorte> (a role's, or the tri's) in the output <sortie> of its session
|
|
1301
1413
|
// (`lireFiche`), each file piece of it checked in the ticket's copy, or in the main tree before the
|
|
1302
1414
|
// copy exists and once the integration removed it, and each piece of the ticket in its description.
|
|
@@ -1330,6 +1442,205 @@ export function garder(ctx, role, fiche, avec) {
|
|
|
1330
1442
|
return fiche;
|
|
1331
1443
|
}
|
|
1332
1444
|
|
|
1445
|
+
// The judgment of the lot (machine.md §5.5), as CODEOWNERS judges a change by the files it
|
|
1446
|
+
// touches, whatever tool wrote them. The lot of a session is what it creates, changes or removes
|
|
1447
|
+
// in the folder it works in, read on content between the tree the folder held before it (`avant`,
|
|
1448
|
+
// which lancer.sh takes once the copy is prepared; else the circuit's, before the launch) and the
|
|
1449
|
+
// tree it holds after it, `.beads/`, the files git ignores and the circuit's copies aside. In the
|
|
1450
|
+
// main tree, which others write, each session is judged on what changes during it, a commit
|
|
1451
|
+
// entered meanwhile aside. In a ticket's copy, a commit of the session takes nothing out of the
|
|
1452
|
+
// lot, and a faulty file stays named until it is back to its state before the session that
|
|
1453
|
+
// changed it (or to main's, once main changed it): the circuit keeps them by role in the working
|
|
1454
|
+
// directory of the ticket (`lot-<rôle>.json`: the session under way `enCours`, the faulty files
|
|
1455
|
+
// `fautifs`), so that neither a session that leaves them nor an act played again lets them pass.
|
|
1456
|
+
// The judgment runs on the installed frame; it reads the languages of the copy, else, when they do
|
|
1457
|
+
// not load there, those of the main tree, and it fails closed when neither loads.
|
|
1458
|
+
|
|
1459
|
+
// The authors of a circuit whose lot is judged on their rule; the agent direct writes tests and
|
|
1460
|
+
// code, and its lot is not judged. Every other judged session writes nothing: an empty lot.
|
|
1461
|
+
const AUTEURS_JUGES = new Set(['testwriter', 'developpeur']);
|
|
1462
|
+
|
|
1463
|
+
const estJuge = (role, horsEnveloppe) => Boolean(horsEnveloppe) || AUTEURS_JUGES.has(role);
|
|
1464
|
+
|
|
1465
|
+
// The head of the report of a lot out of the rule.
|
|
1466
|
+
const TITRE_DU_LOT = 'Le lot de la séance sort de la règle de son rôle';
|
|
1467
|
+
|
|
1468
|
+
const REGLES_DU_LOT = {
|
|
1469
|
+
testwriter:
|
|
1470
|
+
'le testwriter n’écrit que ses fichiers de test, la matière de test partagée, la part de ses tests d’un manifeste et les fichiers de verrou des versions',
|
|
1471
|
+
developpeur: 'le développeur n’écrit ni un fichier de test ni la matière de test partagée',
|
|
1472
|
+
};
|
|
1473
|
+
|
|
1474
|
+
const fichierDuLot = (ctx, role) => path.join(ctx.tmp, `lot-${role}.json`);
|
|
1475
|
+
|
|
1476
|
+
const lotGarde = (ctx, role) =>
|
|
1477
|
+
existsSync(fichierDuLot(ctx, role))
|
|
1478
|
+
? JSON.parse(lire(fichierDuLot(ctx, role)))
|
|
1479
|
+
: { depot: null, enCours: null, fautifs: {} };
|
|
1480
|
+
|
|
1481
|
+
const garderLeLot = (ctx, role, lot) => {
|
|
1482
|
+
mkdirSync(ctx.tmp, { recursive: true });
|
|
1483
|
+
writeFileSync(fichierDuLot(ctx, role), `${JSON.stringify(lot)}\n`);
|
|
1484
|
+
};
|
|
1485
|
+
|
|
1486
|
+
const estLArbrePrincipal = (ctx, depot) => path.resolve(depot) === path.resolve(ctx.racine);
|
|
1487
|
+
|
|
1488
|
+
const teteDe = depot =>
|
|
1489
|
+
spawnSync('git', ['-C', depot, 'rev-parse', 'HEAD'], { encoding: 'utf8' }).stdout.trim();
|
|
1490
|
+
|
|
1491
|
+
// Notes the session <id> of <role> about to work in <depot>, the tree it holds now.
|
|
1492
|
+
function ouvrirLeLot(ctx, role, { id, horsEnveloppe, depot }) {
|
|
1493
|
+
const lot = lotGarde(ctx, role);
|
|
1494
|
+
garderLeLot(ctx, role, {
|
|
1495
|
+
depot,
|
|
1496
|
+
enCours: {
|
|
1497
|
+
id,
|
|
1498
|
+
horsEnveloppe: Boolean(horsEnveloppe),
|
|
1499
|
+
avant: existsSync(depot) ? photographier(depot) : null,
|
|
1500
|
+
principal: teteDe(ctx.racine),
|
|
1501
|
+
},
|
|
1502
|
+
fautifs: estLArbrePrincipal(ctx, depot) ? {} : lot.fautifs,
|
|
1503
|
+
});
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
// The tree the session `enCours` started from: the launcher's, taken after its preparation; else
|
|
1507
|
+
// the circuit's, for a session out of the envelope, or one that ran to its end. Null for a launch
|
|
1508
|
+
// that stopped before its session.
|
|
1509
|
+
function avantLaSeance(ctx, enCours) {
|
|
1510
|
+
const rang = rangDeLaSeance(ctx, enCours.id);
|
|
1511
|
+
if (existsSync(rang.avant)) {
|
|
1512
|
+
return JSON.parse(lire(rang.avant));
|
|
1513
|
+
}
|
|
1514
|
+
return enCours.horsEnveloppe || existsSync(rang.fin) ? enCours.avant : null;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
/**
|
|
1518
|
+
* Judges the lot of <role> (the section's header): the session under way, once, then each faulty
|
|
1519
|
+
* file kept, on the tree the folder holds now. Returns `{ fichiers, rapport }`, or null for a lot
|
|
1520
|
+
* in the rule of its role. Throws an Arret when no tree says which languages judge the lot.
|
|
1521
|
+
* @returns {{ fichiers: string[], rapport: string } | null}
|
|
1522
|
+
*/
|
|
1523
|
+
function jugerLeLot(ctx, role) {
|
|
1524
|
+
const lot = lotGarde(ctx, role);
|
|
1525
|
+
const { depot, enCours } = lot;
|
|
1526
|
+
if (!depot || !existsSync(depot)) {
|
|
1527
|
+
return null;
|
|
1528
|
+
}
|
|
1529
|
+
const principal = estLArbrePrincipal(ctx, depot);
|
|
1530
|
+
const avant = enCours ? avantLaSeance(ctx, enCours) : null;
|
|
1531
|
+
const apres = avant || !principal ? photographier(depot) : null;
|
|
1532
|
+
if (avant && apres) {
|
|
1533
|
+
const entres = new Set(
|
|
1534
|
+
principal && avant.tete !== apres.tete
|
|
1535
|
+
? changements(depot, avant.tete, apres.tete).map(c => c.chemin)
|
|
1536
|
+
: []
|
|
1537
|
+
);
|
|
1538
|
+
for (const c of changements(depot, avant.arbre, apres.arbre)) {
|
|
1539
|
+
if (entres.has(c.chemin) && c.apres === etatDuFichier(depot, apres.tete, c.chemin)) {
|
|
1540
|
+
continue;
|
|
1541
|
+
}
|
|
1542
|
+
lot.fautifs[c.chemin] ??= { avant: c.avant, principal: enCours.principal };
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
if (apres) {
|
|
1546
|
+
for (const [chemin, f] of Object.entries(lot.fautifs)) {
|
|
1547
|
+
const etat = etatDuFichier(depot, apres.arbre, chemin);
|
|
1548
|
+
const faute =
|
|
1549
|
+
!principal && revenuAMain(ctx, chemin, f.principal, etat)
|
|
1550
|
+
? null
|
|
1551
|
+
: fauteDuFichier(ctx, role, depot, { chemin, avant: f.avant, apres: etat });
|
|
1552
|
+
if (faute) {
|
|
1553
|
+
f.parties = faute.parties;
|
|
1554
|
+
} else {
|
|
1555
|
+
delete lot.fautifs[chemin];
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
garderLeLot(ctx, role, { ...lot, enCours: null });
|
|
1560
|
+
const fautifs = Object.entries(lot.fautifs).sort(([a], [b]) => a.localeCompare(b));
|
|
1561
|
+
if (!fautifs.length) {
|
|
1562
|
+
return null;
|
|
1563
|
+
}
|
|
1564
|
+
const regle = REGLES_DU_LOT[role] ?? 'ce rôle n’écrit rien, son lot reste vide';
|
|
1565
|
+
const lignes = fautifs.map(
|
|
1566
|
+
([chemin, f]) =>
|
|
1567
|
+
`- ${chemin}${f.parties ? ` (hors de la part de ses tests : ${f.parties.join(', ')})` : ''}`
|
|
1568
|
+
);
|
|
1569
|
+
const geste = principal
|
|
1570
|
+
? 'D’autres écrivent l’arbre principal : défais seulement ce que tu as toi-même écrit.'
|
|
1571
|
+
: 'Remets chacun à son état d’avant la séance qui l’a changé.';
|
|
1572
|
+
return {
|
|
1573
|
+
fichiers: fautifs.map(([chemin]) => chemin),
|
|
1574
|
+
rapport: `${TITRE_DU_LOT} : ${regle}.\n${lignes.join('\n')}\n${geste}`,
|
|
1575
|
+
};
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
// Whether the file <chemin> of a copy, in the state <etat>, is back to main's after main changed it
|
|
1579
|
+
// since <depuis>: what the advance of the copy brings is no work of a session.
|
|
1580
|
+
function revenuAMain(ctx, chemin, depuis, etat) {
|
|
1581
|
+
const tete = teteDe(ctx.racine);
|
|
1582
|
+
return (
|
|
1583
|
+
tete !== depuis &&
|
|
1584
|
+
etatDuFichier(ctx.racine, tete, chemin) === etat &&
|
|
1585
|
+
etatDuFichier(ctx.racine, depuis, chemin) !== etat
|
|
1586
|
+
);
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
// What puts the change <c> of a file of <depot> out of the rule of <role>: `{ parties }`, the parts
|
|
1590
|
+
// of a manifest out of its tests' (null for a whole file), or null for a change in the rule.
|
|
1591
|
+
function fauteDuFichier(ctx, role, depot, c) {
|
|
1592
|
+
if (c.avant === c.apres) {
|
|
1593
|
+
return null;
|
|
1594
|
+
}
|
|
1595
|
+
const entier = { parties: null };
|
|
1596
|
+
if (!AUTEURS_JUGES.has(role)) {
|
|
1597
|
+
return entier;
|
|
1598
|
+
}
|
|
1599
|
+
return selonLesLangages(ctx, depot, (langage, racine) => {
|
|
1600
|
+
const abs = path.join(racine, c.chemin);
|
|
1601
|
+
const classe = langage.estUnTest(abs, racine);
|
|
1602
|
+
if (role === 'developpeur') {
|
|
1603
|
+
return classe ? entier : null;
|
|
1604
|
+
}
|
|
1605
|
+
// A reader package the plan extended to its tests: its test files alone.
|
|
1606
|
+
const lecteur = (ctx.testsEtendus ?? []).find(d => c.chemin.startsWith(`${d}/`));
|
|
1607
|
+
if (lecteur && !dansLePlan(ctx, lecteur)) {
|
|
1608
|
+
return classe?.test ? null : entier;
|
|
1609
|
+
}
|
|
1610
|
+
if (classe || langage.manifestes.verrous.includes(c.chemin)) {
|
|
1611
|
+
return null;
|
|
1612
|
+
}
|
|
1613
|
+
const parties =
|
|
1614
|
+
c.apres === null
|
|
1615
|
+
? null
|
|
1616
|
+
: langage.manifestes.horsDesTests(
|
|
1617
|
+
abs,
|
|
1618
|
+
racine,
|
|
1619
|
+
texteDeLEtat(depot, c.avant),
|
|
1620
|
+
texteDeLEtat(depot, c.apres)
|
|
1621
|
+
);
|
|
1622
|
+
return parties?.length === 0 ? null : { parties };
|
|
1623
|
+
});
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
// `juger(langage, racine)` on the languages of <depot>, else on those of the main tree; an Arret
|
|
1627
|
+
// that names the version of the frame, the two causes and the main tree when neither loads.
|
|
1628
|
+
function selonLesLangages(ctx, depot, juger) {
|
|
1629
|
+
try {
|
|
1630
|
+
return juger(langageDe(depot), depot);
|
|
1631
|
+
} catch (ici) {
|
|
1632
|
+
try {
|
|
1633
|
+
return juger(langageDe(ctx.racine), ctx.racine);
|
|
1634
|
+
} catch (la) {
|
|
1635
|
+
const { version } = JSON.parse(lire(path.join(import.meta.dirname, '..', 'package.json')));
|
|
1636
|
+
throw arretQuiSeDit(
|
|
1637
|
+
'inattendu',
|
|
1638
|
+
`Le lot n'est pas jugé, et l'étape ne passe pas : la version ${version} du cadre ne charge les langages ni de la copie (${depot} : ${ici.message}) ni de l'arbre principal (${ctx.racine} : ${la.message}). L'arbre principal se répare par le superviseur, hors séance d'agent.`
|
|
1639
|
+
);
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1333
1644
|
// The findings <constats> as an agent's instruction carries them, each under its heading, with
|
|
1334
1645
|
// what it holds, its body and its piece, numbered after <avant>; « aucun » without one.
|
|
1335
1646
|
export const texteDesOuverts = (constats, avant = 0) =>
|