@roomi-fields/grillhouse 0.28.2 → 0.29.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 (71) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/bin/grillhouse.mjs +55 -14
  3. package/cadre/templates/projet/CLAUDE.md +1 -1
  4. package/cadre/templates/projet/README.md +11 -11
  5. package/cadre/templates/projet/_gitignore +2 -5
  6. package/charte.md +24 -3
  7. package/docs/ARCHITECTURE.md +279 -31
  8. package/docs/INTERFACE.md +59 -11
  9. package/package.json +1 -1
  10. package/scripts/aiguillage.mjs +324 -0
  11. package/scripts/avancement.mjs +33 -50
  12. package/scripts/circuit.mjs +558 -146
  13. package/scripts/composition-des-langages.mjs +16 -1
  14. package/scripts/conformite.mjs +16 -0
  15. package/scripts/copies-finies.mjs +181 -29
  16. package/scripts/demon.mjs +134 -21
  17. package/scripts/enveloppe/enveloppe.mjs +8 -5
  18. package/scripts/enveloppe/lancer.sh +24 -15
  19. package/scripts/enveloppe/travail-de-la-copie.mjs +94 -11
  20. package/scripts/etapes.mjs +1 -1
  21. package/scripts/fusion-du-changelog.mjs +0 -1
  22. package/scripts/grillhouse-maj.mjs +16 -7
  23. package/scripts/integration/file.mjs +3 -3
  24. package/scripts/integration/integrer.mjs +3 -3
  25. package/scripts/jointure.d.ts +53 -17
  26. package/scripts/langages/cargo/commandes.mjs +152 -25
  27. package/scripts/langages/cargo/composants.mjs +94 -2
  28. package/scripts/langages/cargo/exemples.mjs +68 -1
  29. package/scripts/langages/cargo/index.mjs +21 -10
  30. package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +35 -0
  31. package/scripts/langages/cargo/sccache.mjs +89 -6
  32. package/scripts/langages/cargo/squelette.mjs +72 -3
  33. package/scripts/langages/cargo/tailles-des-tests.mjs +195 -0
  34. package/scripts/langages/cargo/tests-de-head.mjs +159 -0
  35. package/scripts/langages/python/commandes.mjs +53 -9
  36. package/scripts/langages/python/composants.mjs +33 -3
  37. package/scripts/langages/python/exemples.mjs +19 -0
  38. package/scripts/langages/python/index.mjs +7 -2
  39. package/scripts/langages/python/squelette.mjs +119 -17
  40. package/scripts/langages/typescript/exemples.mjs +16 -0
  41. package/scripts/langages/typescript/index.mjs +6 -3
  42. package/scripts/langages/typescript/regle-des-tests.mjs +13 -0
  43. package/scripts/langages/typescript/squelette.mjs +18 -2
  44. package/scripts/langages/typescript/tests-de-nuit.mjs +50 -20
  45. package/scripts/langages/typescript/verifier.mjs +82 -288
  46. package/scripts/langages/typescript/vitest-config/base.mjs +8 -9
  47. package/scripts/langages/typescript/vitest-config/cibles.mjs +92 -53
  48. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +11 -5
  49. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +6 -1
  50. package/scripts/langages/typescript/vitest-config/mesure.mjs +3 -2
  51. package/scripts/langages/typescript/vitest.nuit.config.mjs +18 -13
  52. package/scripts/lecture-unique.mjs +51 -0
  53. package/scripts/mesure/base-de-passe.mjs +202 -9
  54. package/scripts/mesure/pression.mjs +9 -7
  55. package/scripts/nuit.sh +19 -12
  56. package/scripts/outil.mjs +72 -0
  57. package/scripts/paquet.mjs +39 -10
  58. package/scripts/resultats.mjs +22 -5
  59. package/scripts/services-du-noyau.mjs +16 -10
  60. package/scripts/session-start.sh +10 -1
  61. package/scripts/sortie.mjs +20 -1
  62. package/scripts/sources.mjs +3 -3
  63. package/scripts/sous-commandes.mjs +2 -0
  64. package/scripts/superviseur.mjs +369 -14
  65. package/scripts/tableau.mjs +219 -58
  66. package/scripts/verrou-de-machine.mjs +425 -37
  67. package/skills/developpeur/SKILL.md +11 -3
  68. package/skills/pitmaster/SKILL.md +64 -23
  69. package/skills/pitmaster/references/consigne-agent.md +4 -0
  70. package/skills/relecteur/SKILL.md +18 -6
  71. package/skills/testwriter/SKILL.md +11 -15
@@ -24,16 +24,28 @@
24
24
  // npx grillhouse circuit <ticket> --depuis <testwriter|developpeur> --contexte <texte>
25
25
  // npx grillhouse circuit <ticket> --etendre <paquet>[,<paquet>…] [--contexte <texte>]
26
26
  // npx grillhouse circuit <ticket> --arreter [--contexte <motif>]
27
+ // npx grillhouse circuit <ticket> --rattacher
27
28
  //
28
- // The run is a daemon (scripts/demon.mjs), as daemon(3) and `setsid --fork` make one: the command
29
- // launches a relay,
30
- // which launches the run in a session of its own and ends at once, so that the run is neither in
31
- // the caller's process group nor under it in the tree of processes, and goes on to its end when
32
- // its caller dies (BP 320.8: the circuit, a background command of the supervisor's session, died
33
- // with it). The caller relays the run's output to its own streams while it lives, and ends on the
34
- // run's exit code; the state names the run (`processus` and its start `depart`), which the board
35
- // reads, and a second run of the ticket while it lives is refused (exit 2), `--arreter` stopping
36
- // it.
29
+ // The run is a daemon (scripts/demon.mjs), as daemon(3) and `setsid --fork` make one, in a unit of
30
+ // its own (`grillhouse-circuit-<ticket>-<pid>.scope`) when the user's systemd answers, as
31
+ // `systemd-run --user` starts one: the command launches a relay, which launches the run in a
32
+ // session of its own and ends at once, so that the run is neither in the caller's process group,
33
+ // nor under it in the tree of processes, nor in its group of control, and goes on to its end when
34
+ // its caller dies or when the scope of its caller's terminal is killed (BP 320.8: the circuit, a
35
+ // background command of the supervisor's session, died with it; grillhouse-mwz: systemd-oomd
36
+ // killed the scope of the tmux pane of BPScript's supervisor, two circuits with it). The caller
37
+ // relays the run's output to its own streams until the run's first state names it, then ends at 0
38
+ // on the line that says so (`rendreLaMain` of scripts/demon.mjs, as `systemctl start` returns once
39
+ // its unit has started); a run that ends before (a usage, a second run refused, `--arreter`, a
40
+ // stop before any session) ends it on its code, the line of its question with the question; a
41
+ // resumption that finds the session of the stop before still running names itself in the state
42
+ // first, so gives the hand back, then waits for that session as a daemon. The question of a run wakes the supervisor by the wait of the questions
43
+ // (`npx grillhouse superviseur --attendre`, scripts/superviseur.mjs), and its normal end wakes no
44
+ // one, the board shows it (grillhouse-pq6: a launch that waited for its end woke the supervisor a
45
+ // second time on its question, and a queue of launches woke no one before its end). The state
46
+ // names the run (`processus` and its start `depart`), which the board reads, and a second run of
47
+ // the ticket while it lives is refused (exit 2), `--arreter` stopping it, `--rattacher` waiting
48
+ // for its end.
37
49
  //
38
50
  // The circuit decides on structured results only (scripts/resultats.mjs, the one module of their
39
51
  // formats), as Bazel's Build Event Protocol and the JUnit reports carry the outcome of a build:
@@ -235,9 +247,18 @@
235
247
  // file HEAD holds, justifies each green test of that file and excuses no red; on a new file it
236
248
  // justifies nothing, and the report says so for that file. A green test HEAD already holds has
237
249
  // nothing to prove: the version of HEAD of each file plays in the same run, from a sibling file
238
- // (`<nom>.circuit-avant.test.<ext>`, removed after it), and a green test whose full name HEAD's
250
+ // the module of its language names (`soeurDAvant` of the join, removed after it, a red
251
+ // included; one a killed process left is swept at the circuit's start and before each measure,
252
+ // `balayerLesSoeurs`), and a green test whose full name HEAD's
239
253
  // version holds, green there too, is set aside, counted; a body changed under the same name is
240
- // not told apart. The proof passes with a red (of the lot, existing or of a build), even without
254
+ // not told apart. A file its tool cannot play twice in a run (cargo: a unit test of `src/`, a
255
+ // target `tests/<dossier>/main.rs`) has no sibling: the module reads the names of the tests of
256
+ // its HEAD's version without playing them (`testsDeHead` of the join), and each is held for a
257
+ // green HEAD holds, as main stays green. A sibling that no longer compiles (cargo: HEAD's version
258
+ // of a target against the lot's `tests/common`) is not a red of the lot: when the build fails
259
+ // with the siblings and the lot alone builds, the package plays without them, the names of
260
+ // HEAD's tests of those files read (`testsDeHead`, `sansSoeur`); a build the lot alone breaks
261
+ // stays a red (`jouerAvecLesVersionsDAvant`). The proof passes with a red (of the lot, existing or of a build), even without
241
262
  // a file of the lot: a testwriter with no new test to write says so in his handover, the existing
242
263
  // reds are enough. It fails with neither a file of the lot nor a red, with a broken file of the
