@roomi-fields/grillhouse 0.45.1 → 0.47.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 (114) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +52 -0
  3. package/cadre/templates/c/package.json +19 -0
  4. package/cadre/templates/projet/.github/workflows/ci.yml +34 -49
  5. package/cadre/templates/projet/.github/workflows/machine-vierge.yml +101 -0
  6. package/cadre/templates/projet/CLAUDE.md +28 -5
  7. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  8. package/charte.md +61 -23
  9. package/dist/temporal/circuit/appel.d.ts +7 -0
  10. package/dist/temporal/circuit/appel.js +17 -0
  11. package/dist/temporal/circuit/appel.js.map +1 -1
  12. package/dist/temporal/circuit/client.d.ts +28 -5
  13. package/dist/temporal/circuit/client.js +56 -13
  14. package/dist/temporal/circuit/client.js.map +1 -1
  15. package/dist/temporal/circuit/commande.js +16 -4
  16. package/dist/temporal/circuit/commande.js.map +1 -1
  17. package/dist/temporal/circuit/contrat.d.ts +22 -2
  18. package/dist/temporal/circuit/contrat.js +76 -0
  19. package/dist/temporal/circuit/contrat.js.map +1 -1
  20. package/dist/temporal/circuit/deroule.js +68 -11
  21. package/dist/temporal/circuit/deroule.js.map +1 -1
  22. package/dist/temporal/file/activites.d.ts +2 -0
  23. package/dist/temporal/file/activites.js +7 -0
  24. package/dist/temporal/file/activites.js.map +1 -1
  25. package/dist/temporal/file/contrat.d.ts +28 -18
  26. package/dist/temporal/file/contrat.js +8 -5
  27. package/dist/temporal/file/contrat.js.map +1 -1
  28. package/dist/temporal/file/deroule.d.ts +1 -1
  29. package/dist/temporal/file/deroule.js +91 -42
  30. package/dist/temporal/file/deroule.js.map +1 -1
  31. package/dist/temporal/tickets/activites.d.ts +1 -0
  32. package/dist/temporal/tickets/activites.js +37 -11
  33. package/dist/temporal/tickets/activites.js.map +1 -1
  34. package/dist/temporal/tickets/contrat.d.ts +14 -0
  35. package/dist/temporal/tickets/deroule.js +16 -3
  36. package/dist/temporal/tickets/deroule.js.map +1 -1
  37. package/docs/ARCHITECTURE.md +309 -128
  38. package/docs/INTERFACE.md +42 -22
  39. package/hooks/register.tsx +30 -0
  40. package/package.json +1 -1
  41. package/scripts/activites.mjs +60 -21
  42. package/scripts/arbres-juges.mjs +59 -0
  43. package/scripts/attente-a-l-arret.mjs +29 -52
  44. package/scripts/attente-au-tour.mjs +8 -26
  45. package/scripts/avancement.mjs +2 -38
  46. package/scripts/branche-de-nuit.mjs +14 -45
  47. package/scripts/ci-de-main.mjs +273 -0
  48. package/scripts/circuit.mjs +204 -64
  49. package/scripts/circuits-cles.d.mts +9 -0
  50. package/scripts/circuits-cles.mjs +38 -0
  51. package/scripts/coeurs-dedies.mjs +4 -3
  52. package/scripts/dernier-vert.mjs +78 -10
  53. package/scripts/enveloppe/travail-de-la-copie.mjs +5 -2
  54. package/scripts/etapes.mjs +7 -2
  55. package/scripts/faits-du-circuit.mjs +63 -28
  56. package/scripts/fichiers-nommes.mjs +55 -0
  57. package/scripts/file-des-tickets.d.mts +17 -0
  58. package/scripts/file-des-tickets.mjs +39 -0
  59. package/scripts/grillhouse-maj.mjs +20 -1
  60. package/scripts/integration/file.mjs +137 -592
  61. package/scripts/integration/integrer.mjs +10 -7
  62. package/scripts/langages/c/binaires.json +4 -0
  63. package/scripts/langages/c/binaires.mjs +83 -0
  64. package/scripts/langages/c/clang-format.mjs +62 -0
  65. package/scripts/langages/c/clang-tidy.mjs +93 -0
  66. package/scripts/langages/c/clang.mjs +42 -0
  67. package/scripts/langages/c/commandes.mjs +530 -0
  68. package/scripts/langages/c/composants.mjs +209 -0
  69. package/scripts/langages/c/exemples.mjs +250 -0
  70. package/scripts/langages/c/index-interfaces.mjs +77 -0
  71. package/scripts/langages/c/index.mjs +120 -0
  72. package/scripts/langages/c/lot.mjs +41 -0
  73. package/scripts/langages/c/mise-a-jour.mjs +70 -0
  74. package/scripts/langages/c/squelette.mjs +61 -0
  75. package/scripts/langages/c/verdict.mjs +99 -0
  76. package/scripts/langages/cargo/clippy.mjs +16 -9
  77. package/scripts/langages/cargo/commandes.mjs +7 -2
  78. package/scripts/langages/cargo/sccache.mjs +19 -6
  79. package/scripts/langages/typescript/tests.mjs +31 -5
  80. package/scripts/langages/typescript/turbo-des-paquets.mjs +67 -8
  81. package/scripts/langages/typescript/vitest-config/changements.mjs +32 -3
  82. package/scripts/langages/typescript/vitest-config/lances.mjs +16 -0
  83. package/scripts/langages-des-paquets.mjs +30 -2
  84. package/scripts/langages.mjs +1 -0
  85. package/scripts/limite-d-usage.mjs +88 -0
  86. package/scripts/mesure/avancement.mjs +1 -1
  87. package/scripts/migrations/0.47.0-ci-de-main.mjs +48 -0
  88. package/scripts/migrations.mjs +2 -2
  89. package/scripts/outils-cles.d.mts +13 -5
  90. package/scripts/outils-cles.mjs +157 -17
  91. package/scripts/passe-de-la-machine.mjs +26 -2
  92. package/scripts/places-de-la-machine.mjs +52 -6
  93. package/scripts/plafond-de-la-machine.d.mts +10 -2
  94. package/scripts/plafond-de-la-machine.mjs +39 -13
  95. package/scripts/reponses-du-circuit.d.mts +16 -0
  96. package/scripts/reponses-du-circuit.mjs +39 -3
  97. package/scripts/resultats.mjs +32 -11
  98. package/scripts/seances.mjs +211 -59
  99. package/scripts/session-start.sh +2 -11
  100. package/scripts/sortie.mjs +1 -1
  101. package/scripts/sous-commandes.mjs +5 -2
  102. package/scripts/superviseur.mjs +305 -295
  103. package/scripts/tableau.mjs +73 -45
  104. package/scripts/transitions.d.mts +22 -1
  105. package/scripts/transitions.mjs +111 -13
  106. package/scripts/workflows-du-cadre.mjs +21 -1
  107. package/skills/explorateur/SKILL.md +34 -13
  108. package/skills/grill/SKILL.md +6 -5
  109. package/skills/pitmaster/SKILL.md +33 -27
  110. package/skills/redacteur/references/documents-d-un-composant.md +1 -1
  111. package/skills/relecteur/SKILL.md +6 -0
  112. package/skills/testwriter/SKILL.md +4 -0
  113. package/scripts/ci-des-branches.mjs +0 -93
  114. package/scripts/migrations/0.33.0-ci-des-branches-de-ticket.mjs +0 -31
