@roomi-fields/grillhouse 0.25.3 → 0.25.5

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.
@@ -5,5 +5,5 @@
5
5
  "author": {
6
6
  "name": "Romain Peyrichou"
7
7
  },
8
- "version": "0.25.3"
8
+ "version": "0.25.5"
9
9
  }
@@ -52,7 +52,9 @@ nomme (les paquets du titre), la base des tickets et les sorties du module de so
52
52
  cache de Turborepo ; le `target/` et les magasins de cargo, sa maison `~/.cargo` et `~/.rustup`
53
53
  en lecture) ; `.git` reste en lecture seule, et la matière de test partagée s'écrit par le seul
54
54
  testwriter. Le plan se juge sur les composants du module (un paquet TypeScript, un crate, un
55
- paquet hors cadre) : un chemin du plan hors de tout composant écrit la racine, toute la copie. `GRILLHOUSE_ENVELOPPE` porte la liste aux commandes du
55
+ paquet hors cadre) : un chemin du plan hors de tout composant écrit la racine, toute la copie. Le
56
+ circuit résout les composants du titre sur la même liste (`paquetsDuLangage`) : un crate racine
57
+ est le composant `.`, nommé par son crate (osc-bridge). `GRILLHOUSE_ENVELOPPE` porte la liste aux commandes du
56
58
  cadre, qui construisent, jugent et écrivent ses seuls paquets. Une écriture hors du plan échoue
57
59
  au montage, et le verrou de l'agent arrête sa séance en nommant le paquet ; le circuit s'arrête à
58
60
  « hors-plan », une question pour le superviseur, qui étend le plan (`--etendre`) ou refuse. Comme la visibilité de Bazel et
@@ -216,7 +218,14 @@ d'une relance à l'autre, comme un fil de revue non résolu, jusqu'à ce que le
216
218
  levé ou accepte le lot. Comme l'auteur répond dans chaque fil d'une revue GitHub ou Gerrit, la
217
219
  fiche FAIT du développeur répond à chaque constat ouvert pour lui, par son titre (`reponses` :
218
220
  `levé` avec sa pièce, ou `contesté` avec sa raison et sa pièce) ; le circuit refuse une fiche à