243
264
  // lot, or with a green of the lot no expected green justifies; under a plan « comportement
@@ -271,6 +292,17 @@
271
292
  // relaunches the testwriter (BP 320.37: a first sending before any check, a second after checks
272
293
  // that named the guard's line). That output is kept in the state (`controlesRouges`), so that a
273
294
  // `--reprendre` or a `--depuis` keeps it.
295
+ // - Before the checks and before the final pass (SUR_LA_POINTE), a resumption included, the copy is
296
+ // prepared on the tip of main by the launcher's own preparation (`avantLaPasse`,
297
+ // scripts/enveloppe/travail-de-la-copie.mjs `preparer`: the guard of its submodules, its
298
+ // advance, the pose of its submodules, their mount, the installation when the lock file is newer
299
+ // than it), as a merge queue plays its checks on the branch set on the tip of main: a copy at the
300
+ // tip or ahead of it is not moved; a copy that moves plays the pass due on its new tree, without
301
+ // the restriction of a regeneration before it; a preparation that fails (an advance in conflict
302
+ // or impossible, a branch gone from main, a lot waiting in the copy's git directory, a submodule
303
+ // or an installation that fails) stops at « lancement », the copy, each file in conflict and the
304
+ // gesture that resumes named, the work left in the copy (OSC Bridge SH-cgi.8.2: a final pass and
305
+ // its resumption red on two reds main had lifted, the copy still on its base of origin).
274
306
  // - The checks after the developpeur judge the plan, as Bazel plays the targets of a change: `npm
275
307
  // test -- <package>` for each package of the plan, touched by the lot or not (a package that plays no
276
308
  // tests, `joueDesTests`, plays only when the lot touches it), `npm test -- <test files of the lot>`
@@ -294,9 +326,10 @@
294
326
  // `grillhouse.lit` (a reader out of the plan whose tests read a directory the lot changes
295
327
  // included). After a review, save on the lot it accepted, the final pass is restricted to what
296
328
  // changed since the lot it read and to its dependents, as Turborepo selects them
297
- // (`laPasseFinale`): the circuit keeps the copy as it stands as a commit on that lot
298
- // (`garderLeLot`), and plays `npm run verifier -- --filter=...[<lot relu>...<copie>]
299
- // --filter=//`, the root's tasks (the guards) with them; Turborepo reads a range from its merge
329
+ // (`laPasseFinale`): the circuit keeps the copy as it stands as a commit on that lot, replayed
330
+ // on the copy's HEAD when the copy advanced since, as Gerrit compares two patch sets each
331
+ // against its own base (`leLotGarde`), and plays `npm run verifier --
332
+ // --filter=...[<lot relu>...<copie>] --filter=//`, the root's tasks (the guards) with them; Turborepo reads a range from its merge
300
333
  // base, the lot read, where a single `[<commit>]` would be read against HEAD. The whole final
301
334
  // pass green keeps the tree of its lot (`verifie`). A red of a package of the plan goes to the
302
335
  // developpeur, three sessions for the final pass, counted apart from those of the checks, the
@@ -367,13 +400,14 @@
367
400
  // - The proof, the checks and the final pass are heavy passes: each holds the lock of the machine
368
401
  // (scripts/verrou-de-machine.mjs), shared by every repository of the machine, and waits, the
369
402
  // wait written to the log, while another measure holds it; the wait bounded, the pass is at 75,
370
- // « à repasser ».
403
+ // « à repasser ». The pass names itself beside the lock, its ticket and its step's title, and
404
+ // its progress while it holds it, which the board of every project shows.
371
405
  // - The report a developpeur receives names his reds first, each on its line (test or finding,
372
406
  // file and line, message, the beginning of a failed build's own log), then the count of the
373
407
  // others and the path of the log; the report of a stop names every red with its package.
374
408
  // - A check at 75 (« à repasser ») out of the final pass plays once more, the gesture `rejeu`;
375
- // verifier plays its tasks at 75 again itself, at rest, and its 75 is the final pass's. A check
376
- // still at 75 ends the circuit at 75, the gesture `a-repasser`. A red relaunches the developpeur
409
+ // the 75 of verifier, the final pass's, is final (its wait for the lock of the machine reached
410
+ // its bound). A check still at 75 ends the circuit at 75, the gesture `a-repasser`. A red relaunches the developpeur
377
411
  // with its report, twice at most, the third session on the strong model (`lancer.sh --modele
378
412
  // opus --effort high`): three sessions for the checks, and three for the final pass.
379
413
  // - After the final pass, green, the reviewer: a session out of the envelope, which sees the whole
@@ -537,6 +571,13 @@
537
571
  // the session it led (`seance`); the state keeps its step, its stop « arrete », its question
538
572
  // lifted, its motive (`--contexte`) as its report, said at the ticket (`Circuit · arret : le
539
573
  // superviseur arrête le circuit : <motif>`), exit 0. Without a state, the call is refused.
574
+ // - `--rattacher`, alone, is a client of the circuit of the ticket, as Bazel's client of its
575
+ // server (`rattacher`): run in its caller's process, not as a daemon, it waits while the process
576
+ // the state names lives, then ends as the circuit's own end does: 0 at « integre », the line of
577
+ // the question and its code on a stop, and 1 for a circuit dead without a final state, with the
578
+ // command that resumes it (`--reprendre`). Killed, it leaves the circuit going. It is the command
579
+ // the supervisor launches, in the background, on each circuit the opening of his session names
580
+ // running (scripts/superviseur.mjs). Without a state, the call is refused.
540
581
  // - On a stop other than 0, the circuit applies its gesture when one settles it (`a-repasser`:
541
582
  // it ends at 75), the gesture written at the ticket and in the log; every other stop goes up to
542
583
  // the supervisor (`monter`): its question (MONTEES of scripts/etapes.mjs, or the agent's own
@@ -561,7 +602,9 @@
561
602
  // project.
562
603
  // - Exit codes: 0 at « integre »; 2 a malformed call; a stop, by its name (ARRETS):
563
604
  // 10 lancement (lancer.sh stopped before the session, or the tools of the project,
564
- // `grillhouse.outils`, refused at the launch or a resumption, before any session), 11 bloqué (a motionless transcript),
605
+ // `grillhouse.outils`, refused at the launch or a resumption, before any session, or the copy
606
+ // that does not move forward to the tip of main before the checks or the final pass, its
607
+ // conflicts named), 11 bloqué (a motionless transcript),
565
608
  // 12 sans-fiche (twice no sheet that conforms), 13 preuve (the third proof fails), 14 controles
566
609
  // (the third developpeur of the checks or of the final pass leaves a red check, a red of the
567
610
  // final pass out of the plan or that no package of the plan holds, or reds to settle),
@@ -597,6 +640,7 @@ import {
597
640
  rmSync,
598
641
  statSync,
599
642
  appendFileSync,
643
+ utimesSync,
600
644
  writeFileSync,
601
645
  } from 'node:fs';
602
646
  import os from 'node:os';
@@ -646,24 +690,28 @@ import {
646
690
  RESULTATS,
647
691
  schemaDeFiche,
648
692
  sorteDuPlan,
693
+ suiviDesConstats,
649
694
  VERDICTS_DU_TRI,
650
695
  VERDICTS_ROUVERTS,
651
696
  } from './resultats.mjs';
697
+ import { preparer } from './enveloppe/travail-de-la-copie.mjs';
652
698
  import { AUTEUR_DE_LA_FILE, INTEGRE } from './integration/file.mjs';
653
699
  import { dossierCommun, lireEntrees } from './integration/file-attente.mjs';
654
700
  import { refusArbitrage } from './integration/integrer.mjs';
655
701
  import { AUTEUR_DU_VERDICT } from './integration/verdict.mjs';
656
702
  import { attendreUnPeu } from './verrou-de-fichier.mjs';
657
- import { AttenteDeLaMachine, avecLaMachine } from './verrou-de-machine.mjs';
703
+ import { AttenteDeLaMachine, avecLaMachine, nommerLAvancement } from './verrou-de-machine.mjs';
658
704
  import { garderLeTotal, ouvrirAvancement } from './avancement.mjs';
659
705
  import { AVANCEMENT } from './mesure/avancement.mjs';
660
706
  import { nomsDesGardes } from './gardes-du-cadre.mjs';
661
707
  import { langageDe } from './langages.mjs';
708
+ import { avecUneLecture } from './lecture-unique.mjs';
662
709
  import { sansArchitecture } from './verrous/verrou.mjs';
663
710
  import { A_REPASSER } from './mesure/pression.mjs';
664
711
  import { departDe, leMemeVivant, ouvrirBase, vivant } from './mesure/base-de-passe.mjs';
665
712
  import { GREFFON } from './cadre.mjs';
666
- import { executerEnDemon } from './demon.mjs';
713
+ import { estLeDemon, executerEnDemon, rendreLaMain, sortieLue } from './demon.mjs';
714
+ import { inscrireLaQuestionLue } from './superviseur.mjs';
667
715
  import { retirerLesCopiesDuDepot } from './copies-finies.mjs';
668
716
 
669
717
  // The time a session's transcripts may stand still before the circuit stops it.