@@ -63,6 +63,7 @@ import { mkdirSync, readdirSync, readFileSync, rmdirSync, rmSync } from 'node:fs
63
63
  import { availableParallelism, homedir } from 'node:os';
64
64
  import path from 'node:path';
65
65
  import { departDe } from './mesure/base-de-passe.mjs';
66
+ import { lireLaConsommation } from './consommation-des-passes.mjs';
66
67
  import { ecrireAtomique } from './mesure/avancement.mjs';
67
68
  import { A_REPASSER } from './codes-de-sortie.mjs';
68
69
  import {
@@ -469,7 +470,40 @@ export function partDeLaPasse({ racine, env = process.env }) {
469
470
  if (faute) {
470
471
  throw new AttenteDeLaMachine(`✗ ${faute}`, 1);
471
472
  }
472
- return partDe({ declaree, budget: budgetDeLaPasse(env) });
473
+ return partDe({
474
+ declaree,
475
+ budget: budgetDeLaPasse(env),
476
+ places: plafondDe(env),
477
+ pic: plusGrandPicDeJour(racineDuDepot(racine)),
478
+ });
479
+ }
480
+
481
+ // The kinds of pass the night and the measures of time write: their peaks are not those of a day.
482
+ const SORTES_HORS_JOUR = new Set(['nuit', 'tests-de-nuit', 'mesure']);
483
+
484
+ /**
485
+ * The largest peak of memory (bytes) of the day passes in the register of the project at <racine>;
486
+ * undefined without one. A line without a readable peak, a malformed one and those of the night
487
+ * and of the measures of time do not count.
488
+ * @param {string} racine
489
+ * @returns {number | undefined}
490
+ */
491
+ function plusGrandPicDeJour(racine) {
492
+ let pic;
493
+ for (const l of lireLaConsommation(racine)) {
494
+ const p = l.memoirePic;
495
+ if (
496
+ SORTES_HORS_JOUR.has(l.sorte) ||
497
+ l.sorte.startsWith('mesure') ||
498
+ typeof p !== 'number' ||
499
+ !Number.isFinite(p) ||
500
+ p <= 0
501
+ ) {
502
+ continue;
503
+ }
504
+ pic = Math.max(pic ?? 0, p);
505
+ }
506
+ return pic;
473
507
  }
474
508
 
475
509
  // The `package.json` of the main tree of the repository at <racine>; empty without one (a
@@ -489,12 +523,12 @@ function packageDuDepot(racine) {
489
523
  * @returns {number}
490
524
  * @throws {AttenteDeLaMachine} naming the key (code 1) when its value is faulty, before any work
491
525
  */
492
- function coeursDeLaMesure({ racine, budget }) {
526
+ function coeursDeLaMesure({ racine, budget, env }) {
493
527
  const { declaree, faute } = mesureDeclareeDe(packageDuDepot(racine));
494
528
  if (faute) {
495
529
  throw new AttenteDeLaMachine(`✗ ${faute}`, 1);
496
530
  }
497
- return coeursDeLaMesureDe({ declaree, budget });
531
+ return coeursDeLaMesureDe({ declaree, budget, places: plafondDe(env) });
498
532
  }
499
533
 
500
534
  const RANGS = { 1: 'mesure du cadre', 2: "mesure d'un projet" };
@@ -515,6 +549,18 @@ function sousLAdmission(dossier, f) {
515
549
  }
516
550
  }
517
551
 
552
+ /**
553
+ * How a measure reads the load of the threads it was given under <env>: on the machine a trial
554
+ * fixes (GRILLHOUSE_MESURE_D_ESSAI) they are at rest, no trial reading the load of the user's
555
+ * machine; else the load the system gives (<systeme>).
556
+ * @param {Record<string, string | undefined>} [env]
557
+ * @param {(fils: number[]) => number | null} [systeme]
558
+ * @returns {(fils: number[]) => number | null}
559
+ */
560
+ export function lecteurDeLaCharge(env = process.env, systeme = chargeDesCoeursDuSysteme) {
561
+ return env[VARIABLE_MESURE_D_ESSAI] ? () => 0 : systeme;
562
+ }
563
+
518
564
  /**
519
565
  * Takes the part of a pass of the project at <racine>, waiting for it, saying what it waits for
520
566
  * (`dire`) when it begins and every <rappelMs>, and returns it. Room first on the disks the pass
@@ -524,7 +570,7 @@ function sousLAdmission(dossier, f) {
524
570
  * « tient ». The night (VARIABLE_JETON) and a pass that asks for the <entiere> budget take the
525
571
  * whole budget: they play alone. A <mesure> of time takes dedicated cores (`fils`, whole physical
526
572
  * cores), waits for them and for their rest (<chargeDesCoeurs>: the load of the threads it gives,
527
- * null without a reading; <topologie>, the topology of the system, for a trial). Where no part is taken (the envelope of an agent, a part already
573
+ * null without a reading, by default `lecteurDeLaCharge`; <topologie>, the topology of the system, for a trial). Where no part is taken (the envelope of an agent, a part already
528
574
  * held: GRILLHOUSE_PART_TENUE) the part returned holds nothing.
529
575
  * @param {{ env?: Record<string, string | undefined>, racine?: string, ticket?: string | null,
530
576
  * sorte?: string, entiere?: boolean, borneMs?: number, rappelMs?: number,
@@ -546,7 +592,7 @@ export function prendreUnePart({
546
592
  entiere = false,
547
593
  mesure = false,
548
594
  topologie,
549
- chargeDesCoeurs = chargeDesCoeursDuSysteme,
595
+ chargeDesCoeurs = lecteurDeLaCharge(env),
550
596
  borneMs = borneDe(env),
551
597
  rappelMs = RAPPEL_MS,
552
598
  dire = l => process.stdout.write(`${l}\n`),
@@ -576,7 +622,7 @@ export function prendreUnePart({
576
622
  topo = topologie ?? lireLaTopologie({ nombreDeFils: machineDe(env).coeurs });
577
623
  budgetFils = budgetEnFils({ topologie: topo, budget: budget.coeurs });
578
624
  if (mesure) {
579
- const demande = coeursDeLaMesure({ racine, budget });
625
+ const demande = coeursDeLaMesure({ racine, budget, env });
580
626
  let fils = filsDeLaMesure({ budget: budgetFils, topologie: topo, demande });
581
627
  if (fils === null || !topo.lisible) {
582
628
  // No whole core in the budget, or a topology that does not read: each thread is a core.
@@ -41,13 +41,21 @@ export function budgetDe(
41
41
  reserve: PartDeLaPasse
42
42
  ): PartDeLaPasse;
43
43
 
44
- /** The part of a pass when its project declares none. */
45
- export function partParDefautDe(budget: PartDeLaPasse): PartDeLaPasse;
44
+ /** The part of a pass when its project declares none: the budget divided by the places (2 cores
45
+ * at least), the largest measured peak of memory plus a quarter, never under its floor, a third of
46
+ * the budget (the floor alone without a measure). */
47
+ export function partParDefautDe(
48
+ budget: PartDeLaPasse,
49
+ places: number,
50
+ pic: number | undefined
51
+ ): PartDeLaPasse;
46
52
 
47
53
  /** The part of a pass: the declared one, its missing values from the default, within the budget. */
48
54
  export function partDe(o: {
49
55
  declaree: { coeurs?: number; memoire?: number } | null;
50
56
  budget: PartDeLaPasse;
57
+ places: number;
58
+ pic: number | undefined;
51
59
  }): PartDeLaPasse;
52
60
 
53
61
  /** The part a project declares in `grillhouse.part` of its package.json, or the fault naming it. */
@@ -19,10 +19,12 @@
19
19
  // `machine.env`; zero is admitted, a value that is not a whole number ≥ 0 is refused by its name.
20
20
  // - The budget is the cores and the memory of the machine less the reserve; a reserve that leaves
21
21
  // no core or no memory is refused by its name.
22
- // - The part of a pass is its cores and its memory: the default part has MIN_COEURS_DE_LA_PART
23
- // cores at least (a third of the budget when that is more), its memory in proportion; a part a project
24
- // declares (`grillhouse.part` of its `package.json`) replaces it; a part larger than the budget
25
- // is the budget (one pass at a time), and never under one core.
22
+ // - The part of a pass is its cores and its memory: the default part has the budget divided by the
23
+ // places of the machine in cores (whole division, 2 at least), and in memory the largest peak the
24
+ // project measured plus a quarter, never under its floor (the cores' proportion of the budget
25
+ // before the division, a third of it, which it is without a measure); a
26
+ // part a project declares (`grillhouse.part` of its `package.json`) replaces its own values; a
27
+ // part larger than the budget is the budget (one pass at a time), and never under one core.
26
28
  import { readFileSync } from 'node:fs';
27
29
  import { cpus, totalmem } from 'node:os';
28
30
  import path from 'node:path';
@@ -150,32 +152,56 @@ export function budgetDe({ coeurs, memoireTotale }, reserve) {
150
152
  return { coeurs: coeurs - reserve.coeurs, memoire: memoireTotale - reserve.memoire };
151
153
  }
152
154
 
155
+ /** The margin over the largest measured peak of memory: a quarter. */
156
+ const MARGE_DE_LA_MEMOIRE = 1.25;
157
+
153
158
  /**
154
- * The part of a pass when its project declares none: MIN_COEURS_DE_LA_PART cores (a third of the
155
- * budget, rounded up, when that is more), within the budget and one core at least, its memory in proportion of its
156
- * cores.
159
+ * The part of a pass when its project declares none, pure: the budget divided by the <places> of
160
+ * the machine in cores (whole division, 2 at least, within the budget and one core at least), and
161
+ * in memory the largest measured peak <pic> plus a quarter (the hard ceiling of the group kills a
162
+ * pass above it, so a percentile would not do), within the budget and never under its floor, the
163
+ * proportion of the cores of a part before the division (a third of the budget): the peak raises
164
+ * the memory, it does not lower it; the floor alone when <pic> is absent.
157
165
  * @param {{ coeurs: number, memoire: number }} budget
166
+ * @param {number} places
167
+ * @param {number | undefined} pic the largest peak of memory of the day passes, absent unmeasured
158
168
  * @returns {{ coeurs: number, memoire: number }}
159
169
  */
160
- export function partParDefautDe(budget) {
170
+ export function partParDefautDe(budget, places, pic) {
161
171
  const coeurs = Math.max(
172
+ 1,
173
+ Math.min(budget.coeurs, Math.max(2, Math.floor(budget.coeurs / places)))
174
+ );
175
+ return { coeurs, memoire: memoireParDefautDe(budget, pic) };
176
+ }
177
+
178
+ // The default memory, independent of the division by the places: its floor, the proportion of the
179
+ // cores a part had before the division (MIN_COEURS_DE_LA_PART, or a third of the budget rounded up
180
+ // when that is more), raised to the peak plus a quarter when the register measured more. A
181
+ // register that holds light passes alone (the guards, a pass of 50 ms: a peak of 16 Mo) would
182
+ // else give the next pass a ceiling its kernel kills it under, as the Vertical Pod Autoscaler
183
+ // bounds its recommendation by a minimum (`minAllowed`).
184
+ function memoireParDefautDe(budget, pic) {
185
+ const coeursDAvant = Math.max(
162
186
  1,
163
187
  Math.min(budget.coeurs, Math.max(MIN_COEURS_DE_LA_PART, Math.ceil(budget.coeurs / 3)))
164
188
  );
165
- return { coeurs, memoire: Math.floor((budget.memoire * coeurs) / budget.coeurs) };
189
+ const plancher = Math.floor((budget.memoire * coeursDAvant) / budget.coeurs);
190
+ return Math.min(budget.memoire, Math.max(plancher, Math.floor((pic ?? 0) * MARGE_DE_LA_MEMOIRE)));
166
191
  }
167
192
 
168
193
  /**
169
194
  * The part of a pass: the one its project declares (`partDeclareeDe`), its missing values from the
170
195
  * default part, within the budget and one core at least.
171
196
  * @param {{ declaree: { coeurs?: number, memoire?: number } | null,
172
- * budget: { coeurs: number, memoire: number } }} o
197
+ * budget: { coeurs: number, memoire: number }, places: number, pic: number | undefined }} o
173
198
  * @returns {{ coeurs: number, memoire: number }}
174
199
  */
175
- export function partDe({ declaree, budget }) {
176
- const defaut = partParDefautDe(budget);
200
+ export function partDe({ declaree, budget, places, pic }) {
201
+ const defaut = partParDefautDe(budget, places, pic);
202
+ const coeurs = Math.max(1, Math.min(budget.coeurs, declaree?.coeurs ?? defaut.coeurs));
177
203
  return {
178
- coeurs: Math.max(1, Math.min(budget.coeurs, declaree?.coeurs ?? defaut.coeurs)),
204
+ coeurs,
179
205
  memoire: Math.min(budget.memoire, declaree?.memoire ?? defaut.memoire),
180
206
  };
181
207
  }
@@ -4,3 +4,19 @@
4
4
  export const SANS_ISSUE: Set<string>;
5
5
  /** The answers accepted for the circuit of <ticket> whose workflow has the status <statut>. */
6
6
  export function lesReponses(ticket: string, statut: string, ecrit: boolean): string;
7
+ /** The stops of the testwriter that `--mecanique` answers. */
8
+ export const ARRETS_DU_TESTWRITER: string[];
9
+ /** The sort of a ticket, as the plan says it (scripts/resultats.mjs `sorteDuPlan`). */
10
+ export interface SorteDuTicket {
11
+ genre: string;
12
+ raison: string | null;
13
+ comportement?: 'changé' | 'tests-adaptés' | 'inchangé';
14
+ commande?: string;
15
+ }
16
+ /** The answer `--mecanique` to the stop <etat> of a ticket of sort <sorte>: a refusal, or its new sort and step. */
17
+ export function reponseMecanique(o: {
18
+ etat: { etape: string; raison?: string | null } | null;
19
+ sorte: { genre: string } | null;
20
+ commande: string | null;
21
+ contexte: string | null;
22
+ }): { refus: string } | { sorte: SorteDuTicket; suivant: { etape: string } };
@@ -1,10 +1,15 @@
1
1
  // The answers a circuit accepts from the supervisor, by the status of its workflow, with no input
2
2
  // nor output: the one rule the client (src/temporal/circuit/client.ts: its refusals and the
3
- // circuits it reads), the opening, the wait, the board and the line of a stop name.
3
+ // circuits it reads), the opening, the wait, the board and the line of a stop name; and the
4
+ // answer `--mecanique`, which turns the sort of a ticket stopped on the testwriter.
5
+ import { CODE, GESTE, TESTS } from './transitions.mjs';
4
6
 
5
7
  /** The statuses of a workflow ended without its issue. */
6
8
  export const SANS_ISSUE = new Set(['TERMINATED', 'FAILED', 'TIMED_OUT', 'CANCELLED']);
7
9
 
10
+ /** The stops of the testwriter that `--mecanique` answers: his question, his blocked word. */
11
+ export const ARRETS_DU_TESTWRITER = ['besoin', 'hors-portee'];
12
+
8
13
  /**
9
14
  * The answers accepted for the circuit of <ticket> whose workflow has the status <statut>, a state
10
15
  * written in its memo or not (<ecrit>), each a command between backquotes after the first, which
@@ -22,7 +27,38 @@ export function lesReponses(ticket, statut, ecrit) {
22
27
  return ecrit ? `${circuit} --reprendre\` ou \`${depuis}` : `${circuit} ${depuis}`;
23
28
  }
24
29
  const etendre = '--etendre <paquet>';
30
+ const mecanique = '--mecanique [<commande>] --contexte <raison>';
25
31
  return statut === 'RUNNING'
26
- ? `${circuit} --reprendre\`, \`${depuis}\`, \`${etendre}\`, \`--reporter <heure>\` ou \`--arreter`
27
- : `${circuit} --reprendre\`, \`${depuis}\` ou \`${etendre}`;
32
+ ? `${circuit} --reprendre\`, \`${depuis}\`, \`${mecanique}\`, \`${etendre}\`, \`--reporter <heure>\` ou \`--arreter`
33
+ : `${circuit} --reprendre\`, \`${depuis}\`, \`${mecanique}\` ou \`${etendre}`;
34
+ }
35
+
36
+ /**
37
+ * The answer `--mecanique [<commande>] --contexte <raison>` to the stop <etat> (`{ etape, raison }`)
38
+ * of a ticket of sort <sorte>: a refusal `{ refus }` unless the ticket is stopped on the testwriter
39
+ * (his question or his blocked word) with a reason, its sort not already mechanical; else the sort
40
+ * it becomes and the step the circuit resumes at, the plan kept as it is. With a <commande>, the
41
+ * gesture a command plays: sort mécanique, 1.1. Without, the gesture written by hand: sort
42
+ * comportement « inchangé », the developpeur writes and the existing suite makes the proof.
43
+ * @param {{ etat: { etape: string, raison?: string | null }, sorte: { genre: string },
44
+ * commande: string | null, contexte: string | null }} o
45
+ * @returns {{ refus: string } | { sorte: object, suivant: { etape: string } }}
46
+ */
47
+ export function reponseMecanique({ etat, sorte, commande, contexte }) {
48
+ if (etat?.etape !== TESTS || !ARRETS_DU_TESTWRITER.includes(etat.raison ?? '')) {
49
+ return {
50
+ refus: `--mecanique répond à un arrêt du testwriter (besoin ou hors-portee) : le circuit est à ${etat?.etape ?? 'aucun état'}${etat?.raison ? `, arrêté sur ${etat.raison}` : ''}.`,
51
+ };
52
+ }
53
+ const raison = String(contexte ?? '').trim();
54
+ if (!raison) {
55
+ return { refus: '--mecanique attend sa raison en --contexte.' };
56
+ }
57
+ if (sorte?.genre === 'mécanique') {
58
+ return { refus: 'le ticket est déjà mécanique : sa commande est celle de son plan.' };
59
+ }
60
+ const geste = String(commande ?? '').trim();
61
+ return geste
62
+ ? { sorte: { genre: 'mécanique', raison, commande: geste }, suivant: { etape: GESTE } }
63
+ : { sorte: { genre: 'comportement', raison, comportement: 'inchangé' }, suivant: { etape: CODE } };
28
64
  }
@@ -68,11 +68,12 @@
68
68
  // language, the architecture, a gap to the reference, or no answer (BP 328: a question the
69
69
  // ticket settled stopped the plan) (explorateur);
70
70
  // - `sorte` (`genre` mécanique or comportement, its `raison`, the `commande` a mechanical ticket
71
- // plays, and, for a comportement, `comportement` changé or inchangé): as Google's large-scale
72
- // changes let a tool make a change that a verification and a review judge (Rosie, ClangMR),
73
- // a ticket the plan says mechanical skips the testwriter, the proof and the developpeur, and
74
- // under a plan « comportement inchangé » every green of the proof is expected and the
75
- // developpeur writes the code; a sort
71
+ // plays, and, for a comportement, `comportement` changé, tests-adaptés or inchangé): as
72
+ // Google's large-scale changes let a tool make a change that a verification and a review
73
+ // judge (Rosie, ClangMR), a ticket the plan says mechanical skips the testwriter, the proof
74
+ // and the developpeur; under « tests-adaptés » the testwriter writes and every green of the
75
+ // proof is expected, then the developpeur writes; under « inchangé » (a gesture written by
76
+ // hand) the developpeur alone writes, no testwriter; a sort
76
77
  // absent, out of its kinds, or without its reason or its command is comportement, the whole
77
78
  // circuit (`sorteDuPlan`, grillhouse-sos) (explorateur);
78
79
  // - `ecartes` (`composant`, `raison`): the components of the survey the plan does not touch,
@@ -213,6 +214,10 @@ const VERDICTS_PROUVES = ['traitee', 'a-porter'];
213
214
  // The sorts of a ticket the explorateur judges at the plan (grillhouse-sos): a gesture without new
214
215
  // behaviour, which its command makes, or a change of behaviour, which the circuit of code makes.
215
216
  export const SORTES = ['mécanique', 'comportement'];
217
+ // The values of the field `comportement` of a plan of sort comportement: changé (the testwriter
218
+ // writes, a red is required), tests-adaptés (the testwriter writes, the proof accepts every
219
+ // green), inchangé (a gesture written by hand: the developpeur alone, no testwriter).
220
+ export const COMPORTEMENTS = ['changé', 'tests-adaptés', 'inchangé'];
216
221
 
217
222
  // The schema of the sheet of each role the circuit leads, and of the tri of the discoveries
218
223
  // (`tri`), the explorateur's after the queue.
@@ -241,9 +246,9 @@ const FICHES = {
241
246
  ),
242
247
  comportement: {
243
248
  type: 'string',
244
- enum: ['changé', 'inchangé'],
249
+ enum: COMPORTEMENTS,
245
250
  description:
246
- 'comportement : inchangé quand le lot ne change aucun comportement que ses tests mesurent (un test adapté, un seuil relevé dans un test) ; changé sinon.',
251
+ 'comportement : changé quand un test honnête peut rougir avant le lot (le testwriter écrit, un rouge est exigé) ; tests-adaptés quand le lot adapte des tests ou relève un seuil dans un test sans comportement neuf (le testwriter écrit, la preuve accepte chaque vert) ; inchangé pour un geste écrit à la main (commentaires, code supprimé…) : le développeur seul, sans testwriter, la suite existante faisant la preuve. Le doute vaut changé.',
247
252
  },
248
253
  },
249
254
  ['genre', 'raison'],
@@ -333,6 +338,12 @@ const FICHES = {
333
338
  ),
334
339
  'Les tests du lot qui portent le travail du ticket : la preuve du rouge exige qu’ils échouent avant le code.'
335
340
  ),
341
+ motif: {
342
+ type: 'string',
343
+ enum: ['aucun-comportement'],
344
+ description:
345
+ 'BESOIN ou BLOQUÉ : aucun comportement n’est à tester, aucun test honnête ne peut rougir avant le lot ; le superviseur bascule le ticket en circuit court (`--mecanique`).',
346
+ },
336
347
  ...DECOUVERTES,
337
348
  },
338
349
  ['statut']
@@ -383,6 +394,12 @@ const FICHES = {
383
394
  relecteur: objet(
384
395
  {
385
396
  verdict: { type: 'string', enum: ['ACCEPTÉ', 'RENDU'] },
397
+ motif: {
398
+ type: 'string',
399
+ enum: ['comportement-change'],
400
+ description:
401
+ 'RENDU d’un lot du circuit court dont le comportement du produit change : le circuit reprend le ticket à 2 Tests sur le même plan, sa sorte changée en comportement.',
402
+ },
386
403
  conformite: liste(
387
404
  objet(
388
405
  {
@@ -505,8 +522,8 @@ export const schemaDeFiche = role => FICHES[role] ?? null;
505
522
 
506
523
  // The sort of the ticket the explorateur's sheet of the plan <fiche> says (`sorte`): `{ genre:
507
524
  // 'mécanique', raison, commande }` for a mechanical ticket with its reason and its command; else
508
- // `{ genre: 'comportement', raison, inchange }`, `inchange` for a plan « comportement inchangé »
509
- // with its reason. A sort absent, out of its kinds or without what it needs is comportement, the
525
+ // `{ genre: 'comportement', raison, comportement }`, `comportement` one of COMPORTEMENTS, changé
526
+ // when absent, unknown or without its reason. A sort absent, out of its kinds or without what it needs is comportement, the
510
527
  // whole circuit, as a doubt goes to the circuit (grillhouse-sos).
511
528
  export function sorteDuPlan(fiche) {
512
529
  const s = fiche?.sorte;
@@ -515,8 +532,12 @@ export function sorteDuPlan(fiche) {
515
532
  if (raison && s.genre === 'mécanique' && plein(s.commande)) {
516
533
  return { genre: 'mécanique', raison, commande: s.commande.trim() };
517
534
  }
518
- const inchange = Boolean(raison) && s.genre === 'comportement' && s.comportement === 'inchangé';
519
- return { genre: 'comportement', raison, inchange };
535
+ const valeur = raison && s.genre === 'comportement' ? s.comportement : null;
536
+ return {
537
+ genre: 'comportement',
538
+ raison,
539
+ comportement: COMPORTEMENTS.includes(valeur) ? valeur : 'changé',
540
+ };
520
541
  }
521
542
 
522
543
  // The errors of <valeur> against <schema>, each naming its field by its path <ou>.