219
- laquelle il en manque une (`reponsesAuxConstats`), garde chaque réponse avec son constat, et la
221
+ laquelle il en manque une (`reponsesAuxConstats`). Quand le superviseur relance avec son
222
+ contexte (`--contexte`, ou la question que `--etendre` y verse), comme une revue que son auteur
223
+ relance sur un changement qu'il cadre, la consigne porte ce contexte en tête, comme la tâche,
224
+ avant le ticket, le rapport et les constats ; les constats ouverts au lancement de la passe
225
+ (`enContexte`, `auLancement`) sont donnés en contexte, sans réponse exigée, et ceux qu'un
226
+ `RENDU` pose dans la passe restent la tâche, leur réponse exigée (`constatsDeLaSeance`,
227
+ BP 320.14.2.3 : le contexte après la règle des réponses, une séance qui ne travaille qu'un
228
+ constat ancien, sa fiche refusée, deux fois `sans-livraison`). Le circuit garde chaque réponse avec son constat, et la
220
229
  relecture suivante la lit sous lui (BP 320.21 : la cause de son choix dans une passation que le
221
230
  circuit ne lit pas, « la relecture n'a reçu aucune fiche du développeur », trois `RENDU`, puis
222
231
  l'arrêt). Le bilan compte par étape et par rôle. Ainsi un type change avec ses
@@ -316,6 +325,19 @@ que le ticket, comme l'espace de travail d'un pipeline ; aucun balayage n'y touc
316
325
  l'efface à la clôture, `npx grillhouse retirer-copie` avec la copie d'un ticket fermé sans
317
326
  intégration. Ainsi une séance qui survit à son circuit garde ce qu'il lui a remis.
318
327
 
328
+ **La nuit retire les copies finies** (`packages/grillhouse/scripts/copies-finies.mjs`) : après ses
329
+ étapes, quel que soit son verdict, la nuit passe chaque copie que `git worktree list` nomme, hors
330
+ l'arbre principal et sa propre copie, par `retirer-copie.sh` sans `--jetable`, comme une CI
331
+ nettoie ses espaces de travail à la fin d'un pipeline et comme `git worktree prune`, qu'elle joue
332
+ d'abord. Une copie dont les commits et le travail local sont tous entrés sur main, jugés par le
333
+ contenu comme le retrait juge le travail, part avec sa branche (main et une branche qu'une autre
334
+ copie tient restent) ; une copie refusée (commits ou travail non entrés, verrou) reste, et le
335
+ journal la nomme avec sa raison, le premier chemin non entré compris. Une copie qu'un circuit tient reste sans passer : son ticket en
336
+ cours, son dossier `.travail`, ou, pour la copie de l'intégration et celle de la file, leur
337
+ verrou ; des tickets en cours illisibles, ou lus au-delà d'une minute, gardent toutes les
338
+ copies. Le retrait ne change pas le verdict de la nuit. Ainsi aucune copie ne survit à l'entrée de
339
+ son contenu sur main (Grillhouse, 79 copies d'agents, 5,7 Go ; OSC Bridge, 4,4 Go).
340
+
319
341
  **Le circuit est un démon** (`packages/grillhouse/scripts/demon.mjs`) : comme daemon(3) et
320
342
  `setsid --fork`, `npx grillhouse circuit` lance
321
343
  un relais, qui lance le circuit dans une session à lui puis finit aussitôt ; le circuit n'est ni
@@ -349,10 +371,13 @@ jamais ; les grands tests de jour d'un projet s'inscrivent dans sa dette à la m
349
371
  apporte la garde (`npx grillhouse maj`, migration 0.25.0), sans qu'un test se réécrive. Un grand
350
372
  test de jour qui ne vérifie qu'un module en sort ainsi : ses cas se réécrivent en petits tests par
351
373
  l'interface du module (le plan de l'enveloppe, les options qu'un greffon laisse à Vitest, la
352
- configuration du jour et celle de la nuit, la fonction qui lit l'avancement), et ses cas que seul
353
- un grand test prouve (bwrap réel, une passe réelle de Turborepo et de Vitest) se déplacent tels
354
- quels en tests de nuit dans `packages/grillhouse-essais`. Ainsi le jour ne joue que des tests
355
- courts, et la dette des grands ne fait que baisser.
374
+ configuration du jour et celle de la nuit, la fonction qui lit l'avancement), le module recevant
375
+ en argument ce qu'il lit au dehors (la lecture de l'historique et les réponses de Beads du crochet
376
+ d'un commit par ticket, le git qui pose l'étiquette d'une sortie, les textes des interfaces et les
377
+ lecteurs du ticket de la garde des consommateurs), et ses cas que seul un grand test prouve (bwrap
378
+ réel, une passe réelle de Turborepo et de Vitest, un crochet ou une commande lancés dans un dépôt
379
+ git) se déplacent tels quels en tests de nuit dans `packages/grillhouse-essais`. Ainsi le jour ne
380
+ joue que des tests courts, et la dette des grands ne fait que baisser.
356
381
 
357
382
  **Les chemins des tests** (`packages/grillhouse/scripts/langages/typescript/chemins-des-tests.mjs`, une
358
383
  garde du cadre) : comme le bac à sable de Bazel, qui fait échouer un test qui lit une entrée non
@@ -511,8 +536,14 @@ demandent au projet, ses générateurs ; ses binaires (`binaires`), que `maj` in
511
536
  les fichiers sources laissent de côté et que `maj` écrit dans le `.gitignore`. Le module typescript vit sous
512
537
  `scripts/langages/typescript/` (`tests/temoins/repartition.json` range chaque fichier), ses tests
513
538
  sous `tests/unit/langages/typescript/` ; le module cargo sous `scripts/langages/cargo/` (les crates
514
- de `cargo metadata`, les tests par nextest puis les doctests, la vérification par cargo-deny,
515
- sous le verrou de la machine ; ses gardes, clippy, les frontières entre crates contre la liste
539
+ de `cargo metadata`, les tests par nextest puis les doctests, après la construction des cibles de
540
+ test de chaque crate (`cargo test --no-run`), une tâche `build` du verdict avec son journal, comme
541
+ la tâche `test` de Turborepo dépend de `build` : des tests qui ne compilent pas sont le rouge
542
+ « construction de <crate> » de la preuve du rouge, et se jouent aux contrôles ; la vérification par cargo-deny,
543
+ sous le verrou de la machine ; le refus, avant tout lancement de cargo, d'un espace dont git ne
544
+ suit pas le Cargo.lock, comme `npm ci` refuse un projet sans package-lock.json : les tests, la
545
+ vérification et la préparation le nomment en une ligne avec son geste (`git add Cargo.lock`), et
546
+ `maj` le laisse au projet (`aFaire` de sa part), sans jouer la vérification ; ses gardes, clippy, les frontières entre crates contre la liste
516
547
  permise du manifeste de l'espace de travail, `[workspace.metadata.grillhouse.frontieres]`, comme
517
548
  les `depConstraints` de Nx, et l'index des interfaces, qu'il engendre, chacune aussi une
518
549
  commande de son nom, que la ligne d'une garde rouge nomme), ses
package/docs/INTERFACE.md CHANGED
@@ -52,8 +52,10 @@ noyau, et chaque réponse décrit sans agir, sauf `verifier` d'un fichier engend
52
52
  `init`. `gabarit`, le dossier du gabarit d'un projet du langage, dont le `package.json` donne les
53
53
  scripts du cadre et les versions des outils (`templates/projet`, `templates/cargo`) ;
54
54
  `appliquer`, qui met le projet à la forme du langage, son `package.json` racine, que le noyau
55
- écrit après, et ses autres fichiers, et rend sa part du bilan, les lignes du rapport, s'il faut
56
- `npm install` avant la vérification et la ligne qui dit pourquoi un projet n'a pas de script
55
+ écrit après, et ses autres fichiers, et rend sa part du bilan, les lignes du rapport, ce qu'il
56
+ laisse au projet (`aFaire`, chaque ligne avec son geste, que `maj` écrit sur la sortie d'erreur
57
+ avant tout outil du langage, son code 1, sans jouer la vérification ; `cargo`, un Cargo.lock que
58
+ git ne suit pas), s'il faut `npm install` avant la vérification et la ligne qui dit pourquoi un projet n'a pas de script
57
59
  `verifier` ; `generateurs`, les générateurs que `maj` lance ensuite, chacun avec le fichier qu'il
58
60
  écrit ; `installation`, null sans binaires, sinon la commande qui liste les binaires installés
59
61
  (`{ <nom>: <version> }` en JSON) et celle qui en installe un, que le noyau lance par Node.
@@ -88,7 +90,9 @@ noyau, et chaque réponse décrit sans agir, sauf `verifier` d'un fichier engend
88
90
  `typescript`, un script `test:unit` dans son `package.json` ; `cargo`, un dossier `tests/`. Le circuit en tire les paquets du
89
91
  plan qui portent des tests, comme Bazel lit les cibles de test d'un paquet à leur genre.
90
92
  - `lecteurs` : les fournisseurs et les lecteurs, par le code, des éléments qu'un ticket nomme : son
91
- interface, ses imports, ses tests, ses types. Le relevé des composants touchés
93
+ interface, ses imports, ses tests, ses types ; ce que lit chaque composant (`lit`) et ce que
94
+ lisent ses tests (`parLesTests` : leurs imports ; `cargo`, ses dépendances de développement),
95
+ d'où `--etendre` tire l'ordre du plan. Le relevé des composants touchés
92
96
  (`composants-affectes`) y ajoute les chemins lus et l'architecture.
93
97
  - `touches` : les composants touchés depuis un commit, leurs dépendants, transitivement, et les
94
98
  fichiers hors de tout composant (`{ touches, dependants, horsGraphe }`), comme le
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomi-fields/grillhouse",
3
- "version": "0.25.3",
3
+ "version": "0.25.5",
4
4
  "description": "Roomi's Grillhouse: the frame's scripts, called by one command, grillhouse <sous-commande>",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -47,6 +47,10 @@
47
47
  // separated by commas: each one a path (`packages/<nom>`, or `.`), or the name of a package,
48
48
  // which becomes its directory (scripts/paquets.mjs), read in the ticket's copy when it exists,
49
49
  // else in the main tree. A name that names neither stops the call, exit 2, named.
50
+ // - A ticket whose description holds no « ## Architecture » section stops the call, exit 2, before
51
+ // step 1, with the reason of the developer's lock (`sansArchitecture`, scripts/verrous/
52
+ // verrou.mjs), the one rule both read: the code waits for the architecture, and the steps before
53
+ // it would be sessions lost. `--arreter` passes, the stop not depending on the ticket's content.
50
54
  // - Before the testwriter (a run that starts there), the plan (step 1 of scripts/etapes.mjs), as
51
55
  // an RFC: its author writes it after surveying what exists, a review reads it once, the author
52
56
  // answers once, and what stays open goes to who decides. One session of the explorateur out of
@@ -98,8 +102,8 @@
98
102
  // section absent without notes), both read with `bd show` at the session's launch, the report of
99
103
  // the step before (the proof, the reds of a check), the findings of the reviewer still open, the
100
104
  // last handover of the session's author at the ticket, for a developpeur without one yet the last
101
- // of the testwriter, else « aucune » (no verdict), the line `CONTEXTE :`: the text of
102
- // `--contexte`, for each agent of the run, and the references 4.2 regenerates, each with its
105
+ // of the testwriter, else « aucune » (no verdict), the text of `--contexte` at its head, as its
106
+ // task (`tache`), for each agent of the run, and the references 4.2 regenerates, each with its
103
107
  // files (`lesReferences`), so that no session stops on what the circuit writes itself (BP
104
108
  // 320.8: a developpeur, code and tests green, stopped on a ceiling, the debt and the index).
105
109
  // The session's own exit code is the one lancer.sh
@@ -376,7 +380,10 @@
376
380
  // in each thread of a review on GitHub or Gerrit, a sheet FAIT of the developpeur answers each
377
381
  // finding open for him, by its title, levé or contesté with its reason, with its piece
378
382
  // (`reponses`); a sheet without the answer to one is refused (`reponsesAuxConstats` of
379
- // scripts/resultats.mjs) and asked again once of the same session, and the answer is kept with
383
+ // scripts/resultats.mjs) and asked again once of the same session, except in a run whose
384
+ // supervisor gives the task (`--contexte`), where the findings open at its launch are the
385
+ // session's context and need no answer, a finding a RENDU states within the run still its task
386
+ // (`auLancement`, `constatsDeLaSeance`, BP 320.14.2.3), and the answer is kept with
380
387
  // its finding in the state until the next review (BP 320.21: the cause of his choice in a
381
388
  // handover the circuit does not read, three RENDU, then the stop); the rest of the lot it does not read again (its skill, « La relecture
382
389
  // bornée »). A blocking finding without a valid agent, or one that puts its criterion in
@@ -457,7 +464,8 @@
457
464
  // a stop « questionnement », it lets the plan pass as it is then (the supervisor
458
465
  // changed it or kept it), from the testwriter.
459
466
  // - `--depuis <testwriter|developpeur>` has the lot corrected: it plays the whole ticket from
460
- // that step, the text of `--contexte` on the line CONTEXTE of each agent of the run (after a stop
467
+ // that step, the text of `--contexte` the task at the head of each agent's instruction in the
468
+ // run, the reviewer's line CONTEXTE (after a stop
461
469
  // « integration », from the developpeur, the refusal as his report, the red to lift, as a merge
462
470
  // queue sends the lot back to its author with the log of its check; from the testwriter, the
463
471
  // refusal dropped), as a retry
@@ -467,7 +475,10 @@
467
475
  // no `--reprendre`, and names no component: a second name is a second ticket, exit 2.
468
476
  // - `--etendre <paquet>[,<paquet>…]` (each a path or a package name of the repository) extends the
469
477
  // plan: the circuit writes the title (`bd update --title`), each package gained before the first
470
- // package of the plan that depends on it (its package.json), else at its end, said at the ticket
478
+ // package of the plan that reads it, as the module of the language says (`lecteurs` of the
479
+ // join: the imports of a package of TypeScript, its tests' included, the dependencies of a
480
+ // crate, of development included), else at its end,
481
+ // said at the ticket
471
482
  // (`Circuit · plan : le superviseur étend le plan à …`); then the step under way resumes as
472
483
  // after `--reprendre`, on the plan extended, the question as its context with the text of
473
484
  // `--contexte`; a stop « sans-livraison » on the developpeur's sending to the testwriter
@@ -547,7 +558,11 @@ import { stripVTControlCharacters } from 'node:util';
547
558
  import { ecrireLeBilan } from './bilan.mjs';
548
559
  import { DEPUIS_LE_VERT } from './dernier-vert.mjs';
549
560
  import { commandesPermises, optionsDuRole } from './droits.mjs';
550
- import { ecrireLaListe, VARIABLE as VARIABLE_ENVELOPPE } from './enveloppe/paquets-du-plan.mjs';
561
+ import {
562
+ ecrireLaListe,
563
+ paquetsDuLangage,
564
+ VARIABLE as VARIABLE_ENVELOPPE,
565
+ } from './enveloppe/paquets-du-plan.mjs';
551
566
  import {
552
567
  AGENTS_DU_LOT,
553
568
  ARRETS,
@@ -564,7 +579,6 @@ import {
564
579
  RESPONSABLE,
565
580
  SUITE,
566
581
  } from './etapes.mjs';
567
- import { paquets } from './paquets.mjs';
568
582
  import { releve } from './composants-affectes.mjs';
569
583
  import { ecrire as ecrireAuRegistre, ligneDEtape, transcriptionsDeLaCopie } from './registre.mjs';
570
584
  import { FICHIER as DETTE } from './dette.mjs';
@@ -593,6 +607,7 @@ import { garderLeTotal, ouvrirAvancement } from './avancement.mjs';
593
607
  import { AVANCEMENT } from './mesure/avancement.mjs';
594
608
  import { nomsDesGardes } from './gardes-du-cadre.mjs';
595
609
  import { langageDe } from './langages.mjs';
610
+ import { sansArchitecture } from './verrous/verrou.mjs';
596
611
  import { A_REPASSER } from './mesure/pression.mjs';
597
612
  import { departDe, leMemeVivant, ouvrirBase, vivant } from './mesure/base-de-passe.mjs';
598
613
  import { GREFFON } from './cadre.mjs';
@@ -795,6 +810,39 @@ function arbrePrincipal() {
795
810
  return path.dirname(r.stdout.trim());
796
811
  }
797
812
 
813
+ // The components of the repository at <racine> as the module of its language gives them, and the
814
+ // packages out of the frame a plan may name (`paquetsDuLangage`, as the envelope reads them):
815
+ // `{ dossier, pkg: { name }, hors }`, `dossier` relative to <racine>, `.` for a component at its
816
+ // root (a crate whose workspace is its own, as OSC Bridge's).
817
+ export const composantsDe = racine => paquetsDuLangage(langageDe(racine), racine);
818
+
819
+ // The directory of the component <nom> of a title among <liste> (`composantsDe` of the repository
820
+ // at <base>): `.` itself; a component by its path or its name; else a path of the repository; or a
821
+ // Usage.
822
+ export function resoudreComposant(liste, base, nom) {
823
+ const brut = path.normalize(nom);
824
+ const norme = brut.endsWith('/') ? brut.slice(0, -1) : brut;
825
+ if (norme === '.') return '.';
826
+ if (liste.some(p => p.dossier === norme)) return norme;
827
+ const parNom = liste.find(p => p.pkg.name === nom);
828
+ if (parNom) return parNom.dossier;
829
+ if (!norme.startsWith('..') && existsSync(path.join(base, norme))) return norme;
830
+ throw new Usage(`le composant « ${nom} » du titre ne nomme ni un paquet ni un chemin du dépôt.`);
831
+ }
832
+
833
+ // The ticket <id> as `bd show --json` gives it in <sortie>, refused by a Usage when its description
834
+ // holds no « ## Architecture » section, by the rule of the developer's lock (`sansArchitecture`):
835
+ // the code waits for the architecture, so the circuit stops before its first session, as a CI
836
+ // validates its configuration before it runs its jobs. The supervisor's stop (<arreter>,
837
+ // `--arreter`) passes: it does not depend on the ticket's content, as GitLab cancels a pipeline
838
+ // whatever its configuration; `--reprendre` and `--etendre` keep the check.
839
+ export function ticketAuDepart(id, sortie, { arreter = false } = {}) {
840
+ const t = JSON.parse(sortie)[0];
841
+ const refus = arreter ? null : sansArchitecture(id, t?.description);
842
+ if (refus) throw new Usage(refus);
843
+ return t;
844
+ }
845
+
798
846
  // The context of one run: the paths of the ticket, its plan, how the circuit speaks to bd.
799
847
  function contexte(o) {
800
848
  const racine = arbrePrincipal();
@@ -811,22 +859,10 @@ function contexte(o) {
811
859
  const bd = (...a) => bdSous(AUTEUR_DU_CIRCUIT, ...a);
812
860
  const show = bd('show', o.ticket, '--json');
813
861
  if (show.status !== 0) throw new Usage(`ticket ${o.ticket} illisible : ${show.stderr}`);
814
- const t = JSON.parse(show.stdout)[0];
862
+ const t = ticketAuDepart(o.ticket, show.stdout, { arreter: Boolean(o.arreter) });
815
863
  const base = existsSync(copie) ? copie : racine;
816
- const liste = paquets(base);
817
- const resoudre = nom => {
818
- if (nom === '.') return '.';
819
- const norme = path.normalize(nom).endsWith('/')
820
- ? path.normalize(nom).slice(0, -1)
821
- : path.normalize(nom);
822
- if (liste.some(p => p.dossier === norme)) return norme;
823
- const parNom = liste.find(p => p.pkg.name === nom);
824
- if (parNom) return parNom.dossier;
825
- if (!norme.startsWith('..') && existsSync(path.join(base, norme))) return norme;
826
- throw new Usage(
827
- `le composant « ${nom} » du titre ne nomme ni un paquet ni un chemin du dépôt.`
828
- );
829
- };
864
+ const liste = composantsDe(base);
865
+ const resoudre = nom => resoudreComposant(liste, base, nom);
830
866
  // The subject of the title <titre>, « numéro — sujet — composants », and the packages of its
831
867
  // plan, its components, each a directory of the repository; or a Usage.
832
868
  const duTitre = titre => {
@@ -1244,7 +1280,7 @@ async function attendreLaSeance(ctx, groupe) {
1244
1280
  // developpeur's on a resumption, 4 the questionneur's on the plan, 5 the explorateur's on the plan,
1245
1281
  // 6 the explorateur's on the questions of the plan, 7 the explorateur's on the tri of the
1246
1282
  // discoveries), filled with <valeurs>.
1247
- function consigne(valeurs, rang = 0) {
1283
+ export function consigne(valeurs, rang = 0) {
1248
1284
  const texte = readFileSync(GABARIT, 'utf8');
1249
1285
  const bloc = [...texte.matchAll(/```text\n([\s\S]*?)\n```/g)][rang];
1250
1286
  if (!bloc) throw new Error(`gabarit sans bloc de consigne n° ${rang + 1} : ${GABARIT}`);
@@ -1260,23 +1296,24 @@ function consigne(valeurs, rang = 0) {
1260
1296
  // circuit keeps. A fresh session's instruction (the first
1261
1297
  // template) carries the ticket's description and notes as they are at its launch, the packages of
1262
1298
  // the plan, and the last handover of its author at the ticket. Every instruction, fresh or resumed,
1263
- // carries the findings of the reviewer still open for its role (`ctx.constats`), all of them,
1264
- // whatever the relaunch: a proof refused, red checks, a sending, a RENDU, a resumption of the
1265
- // supervisor; <change> says what changed on a resumption, when it is not the proof or the checks
1266
- // (the integration's refusal of the lot, `refus`); a developpeur's sheet FAIT answers each of his by its title (`reponsesAuxConstats`),
1267
- // refused without one, and the circuit keeps each answer with its finding (`avecLesReponses`).
1299
+ // carries the supervisor's context of the run at its head, as its task, and the findings of the
1300
+ // reviewer still open for its role (`ctx.constats`), all of them, whatever the relaunch: a proof
1301
+ // refused, red checks, a sending, a RENDU, a resumption of the supervisor (`constatsDeLaSeance`);
1302
+ // <change> says what changed on a resumption, when it is not the proof or the checks (the
1303
+ // integration's refusal of the lot, `refus`).
1268
1304
  // Throws an Arret for a launch that stops before its session, a motionless session, or
1269
1305
  // a session that ends twice without a sheet that conforms.
1270
1306
  async function seance(ctx, role, { tentative, rapport, fort, derniere, change }) {
1271
1307
  const nom = nomDuRole(role);
1272
1308
  const reprise = tentative > 1 && !derniere && ctx.reprise?.agent === role ? ctx.reprise : null;
1273
- const constats = texteDesOuverts(ouverts(ctx, role));
1309
+ const { tache, ouverts, constats, valider, repondre } = constatsDeLaSeance(
1310
+ ctx.contexte,
1311
+ ctx.constats,
1312
+ role
1313
+ );
1274
1314
  const plan = ctx.paquets.join(', ');
1275
- // A developpeur's sheet answers each finding open for him, kept with its finding.
1276
- const titres = role === 'developpeur' ? ouverts(ctx, role).map(c => c.titre) : [];
1277
- const valider = f => reponsesAuxConstats(f, titres);
1278
1315
  const repondu = fiche => {
1279
- if (fiche && titres.length) ctx.constats = avecLesReponses(ctx.constats, fiche);
1316
+ if (fiche) ctx.constats = repondre(ctx.constats, fiche);
1280
1317
  return fiche;
1281
1318
  };
1282
1319
  if (reprise) {
@@ -1292,6 +1329,8 @@ async function seance(ctx, role, { tentative, rapport, fort, derniere, change })
1292
1329
  ? 'la preuve du rouge, jouée après ta séance, refuse ton lot'
1293
1330
  : 'les contrôles, joués après ta séance, sont rouges'),
1294
1331
  rapport: rapport ?? 'aucun',
1332
+ tache,
1333
+ ouverts,
1295
1334
  constats,
1296
1335
  };
1297
1336
  const fiche = await jusquALaFiche(ctx, role, consigne(courte, 3), {
@@ -1326,13 +1365,14 @@ async function seance(ctx, role, { tentative, rapport, fort, derniere, change })
1326
1365
  lots: lots.length
1327
1366
  ? `${role === 'developpeur' ? 'le lot de tests' : 'tes tests'}, déjà dans la copie : ${lots.join(', ')}`
1328
1367
  : 'aucun',
1329
- contexte: contexteDe(ctx),
1368
+ tache,
1330
1369
  description: description.trim() || 'aucune',
1331
1370
  // The section of the ticket's notes, absent without notes.
1332
1371
  notes: notes.trim()
1333
1372
  ? `\nLES NOTES DU TICKET, l'état qu'un agent d'avant y a écrit :\n\n${notes.trim()}\n`
1334
1373
  : '',
1335
1374
  rapport: rapport ?? 'aucun',
1375
+ ouverts,
1336
1376
  constats,
1337
1377
  passation: passation?.text ?? 'aucune',
1338
1378
  references: lesReferences(ctx)
@@ -1342,6 +1382,53 @@ async function seance(ctx, role, { tentative, rapport, fort, derniere, change })
1342
1382
  return repondu(await jusquALaFiche(ctx, role, consigne(valeurs), { fort, neuve: role, valider }));
1343
1383
  }
1344
1384
 
1385
+ // The findings of the reviewer open for <role> among <constats>, as a session of the run whose
1386
+ // supervisor's context is <contexte> (`--contexte`, with `--depuis`, `--reprendre` or
1387
+ // `--etendre`) receives them, as a review its author relaunches on a change he frames keeps its
1388
+ // open threads in sight without blocking on them (BP 320.14.2.3: the context after the rule of
1389
+ // the answers, a session that worked an old finding only, its sheet refused, « sans-livraison »
1390
+ // twice). With a context, the context heads the instruction as its task (`tache`); the findings
1391
+ // open at the launch of the run (`enContexte`, `auLancement`) are its context, after the others
1392
+ // under their own heading, and a developpeur's sheet FAIT is not refused for want of an answer to
1393
+ // one of them; every other finding, without a context or stated by a RENDU within the run, is its
1394
+ // task, and his sheet FAIT answers each by its title, refused without one (`valider`,
1395
+ // `reponsesAuxConstats`). Either way, each answer a developpeur's sheet gives is kept with its
1396
+ // finding (`repondre`, `avecLesReponses`).
1397
+ export function constatsDeLaSeance(contexte, constats, role) {
1398
+ const siens = (constats ?? []).filter(c => c.role === role);
1399
+ const anciens = siens.filter(c => c.enContexte);
1400
+ const neufs = siens.filter(c => !c.enContexte);
1401
+ const titres = role === 'developpeur' ? neufs.map(c => c.titre) : [];
1402
+ 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`;
1403
+ const titre =
1404
+ 'LES CONSTATS DU RELECTEUR QUI RESTENT OUVERTS pour ton rôle, ' +
1405
+ (anciens.length && !neufs.length ? enContexte : "chacun jusqu'à la relecture qui le juge levé");
1406
+ const texte =
1407
+ anciens.length && neufs.length
1408
+ ? `${texteDesOuverts(neufs)}\n\nPUIS ${enContexte} :\n\n${texteDesOuverts(anciens, neufs.length)}`
1409
+ : texteDesOuverts(siens);
1410
+ return {
1411
+ tache: contexte
1412
+ ? `TA TÂCHE, que le superviseur te donne ; elle passe avant le ticket, le rapport${anciens.length ? ' et les constats donnés en contexte' : ''} ci-dessous :\n\n${contexte}\n\n`
1413
+ : '',
1414
+ ouverts: titre,
1415
+ constats: texte,
1416
+ valider: f => reponsesAuxConstats(f, titres),
1417
+ repondre: (tous, fiche) =>
1418
+ role === 'developpeur' && siens.length ? avecLesReponses(tous, fiche) : tous,
1419
+ };
1420
+ }
1421
+
1422
+ // The findings <constats> as a run launched with the supervisor's context <contexte> holds them:
1423
+ // each one open at its launch marked `enContexte`, as the threads already open when the author
1424
+ // relaunches a review on a change he frames; without a context, none. A finding a RENDU states
1425
+ // within the run comes without the mark (`constatsOuverts`), and is the session's task again.
1426
+ export const auLancement = (contexte, constats) =>
1427
+ (constats ?? []).map(c => {
1428
+ const { enContexte, ...reste } = c;
1429
+ return contexte ? { ...reste, enContexte: true } : reste;
1430
+ });
1431
+
1345
1432
  // The findings <constats>, each finding of the developpeur that his sheet <fiche> answers (by its
1346
1433
  // title) with its answer `{ etat, raison, piece }`, as a thread of a review keeps the author's
1347
1434
  // reply under its comment.
@@ -1357,8 +1444,8 @@ function avecLesReponses(constats, fiche) {
1357
1444
  });
1358
1445
  }
1359
1446
 
1360
- // The line CONTEXTE of a session: the text of `--contexte` of the run, which every session of the
1361
- // run receives; « aucun » without it.
1447
+ // The line CONTEXTE of a reviewer's session: the text of `--contexte` of the run; « aucun »
1448
+ // without it.
1362
1449
  const contexteDe = ctx => ctx.contexte || 'aucun';
1363
1450
 
1364
1451
  // The launch <r> of a session of <role>, or the Arret it is: a session its lock stopped on a
@@ -1450,10 +1537,10 @@ const lireSaFiche = (ctx, sorte, sortie) =>
1450
1537
  ticket: leTicket(ctx).description,
1451
1538
  });
1452
1539
 
1453
- // The name of the package <dossier> as a title writes it: its package's name, or its path.
1454
- function nomDe(ctx, dossier) {
1455
- const liste = paquets(existsSync(ctx.copie) ? ctx.copie : ctx.racine);
1456
- return liste.find(p => p.dossier === dossier)?.pkg.name ?? dossier;
1540
+ // The name of each package of <dossiers> as a title writes it: its component's name, or its path.
1541
+ function nomsDe(ctx, dossiers) {
1542
+ const liste = composantsDe(existsSync(ctx.copie) ? ctx.copie : ctx.racine);
1543
+ return dossiers.map(d => liste.find(p => p.dossier === d)?.pkg.name ?? d);
1457
1544
  }
1458
1545
 
1459
1546
  // The sheet <fiche> of <role>, kept with the ticket's sheets, <avec> joined to its entry, each of
@@ -1462,7 +1549,7 @@ function nomDe(ctx, dossier) {
1462
1549
  // and its subject), which the tri reads; returns it.
1463
1550
  function garder(ctx, role, fiche, avec = {}) {
1464
1551
  inscrire(ctx, { role, fiche, ...avec });
1465
- const composants = ctx.paquets.map(c => nomDe(ctx, c)).join(', ');
1552
+ const composants = nomsDe(ctx, ctx.paquets).join(', ');
1466
1553
  for (const d of fiche.decouvertes ?? []) {
1467
1554
  const r = spawnSync(
1468
1555
  'bash',
@@ -2052,13 +2139,13 @@ function renvoiDe(ctx, fiche) {
2052
2139
  const ouverts = (ctx, role) => (ctx.constats ?? []).filter(c => c.role === role);
2053
2140
 
2054
2141
  // The findings <constats> as an agent's instruction carries them, each under its heading, with
2055
- // what it holds, its body and its piece; « aucun » without one.
2056
- const texteDesOuverts = constats =>
2142
+ // what it holds, its body and its piece, numbered after <avant>; « aucun » without one.
2143
+ const texteDesOuverts = (constats, avant = 0) =>
2057
2144
  constats.length
2058
2145
  ? constats
2059
2146
  .map(
2060
2147
  (c, i) =>
2061
- `### Constat ${i + 1} — ${c.titre}\nBloquant : ${c.regle}\n${c.corps}${c.piece ? `\nPièce : ${c.piece}` : ''}`
2148
+ `### Constat ${avant + i + 1} — ${c.titre}\nBloquant : ${c.regle}\n${c.corps}${c.piece ? `\nPièce : ${c.piece}` : ''}`
2062
2149
  )
2063
2150
  .join('\n\n')
2064
2151
  : 'aucun';
@@ -2067,11 +2154,12 @@ const texteDesOuverts = constats =>
2067
2154
  // review stay open until the review that resolves them: each blocking finding of the sheet (a
2068
2155
  // remark reaches the ticket, no agent; the sheet's schema gives a RENDU at least one), after each
2069
2156
  // finding open before it that the sheet neither marks lifted (`suivi`, by its title) nor states
2070
- // again. Each one `{ titre, regle, role, corps, piece }`, its recipient the agent it names, testwriter or
2157
+ // again, which keeps its mark `enContexte` (`auLancement`), a finding the sheet states coming
2158
+ // without it. Each one `{ titre, regle, role, corps, piece }`, its recipient the agent it names, testwriter or
2071
2159
  // developpeur, without the developpeur's answer to the review before (`reponse`): his next sheet
2072
2160
  // answers it again. Throws an Arret `relecture-arret` for a finding without a valid recipient or one
2073
2161
  // that puts a criterion in question.
2074
- function constatsOuverts(ctx, fiche, texte) {
2162
+ export function constatsOuverts(ctx, fiche, texte) {
2075
2163
  const arret = raison =>
2076
2164
  new Arret('relecture-arret', `${raison}\n\nLe verdict :\n\n${texte}`, { piece: raison });
2077
2165
  const neufs = bloquants(fiche).map(c => {
@@ -2347,10 +2435,11 @@ const TYPES_DE_COMMIT = { bug: 'fix', chore: 'chore', docs: 'docs' };
2347
2435
  // plan by their name; then the message the sheets of the developpeur and of the reviewer give, in
2348
2436
  // their order, written once from the final state (`messageDuLot`).
2349
2437
  function messageDeCommit(ctx) {
2350
- const liste = paquets(existsSync(ctx.copie) ? ctx.copie : ctx.racine);
2351
- const noms = ctx.paquets
2352
- .filter(c => c !== '.')
2353
- .map(c => liste.find(p => p.dossier === c)?.pkg.name ?? path.basename(c));
2438
+ const liste = composantsDe(existsSync(ctx.copie) ? ctx.copie : ctx.racine);
2439
+ const noms = ctx.paquets.flatMap(c => {
2440
+ const nom = liste.find(p => p.dossier === c)?.pkg.name;
2441
+ return nom ? [nom] : c === '.' ? [] : [path.basename(c)];
2442
+ });
2354
2443
  const type = TYPES_DE_COMMIT[ctx.type] ?? 'feat';
2355
2444
  const portee = noms.length ? `(${noms.join(',')})` : '';
2356
2445
  return messageDuLot({
@@ -2613,7 +2702,7 @@ function preuve(ctx) {
2613
2702
  const injustifies = [];
2614
2703
  const casses = [];
2615
2704
  const neufs = [];
2616
- const liste = paquets(ctx.copie).filter(p => !p.hors);
2705
+ const liste = composantsDe(ctx.copie).filter(p => !p.hors);
2617
2706
  let anciens = 0;
2618
2707
  const reportes = [];
2619
2708
  const mesure = mesureDeLaPreuve(ctx, liste, fichiers);
@@ -2887,7 +2976,7 @@ const ligneDeCommande = c =>
2887
2976
  // at the final pass, each key of the debt a guard wrote inscribed above what it finds, `{ garde,
2888
2977
  // fichier, regle, trouve }`.
2889
2978
  function controles(ctx, finale, restreinte = null, reportes = null) {
2890
- const liste = paquets(ctx.copie).filter(p => !p.hors);
2979
+ const liste = composantsDe(ctx.copie).filter(p => !p.hors);
2891
2980
  const filtres = restreinte
2892
2981
  ? ['--', `--filter=...[${restreinte.avant}...${restreinte.apres}]`, '--filter=//']
2893
2982
  : [];
@@ -3083,7 +3172,7 @@ function paquetsDuPlan(ctx, liste) {
3083
3172
  // packages plays its tests at its root: each plan has them.
3084
3173
  function sansTests(ctx) {
3085
3174
  const racine = existsSync(ctx.copie) ? ctx.copie : ctx.racine;
3086
- const liste = paquets(racine).filter(p => !p.hors);
3175
+ const liste = composantsDe(racine).filter(p => !p.hors);
3087
3176
  if (liste.length === 0) return false;
3088
3177
  const touche = (c, d) => c === '.' || d === c || d.startsWith(`${c}/`) || c.startsWith(`${d}/`);
3089
3178
  return !liste.some(p => ctx.paquets.some(c => touche(c, p.dossier)) && joueDesTests(racine, p));
@@ -3914,7 +4003,7 @@ function decrireLePlan(description, criteres, questions) {
3914
4003
  function ecrireLePlan(ctx, plan, description = null) {
3915
4004
  const t = leTicket(ctx);
3916
4005
  const parts = t.titre.split(' — ');
3917
- const titre = [...parts.slice(0, -1), plan.map(c => nomDe(ctx, c)).join(', ')].join(' — ');
4006
+ const titre = [...parts.slice(0, -1), nomsDe(ctx, plan).join(', ')].join(' — ');
3918
4007
  const options = [
3919
4008
  ...(titre === t.titre ? [] : ['--title', titre]),
3920
4009
  ...(description === null || description === t.description ? [] : ['-d', description]),
@@ -4225,31 +4314,47 @@ async function arreter(ctx, e) {
4225
4314
  return 0;
4226
4315
  }
4227
4316
 
4228
- // The plan extended by the supervisor to the packages of `--etendre` (each a path or a package
4229
- // name of the repository, else a Usage): each one enters the title before the first package of
4230
- // the plan whose package.json depends on it, else at its end, written by bd and said at the
4231
- // ticket. With the state <e>, the run then resumes the step under way, as `--reprendre` does, the
4232
- // question of the stop and the text of `--contexte` as the context of its sessions; a stop
4233
- // « sans-livraison » whose developpeur's last sheet sends the red to the testwriter (`renvoi`,
4234
- // twice in a row) resumes at the step of the role it names, the testwriter's, as a retry plays the
4235
- // job that failed. Without a state, it starts on the plan extended. The state the run resumes
4236
- // from.
4237
- function etendre(ctx, e) {
4238
- const gagnes = [...new Set(ctx.etendre.map(ctx.resoudre))].filter(c => !ctx.paquets.includes(c));
4239
- const liste = paquets(existsSync(ctx.copie) ? ctx.copie : ctx.racine);
4240
- const pkg = c => liste.find(p => p.dossier === c)?.pkg ?? null;
4241
- const lit = (lecteur, fournisseur) => {
4242
- const nom = pkg(fournisseur)?.name;
4243
- const p = pkg(lecteur);
4244
- return Boolean(
4245
- nom && p && [p.dependencies, p.devDependencies, p.peerDependencies].some(d => d && nom in d)
4246
- );
4317
+ // The plan <paquets> of the repository at <base>, each a directory relative to it, extended by
4318
+ // <gagnes>: each one enters before the first package of the plan that reads it, as the module of
4319
+ // the language reads its components (`lecteurs` of the join, its `lit` and its `parLesTests`: the
4320
+ // imports of a package of TypeScript, its tests' included, the dependencies of a crate of cargo,
4321
+ // of development included), else at its end, as Pants asks the order of the targets of its
4322
+ // backends.
4323
+ export function ordonnerLePlan(base, paquets, gagnes) {
4324
+ const langage = langageDe(base);
4325
+ const composants = langage.composants(base);
4326
+ const { lit, parLesTests } = langage.lecteurs(base, {
4327
+ composants,
4328
+ noms: [],
4329
+ texte: '',
4330
+ nommes: [],
4331
+ });
4332
+ const de = d => composants.find(c => (path.relative(base, c.dossier) || '.') === d);
4333
+ const litLe = (lecteur, fournisseur) => {
4334
+ const l = de(lecteur);
4335
+ const f = de(fournisseur);
4336
+ return Boolean(l && f && (lit.get(l)?.has(f) || parLesTests.get(l)?.has(f)));
4247
4337
  };
4248
- const plan = [...ctx.paquets];
4338
+ const plan = [...paquets];
4249
4339
  for (const c of gagnes) {
4250
- const i = plan.findIndex(x => lit(x, c));
4340
+ const i = plan.findIndex(x => litLe(x, c));
4251
4341
  plan.splice(i < 0 ? plan.length : i, 0, c);
4252
4342
  }
4343
+ return plan;
4344
+ }
4345
+
4346
+ // The plan extended by the supervisor to the packages of `--etendre` (each a path or a package
4347
+ // name of the repository, else a Usage): each one enters the title in the order of
4348
+ // `ordonnerLePlan`, written by bd and said at the ticket. With the state <e>, the run then resumes
4349
+ // the step under way, as `--reprendre` does, the question of the stop and the text of
4350
+ // `--contexte` as the context of its sessions; a stop « sans-livraison » whose developpeur's last
4351
+ // sheet sends the red to the testwriter (`renvoi`, twice in a row) resumes at the step of the role
4352
+ // it names, the testwriter's, as a retry plays the job that failed. Without a state, it starts on
4353
+ // the plan extended. The state the run resumes from.
4354
+ function etendre(ctx, e) {
4355
+ const gagnes = [...new Set(ctx.etendre.map(ctx.resoudre))].filter(c => !ctx.paquets.includes(c));
4356
+ const base = existsSync(ctx.copie) ? ctx.copie : ctx.racine;
4357
+ const plan = ordonnerLePlan(base, ctx.paquets, gagnes);
4253
4358
  const titre = ecrireLePlan(ctx, plan);
4254
4359
  // The plan the supervisor extends has passed: it is written, questioned no more.
4255
4360
  inscrire(ctx, {
@@ -4302,6 +4407,9 @@ export async function main(argv) {
4302
4407
  throw new Usage(`--etendre : le lot de ${ctx.ticket} est intégré.`);
4303
4408
  e = etendre(ctx, e);
4304
4409
  }
4410
+ // The findings open at the launch of a run with the supervisor's context (`--contexte`, or the
4411
+ // question `--etendre` gives it) are its sessions' context; without one, their task.
4412
+ ctx.constats = auLancement(ctx.contexte, ctx.constats);
4305
4413
  // The supervisor's resumption of the questioning lets the plan pass as it is now.
4306
4414
  if (ctx.reprendre && e?.raison === 'questionnement') {
4307
4415
  commenter(