@roomi-fields/grillhouse 0.50.2 → 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.
Files changed (132) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +52 -0
  3. package/agents/developpeur.md +1 -1
  4. package/agents/direct.md +1 -1
  5. package/agents/explorateur.md +1 -1
  6. package/agents/questionneur.md +1 -1
  7. package/agents/relecteur.md +1 -1
  8. package/agents/testwriter.md +1 -1
  9. package/cadre/templates/c/package.json +1 -0
  10. package/cadre/templates/cargo/package.json +1 -0
  11. package/cadre/templates/python/package.json +1 -0
  12. package/charte.md +17 -12
  13. package/dist/machine/part-par-sorte.d.ts +16 -0
  14. package/dist/machine/part-par-sorte.js +36 -0
  15. package/dist/machine/part-par-sorte.js.map +1 -0
  16. package/dist/temporal/circuit/appel.js +1 -1
  17. package/dist/temporal/circuit/appel.js.map +1 -1
  18. package/dist/temporal/circuit/client.d.ts +5 -4
  19. package/dist/temporal/circuit/client.js +39 -16
  20. package/dist/temporal/circuit/client.js.map +1 -1
  21. package/dist/temporal/circuit/contrat.d.ts +11 -7
  22. package/dist/temporal/circuit/contrat.js +5 -9
  23. package/dist/temporal/circuit/contrat.js.map +1 -1
  24. package/dist/temporal/circuit/deroule.js +18 -6
  25. package/dist/temporal/circuit/deroule.js.map +1 -1
  26. package/dist/temporal/commande.js +12 -3
  27. package/dist/temporal/commande.js.map +1 -1
  28. package/dist/temporal/installation.d.ts +54 -3
  29. package/dist/temporal/installation.js +187 -17
  30. package/dist/temporal/installation.js.map +1 -1
  31. package/dist/temporal/places/client.d.ts +5 -1
  32. package/dist/temporal/places/client.js +23 -11
  33. package/dist/temporal/places/client.js.map +1 -1
  34. package/docs/ARCHITECTURE.md +23 -2700
  35. package/docs/INTERFACE.md +23 -8
  36. package/docs/architecture/circuit.md +59 -12
  37. package/docs/architecture/entree.md +20 -7
  38. package/docs/architecture/greffon.md +6 -2
  39. package/docs/architecture/installation.md +30 -11
  40. package/docs/architecture/machine.md +50 -37
  41. package/docs/architecture/tests.md +52 -14
  42. package/docs/lexique.md +154 -0
  43. package/hooks/register.tsx +1 -1
  44. package/package.json +1 -1
  45. package/scripts/activites.mjs +85 -60
  46. package/scripts/aiguillage.mjs +15 -7
  47. package/scripts/attente-de-la-machine.mjs +4 -8
  48. package/scripts/avancement.mjs +12 -8
  49. package/scripts/bilan.mjs +10 -7
  50. package/scripts/branche-de-nuit.mjs +2 -2
  51. package/scripts/ci-de-main.mjs +18 -21
  52. package/scripts/circuit.mjs +86 -43
  53. package/scripts/circuits-du-serveur.mjs +5 -5
  54. package/scripts/composants-affectes.mjs +30 -12
  55. package/scripts/composition-des-langages.mjs +5 -3
  56. package/scripts/conformite.mjs +1 -1
  57. package/scripts/consommation-des-passes.mjs +8 -6
  58. package/scripts/copies-finies.mjs +3 -14
  59. package/scripts/depart-du-ticket.d.mts +8 -2
  60. package/scripts/depart-du-ticket.mjs +26 -8
  61. package/scripts/direct.mjs +158 -72
  62. package/scripts/droits.mjs +63 -185
  63. package/scripts/engendres.mjs +3 -14
  64. package/scripts/enveloppe/enveloppe.mjs +75 -30
  65. package/scripts/enveloppe/lancer.sh +59 -45
  66. package/scripts/enveloppe/paquets-du-plan.mjs +38 -11
  67. package/scripts/enveloppe/travail-de-la-copie.mjs +115 -3
  68. package/scripts/etapes.mjs +84 -22
  69. package/scripts/faits-du-circuit.mjs +8 -2
  70. package/scripts/grillhouse-maj.mjs +43 -18
  71. package/scripts/groupe-cles.d.mts +15 -0
  72. package/scripts/groupe-cles.mjs +77 -2
  73. package/scripts/init.mjs +9 -2
  74. package/scripts/integration/rejeu.mjs +8 -1
  75. package/scripts/jointure.d.ts +22 -3
  76. package/scripts/langages/c/index.mjs +5 -2
  77. package/scripts/langages/cargo/commandes.mjs +35 -15
  78. package/scripts/langages/cargo/composants.mjs +45 -3
  79. package/scripts/langages/cargo/index.mjs +6 -3
  80. package/scripts/langages/cargo/sccache.mjs +10 -3
  81. package/scripts/langages/python/index.mjs +5 -2
  82. package/scripts/langages/typescript/chemins-des-tests.mjs +1 -1
  83. package/scripts/langages/typescript/index.mjs +4 -2
  84. package/scripts/langages/typescript/mise-a-jour.mjs +1 -1
  85. package/scripts/langages/typescript/rapports-aux-lignes.mjs +74 -0
  86. package/scripts/langages/typescript/turbo-des-paquets.mjs +99 -36
  87. package/scripts/langages/typescript/verdict.mjs +29 -3
  88. package/scripts/langages/typescript/verifier.mjs +1 -1
  89. package/scripts/langages/typescript/vitest-config/changements.mjs +8 -6
  90. package/scripts/langages/typescript/vitest-config/lances.mjs +15 -32
  91. package/scripts/langages.mjs +54 -4
  92. package/scripts/matieres-lues.mjs +1 -1
  93. package/scripts/mesure/base-de-passe.mjs +32 -90
  94. package/scripts/migrations/serveurs-de-l-index.mjs +79 -0
  95. package/scripts/migrations.mjs +21 -7
  96. package/scripts/paquets.d.ts +3 -0
  97. package/scripts/paquets.mjs +88 -1
  98. package/scripts/passe-de-la-machine.mjs +109 -36
  99. package/scripts/places-de-la-machine.mjs +81 -29
  100. package/scripts/plafond-de-la-machine.d.mts +2 -5
  101. package/scripts/plafond-de-la-machine.mjs +9 -9
  102. package/scripts/reprise.mjs +42 -13
  103. package/scripts/resultats.mjs +76 -54
  104. package/scripts/retirer-les-copies-finies.mjs +1 -1
  105. package/scripts/seances.mjs +426 -115
  106. package/scripts/services-du-noyau.mjs +9 -1
  107. package/scripts/session-start.sh +14 -1
  108. package/scripts/sortie.mjs +37 -6
  109. package/scripts/sous-commandes.mjs +0 -2
  110. package/scripts/superviseur.mjs +33 -13
  111. package/scripts/tableau.mjs +61 -16
  112. package/scripts/transitions.d.mts +25 -2
  113. package/scripts/transitions.mjs +137 -29
  114. package/scripts/verrous/ecriture-hors-enveloppe.mjs +31 -9
  115. package/skills/codebase-design/DESIGN-IT-TWICE.md +1 -1
  116. package/skills/developpeur/SKILL.md +38 -15
  117. package/skills/direct/SKILL.md +29 -9
  118. package/skills/domain-modeling/GLOSSARY-FORMAT.md +9 -9
  119. package/skills/domain-modeling/SKILL.md +14 -12
  120. package/skills/explorateur/SKILL.md +30 -6
  121. package/skills/pitmaster/SKILL.md +12 -16
  122. package/skills/pitmaster/references/consigne-agent.md +12 -11
  123. package/skills/relecteur/SKILL.md +12 -5
  124. package/skills/systematic-debugging/SKILL.md +281 -0
  125. package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  126. package/skills/systematic-debugging/condition-based-waiting.md +115 -0
  127. package/skills/systematic-debugging/defense-in-depth.md +122 -0
  128. package/skills/systematic-debugging/find-polluter.sh +72 -0
  129. package/skills/systematic-debugging/root-cause-tracing.md +169 -0
  130. package/skills/testwriter/SKILL.md +35 -29
  131. package/scripts/verrous/commande.mjs +0 -214
  132. package/scripts/verrous/verrou.mjs +0 -311