@@ -723,6 +771,7 @@ const MENEES = new Set(SUITE.filter(e => e.qui.includes(AUTO) && e.etat).map(e =
723
771
  const ici = import.meta.dirname;
724
772
  const LANCEUR = path.join(ici, 'enveloppe', 'lancer.sh');
725
773
  const INTEGRER = path.join(ici, 'integration', 'integrer.mjs');
774
+ const PREPARER = path.join(ici, 'enveloppe', 'travail-de-la-copie.mjs');
726
775
  const FILE = path.join(ici, 'integration', 'file.mjs');
727
776
  const REGISTRE = path.join(ici, 'registre.mjs');
728
777
  // A generator of the frame, beside this script, as the command of a reference.
@@ -816,11 +865,13 @@ function lireArguments(argv) {
816
865
  depuis: null,
817
866
  etendre: null,
818
867
  arreter: false,
868
+ rattacher: false,
819
869
  };
820
870
  for (let i = 0; i < argv.length; i++) {
821
871
  const a = argv[i];
822
872
  if (a === '--reprendre') o.reprendre = true;
823
873
  else if (a === '--arreter') o.arreter = true;
874
+ else if (a === '--rattacher') o.rattacher = true;
824
875
  else if (a === '--etendre') {
825
876
  const liste = String(argv[i + 1] ?? '')
826
877
  .split(',')
@@ -852,6 +903,8 @@ function lireArguments(argv) {
852
903
  );
853
904
  if (o.arreter && (o.reprendre || o.depuis))
854
905
  throw new Usage('--arreter va seule, son motif en --contexte.');
906
+ if (o.rattacher && (o.reprendre || o.depuis || o.etendre || o.arreter || o.contexte !== null))
907
+ throw new Usage('--rattacher va seule.');
855
908
  return o;
856
909
  }
857
910
 
@@ -1074,7 +1127,8 @@ function ecrireRapport(ctx, etape, texte, resultat, rapport = texte) {
1074
1127
 
1075
1128
  // The state of the run, written whole (`seance` and `question` null and `finale` false unless <etat>
1076
1129
  // sets them, `processus`, `paquets`, `constats`, `verifie`, `reprise`, `aRegenerer`, `refus` and
1077
- // `controlesRouges` the run's), kept as the run's current state.
1130
+ // `controlesRouges` the run's), kept as the run's current state. Its first write in a daemon gives
1131
+ // the hand back to the caller (`rendreLaMain`): the state names the run from then on.
1078
1132
  function ecrireEtat(ctx, etat) {
1079
1133
  ctx.courant = {
1080
1134
  finale: false,
@@ -1100,6 +1154,15 @@ function ecrireEtat(ctx, etat) {
1100
1154
  `${JSON.stringify({ ...ctx.courant, journal: ctx.journal }, null, 2)}\n`
1101
1155
  );
1102
1156
  renameSync(provisoire, ctx.etat);
1157
+ // The supervisor's « --arreter » is no launch, and a run whose first state is already a stop (a
1158
+ // refusal before any session: the arbitrage, the tools, the generated files) ends at once: their
1159
+ // caller waits for their end, and says the stop and its question (`monter`) with its code.
1160
+ if (ctx.arreter || ctx.courant.raison) {
1161
+ return;
1162
+ }
1163
+ rendreLaMain(
1164
+ `▶ Circuit de ${ctx.ticket} lancé (processus ${process.pid}), détaché : sa question réveille l'attente des questions (\`npx grillhouse superviseur --attendre\`), sa fin se lit au panneau ; \`--rattacher\` attend sa fin.\n`
1165
+ );
1103
1166
  }
1104
1167
 
1105
1168
  // The register's line of the step <etape> the circuit led itself from <debut> (an ISO date) to
@@ -1720,24 +1783,24 @@ export function texteDuVerdict(fiche) {
1720
1783
  // The review of the lot, the reviewer's session out of the envelope, from the second template:
1721
1784
  // `{ verdict, fiche, texte, arbre }`, its sheet, the verdict the circuit writes at the ticket from
1722
1785
  // it, under the reviewer's author, and the tree of the lot it read. The lot it reads is kept as a
1723
- // patch set (`garderLeLot`), on the lot the review before read, joined to its sheet's entry (`lot:
1724
- // { commit, arbre, fichiers }`); after a review sent back, the review reads the difference
1725
- // between the two and the findings before it (the bounded review), as Gerrit has the next review
1726
- // read the difference between two patch sets: the files of the lot that changed since, the
1727
- // command of the difference, the findings still open with their recipients.
1786
+ // patch set (`leLotGarde`), on the lot the review before read set on the copy's HEAD, joined to
1787
+ // its sheet's entry (`lot: { commit, arbre, base, fichiers }`); after a review sent back, the
1788
+ // review reads the difference between the two and the findings before it (the bounded review), as
1789
+ // Gerrit has the next review read the difference between two patch sets, each against its own
1790
+ // base: the files of the lot that changed since, the command of the difference, the findings
1791
+ // still open with their recipients.
1728
1792
  async function relire(ctx) {
1729
1793
  const { tests, code } = fichiersDuLot(ctx);
1730
1794
  const rapports = rapportsDuCircuit(ctx);
1731
1795
  const precedents = fichesDe(ctx, 'relecteur').length;
1732
- const avant = relectureDAvant(ctx);
1733
- const lot = garderLeLot(ctx, avant?.lot.commit);
1796
+ const { avant, depuis, lot } = leLotGarde(ctx);
1734
1797
  let lus = { tests, code };
1735
- let precedente = 'aucune : tu relis le lot entier';
1736
- if (avant && lot) {
1798
+ // The findings still open go to every review, bounded or whole.
1799
+ const ouvertsALaRelecture = (ctx.constats ?? []).map(c => c.titre);
1800
+ let precedente = relectureEntiere(ctx.constats ?? []);
1801
+ if (avant && depuis && lot) {
1737
1802
  const dansLeLot = new Set([...tests, ...code, ...(avant.lot.fichiers ?? [])]);
1738
- const changes = differenceDesLots(ctx, avant.lot.commit, lot.commit).filter(f =>
1739
- dansLeLot.has(f)
1740
- );
1803
+ const changes = differenceDesLots(ctx, depuis, lot.commit).filter(f => dansLeLot.has(f));
1741
1804
  lus = {
1742
1805
  tests: changes.filter(f => duTestwriter(ctx, f)),
1743
1806
  code: changes.filter(f => !duTestwriter(ctx, f)),
@@ -1745,7 +1808,7 @@ async function relire(ctx) {
1745
1808
  precedente = [
1746
1809
  `la relecture ${precedents}, ${avant.fiche.verdict} : tu relis la différence du lot depuis elle et ses constats, selon ta compétence (« La relecture bornée »).`,
1747
1810
  '',
1748
- `- La différence : \`git diff ${avant.lot.commit} ${lot.commit}\`, dans la copie du ticket ; ses fichiers : ${changes.join(', ') || 'aucun'}.`,
1811
+ `- La différence : \`git diff ${depuis} ${lot.commit}\`, dans la copie du ticket ; ses fichiers : ${changes.join(', ') || 'aucun'}.`,
1749
1812
  '- Les constats bloquants qui restent ouverts, chacun avec son destinataire :',
1750
1813
  '',
1751
1814
  ...lignesDesConstats(ctx.constats ?? []),
@@ -1763,8 +1826,9 @@ async function relire(ctx) {
1763
1826
  // since.
1764
1827
  const touches =
1765
1828
  avant &&
1829
+ depuis &&
1766
1830
  lot &&
1767
- langageDe(ctx.copie).elementsDuLot(ctx.copie, { avant: avant.lot.commit, apres: lot.commit });
1831
+ langageDe(ctx.copie).elementsDuLot(ctx.copie, { avant: depuis, apres: lot.commit });
1768
1832
  const bornee = touches
1769
1833
  ? {
1770
1834
  touches: touches.etat === 'fait' ? new Set(touches.elements.map(e => e.id)) : null,
@@ -1780,7 +1844,7 @@ async function relire(ctx) {
1780
1844
  ? `oui : ${precedents} relecture(s) d'avant ont rendu le lot, et le lot a repassé le circuit depuis`
1781
1845
  : 'non',
1782
1846
  lots: [
1783
- ...(avant && lot ? ["ce que le lot change depuis la relecture d'avant"] : []),
1847
+ ...(avant && depuis && lot ? ["ce que le lot change depuis la relecture d'avant"] : []),
1784
1848
  `le lot de tests : ${lus.tests.join(', ') || 'aucun fichier'}`,
1785
1849
  `le lot de code : ${lus.code.join(', ') || 'aucun fichier'}`,
1786
1850
  ].join(' ; '),
@@ -1795,7 +1859,11 @@ async function relire(ctx) {
1795
1859
  horsEnveloppe: true,
1796
1860
  droits: horsDeLEnveloppe(ctx, 'relecteur', 'opus'),
1797
1861
  avec: lot ? { lot: { ...lot, fichiers: [...tests, ...code] } } : {},
1798
- valider: f => conformiteDuLot(f, liste),
1862
+ // Every review judges the findings still open, bounded or whole (`suiviDesConstats`).
1863
+ valider: f =>
1864
+ [conformiteDuLot(f, liste), suiviDesConstats(f, ouvertsALaRelecture)]
1865
+ .filter(Boolean)
1866
+ .join(' ; ') || null,
1799
1867
  });
1800
1868
  const texte = texteDuVerdict(fiche);
1801
1869
  const r = ctx.bdSous(AUTEUR_DU_VERDICT, 'comments', 'add', ctx.ticket, texte);
@@ -1803,6 +1871,22 @@ async function relire(ctx) {
1803
1871
  return { verdict: fiche.verdict, fiche, texte, arbre: lot?.arbre ?? null };
1804
1872
  }
1805
1873
 
1874
+ // The line « LA RELECTURE D'AVANT » of a whole review (no review before, the replay of the lot in
1875
+ // conflict, or a review before without its base): with the findings <constats> still open, each
1876
+ // with its recipient and the developpeur's answer under it, which it judges lifted or not in
1877
+ // `suivi`, as Gerrit carries the unresolved comments to each new patch set whatever the form of
1878
+ // the review.
1879
+ export function relectureEntiere(constats) {
1880
+ if (!constats.length) return 'aucune : tu relis le lot entier';
1881
+ return [
1882
+ 'aucune différence à lire : tu relis le lot entier, et tu juges chaque constat bloquant qui reste ouvert, levé ou non levé, dans `suivi`, selon ta compétence (« La relecture entière ») ; chacun, avec son destinataire :',
1883
+ '',
1884
+ ...lignesDesConstats(constats),
1885
+ ]
1886
+ .join('\n')
1887
+ .trim();
1888
+ }
1889
+
1806
1890
  // The elements of the lot <liste> (`elementsDuLot` of the module of language) as the reviewer's instruction
1807
1891
  // lists them: one line each, its id, its kind, its status, its export, its package and its place;
1808
1892
  // in a bounded review (<bornee>: `{ touches, lignes }`, the ids the difference touches, null for
@@ -1837,13 +1921,14 @@ function texteDesElements(liste, bornee = null) {
1837
1921
  }
1838
1922
 
1839
1923
  // The last review of the ticket and the lot it read: its sheet's entry (`{ fiche, lot: { commit,
1840
- // arbre, fichiers } }`), or null before any, without a copy, or when the repository no longer
1841
- // holds that lot.
1924
+ // arbre, base, fichiers } }`), or null before any, without a copy, or when the lot or its base is
1925
+ // not kept (the repository no longer holds one of them).
1842
1926
  function relectureDAvant(ctx) {
1843
1927
  const e = lesFiches(ctx).findLast(x => x.role === 'relecteur');
1844
- if (!e?.lot?.commit || !existsSync(ctx.copie)) return null;
1845
- const r = spawnSync('git', ['-C', ctx.copie, 'cat-file', '-e', `${e.lot.commit}^{commit}`]);
1846
- return r.status === 0 ? e : null;
1928
+ if (!e?.lot?.commit || !e.lot.base || !existsSync(ctx.copie)) return null;
1929
+ const tient = c =>
1930
+ spawnSync('git', ['-C', ctx.copie, 'cat-file', '-e', `${c}^{commit}`]).status === 0;
1931
+ return tient(e.lot.commit) && tient(e.lot.base) ? e : null;
1847
1932
  }
1848
1933
 
1849
1934
  // The tree of the copy as it stands, the copy's HEAD and index untouched: its index copied to a
@@ -1869,29 +1954,89 @@ function arbreDeLaCopie(ctx) {
1869
1954
  }
1870
1955
  }
1871
1956
 
1872
- // The lot of the copy kept as a commit on <parent> (the lot kept before, or HEAD), as Gerrit keeps
1873
- // each patch set of a change: `{ commit, arbre }`, or null when git fails. Turborepo compares two
1874
- // of them (`--filter=...[<avant>...<après>]`, the merge base of the range being the first), and
1875
- // the reviewer reads their difference.
1957
+ // The copy's HEAD, the base of the lot as it stands (the tip of main of its time), or null.
1958
+ function laBase(ctx) {
1959
+ const r = spawnSync('git', ['-C', ctx.copie, 'rev-parse', 'HEAD'], { encoding: 'utf8' });
1960
+ return r.status === 0 ? r.stdout.trim() : null;
1961
+ }
1962
+
1963
+ // The tree <arbre> kept as a commit on <parent> in the copy, under the circuit's author, with the
1964
+ // message <message>: its id, or null when git fails.
1965
+ function unCommit(ctx, arbre, parent, message) {
1966
+ const qui = { name: AUTEUR_DU_CIRCUIT, email: 'circuit@grillhouse.invalid' };
1967
+ const r = spawnSync('git', ['-C', ctx.copie, 'commit-tree', arbre, '-p', parent, '-m', message], {
1968
+ encoding: 'utf8',
1969
+ env: {
1970
+ ...process.env,
1971
+ GIT_AUTHOR_NAME: qui.name,
1972
+ GIT_AUTHOR_EMAIL: qui.email,
1973
+ GIT_COMMITTER_NAME: qui.name,
1974
+ GIT_COMMITTER_EMAIL: qui.email,
1975
+ },
1976
+ });
1977
+ return r.status === 0 ? r.stdout.trim() : null;
1978
+ }
1979
+
1980
+ // The lot of the copy kept as a commit on <parent> (a lot kept before, or HEAD), as Gerrit keeps
1981
+ // each patch set of a change: `{ commit, arbre, base }`, its base the copy's HEAD, or null when git
1982
+ // fails. Turborepo compares two of them (`--filter=...[<avant>...<après>]`, the merge base of the
1983
+ // range being the first), and the reviewer reads their difference.
1876
1984
  function garderLeLot(ctx, parent) {
1877
1985
  const arbre = arbreDeLaCopie(ctx);
1878
- if (!arbre) return null;
1879
- const qui = { name: AUTEUR_DU_CIRCUIT, email: 'circuit@grillhouse.invalid' };
1986
+ const base = laBase(ctx);
1987
+ if (!arbre || !base) return null;
1988
+ const commit = unCommit(ctx, arbre, parent ?? base, `lot de ${ctx.ticket}`);
1989
+ return commit ? { commit, arbre, base } : null;
1990
+ }
1991
+
1992
+ // The lot <lot> kept before (`{ commit, base }`) as it reads on the copy's HEAD, as Gerrit compares
1993
+ // two patch sets each against its own base: the lot itself while HEAD is its base; after an
1994
+ // advance of the copy, what it changed since its base replayed on HEAD (`git merge-tree
1995
+ // --write-tree --merge-base=<base> HEAD <lot>`), kept as a commit on HEAD, so that its difference
1996
+ // with the next lot holds what the lot changed, never the commits of main. Null when the replay
1997
+ // conflicts with what main changed, or git fails: nothing bounds the next review.
1998
+ function leLotSurLaBase(ctx, lot) {
1999
+ const base = laBase(ctx);
2000
+ if (!base) return null;
2001
+ if (lot.base === base) return lot.commit;
1880
2002
  const r = spawnSync(
1881
2003
  'git',
1882
- ['-C', ctx.copie, 'commit-tree', arbre, '-p', parent ?? 'HEAD', '-m', `lot de ${ctx.ticket}`],
1883
- {
1884
- encoding: 'utf8',
1885
- env: {
1886
- ...process.env,
1887
- GIT_AUTHOR_NAME: qui.name,
1888
- GIT_AUTHOR_EMAIL: qui.email,
1889
- GIT_COMMITTER_NAME: qui.name,
1890
- GIT_COMMITTER_EMAIL: qui.email,
1891
- },
1892
- }
2004
+ ['-C', ctx.copie, 'merge-tree', '--write-tree', `--merge-base=${lot.base}`, base, lot.commit],
2005
+ { encoding: 'utf8' }
1893
2006
  );
1894
- return r.status === 0 ? { commit: r.stdout.trim(), arbre } : null;
2007
+ if (r.status !== 0) return null;
2008
+ const arbre = r.stdout.split('\n')[0].trim();
2009
+ return unCommit(ctx, arbre, base, `lot relu de ${ctx.ticket} sur ${base}`);
2010
+ }
2011
+
2012
+ // The lot of the copy kept against the review before: `{ avant, depuis, lot }`, that review
2013
+ // (`relectureDAvant`, null before any), the lot it read set on the copy's HEAD (`leLotSurLaBase`,
2014
+ // null when nothing bounds), and the copy kept as a lot on it (on HEAD without it). The bounded
2015
+ // review, its elements to judge again and the restricted final pass read the difference from
2016
+ // `depuis` to `lot`.
2017
+ export function leLotGarde(ctx) {
2018
+ const avant = relectureDAvant(ctx);
2019
+ const depuis = avant ? leLotSurLaBase(ctx, avant.lot) : null;
2020
+ return { avant, depuis, lot: garderLeLot(ctx, depuis) };
2021
+ }
2022
+
2023
+ // The tree of the commit <commit> in the copy, or null.
2024
+ function arbreDuCommit(ctx, commit) {
2025
+ const r = spawnSync('git', ['-C', ctx.copie, 'rev-parse', `${commit}^{tree}`], {
2026
+ encoding: 'utf8',
2027
+ });
2028
+ return r.status === 0 ? r.stdout.trim() : null;
2029
+ }
2030
+
2031
+ // Whether the last review accepted the lot whose tree is <arbre>: its lot, set on the copy's HEAD
2032
+ // (`leLotSurLaBase`), is that tree, as Gerrit keeps the votes of a patch set across a trivial
2033
+ // rebase; an advance of the copy that leaves the lot as it was sends it to no other review.
2034
+ export function leLotAccepte(ctx, arbre) {
2035
+ const r = relectureDAvant(ctx);
2036
+ if (r?.fiche.verdict !== 'ACCEPTÉ' || !arbre) return false;
2037
+ if (r.lot.arbre === arbre) return true;
2038
+ const surLaBase = leLotSurLaBase(ctx, r.lot);
2039
+ return Boolean(surLaBase) && arbreDuCommit(ctx, surLaBase) === arbre;
1895
2040
  }
1896
2041
 
1897
2042
  // The files that differ between the lots kept <avant> and <apres>, relative to the copy, sorted.
@@ -1905,19 +2050,16 @@ function differenceDesLots(ctx, avant, apres) {
1905
2050
 
1906
2051
  // The final pass the lot calls for: `{ arbre, restreinte }`, the tree of the copy, and, after a
1907
2052
  // review whose lot it no longer is the accepted one, the range Turborepo plays (`{ avant, apres }`:
1908
- // the lot that review read and the copy kept on it), null for the whole pass: before any review,
1909
- // or on the lot the last review accepted.
1910
- function laPasseFinale(ctx) {
1911
- const avant = relectureDAvant(ctx);
2053
+ // the lot that review read set on the copy's HEAD, and the copy kept on it, `leLotGarde`), null
2054
+ // for the whole pass: before any review, on the lot the last review accepted (`leLotAccepte`, an
2055
+ // advance of the copy included), or when that lot does not replay on HEAD.
2056
+ export function laPasseFinale(ctx) {
1912
2057
  const arbre = arbreDeLaCopie(ctx);
1913
- if (!avant || !arbre) return { arbre, restreinte: null };
1914
- if (avant.fiche.verdict === 'ACCEPTÉ' && avant.lot.arbre === arbre) {
1915
- return { arbre, restreinte: null };
1916
- }
1917
- const apres = garderLeLot(ctx, avant.lot.commit);
2058
+ if (!arbre || leLotAccepte(ctx, arbre)) return { arbre, restreinte: null };
2059
+ const { depuis, lot } = leLotGarde(ctx);
1918
2060
  return {
1919
2061
  arbre,
1920
- restreinte: apres ? { avant: avant.lot.commit, apres: apres.commit } : null,
2062
+ restreinte: depuis && lot ? { avant: depuis, apres: lot.commit } : null,
1921
2063
  };
1922
2064
  }
1923
2065
 
@@ -2004,7 +2146,7 @@ function regenerer(ctx, noms, notes = [], suite = null, refusAuLot = false) {
2004
2146
  );
2005
2147
  const aJouer = toutes.filter(r => noms.includes(r.nom));
2006
2148
  if (aJouer.some(r => r.abaisser)) writeFileSync(fichierDesNotes, `${JSON.stringify(notes)}\n`);
2007
- const avant = garderLeLot(ctx, relectureDAvant(ctx)?.lot.commit);
2149
+ const { lot: avant } = leLotGarde(ctx);
2008
2150
  if (!avant) {
2009
2151
  throw new Arret(
2010
2152
  'references',
@@ -2117,6 +2259,61 @@ export const environnementDeLaPasse = (ctx, base, env = {}) => ({
2117
2259
  ...env,
2118
2260
  });
2119
2261
 
2262
+ // The steps whose pass judges the lot, 3.1 and 4.1 (one state, `finale` apart): the copy is
2263
+ // prepared on the tip of main before each of them.
2264
+ export const SUR_LA_POINTE = new Set([CONTROLES]);
2265
+
2266
+ // What the circuit does before the step <etape>, whose regeneration before it is <regeneration>
2267
+ // (`ctx.regeneration`), as a merge queue plays its checks on the branch set on the tip of main: at a
2268
+ // step of SUR_LA_POINTE, the copy prepared by the launcher's own preparation
2269
+ // (scripts/enveloppe/travail-de-la-copie.mjs, `preparer`: the guard of its submodules, its advance
2270
+ // to the main tree's HEAD, the pose of its submodules, their mount, the installation when the lock
2271
+ // file is newer), its output in the ticket's log, with <env>. `{ avancee, regeneration }`: whether
2272
+ // the copy's HEAD moved (a copy at the tip, or ahead of it, is not moved), and the regeneration the
2273
+ // pass keeps, none once the copy moved, its tree new; at any other step, the regeneration as it is,
2274
+ // the copy untouched. Or `{ arret }`, the stop « lancement » (its name, report, piece and
2275
+ // question), the copy and its work as the preparation leaves them, each file in conflict named.
2276
+ export function avantLaPasse(
2277
+ ctx,
2278
+ etape,
2279
+ regeneration,
2280
+ env = environnementDeLaPasse(ctx, process.env)
2281
+ ) {
2282
+ if (!SUR_LA_POINTE.has(etape)) return { avancee: false, regeneration };
2283
+ const tete = dossier =>
2284
+ spawnSync('git', ['-C', dossier, 'rev-parse', 'HEAD'], { encoding: 'utf8' });
2285
+ const cible = tete(ctx.racine);
2286
+ const avant = tete(ctx.copie);
2287
+ let r;
2288
+ if (cible.status === 0 && avant.status === 0) {
2289
+ entete(ctx, 'preparation');
2290
+ appendFileSync(
2291
+ ctx.journal,
2292
+ `$ node ${PREPARER} preparer ${ctx.copie} ${cible.stdout.trim()}\n`
2293
+ );
2294
+ const fd = openSync(ctx.journal, 'a');
2295
+ try {
2296
+ r = preparer(ctx.copie, cible.stdout.trim(), { env, sortie: fd });
2297
+ } finally {
2298
+ closeSync(fd);
2299
+ }
2300
+ } else {
2301
+ r = { ok: false, message: `⛔ ${String(cible.stderr || avant.stderr).trim()}` };
2302
+ }
2303
+ if (r.ok) {
2304
+ const avancee = tete(ctx.copie).stdout.trim() !== avant.stdout.trim();
2305
+ return { avancee, regeneration: avancee ? null : regeneration };
2306
+ }
2307
+ return {
2308
+ arret: {
2309
+ nom: 'lancement',
2310
+ rapport: `La copie ${ctx.copie} ne se prépare pas sur la pointe de main avant la passe qui juge le lot.\n\n${r.message}`,
2311
+ piece: `$ node ${PREPARER} preparer ${ctx.copie} ${cible.stdout.trim()}\n${r.message}`,
2312
+ question: `La copie ${ctx.copie} se remet en état à la main, comme la préparation le dit (chaque fichier en conflit résolu puis \`git add\`, le lot en attente repris, la branche ramenée sur main, ou le sous-module et l'installation réparés), sans perdre son travail ; puis \`npx grillhouse circuit ${ctx.ticket} --reprendre\`, qui prépare la copie et rejoue la passe.`,
2313
+ },
2314
+ };
2315
+ }
2316
+
2120
2317
  // The tools of the project whose main tree is <racine>, read at the launch of a run:
2121
2318
  // `{ outils }`, or `{ arret }`, the stop « lancement » that goes up to the supervisor before any
2122
2319
  // session (its code, name, report, piece and question), the faults of the key named.
@@ -2177,7 +2374,12 @@ function commandeDeReference(ctx, commande) {
2177
2374
  stdio: ['ignore', fd, fd],
2178
2375
  env: environnementDeLaPasse(ctx, env),
2179
2376
  }),
2180
- { racine: ctx.copie, dire: l => appendFileSync(ctx.journal, `${l}\n`) }
2377
+ {
2378
+ racine: ctx.copie,
2379
+ dire: l => appendFileSync(ctx.journal, `${l}\n`),
2380
+ ticket: ctx.ticket,
2381
+ sorte: etapeDuCircuit({ etape: 'references' }).titre,
2382
+ }
2181
2383
  );
2182
2384
  const code = r.status ?? 1;
2183
2385
  return {
@@ -2791,21 +2993,32 @@ function npm(ctx, etape, args, env = {}) {
2791
2993
  appendFileSync(ctx.journal, `$ ${prefixe.join('')}npm ${args.join(' ')}\n`);
2792
2994
  const fd = openSync(ctx.journal, 'a');
2793
2995
  try {
2996
+ const finale = etape === 'controles' && args[1] === 'verifier';
2794
2997
  const r = avecLaMachine(
2795
2998
  envMachine =>
2796
- avecAvancement(ctx, genreDeLaPasse(ctx, etape, args), avancement =>
2797
- spawnSync('npm', args, {
2798
- cwd: ctx.copie,
2799
- stdio: ['ignore', fd, fd],
2800
- env: environnementDeLaPasse(ctx, envMachine, {
2801
- ...env,
2802
- [RESULTATS]: dossier,
2803
- [AVANCEMENT]: avancement,
2804
- ...(args[0] === 'test' ? { [DEPUIS_LE_VERT]: '1' } : {}),
2805
- }),
2806
- })
2807
- ),
2808
- { racine: ctx.copie, dire: l => appendFileSync(ctx.journal, `${l}\n`) }
2999
+ avecAvancement(ctx, genreDeLaPasse(ctx, etape, args), avancement => {
3000
+ const oublier = nommerLAvancement({ env: envMachine, dossier: avancement });
3001
+ try {
3002
+ return spawnSync('npm', args, {
3003
+ cwd: ctx.copie,
3004
+ stdio: ['ignore', fd, fd],
3005
+ env: environnementDeLaPasse(ctx, envMachine, {
3006
+ ...env,
3007
+ [RESULTATS]: dossier,
3008
+ [AVANCEMENT]: avancement,
3009
+ ...(args[0] === 'test' ? { [DEPUIS_LE_VERT]: '1' } : {}),
3010
+ }),
3011
+ });
3012
+ } finally {
3013
+ oublier();
3014
+ }
3015
+ }),
3016
+ {
3017
+ racine: ctx.copie,
3018
+ dire: l => appendFileSync(ctx.journal, `${l}\n`),
3019
+ ticket: ctx.ticket,
3020
+ sorte: etapeDuCircuit({ etape, finale })?.titre ?? etape,
3021
+ }
2809
3022
  );
2810
3023
  return { code: r.status ?? 1, dossier };
2811
3024
  } catch (e) {
@@ -2844,23 +3057,111 @@ function avecAvancement(ctx, genre, passe) {
2844
3057
  }
2845
3058
  }
2846
3059
 
2847
- // HEAD's version of each file of <fichiers> that HEAD holds, written beside it in the copy under
2848
- // the name `<nom>.circuit-avant.<test|spec>.<ext>`, which the same run plays: Map file → sibling,
2849
- // both relative to the copy. The caller removes the siblings.
2850
- function versionsDAvant(ctx, fichiers) {
2851
- const out = new Map();
2852
- for (const f of fichiers) {
3060
+ // Removes from the copy each sibling of HEAD's version a killed process left there, between its
3061
+ // writing and its removal (`avecLesVersionsDAvant`): a file git does not track, the sibling, by
3062
+ // the name the module of its language gives (`soeurDAvant` of the join, a file beside its own),
3063
+ // of a file of its folder that git tracks and that exists, each named in the ticket's log. A file
3064
+ // git tracks, or whose file is absent, is left. What the module reads at a cost is read once for
3065
+ // the sweep (`avecUneLecture`, ./lecture-unique.mjs), whatever the number of files. Returns the
3066
+ // siblings removed, from the copy, sorted.
3067
+ export function balayerLesSoeurs(ctx) {
3068
+ return avecUneLecture(() => balayer(ctx));
3069
+ }
3070
+
3071
+ // The sweep of `balayerLesSoeurs`, in its scope of readings done once.
3072
+ function balayer(ctx) {
3073
+ const git = (...a) =>
3074
+ spawnSync('git', ['-C', ctx.copie, ...a], { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
3075
+ const r = git('ls-files', '-z', '--others', '--exclude-standard');
3076
+ if (r.status !== 0) return [];
3077
+ const parDossier = new Map();
3078
+ for (const f of r.stdout.split('\0').filter(Boolean)) {
3079
+ const d = path.posix.dirname(f);
3080
+ parDossier.set(d, [...(parDossier.get(d) ?? []), f]);
3081
+ }
3082
+ const langage = langageDe(ctx.copie);
3083
+ const retirees = [];
3084
+ for (const [dossier, nonSuivis] of parDossier) {
3085
+ const suivis = git('ls-files', '-z', ...(dossier === '.' ? [] : ['--', `${dossier}/`]));
3086
+ const soeurs = new Set(
3087
+ suivis.stdout
3088
+ .split('\0')
3089
+ .filter(f => f && path.posix.dirname(f) === dossier)
3090
+ .filter(f => existsSync(path.join(ctx.copie, f)))
3091
+ .map(f => langage.soeurDAvant(f, ctx.copie))
3092
+ );
3093
+ for (const f of nonSuivis.filter(n => soeurs.has(n))) {
3094
+ rmSync(path.join(ctx.copie, f), { force: true });
3095
+ retirees.push(f);
3096
+ if (ctx.journal) {
3097
+ appendFileSync(ctx.journal, `sœur de la version de HEAD laissée, retirée : ${f}\n`);
3098
+ }
3099
+ }
3100
+ }
3101
+ return retirees.sort();
3102
+ }
3103
+
3104
+ // Runs <jouer> with HEAD's version of each file of <fichiers> that HEAD holds written beside it in
3105
+ // the copy, under the name the module of its language gives (`soeurDAvant` of the join), a test
3106
+ // its tool plays in the same run: <jouer> gets the Map file → sibling, both relative to the copy,
3107
+ // and the Map file → names of the tests of HEAD's version, read without playing them, of each file
3108
+ // its tool cannot play twice in a run (`testsDeHead` of the join). A sibling left before is swept
3109
+ // first (`balayerLesSoeurs`); the siblings are removed after it, a red included. With
3110
+ // <sansSoeurs>, no sibling is written: the names of HEAD's tests of each file that has one are read
3111
+ // too (`testsDeHead`, `sansSoeur`). Returns what <jouer> returns.
3112
+ export function avecLesVersionsDAvant(ctx, fichiers, jouer, { sansSoeurs = false } = {}) {
3113
+ balayerLesSoeurs(ctx);
3114
+ const avant = new Map();
3115
+ const lus = new Map();
3116
+ const deHead = f => {
2853
3117
  const r = spawnSync('git', ['-C', ctx.copie, 'show', `HEAD:${f}`], {
2854
3118
  encoding: 'utf8',
2855
3119
  maxBuffer: 64 * 1024 * 1024,
2856
3120
  });
2857
- if (r.status !== 0) continue;
2858
- const soeur = f.replace(/\.(test|spec)(\.[cm]?[jt]sx?)$/, '.circuit-avant.$1$2');
2859
- if (soeur === f) continue;
2860
- writeFileSync(path.join(ctx.copie, soeur), r.stdout);
2861
- out.set(f, soeur);
3121
+ return r.status === 0 ? r.stdout : null;
3122
+ };
3123
+ try {
3124
+ for (const f of fichiers) {
3125
+ const langage = langageDe(ctx.copie);
3126
+ const soeur = langage.soeurDAvant(f, ctx.copie);
3127
+ if (soeur === null || sansSoeurs) {
3128
+ const sansSoeur = soeur !== null;
3129
+ const noms = langage.testsDeHead(f, ctx.copie, deHead, { sansSoeur });
3130
+ if (noms !== null) lus.set(f, noms);
3131
+ continue;
3132
+ }
3133
+ const texte = deHead(f);
3134
+ if (texte === null) continue;
3135
+ writeFileSync(path.join(ctx.copie, soeur), texte);
3136
+ avant.set(f, soeur);
3137
+ }
3138
+ return jouer(avant, lus);
3139
+ } finally {
3140
+ for (const soeur of avant.values()) rmSync(path.join(ctx.copie, soeur), { force: true });
2862
3141
  }
2863
- return out;
3142
+ }
3143
+
3144
+ // The run of the files <groupe> of one package of the proof, HEAD's version of each beside it
3145
+ // (`avecLesVersionsDAvant`): `{ avant, lus, code, resultats, constructions }`, <jouer> given the
3146
+ // files to play and returning `{ code, resultats, constructions }`. A sibling that does not compile
3147
+ // is not a red of the lot (the owner's decision on grillhouse-3e2.2): when the build fails with
3148
+ // siblings, the package plays again without them, and when the lot alone builds, that run is kept,
3149
+ // the names of HEAD's tests of those files read without playing them; a build the lot alone breaks
3150
+ // stays a red, the first run kept.
3151
+ export function jouerAvecLesVersionsDAvant(ctx, groupe, jouer) {
3152
+ const avecSoeurs = avecLesVersionsDAvant(ctx, groupe, (avant, lus) => ({
3153
+ avant,
3154
+ lus,
3155
+ ...jouer([...groupe, ...avant.values()]),
3156
+ }));
3157
+ if (avecSoeurs.avant.size === 0 || avecSoeurs.constructions.length === 0) return avecSoeurs;
3158
+ const sansSoeurs = avecLesVersionsDAvant(
3159
+ ctx,
3160
+ groupe,
3161
+ (avant, lus) => ({ avant, lus, ...jouer(groupe) }),
3162
+ { sansSoeurs: true }
3163
+ );
3164
+ return sansSoeurs.constructions.length === 0 ? sansSoeurs : avecSoeurs;
2864
3165
  }
2865
3166
 
2866
3167
  // The log of the task <t> of a summary of Turborepo, its file from the root of the copy: its path,
@@ -2872,9 +3173,10 @@ function journalDeTache(ctx, t) {
2872
3173
  }
2873
3174
 
2874
3175
  // The measure of the proof of the red: one run per package, `npm test -- --force <files>` of the
2875
- // lot that lie in it, HEAD's version of each beside it, or, with no file of the lot, `npm test --
2876
- // <package>` for each package of the plan, played whole. Each run `{ groupe, entier, avant, code,
2877
- // resultats, constructions }`. A measure on the same tree (the copy's fingerprint, `empreinte`) is
3176
+ // lot that lie in it, HEAD's version of each beside it, played again without the siblings when
3177
+ // they alone break the build (`jouerAvecLesVersionsDAvant`), or, with no file of the lot, `npm
3178
+ // test -- <package>` for each package of the plan, played whole. Each run `{ groupe, entier, avant, lus,
3179
+ // code, resultats, constructions }`. A measure on the same tree (the copy's fingerprint, `empreinte`) is
2878
3180
  // not played again, as Turborepo replays a task whose inputs did not move: the last one is kept
2879
3181
  // in `ctx.mesureDeLaPreuve`.
2880
3182
  function mesureDeLaPreuve(ctx, liste, fichiers) {
@@ -2889,35 +3191,43 @@ function mesureDeLaPreuve(ctx, liste, fichiers) {
2889
3191
  const runs = [];
2890
3192
  for (const [dossier, groupe] of groupes) {
2891
3193
  const entier = entiers.includes(dossier);
2892
- const avant = versionsDAvant(ctx, groupe);
2893
- let r;
2894
- try {
2895
- // The files of the lot play for real (`--force`): a run replayed from Turborepo's cache, the
2896
- // checks' same command on the same inputs, writes no report of Vitest.
2897
- r = npm(ctx, 'preuve', [
3194
+ // The files of the lot play for real (`--force`): a run replayed from Turborepo's cache, the
3195
+ // checks' same command on the same inputs, writes no report of Vitest.
3196
+ const run = jouerAvecLesVersionsDAvant(ctx, groupe, aJouer => {
3197
+ const r = npm(ctx, 'preuve', [
2898
3198
  'test',
2899
3199
  '--',
2900
3200
  ...(entier ? [dossier] : ['--force']),
2901
- ...groupe,
2902
- ...avant.values(),
3201
+ ...aJouer,
2903
3202
  ]);
2904
- } finally {
2905
- for (const soeur of avant.values()) rmSync(path.join(ctx.copie, soeur), { force: true });
2906
- }
2907
- runs.push({
2908
- groupe,
2909
- entier,
2910
- avant,
2911
- code: r.code,
2912
- resultats: langageDe(ctx.copie).verdict(r.dossier).rapports,
2913
- // The builds of the plan's packages that failed: each one a red, not compiling is failing.
2914
- constructions: constructionsEchouees(ctx, liste, r.dossier),
3203
+ return {
3204
+ code: r.code,
3205
+ resultats: langageDe(ctx.copie).verdict(r.dossier).rapports,
3206
+ // The builds of the plan's packages that failed: each one a red, not compiling is failing.
3207
+ constructions: constructionsEchouees(ctx, liste, r.dossier),
3208
+ };
2915
3209
  });
3210
+ runs.push({ groupe, entier, ...run });
2916
3211
  }
2917
3212
  ctx.mesureDeLaPreuve = { cle, runs };
2918
3213
  return runs;
2919
3214
  }
2920
3215
 
3216
+ // The green tests of HEAD's version of the file <f> of the lot, by their full name: those of the
3217
+ // report of its sibling (`avant`, file → sibling, from the copy <copie>) in the results <resultats>
3218
+ // of the run (`verdict` of the join), or, for a file without sibling, the names of its tests read
3219
+ // in HEAD's version (`lus`, file → names), each held green, as main stays green; empty for a file
3220
+ // HEAD does not hold.
3221
+ export function vertsDeHead(resultats, copie, f, avant, lus = new Map()) {
3222
+ if (lus.has(f)) return new Set(lus.get(f));
3223
+ const soeur = avant.has(f) ? path.join(copie, avant.get(f)) : null;
3224
+ return new Set(
3225
+ (resultats.find(t => soeur !== null && t.fichier === soeur)?.tests ?? [])
3226
+ .filter(a => a.etat === 'passed')
3227
+ .map(a => a.nom)
3228
+ );
3229
+ }
3230
+
2921
3231
  // The full name of a test <nom> with each separator between a group and what it holds, « > » or
2922
3232
  // « › » between blanks, read as the blank that Vitest's full name puts there.
2923
3233
  const sansSeparateur = nom =>
@@ -2956,7 +3266,7 @@ function preuve(ctx) {
2956
3266
  const mesure = mesureDeLaPreuve(ctx, liste, fichiers);
2957
3267
  // A plan « comportement inchangé »: every green of the lot is expected.
2958
3268
  const inchange = Boolean(ctx.sorte?.inchange);
2959
- for (const { groupe, entier, avant, code, resultats, constructions } of mesure) {
3269
+ for (const { groupe, entier, avant, lus, code, resultats, constructions } of mesure) {
2960
3270
  for (const { nom, erreur } of constructions) {
2961
3271
  if (reportes.includes(nom)) continue;
2962
3272
  rouges.push(`construction de ${nom} — ${erreur}`);
@@ -2980,15 +3290,9 @@ function preuve(ctx) {
2980
3290
  for (const f of groupe) {
2981
3291
  const res = resultats.find(t => t.fichier === path.join(ctx.copie, f));
2982
3292
  const tests = res?.tests ?? [];
2983
- // The green tests of HEAD's version of the file, by their full name.
2984
- const deHead = new Set(
2985
- (
2986
- resultats.find(t => avant.has(f) && t.fichier === path.join(ctx.copie, avant.get(f)))
2987
- ?.tests ?? []
2988
- )
2989
- .filter(a => a.etat === 'passed')
2990
- .map(a => a.nom)
2991
- );
3293
+ const deHead = vertsDeHead(resultats, ctx.copie, f, avant, lus);
3294
+ // Whether HEAD holds the file: its sibling played, or the names of its tests read.
3295
+ const tenu = avant.has(f) || lus.has(f);
2992
3296
  if (constructions.length && (!res || tests.length === 0)) {
2993
3297
  // It cannot load before the build: it plays at the checks.
2994
3298
  } else if (!res) {
@@ -3000,7 +3304,7 @@ function preuve(ctx) {
3000
3304
  }
3001
3305
  // The expected green of the whole file justifies its greens only for a file HEAD holds.
3002
3306
  const duF = duFichier(f);
3003
- if (duF && !avant.has(f)) {
3307
+ if (duF && !tenu) {
3004
3308
  neufs.push(
3005
3309
  `${f} — fichier neuf, que HEAD ne tient pas : son vert attendu sans test ne justifie aucun de ses verts`
3006
3310
  );
@@ -3015,7 +3319,7 @@ function preuve(ctx) {
3015
3319
  const raison = raisonDuTest(f, a);
3016
3320
  if (raison) {
3017
3321
  justifies.push(`${f} › ${a.nom} — ${raison}`);
3018
- } else if (duF && avant.has(f)) {
3322
+ } else if (duF && tenu) {
3019
3323
  justifies.push(`${f} › ${a.nom} — ${duF.raison} (par le vert attendu du fichier)`);
3020
3324
  } else if (inchange) {
3021
3325
  justifies.push(`${f} › ${a.nom} — le plan dit « comportement inchangé »`);
@@ -3251,8 +3555,8 @@ function controles(ctx, finale, restreinte = null, reportes = null) {
3251
3555
  : commandesDuPlan(ctx, liste);
3252
3556
  const resultats = commandes.map(({ args, env }) => {
3253
3557
  let r = npm(ctx, 'controles', args, env);
3254
- // verifier plays a task at 75 again itself, at rest: its 75 is final; a command of the checks
3255
- // plays once more, the gesture `rejeu`.
3558
+ // The 75 of verifier is final (its wait for the lock reached its bound); a command of the
3559
+ // checks plays once more, the gesture `rejeu`.
3256
3560
  if (r.code === A_REPASSER && !finale) {
3257
3561
  geste(ctx, 'rejeu');
3258
3562
  r = npm(ctx, 'controles', args, env);
@@ -3510,6 +3814,8 @@ async function derouler(ctx, debut) {
3510
3814
  let reprise = Boolean(ctx.reprendre);
3511
3815
  // A developpeur relaunched on the integration's refusal of the lot he left unchanged.
3512
3816
  let relanceSurLeRefus = false;
3817
+ // A sibling of HEAD's version a killed circuit left in the copy never enters the lot.
3818
+ if (existsSync(ctx.copie)) balayerLesSoeurs(ctx);
3513
3819
  for (;;) {
3514
3820
  const reprend = reprise;
3515
3821
  reprise = false;
@@ -3527,6 +3833,17 @@ async function derouler(ctx, debut) {
3527
3833
  const menee = MENEES.has(etape) ? { etape, debut: new Date().toISOString() } : null;
3528
3834
  ecrireEtat(ctx, { ...etat, mene: menee?.debut ?? null });
3529
3835
  try {
3836
+ // A pass that judges the lot, a resumption included, plays on the copy prepared on the tip
3837
+ // of main; a preparation that fails goes up.
3838
+ const pointe = avantLaPasse(ctx, etape, ctx.regeneration ?? null);
3839
+ if (pointe.arret) {
3840
+ const { nom, rapport: motif, piece, question } = pointe.arret;
3841
+ throw new Arret(nom, motif, { piece, question });
3842
+ }
3843
+ if (pointe.avancee) {
3844
+ appendFileSync(ctx.journal, 'la copie avance sur la pointe de main avant la passe.\n');
3845
+ }
3846
+ ctx.regeneration = pointe.regeneration;
3530
3847
  // After the plan: the gesture of a mechanical ticket, the developpeur of a plan without
3531
3848
  // tests, else the testwriter.
3532
3849
  const route =
@@ -3914,10 +4231,7 @@ async function derouler(ctx, debut) {
3914
4231
  if (passe.arbre && (regeneration ? regeneration.entiere : !passe.restreinte)) {
3915
4232
  ctx.verifie = passe.arbre;
3916
4233
  }
3917
- const r = relectureDAvant(ctx);
3918
- const accepte =
3919
- r?.fiche.verdict === 'ACCEPTÉ' && passe.arbre && r.lot.arbre === passe.arbre;
3920
- etape = accepte ? INTEGRATION : RELECTURE;
4234
+ etape = leLotAccepte(ctx, passe.arbre) ? INTEGRATION : RELECTURE;
3921
4235
  }
3922
4236
  }
3923
4237
  } else if (etape === REFERENCES) {
@@ -3992,7 +4306,8 @@ async function derouler(ctx, debut) {
3992
4306
  );
3993
4307
  }
3994
4308
  if (v.verdict === 'ACCEPTÉ') {
3995
- // The review that accepts the lot closes every finding.
4309
+ // The review that accepts the lot closes every finding, each one it judged lifted
4310
+ // (`suiviDesConstats`).
3996
4311
  ctx.constats = [];
3997
4312
  }
3998
4313
  if (v.verdict === 'ACCEPTÉ' && (!v.arbre || ctx.verifie === v.arbre)) {
@@ -4165,12 +4480,62 @@ function monter(ctx, a) {
4165
4480
  });
4166
4481
  const ou = ouDansLeCircuit({ ...a.etat, raison: a.nom });
4167
4482
  commenter(ctx, 'question', `${a.nom} à ${ou} — ${fait} — au ${qui} : ${question}`);
4168
- process.stderr.write(
4169
- `⛔ Circuit de ${ctx.ticket} : question au ${qui} (${a.nom}, à ${ou}), dans ${ctx.etat} ; la réponse : \`npx grillhouse circuit ${ctx.ticket} --reprendre\`, \`--depuis <testwriter|developpeur>\`, \`--etendre <paquet>\` ou \`--arreter\`.\n`
4170
- );
4483
+ process.stderr.write(laQuestion(ctx.ticket, ctx.etat, { arret: a.nom, qui, ou, question }));
4484
+ // A question its caller reads here (a launch in the foreground that stops before any session)
4485
+ // is gone up: the wait of the questions does not wake on it (grillhouse-pq6.1).
4486
+ if (sortieLue()) {
4487
+ inscrireLaQuestionLue(ctx.racine, {
4488
+ ticket: ctx.ticket,
4489
+ processus: process.pid,
4490
+ depart: DEPART,
4491
+ arret: a.nom,
4492
+ });
4493
+ }
4171
4494
  return a.code;
4172
4495
  }
4173
4496
 
4497
+ // The line that says the question <question> of the circuit of <ticket> stopped at <ou> on
4498
+ // <arret>, kept in its state <fichier>, to <qui>, with the commands that answer it.
4499
+ const laQuestion = (ticket, fichier, { arret, qui, ou, question }) =>
4500
+ `⛔ Circuit de ${ticket} : question au ${qui} (${arret}, à ${ou}) : ${String(question ?? '').trim()}\n\nDans ${fichier} ; la réponse : \`npx grillhouse circuit ${ticket} --reprendre\`, \`--depuis <testwriter|developpeur>\`, \`--etendre <paquet>\` ou \`--arreter\`.\n`;
4501
+
4502
+ // The client of the circuit of <ticket> whose state is <fichier> (`--rattacher`), as Bazel's
4503
+ // client attaches to its server: it waits, reading the state every <pas> ms, while the process the
4504
+ // state names lives (`processus`, the same one by its start `depart`), then ends on what the state
4505
+ // says, as the circuit's own end says it on <erreurs>: 0 at « integre »; on a stop, its question
4506
+ // (laQuestion) or its name, and its code (0 for the supervisor's « arrete »); a circuit dead
4507
+ // without a final state (its process gone, no stop written), 1, with the command that resumes it.
4508
+ // It holds nothing of the circuit: killed, it leaves the circuit going.
4509
+ export async function rattacher({ ticket, etat: fichier, pas = 2000, erreurs = process.stderr }) {
4510
+ let e = lireJson(fichier);
4511
+ if (!e) throw new Usage(`--rattacher : ${fichier} n'existe pas, aucun circuit à attendre.`);
4512
+ while (leMemeVivant(e.processus, e.depart)) {
4513
+ await new Promise(r => setTimeout(r, pas));
4514
+ e = lireJson(fichier) ?? e;
4515
+ }
4516
+ const ou = ouDansLeCircuit(e);
4517
+ if (e.etape === 'integre') return 0;
4518
+ if (e.question) {
4519
+ erreurs.write(
4520
+ laQuestion(ticket, fichier, {
4521
+ arret: e.question.arret,
4522
+ qui: e.question.qui,
4523
+ ou,
4524
+ question: e.question.question,
4525
+ })
4526
+ );
4527
+ return e.code;
4528
+ }
4529
+ if (e.raison) {
4530
+ erreurs.write(`⛔ Circuit de ${ticket} arrêté : ${e.raison}, à ${ou}.\n`);
4531
+ return e.code ?? 0;
4532
+ }
4533
+ erreurs.write(
4534
+ `⛔ Circuit de ${ticket} mort sans état final (processus ${e.processus ?? '?'} parti, aucun arrêt écrit, à ${ou}) ; la reprise : \`npx grillhouse circuit ${ticket} --reprendre\`.\n`
4535
+ );
4536
+ return 1;
4537
+ }
4538
+
4174
4539
  // The run from <d> (where `depart` starts it) to its end: 0 at « integre »; a stop the gesture
4175
4540
  // `a-repasser` settles ends at 75, said at the ticket; every other stop goes up to the supervisor
4176
4541
  // (monter). Its exit code.
@@ -4821,7 +5186,15 @@ function etendre(ctx, e) {
4821
5186
  export async function main(argv) {
4822
5187
  let ctx = null;
4823
5188
  try {
4824
- ctx = contexte(lireArguments(argv));
5189
+ const o = lireArguments(argv);
5190
+ if (o.rattacher) {
5191
+ const dossier = path.join(arbrePrincipal(), '.claude', 'worktrees');
5192
+ return await rattacher({
5193
+ ticket: o.ticket,
5194
+ etat: path.join(dossier, `${o.ticket}.circuit.json`),
5195
+ });
5196
+ }
5197
+ ctx = contexte(o);
4825
5198
  mkdirSync(path.dirname(ctx.copie), { recursive: true });
4826
5199
  let e = existsSync(ctx.etat) ? JSON.parse(readFileSync(ctx.etat, 'utf8')) : null;
4827
5200
  // The findings of the reviewer still open, the lot the whole final pass verified, the session a
@@ -4862,7 +5235,12 @@ export async function main(argv) {
4862
5235
  });
4863
5236
  }
4864
5237
  const d = depart(ctx, e);
4865
- // A session a dead circuit left running ends before this run launches its own.
5238
+ // A session a dead circuit left running ends before this run launches its own. The run first
5239
+ // names itself in the state, at the step it found, the session kept: the launch gives the hand
5240
+ // back at once (`ecrireEtat`), and the run waits for the session alone, as a daemon.
5241
+ if (e?.seance && signalerGroupe(e.seance, 0)) {
5242
+ ecrireEtat(ctx, { ...e, code: null, raison: null, question: null, rapport: null });
5243
+ }
4866
5244
  await attendreLaSeance(ctx, e?.seance);
4867
5245
  // A ticket labelled arbitrage starts and resumes only on the arbitrage its integration will
4868
5246
  // ask for: the integration's rule, before any session.
@@ -4903,7 +5281,7 @@ export async function main(argv) {
4903
5281
  } catch (e) {
4904
5282
  if (!(e instanceof Usage)) throw e;
4905
5283
  process.stderr.write(
4906
- `usage: npx grillhouse circuit <ticket> [--reprendre | --depuis <testwriter|developpeur>] [--contexte <texte>] | --etendre <paquet>[,<paquet>…] [--contexte <texte>] | --arreter [--contexte <motif>]\n⛔ ${e.message}\n`
5284
+ `usage: npx grillhouse circuit <ticket> [--reprendre | --depuis <testwriter|developpeur>] [--contexte <texte>] | --etendre <paquet>[,<paquet>…] [--contexte <texte>] | --arreter [--contexte <motif>] | --rattacher\n⛔ ${e.message}\n`
4907
5285
  );
4908
5286
  return CODE_USAGE;
4909
5287
  } finally {
@@ -4911,7 +5289,41 @@ export async function main(argv) {
4911
5289
  }
4912
5290
  }
4913
5291
 
4914
- // The entry: the run as a daemon (scripts/demon.mjs), apart from its caller.
5292
+ // The entry: the run as a daemon (scripts/demon.mjs), apart from its caller, in a unit named after
5293
+ // its ticket; `--rattacher`, a client, in the caller's own process, which dies with its session.
4915
5294
  if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
4916
- process.exitCode = await executerEnDemon(import.meta.filename, process.argv.slice(2), main);
5295
+ const argv = process.argv.slice(2);
5296
+ let o = null;
5297
+ try {
5298
+ o = lireArguments(argv);
5299
+ } catch {
5300
+ // a malformed call: the run says its usage
5301
+ }
5302
+ // The run's last mark at its exit, whatever ends it but a kill: its state touched, so that the
5303
+ // wait of the questions, which watches the directory of the states (scripts/superviseur.mjs),
5304
+ // reads it at once, the process gone, rather than at its next reading.
5305
+ let etat = null;
5306
+ try {
5307
+ etat =
5308
+ o?.ticket && !o.rattacher && estLeDemon()
5309
+ ? path.join(arbrePrincipal(), '.claude', 'worktrees', `${o.ticket}.circuit.json`)
5310
+ : null;
5311
+ } catch {
5312
+ // out of a repository: the run says so
5313
+ }
5314
+ if (etat) {
5315
+ process.on('exit', () => {
5316
+ try {
5317
+ const maintenant = new Date();
5318
+ utimesSync(etat, maintenant, maintenant);
5319
+ } catch {
5320
+ // no state written: nothing to mark
5321
+ }
5322
+ });
5323
+ }
5324
+ process.exitCode = o?.rattacher
5325
+ ? await main(argv)
5326
+ : await executerEnDemon(import.meta.filename, argv, main, {
5327
+ unite: `grillhouse-circuit-${o?.ticket ?? 'usage'}`,
5328
+ });
4917
5329
  }