@@ -28,6 +28,8 @@
28
28
  // and the machine admits it (`admissionDePart` of ./regles-des-places.mjs); else it waits, says
29
29
  // what for when it begins and every 30 s, keeps its rank (the measure of the frame before a
30
30
  // project's, then the order of arrival) and stops at « à repasser » (75) at the bound.
31
+ // - The memory of a part is that of its sort (`partDeLaPasse`): at 20 peaks or more of the sort in
32
+ // the register, a reservation the admission counts and a limit where its group is cut.
31
33
  // - The parts are one file per pass in `${XDG_STATE_HOME:-~/.local/state}/grillhouse/parts`
32
34
  // (GRILLHOUSE_PARTS_DE_LA_MACHINE names another): the part held or waited for, its project,
33
35
  // ticket, kind, rank and progress directory, which the board reads (`lireLesParts`). A pass
@@ -43,10 +45,11 @@
43
45
  import { randomUUID } from 'node:crypto';
44
46
  import { spawnSync } from 'node:child_process';
45
47
  import { mkdirSync, readdirSync, readFileSync, rmdirSync, rmSync } from 'node:fs';
48
+ import { createRequire } from 'node:module';
46
49
  import { availableParallelism, homedir } from 'node:os';
47
50
  import path from 'node:path';
48
51
  import { departDe } from './mesure/base-de-passe.mjs';
49
- import { lireLaConsommation } from './consommation-des-passes.mjs';
52
+ import { lireLaConsommation, sorteDeLaPasse } from './consommation-des-passes.mjs';
50
53
  import { ecrireAtomique } from './mesure/avancement.mjs';
51
54
  import { A_REPASSER } from './codes-de-sortie.mjs';
52
55
  import {
@@ -95,6 +98,9 @@ export function sousNiceEtIonice(commande) {
95
98
  }
96
99
  /** The mark of a place held, which the children of its holder inherit. */
97
100
  export const VARIABLE_TENUE = 'GRILLHOUSE_PLACE_TENUE';
101
+
102
+ /** The sort of the verification of the update (scripts/grillhouse-maj.mjs), a gesture of the maintenance. */
103
+ export const SORTE_DE_LA_MONTEE = 'Montée';
98
104
  /** The measure of the machine a trial fixes, in JSON `{ coeurs, charge, memoireLibre, memoireTotale }`. */
99
105
  export const VARIABLE_MESURE_D_ESSAI = 'GRILLHOUSE_MESURE_D_ESSAI';
100
106
  /** The directory of the state of the parts a trial names, in place of the user's. */
@@ -434,43 +440,71 @@ export function budgetDeLaPasse(env = process.env) {
434
440
  return budgetDe({ coeurs: m.coeurs, memoireTotale: m.memoireTotale }, reserveDe(env, { coeurs: m.coeurs }));
435
441
  }
436
442
 
443
+ // The memory of a part by its sort, from the build of src/machine/part-par-sorte.ts; null in a
444
+ // tree not built (a fresh clone before its build), where the part of the project stands.
445
+ function calculParSorte() {
446
+ try {
447
+ return createRequire(import.meta.url)('../dist/machine/part-par-sorte.js');
448
+ } catch (e) {
449
+ if (e?.code === 'MODULE_NOT_FOUND') {
450
+ return null;
451
+ }
452
+ throw e;
453
+ }
454
+ }
455
+
437
456
  /**
438
- * The part of a pass of the project at <racine> under <env>: the one the key `grillhouse.part` of
439
- * its main tree's `package.json` declares, else the default part of the budget.
440
- * @param {{ racine: string, env?: Record<string, string | undefined> }} o
441
- * @returns {{ coeurs: number, memoire: number }}
457
+ * The part of a pass of the sort <sorte> of the project at <racine> under <env>. Its cores are
458
+ * those the key `grillhouse.part` of its main tree's `package.json` declares, else the default
459
+ * ones. Its memory comes from the measure of its sort in the register, at 20 peaks or more:
460
+ * `memoire`, the reservation the admission counts (their 95th percentile), and `limite`, the
461
+ * ceiling of its group (their maximum plus a quarter). Under 20, `memoire` is the declared one,
462
+ * else the default, and stands for both: no `limite`.
463
+ * @param {{ racine: string, env?: Record<string, string | undefined>,
464
+ * sorte?: string }} o <sorte> as the caller names the pass (« Vérification », « séance direct »)
465
+ * @returns {{ coeurs: number, memoire: number, limite?: number }}
442
466
  * @throws {AttenteDeLaMachine} naming the key (code 1) when its value is faulty, before any work
443
467
  */
444
- export function partDeLaPasse({ racine, env = process.env, direct = false }) {
468
+ export function partDeLaPasse({ racine, env = process.env, sorte }) {
445
469
  const { declaree, faute } = partDeclareeDe(packageDuDepot(racine));
446
470
  if (faute) {
447
471
  throw new AttenteDeLaMachine(`✗ ${faute}`, 1);
448
472
  }
449
- return partDe({
473
+ const budget = budgetDeLaPasse(env);
474
+ const depot = racineDuDepot(racine);
475
+ const lignes = lireLaConsommation(depot);
476
+ const part = partDe({
450
477
  declaree,
451
- budget: budgetDeLaPasse(env),
452
- ...(direct ? { direct } : {}),
453
- pic: plusGrandPicDeJour(racineDuDepot(racine)),
478
+ budget,
479
+ pic: plusGrandPicDeJour(lignes),
454
480
  });
481
+ const mesure = sorte
482
+ ? calculParSorte()?.memoireDeLaSorte(lignes, sorteDeLaPasse(sorte), budget.memoire)
483
+ : null;
484
+ return mesure
485
+ ? { coeurs: part.coeurs, memoire: mesure.reservation, limite: mesure.limite }
486
+ : part;
455
487
  }
456
488
 
457
- // The kinds of pass the night and the measures of time write: their peaks are not those of a day.
489
+ // The kinds of line the night and the measures of time write are not those of a day, nor are the
490
+ // sessions of the agents (« seance-<role> »).
458
491
  const SORTES_HORS_JOUR = new Set(['nuit', 'tests-de-nuit', 'mesure']);
459
492
 
460
493
  /**
461
- * The largest peak of memory (bytes) of the day passes in the register of the project at <racine>;
462
- * undefined without one. A line without a readable peak, a malformed one and those of the night
463
- * and of the measures of time do not count.
464
- * @param {string} racine
494
+ * The largest peak of memory (bytes) of the day passes among the <lignes> of a register;
495
+ * undefined without one. A line without a readable peak and those of the night, of the measures
496
+ * of time and of the sessions do not count.
497
+ * @param {Record<string, any>[]} lignes
465
498
  * @returns {number | undefined}
466
499
  */
467
- function plusGrandPicDeJour(racine) {
500
+ function plusGrandPicDeJour(lignes) {
468
501
  let pic;
469
- for (const l of lireLaConsommation(racine)) {
502
+ for (const l of lignes) {
470
503
  const p = l.memoirePic;
471
504
  if (
472
505
  SORTES_HORS_JOUR.has(l.sorte) ||
473
506
  l.sorte.startsWith('mesure') ||
507
+ l.sorte.startsWith('seance') ||
474
508
  typeof p !== 'number' ||
475
509
  !Number.isFinite(p) ||
476
510
  p <= 0
@@ -507,6 +541,12 @@ function coeursDeLaMesure({ racine, budget }) {
507
541
  return coeursDeLaMesureDe({ declaree, budget });
508
542
  }
509
543
 
544
+ // What a part asks of the memory, as the waiting line says it: « 4,3 Go réservés, limite 7,5 Go ».
545
+ const memoireDite = ({ memoire, limite }) => {
546
+ const go = o => String(Math.round((o / 1024 ** 3) * 10) / 10).replace('.', ',');
547
+ return `${go(memoire)} Go réservés, ${limite === null ? 'sans limite' : `limite ${go(limite)} Go`}`;
548
+ };
549
+
510
550
  const RANGS = { 1: 'mesure du cadre', 2: "mesure d'un projet" };
511
551
  // The rank of a pass among the parts: the kind of its measure first (the frame's before a
512
552
  // project's), then its time of arrival, so that a smaller rank passes first.
@@ -561,13 +601,16 @@ export function lecteurDeLaCharge(env = process.env, systeme = chargeDesCoeursDu
561
601
  * The reservation of the machine (<lireLaReservation>, the places of the server by default) is read at each
562
602
  * turn of the wait, before the admission lock: under the supervisor's closure the pass waits without bound
563
603
  * (« machine fermée par le superviseur »); a reading that fails stands for no reservation. Where no part is taken (the envelope of an agent, a part already
564
- * held: GRILLHOUSE_PART_TENUE) the part returned holds nothing.
604
+ * held: GRILLHOUSE_PART_TENUE) the part returned holds nothing. <bornee> false (a session of an
605
+ * agent) reserves the memory without a limit.
565
606
  * @param {{ env?: Record<string, string | undefined>, racine?: string, ticket?: string | null,
566
- * sorte?: string, mesure?: boolean, direct?: boolean, borneMs?: number, rappelMs?: number,
607
+ * sorte?: string, mesure?: boolean, bornee?: boolean,
608
+ * borneMs?: number, rappelMs?: number,
567
609
  * dire?: (l: string) => void, maintenant?: () => number, dormir?: (ms: number) => void,
568
610
  * libre?: (d: string) => number, occupe?: (d: string) => string,
569
611
  * occupeLaCopie?: (r: string) => string }} [o]
570
- * @returns {{ id: string | null, part: { coeurs: number, memoire: number } | null,
612
+ * @returns {{ id: string | null,
613
+ * part: { coeurs: number, memoire: number, limite?: number | null } | null,
571
614
  * env: Record<string, string | undefined>, rendre: () => void, raison: string | null }}
572
615
  * `env`, the environment of its holder's children, with the mark of the part and the workers of
573
616
  * its tools; `raison`, why no part is held, null when one is
@@ -580,7 +623,7 @@ export function prendreUnePart({
580
623
  ticket,
581
624
  sorte,
582
625
  mesure = false,
583
- direct = false,
626
+ bornee = true,
584
627
  topologie,
585
628
  chargeDesCoeurs = lecteurDeLaCharge(env),
586
629
  borneMs = borneDe(env),
@@ -623,7 +666,7 @@ export function prendreUnePart({
623
666
  }
624
667
  part = { coeurs: fils, memoire: Math.floor((budget.memoire * fils) / budget.coeurs) };
625
668
  } else {
626
- part = partDeLaPasse({ racine, env, direct });
669
+ part = partDeLaPasse({ racine, env, sorte });
627
670
  }
628
671
  } catch (e) {
629
672
  throw e instanceof AttenteDeLaMachine ? e : new AttenteDeLaMachine(`✗ ${e.message}`, 1);
@@ -642,6 +685,8 @@ export function prendreUnePart({
642
685
  rang: rangDeLaPasse * ECHELLE_DES_RANGS + maintenant(),
643
686
  coeurs: part.coeurs,
644
687
  memoire: part.memoire,
688
+ // Where the group of the pass is cut; null, a session, whose group has no memory bound.
689
+ limite: bornee ? (part.limite ?? part.memoire) : null,
645
690
  dediee: mesure,
646
691
  depuis: maintenant(),
647
692
  };
@@ -666,11 +711,16 @@ export function prendreUnePart({
666
711
  for (;;) {
667
712
  // The reservation of the machine is read each turn, before the admission lock, bounded by
668
713
  // the delay of a call to the server; a reading that fails stands for « no reservation ».
714
+ // A pass already admitted (a place held: GRILLHOUSE_PLACE_TENUE) or of the update (sort
715
+ // « Montée ») is no new work: the closure does not refuse it, as a drain keeps the pods of
716
+ // the system.
669
717
  let reservation = null;
670
- try {
671
- reservation = lireLaReservation() ?? null;
672
- } catch {
673
- reservation = null;
718
+ if (!env[VARIABLE_TENUE] && sorte !== SORTE_DE_LA_MONTEE) {
719
+ try {
720
+ reservation = lireLaReservation() ?? null;
721
+ } catch {
722
+ reservation = null;
723
+ }
674
724
  }
675
725
  const fermee = reservation?.auteur === 'superviseur';
676
726
  const refus = sousLAdmission(dossier, () => {
@@ -727,10 +777,12 @@ export function prendreUnePart({
727
777
  }
728
778
  if (dit === null) {
729
779
  dire(
730
- `⏳ ${RANGS[rangDeLaPasse]}, la passe attend sa part (${part.coeurs} cœurs) : ${refus}${fermee ? ' ; sans borne, jusqu’à la réouverture.' : ` ; ${duree(borneMs)} au plus.`}`
780
+ `⏳ ${RANGS[rangDeLaPasse]}, la passe attend sa part (${part.coeurs} cœurs, ${memoireDite(moi)}) : ${refus}${fermee ? ' ; sans borne, jusqu’à la réouverture.' : ` ; ${duree(borneMs)} au plus.`}`
731
781
  );
732
782
  } else if (t - dit >= rappelMs) {
733
- dire(`⏳ la passe attend sa part depuis ${duree(t - debut)} : ${refus}.`);
783
+ dire(
784
+ `⏳ la passe attend sa part (${memoireDite(moi)}) depuis ${duree(t - debut)} : ${refus}.`
785
+ );
734
786
  }
735
787
  if (dit === null || t - dit >= rappelMs) {
736
788
  dit = t;
@@ -792,7 +844,7 @@ export function prendreUnePart({
792
844
  tracer('prise');
793
845
  return {
794
846
  id: moi.id,
795
- part,
847
+ part: bornee ? part : { ...part, limite: null },
796
848
  fils: tenus,
797
849
  dediee: mesure,
798
850
  budgetFils,
@@ -16,8 +16,6 @@ export const RESERVE_COEURS_PAR_DEFAUT: 4;
16
16
  export const RESERVE_MEMOIRE_GO_PAR_DEFAUT: 4;
17
17
  /** The cores the reservation of an ordinary pass holds when its project declares none. */
18
18
  export const COEURS_PAR_DEFAUT: 3;
19
- /** The cores the reservation of a direct pass holds, fixed. */
20
- export const COEURS_DU_DIRECT: 2;
21
19
 
22
20
  /**
23
21
  * The ceiling of the places under <env>: GRILLHOUSE_PLACES of the environment, else of the file of
@@ -43,13 +41,12 @@ export function budgetDe(
43
41
  reserve: PartDeLaPasse
44
42
  ): PartDeLaPasse;
45
43
 
46
- /** The reservation of a pass: the declared cores, else 3, within the budget (a direct pass: 2,
47
- * fixed); its memory the declared one, else the default memory, within the budget. */
44
+ /** The reservation of a pass: the declared cores, else 3, within the budget; its memory the
45
+ * declared one, else the default memory, within the budget. */
48
46
  export function partDe(o: {
49
47
  declaree: { coeurs?: number; memoire?: number } | null;
50
48
  budget: PartDeLaPasse;
51
49
  pic: number | undefined;
52
- direct?: boolean;
53
50
  }): PartDeLaPasse;
54
51
 
55
52
  /** The part a project declares in `grillhouse.part` of its package.json, or the fault naming it. */
@@ -21,10 +21,12 @@
21
21
  // no core or no memory is refused by its name.
22
22
  // - The part of a pass (`partDe`) is its cores and its memory, within the budget and one core at
23
23
  // least. Its cores are those its project declares (`grillhouse.part` of its `package.json`),
24
- // else COEURS_PAR_DEFAUT; a direct pass has COEURS_DU_DIRECT, fixed. Its memory is the declared
24
+ // else COEURS_PAR_DEFAUT. Its memory is the declared
25
25
  // one, else the largest peak the project measured plus a quarter, never under a floor (the
26
26
  // share of the budget that max(4, a third of its cores) cores hold, which it is without a
27
- // measure). A part larger than the budget is the budget (one pass at a time).
27
+ // measure). A part larger than the budget is the budget (one pass at a time). That memory stands
28
+ // for a sort of pass the register measured less than 20 times (`partDeLaPasse` of
29
+ // ./places-de-la-machine.mjs).
28
30
  import { readFileSync } from 'node:fs';
29
31
  import { cpus, totalmem } from 'node:os';
30
32
  import path from 'node:path';
@@ -48,8 +50,6 @@ export const RESERVE_COEURS_PAR_DEFAUT = 4;
48
50
  export const RESERVE_MEMOIRE_GO_PAR_DEFAUT = 4;
49
51
  /** The cores the reservation of an ordinary pass holds when its project declares none. */
50
52
  export const COEURS_PAR_DEFAUT = 3;
51
- /** The cores the reservation of a direct pass holds, fixed. */
52
- export const COEURS_DU_DIRECT = 2;
53
53
  // The cores the reserve of the user leaves the passes at least; the floor of the memory.
54
54
  const COEURS_LAISSES_AUX_PASSES = 4;
55
55
 
@@ -176,14 +176,14 @@ function memoireParDefautDe(budget, pic) {
176
176
 
177
177
  /**
178
178
  * The reservation of a pass: the cores its project declares (`partDeclareeDe`), else 3, within the
179
- * budget and one core at least; a direct pass reserves 2 cores, fixed. Its memory is the declared
180
- * one, else the default memory, within the budget.
179
+ * budget and one core at least. Its memory is the declared one, else the default memory, within
180
+ * the budget.
181
181
  * @param {{ declaree: { coeurs?: number, memoire?: number } | null,
182
- * budget: { coeurs: number, memoire: number }, pic: number | undefined, direct?: boolean }} o
182
+ * budget: { coeurs: number, memoire: number }, pic: number | undefined }} o
183
183
  * @returns {{ coeurs: number, memoire: number }}
184
184
  */
185
- export function partDe({ declaree, budget, pic, direct = false }) {
186
- const voulus = direct ? COEURS_DU_DIRECT : (declaree?.coeurs ?? COEURS_PAR_DEFAUT);
185
+ export function partDe({ declaree, budget, pic }) {
186
+ const voulus = declaree?.coeurs ?? COEURS_PAR_DEFAUT;
187
187
  return {
188
188
  coeurs: Math.max(1, Math.min(budget.coeurs, voulus)),
189
189
  memoire: Math.min(budget.memoire, declaree?.memoire ?? memoireParDefautDe(budget, pic)),
@@ -4,9 +4,7 @@
4
4
  // `--depuis` resumes. Mature model: « Re-run failed jobs » of GitHub Actions (the red job and what
5
5
  // depends on it replay). The fingerprint of a step, which hashes with `node:crypto`, is in
6
6
  // scripts/empreinte-d-etape.mjs, on the side of the activities.
7
- import { SUITE } from './etapes.mjs';
8
-
9
- const etatDe = n => SUITE.find(e => e.numero === n).etat;
7
+ import { joue, rolesDe, SUITE } from './etapes.mjs';
10
8
 
11
9
  /**
12
10
  * The step that carries the red whose places are <lieux> (`{ paquet, fichier, gardes, nommes,
@@ -21,8 +19,12 @@ const etatDe = n => SUITE.find(e => e.numero === n).etat;
21
19
  * build) is the developpeur's, no file named, as a red job of a CI goes back to its author (the
22
20
  * the owner's decision); one out of the plan, or a file nobody wrote, is never
23
21
  * attributed (`etape` null, its `motif` said): it goes up.
22
+ *
23
+ * In a direct circuit (<circuit>), whose one agent writes the tests and the code, every red
24
+ * attributed is his, at the step of the code.
24
25
  */
25
- export function attribuerLeRouge({ lieux, portes }) {
26
+ export function attribuerLeRouge({ lieux, portes, circuit = null }) {
27
+ const direct = circuit === 'direct';
26
28
  const avecFichier = (lieux ?? []).filter(l => typeof l.fichier === 'string' && l.fichier);
27
29
  const nommes = [...new Set(avecFichier.map(l => l.fichier))];
28
30
  if (!nommes.length) {
@@ -37,7 +39,7 @@ export function attribuerLeRouge({ lieux, portes }) {
37
39
  return {
38
40
  etape: null,
39
41
  fichiers: [],
40
- motif: `le rouge nomme ${inconnus.join(', ')}, que ni le testwriter ni le développeur ne portent`,
42
+ motif: `le rouge nomme ${inconnus.join(', ')}, que ${direct ? 'l’agent direct ne porte pas' : 'ni le testwriter ni le développeur ne portent'}`,
41
43
  };
42
44
  }
43
45
  // The test files of the lot the message of a failed test out of the lot names.
@@ -46,7 +48,7 @@ export function attribuerLeRouge({ lieux, portes }) {
46
48
  .flatMap(l => l.nommes ?? [])
47
49
  .filter(f => tests.has(f));
48
50
  // A test file of a reader package extended to its tests (`portes.lecteurs`): the testwriter
49
- // alone writes it, the developpeur's lock refuses it.
51
+ // alone writes it, the developpeur's lot holds no test file.
50
52
  const lecteurs = new Set(portes.lecteurs ?? []);
51
53
  const refuses = [
52
54
  ...new Set([
@@ -59,23 +61,48 @@ export function attribuerLeRouge({ lieux, portes }) {
59
61
  ]),
60
62
  ];
61
63
  const tous = [...new Set([...nommes, ...designes])];
64
+ if (direct) {
65
+ return { etape: 'developpeur', fichiers: tous };
66
+ }
62
67
  return refuses.length
63
68
  ? { etape: 'testwriter', fichiers: refuses.length === tous.length ? refuses : tous }
64
69
  : { etape: 'developpeur', fichiers: nommes };
65
70
  }
66
71
 
67
- // The steps `--depuis` names, each with the state it resumes at.
72
+ // The steps `--depuis` names, each with its step of the list, the role it launches when it names
73
+ // one, and the state it resumes at.
68
74
  const DEPARTS = {
69
- testwriter: () => ({ etape: etatDe('2'), tentative: 1, finale: false }),
70
- preuve: () => ({ etape: etatDe('2.1'), tentative: 1, finale: false }),
71
- developpeur: () => ({ etape: etatDe('3'), tentative: 1, finale: false }),
72
- controles: () => ({ etape: etatDe('3.1'), tentative: 0, finale: false }),
73
- 'passe-finale': () => ({ etape: etatDe('3.1'), tentative: 0, finale: true }),
75
+ testwriter: { numero: '2', role: 'testwriter', tentative: 1 },
76
+ preuve: { numero: '2.1', tentative: 1 },
77
+ developpeur: { numero: '3', role: 'developpeur', tentative: 1 },
78
+ direct: { numero: '3', role: 'direct', tentative: 1 },
79
+ controles: { numero: '3.1', tentative: 0 },
80
+ 'passe-finale': { numero: '4.1', tentative: 0 },
74
81
  };
75
82
 
76
83
  /** The steps `--depuis` names. */
77
84
  export const ETAPES_DE_REPRISE = Object.keys(DEPARTS);
78
85
 
86
+ // Whether the circuit <circuit> resumes at the step <nom>: it plays that step, with the role the
87
+ // name says. A short circuit resumes as a long one, whose steps its switch may play.
88
+ const accepte = (nom, circuit) => {
89
+ const parcours = circuit === 'direct' ? circuit : 'long';
90
+ const { numero, role } = DEPARTS[nom];
91
+ const etape = SUITE.find(e => e.numero === numero);
92
+ return joue(numero, parcours) && (!role || rolesDe(etape, parcours).includes(role));
93
+ };
94
+
95
+ /**
96
+ * The refusal of `--depuis <depuis>` in the circuit <circuit>, naming the resumptions it accepts,
97
+ * or null: the one rule the validator of the workflow of a ticket and the start of a run read.
98
+ */
99
+ export function refusDeLaReprise({ depuis, circuit = null }) {
100
+ const acceptees = ETAPES_DE_REPRISE.filter(nom => accepte(nom, circuit));
101
+ return acceptees.includes(depuis)
102
+ ? null
103
+ : `--depuis attend une étape du ticket : ${acceptees.join(', ')} (reçu « ${depuis} »).`;
104
+ }
105
+
79
106
  /**
80
107
  * The state `--depuis <nom>` resumes at: that step and the ones after it, no fingerprint kept
81
108
  * (`verts` empty), so nothing is read back.
@@ -86,5 +113,7 @@ export function departDepuis(nom) {
86
113
  `--depuis attend une étape du ticket : ${ETAPES_DE_REPRISE.join(', ')} (reçu « ${nom} »).`
87
114
  );
88
115
  }
89
- return { ...DEPARTS[nom](), rapport: null, verts: {} };
116
+ const { numero, tentative } = DEPARTS[nom];
117
+ const { etat, finale = false } = SUITE.find(e => e.numero === numero);
118
+ return { etape: etat, tentative, finale, rapport: null, verts: {} };
90
119
  }
@@ -5,30 +5,33 @@
5
5
  // npx grillhouse resultats --schema <rôle> prints the JSON schema of a role's sheet
6
6
  //
7
7
  // - The sheet of the end of a session (« la fiche ») of the explorateur, the questionneur, the
8
- // testwriter, the developpeur and the reviewer: the schema of each role (FICHES), which the
8
+ // testwriter, the developpeur, the agent direct and the reviewer: the schema of each role (FICHES), which the
9
9
  // session receives (`claude -p --output-format json --json-schema <schéma>`) and fills as its
10
10
  // last act, in the field `structured_output` of its result. A field exists only when a reader
11
11
  // reads it:
12
12
  // - `statut` (FAIT, BLOQUÉ, BESOIN), with `raison` for BLOQUÉ and `question` for BESOIN, each
13
13
  // with its `piece`: the circuit goes on, or stops at « hors-portee » or « besoin »
14
- // (testwriter, developpeur, and the explorateur's gesture of a mechanical ticket, its own
14
+ // (testwriter, developpeur, direct, and the explorateur's gesture of a mechanical ticket, its own
15
15
  // schema, `geste`);
16
+ // - `manque` (the path of a file out of the plan a BESOIN sheet lacks): the circuit extends the
17
+ // plan to its package when the ticket names it, else puts its question (testwriter,
18
+ // developpeur, direct);
16
19
  // - `portent_le_travail` (`fichier` from the root, `test` its full name, or none for every test
17
20
  // of the file): the tests of the lot that the proof of the red requires red (testwriter);
18
21
  // - `renvoi` (`role` testwriter): the circuit relaunches the testwriter, then the proof and the
19
22
  // developpeur (developpeur);
20
23
  // - `hors_plan` (`critere` its number, `paquet` the package out of the plan that would hold it,
21
24
  // `piece`): each criterion the session does not hold for want of a package out of the plan; a
22
- // FAIT that carries one stops at « hors-portee » (developpeur);
25
+ // FAIT that carries one stops at « hors-portee » (developpeur, direct);
23
26
  // - `reponses` (`titre` of the finding, `etat` levé or contesté, `raison` for a contesté,
24
27
  // `piece`): a FAIT answers each finding of the reviewer open for its role, by its title (the
25
28
  // number « Constat N — » is recognised, `cleDuConstat`); the circuit refuses a sheet without
26
29
  // the answer to one (`reponsesAuxConstats`), save in a run where the supervisor gives the task
27
30
  // (`--contexte`: the findings open at the run's launch are then its context, the ones a RENDU
28
31
  // states within it still its task, `constatsDeLaSeance` of scripts/circuit.mjs), and gives the
29
- // next review each answer under its finding (developpeur);
32
+ // next review each answer under its finding (developpeur, direct);
30
33
  // - `ecarts` (`sujet`, `texte`): the body of the commit message, written by the circuit, each
31
- // subject once, its value from the last sheet that carries it (developpeur, reviewer);
34
+ // subject once, its value from the last sheet that carries it (developpeur, direct, reviewer);
32
35
  // - `decouvertes` (`sujet`, `corps`): each one a ticket filed closed under the ticket, labelled
33
36
  // `decouverte`, created by the circuit (every role);
34
37
  // - `verdict` (ACCEPTÉ, RENDU), `constats` (`titre`, `corps`, `piece`, `genre` bloquant or
@@ -119,7 +122,7 @@ import path from 'node:path';
119
122
  import { pathToFileURL } from 'node:url';
120
123
  import { refusDeLaCommande } from './commande-du-plan.mjs';
121
124
  import { paquets } from './paquets.mjs';
122
- import { AUTEUR_DU_CIRCUIT, EXPLORATEUR } from './etapes.mjs';
125
+ import { AUTEUR_DU_CIRCUIT, AUTEURS_DE_LOT, EXPLORATEUR } from './etapes.mjs';
123
126
 
124
127
  // The variable that names the results directory of a run.
125
128
  export const RESULTATS = 'GRILLHOUSE_RESULTATS';
@@ -206,6 +209,58 @@ export const SORTES = ['mécanique', 'comportement'];
206
209
  // green), inchangé (a gesture written by hand: the developpeur alone, no testwriter).
207
210
  export const COMPORTEMENTS = ['changé', 'tests-adaptés', 'inchangé'];
208
211
 
212
+ // The file out of the plan a writing role lacks, on a sheet BESOIN: a write out of the plan fails
213
+ // on the mount of the envelope, and the sheet says it (circuit.md §5.5).
214
+ const MANQUE = {
215
+ manque: texte(
216
+ 'BESOIN, quand un fichier hors du plan te manque (son écriture échoue sur le montage) : son chemin depuis la racine de la copie. Le circuit étend le plan quand le ticket le nomme, sinon la question monte.'
217
+ ),
218
+ };
219
+
220
+ // The schema of the sheet of an author of the code (3), the developpeur or the agent direct, with
221
+ // the fields <propres> his role alone has.
222
+ const fiche = (propres = {}) =>
223
+ objet(
224
+ {
225
+ ...STATUT,
226
+ ...MANQUE,
227
+ ...propres,
228
+ hors_plan: liste(
229
+ objet(
230
+ {
231
+ critere: texte('Le numéro du critère du ticket, « 10 ».'),
232
+ paquet: texte('Le paquet hors du plan qui le porterait, comme le titre le nomme.'),
233
+ piece: piece('Sa pièce'),
234
+ },
235
+ ['critere', 'paquet', 'piece']
236
+ ),
237
+ 'Chaque critère du ticket que tu ne tiens pas parce qu’il demande un paquet hors du plan ; le circuit monte au superviseur, qui étend le plan ou amende le critère.'
238
+ ),
239
+ reponses: liste(
240
+ objet(
241
+ {
242
+ titre: texte(
243
+ 'Le titre du constat, tel que ta consigne l’écrit, sans son numéro « Constat N — ».'
244
+ ),
245
+ etat: {
246
+ type: 'string',
247
+ enum: ['levé', 'contesté'],
248
+ description:
249
+ 'levé : ton lot le lève ; contesté : tu ne le lèves pas, avec ta raison.',
250
+ },
251
+ raison: texte('Contesté : pourquoi le lot reste tel quel.'),
252
+ piece: piece('Sa pièce, ce qui le lève ou ce qui fonde ta raison'),
253
+ },
254
+ ['titre', 'etat', 'piece']
255
+ ),
256
+ 'FAIT : ta réponse à chaque constat du relecteur ouvert pour toi, par son titre ; le relecteur la lit sous son constat. Le circuit refuse une fiche à laquelle il en manque une.'
257
+ ),
258
+ ...ECARTS,
259
+ ...DECOUVERTES,
260
+ },
261
+ ['statut']
262
+ );
263
+
209
264
  // The schema of the sheet of each role the circuit leads, and of the tri of the discoveries
210
265
  // (`tri`), the explorateur's after the queue.
211
266
  const FICHES = {
@@ -317,6 +372,7 @@ const FICHES = {
317
372
  testwriter: objet(
318
373
  {
319
374
  ...STATUT,
375
+ ...MANQUE,
320
376
  portent_le_travail: liste(
321
377
  objet(
322
378
  {
@@ -337,49 +393,15 @@ const FICHES = {
337
393
  },
338
394
  ['statut']
339
395
  ),
340
- developpeur: objet(
341
- {
342
- ...STATUT,
343
- renvoi: objet(
344
- { role: { type: 'string', enum: ['testwriter'] } },
345
- ['role'],
346
- 'Le rouge qui reste est dans les tests du lot : le circuit relance le testwriter.'
347
- ),
348
- hors_plan: liste(
349
- objet(
350
- {
351
- critere: texte('Le numéro du critère du ticket, « 10 ».'),
352
- paquet: texte('Le paquet hors du plan qui le porterait, comme le titre le nomme.'),
353
- piece: piece('Sa pièce'),
354
- },
355
- ['critere', 'paquet', 'piece']
356
- ),
357
- 'Chaque critère du ticket que tu ne tiens pas parce qu’il demande un paquet hors du plan ; le circuit monte au superviseur, qui étend le plan ou amende le critère.'
358
- ),
359
- reponses: liste(
360
- objet(
361
- {
362
- titre: texte(
363
- 'Le titre du constat, tel que ta consigne l’écrit, sans son numéro « Constat N — ».'
364
- ),
365
- etat: {
366
- type: 'string',
367
- enum: ['levé', 'contesté'],
368
- description:
369
- 'levé : ton lot le lève ; contesté : tu ne le lèves pas, avec ta raison.',
370
- },
371
- raison: texte('Contesté : pourquoi le lot reste tel quel.'),
372
- piece: piece('Sa pièce, ce qui le lève ou ce qui fonde ta raison'),
373
- },
374
- ['titre', 'etat', 'piece']
375
- ),
376
- 'FAIT : ta réponse à chaque constat du relecteur ouvert pour toi, par son titre ; le relecteur la lit sous son constat. Le circuit refuse une fiche à laquelle il en manque une.'
377
- ),
378
- ...ECARTS,
379
- ...DECOUVERTES,
380
- },
381
- ['statut']
382
- ),
396
+ developpeur: fiche({
397
+ renvoi: objet(
398
+ { role: { type: 'string', enum: ['testwriter'] } },
399
+ ['role'],
400
+ 'Le rouge qui reste est dans les tests du lot : le circuit relance le testwriter.'
401
+ ),
402
+ }),
403
+ // The agent direct writes the tests with the code: he sends no red to the testwriter.
404
+ direct: fiche(),
383
405
  relecteur: objet(
384
406
  {
385
407
  verdict: { type: 'string', enum: ['ACCEPTÉ', 'RENDU'] },
@@ -408,7 +430,7 @@ const FICHES = {
408
430
  'La règle dans ce document (« 000-forms, R2 », « § Les frontières ») ; un export neuf, le nom de son entrée.'
409
431
  ),
410
432
  piece: piece('Sa pièce'),
411
- role: { type: 'string', enum: ['testwriter', 'developpeur'] },
433
+ role: { type: 'string', enum: AUTEURS_DE_LOT },
412
434
  },
413
435
  ['element', 'conforme', 'document', 'reference', 'piece']
414
436
  ),
@@ -429,7 +451,7 @@ const FICHES = {
429
451
  ),
430
452
  role: {
431
453
  type: 'string',
432
- enum: ['testwriter', 'developpeur'],
454
+ enum: AUTEURS_DE_LOT,
433
455
  description: 'Bloquant : l’agent qui écrit la correction, à qui le circuit le rend.',
434
456
  },
435
457
  corps: texte('Sa preuve : son exemple et ce qu’il montre.'),
@@ -891,8 +913,8 @@ function horsDuTicket(f, description) {
891
913
  }
892
914
 
893
915
  // What a sheet of <role> needs beyond its schema: the reason of a BLOQUÉ, the question of a
894
- // BESOIN, the number of each criterion out of the plan, the reason of a developpeur's answer
895
- // contesté, the packages of a plan and the number of each answer, the questions of a QUESTIONS, the text of a
916
+ // BESOIN, the number of each criterion out of the plan, the reason of an answer contesté of the
917
+ // developpeur or the agent direct, the packages of a plan and the number of each answer, the questions of a QUESTIONS, the text of a
896
918
  // DÉSACCORD, the criterion or rule of a blocking finding, the reference of the rule each line of
897
919
  // a reviewer's conformity cites in its document and the recipient of a « non », and a reviewer's verdict that follows its blocking findings, its « non » among them
898
920
  // (RENDU with one, ACCEPTÉ without), the piece of a BLOQUÉ, a BESOIN and a reviewer's question,
@@ -950,7 +972,7 @@ function manques(role, f) {
950
972
  out.push(`hors_plan[${i}].critere : « ${h.critere} » n'est pas le numéro d'un critère`);
951
973
  }
952
974
  }
953
- if (role === 'developpeur') {
975
+ if (role === 'developpeur' || role === 'direct') {
954
976
  for (const [i, r] of (f.reponses ?? []).entries()) {
955
977
  if (r.etat === 'contesté' && !(typeof r.raison === 'string' && r.raison.trim())) {
956
978
  out.push(`reponses[${i}].raison : manque, pour contesté`);
@@ -5,7 +5,7 @@
5
5
  // node scripts/retirer-les-copies-finies.mjs [<copie finie de jouer>…] from the main tree
6
6
  //
7
7
  // - The circuits that hold their copy are what the Temporal server says (./circuits-du-serveur.mjs,
8
- // one call, 5 s at most): each that has not ended (it runs, or waits an answer or a place), and
8
+ // 5 s at most): each that has not ended (it runs, or waits an answer or a place), and
9
9
  // each ended without its issue, which waits the supervisor's answer; a server that does not
10
10
  // answer, a client not built or any other fault of that reading leaves them unread (null), and
11
11
  // the removal of ./copies-finies.mjs then keeps each copy beside its `.travail`.