@roomi-fields/grillhouse 0.32.0 → 0.33.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 (116) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +22 -0
  3. package/bin/grillhouse.mjs +6 -4
  4. package/cadre/templates/projet/.github/workflows/ci.yml +136 -16
  5. package/cadre/templates/projet/.github/workflows/nuit.yml +111 -0
  6. package/cadre/templates/projet/deployment/docs/01-INSTALL.md +4 -4
  7. package/cadre/templates/projet/package.json +2 -2
  8. package/charte.md +8 -5
  9. package/dist/temporal/circuit/contrat.d.ts +15 -0
  10. package/dist/temporal/circuit/deroule.js +37 -14
  11. package/dist/temporal/circuit/deroule.js.map +1 -1
  12. package/dist/temporal/deroules.d.ts +1 -0
  13. package/dist/temporal/deroules.js +3 -1
  14. package/dist/temporal/deroules.js.map +1 -1
  15. package/dist/temporal/file/activites.d.ts +1 -0
  16. package/dist/temporal/file/activites.js +5 -2
  17. package/dist/temporal/file/activites.js.map +1 -1
  18. package/dist/temporal/file/contrat.d.ts +50 -33
  19. package/dist/temporal/file/contrat.js +2 -2
  20. package/dist/temporal/file/contrat.js.map +1 -1
  21. package/dist/temporal/file/deroule.d.ts +3 -1
  22. package/dist/temporal/file/deroule.js +128 -26
  23. package/dist/temporal/file/deroule.js.map +1 -1
  24. package/dist/temporal/nuits/activites.d.ts +10 -0
  25. package/dist/temporal/nuits/activites.js +114 -0
  26. package/dist/temporal/nuits/activites.js.map +1 -0
  27. package/dist/temporal/nuits/appel.d.ts +23 -0
  28. package/dist/temporal/nuits/appel.js +40 -0
  29. package/dist/temporal/nuits/appel.js.map +1 -0
  30. package/dist/temporal/nuits/choix.d.ts +14 -0
  31. package/dist/temporal/nuits/choix.js +119 -0
  32. package/dist/temporal/nuits/choix.js.map +1 -0
  33. package/dist/temporal/nuits/client.d.ts +28 -0
  34. package/dist/temporal/nuits/client.js +83 -0
  35. package/dist/temporal/nuits/client.js.map +1 -0
  36. package/dist/temporal/nuits/commande.d.ts +2 -0
  37. package/dist/temporal/nuits/commande.js +107 -0
  38. package/dist/temporal/nuits/commande.js.map +1 -0
  39. package/dist/temporal/nuits/contrat.d.ts +98 -0
  40. package/dist/temporal/nuits/contrat.js +30 -0
  41. package/dist/temporal/nuits/contrat.js.map +1 -0
  42. package/dist/temporal/nuits/deroule.d.ts +5 -0
  43. package/dist/temporal/nuits/deroule.js +100 -0
  44. package/dist/temporal/nuits/deroule.js.map +1 -0
  45. package/dist/temporal/travailleur.js +4 -1
  46. package/dist/temporal/travailleur.js.map +1 -1
  47. package/docs/ARCHITECTURE.md +186 -45
  48. package/docs/CADRE.md +31 -1
  49. package/docs/INTERFACE.md +45 -6
  50. package/hooks/register.tsx +11 -3
  51. package/package.json +4 -1
  52. package/scripts/abi-des-dependances.mjs +105 -0
  53. package/scripts/activites.mjs +94 -41
  54. package/scripts/aiguillage.mjs +1 -0
  55. package/scripts/avancement.mjs +8 -18
  56. package/scripts/ci-des-branches.mjs +91 -0
  57. package/scripts/circuit.mjs +79 -4
  58. package/scripts/composants-affectes.mjs +24 -7
  59. package/scripts/composition-des-langages.mjs +3 -0
  60. package/scripts/crochets.mjs +4 -0
  61. package/scripts/enveloppe/enveloppe.mjs +3 -1
  62. package/scripts/enveloppe/lancer.sh +1 -1
  63. package/scripts/enveloppe/travail-de-la-copie.mjs +219 -59
  64. package/scripts/etapes.mjs +18 -1
  65. package/scripts/faits-du-circuit.mjs +43 -20
  66. package/scripts/fichier-du-poste.mjs +87 -0
  67. package/scripts/grillhouse-maj.mjs +15 -1
  68. package/scripts/integration/file.mjs +215 -275
  69. package/scripts/integration/integrer.mjs +82 -41
  70. package/scripts/integration/rejeu.mjs +13 -64
  71. package/scripts/jointure.d.ts +26 -2
  72. package/scripts/langages/cargo/commandes.mjs +81 -19
  73. package/scripts/langages/cargo/exemples.mjs +2 -2
  74. package/scripts/langages/cargo/index.mjs +11 -5
  75. package/scripts/langages/cargo/tailles-des-tests.mjs +19 -11
  76. package/scripts/langages/python/commandes.mjs +11 -7
  77. package/scripts/langages/python/exemples.mjs +1 -1
  78. package/scripts/langages/python/index.mjs +9 -2
  79. package/scripts/langages/python/tailles-des-tests.mjs +19 -11
  80. package/scripts/langages/typescript/code-mort.mjs +41 -24
  81. package/scripts/langages/typescript/consommateurs.mjs +28 -17
  82. package/scripts/langages/typescript/exemples.mjs +2 -0
  83. package/scripts/langages/typescript/index.mjs +22 -3
  84. package/scripts/langages/typescript/migrations/0.33.0-binaire-de-jour.mjs +34 -0
  85. package/scripts/langages/typescript/migrations/0.33.0-tests-du-poste.mjs +31 -0
  86. package/scripts/langages/typescript/resumes.mjs +17 -7
  87. package/scripts/langages/typescript/tailles-des-tests.mjs +251 -22
  88. package/scripts/langages/typescript/tests-de-nuit.mjs +101 -9
  89. package/scripts/langages/typescript/tests-du-poste.mjs +172 -0
  90. package/scripts/langages/typescript/tranches.mjs +273 -0
  91. package/scripts/langages/typescript/verifier.mjs +131 -29
  92. package/scripts/langages/typescript/vitest-config/cibles.mjs +78 -7
  93. package/scripts/langages/typescript/vitest-config/lances.mjs +4 -4
  94. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +9 -0
  95. package/scripts/langages/typescript/vitest.nuit.config.mjs +3 -2
  96. package/scripts/lint-des-scripts.mjs +23 -6
  97. package/scripts/migrations/0.33.0-cache-distant.mjs +36 -0
  98. package/scripts/migrations/0.33.0-ci-des-branches-de-ticket.mjs +31 -0
  99. package/scripts/migrations/0.33.0-ci-du-cadre.mjs +31 -0
  100. package/scripts/migrations/0.33.0-node-26.mjs +58 -0
  101. package/scripts/migrations.mjs +8 -0
  102. package/scripts/newday.mjs +18 -0
  103. package/scripts/nuit.sh +35 -17
  104. package/scripts/registre.d.mts +90 -0
  105. package/scripts/registre.mjs +28 -3
  106. package/scripts/reprise.mjs +12 -8
  107. package/scripts/services-du-noyau.mjs +4 -0
  108. package/scripts/session-start.sh +28 -32
  109. package/scripts/sous-commandes.mjs +29 -10
  110. package/scripts/tableau.mjs +124 -17
  111. package/scripts/taches-du-graphe.mjs +39 -6
  112. package/scripts/transitions.mjs +42 -3
  113. package/scripts/verrou-de-machine.mjs +1 -2
  114. package/scripts/workflows-du-cadre.mjs +75 -0
  115. package/skills/grill/SKILL.md +8 -6
  116. package/skills/pitmaster/SKILL.md +5 -4
@@ -133,6 +133,9 @@ const PLACE_DU_SUJET = 10;
133
133
  // The role of a register line that a step of a circuit writes (scripts/circuit.mjs): no agent,
134
134
  // no role of the flow.
135
135
  export const ROLE_DU_CIRCUIT = 'circuit';
136
+ // The role of a register line that the workflow of the nights writes for a night it skips
137
+ // (src/temporal/nuits/): no agent, no ticket, no turn; the board counts it nowhere.
138
+ export const ROLE_DE_LA_NUIT = 'nuit';
136
139
  // A sub-agent's role from its meta file: the type it was spawned as; a named agent's `agentType`
137
140
  // is its name.
138
141
  export const roleDuMeta = m =>
@@ -780,7 +783,9 @@ export function assembler({
780
783
  }) {
781
784
  // A circuit's lines are its steps, no agent's passage.
782
785
  const etapesFinies = lignesDuRegistre.filter(r => r.role === ROLE_DU_CIRCUIT);
783
- const registre = parAgent(lignesDuRegistre.filter(r => r.role !== ROLE_DU_CIRCUIT));
786
+ const registre = parAgent(
787
+ lignesDuRegistre.filter(r => r.role !== ROLE_DU_CIRCUIT && r.role !== ROLE_DE_LA_NUIT)
788
+ );
784
789
  // A living agent runs without an end in the register, or when an incoming message follows its
785
790
  // latest end strictly; the writings of its last turn after that end leave it finished. A running
786
791
  // agent's transcript holds its sessions already in the register.
@@ -938,7 +943,39 @@ export function assembler({
938
943
  const duJour = mesures
939
944
  .filter(m => m.quand >= jour)
940
945
  .map(m => (m.tours ? { ...m, travail: partDuJour(m.tours) } : m));
941
- const global = { compteurs, jour: somme(duJour), cumul: somme(mesures) };
946
+ // The discoveries (label `decouverte`, grillhouse-3uv.96): each counts in one case, the first that
947
+ // applies. « rejetés » and « validés » count only since the day's marker <jour>; « new » and
948
+ // « →check », states that await the owner, do not filter by it.
949
+ const aLabel = (t, ...ls) => ls.some(l => (t.labels ?? []).includes(l));
950
+ const estDecouverte = t => aLabel(t, 'decouverte');
951
+ const VERDICTS_DU_TRI = ['traitee', 'doublon', 'sans-suite', 'a-porter', 'non-confirmee'];
952
+ const caseDeLaDecouverte = t => {
953
+ const ferme = t.status === 'closed';
954
+ if (aLabel(t, 'circuit') && (Date.parse(t.updated_at ?? '') || 0) >= jour) {
955
+ return 'valides';
956
+ }
957
+ if (!ferme && aLabel(t, 'a-valider')) {
958
+ return 'check';
959
+ }
960
+ const rejete =
961
+ aLabel(t, 'traitee', 'doublon', 'sans-suite') ||
962
+ (aLabel(t, 'a-porter', 'non-confirmee') && !aLabel(t, 'circuit'));
963
+ if (ferme && rejete && (Date.parse(t.closed_at ?? '') || 0) >= jour) {
964
+ return 'rejetes';
965
+ }
966
+ if (ferme && !aLabel(t, ...VERDICTS_DU_TRI)) {
967
+ return 'new';
968
+ }
969
+ return null;
970
+ };
971
+ const decouvertes = { new: 0, check: 0, rejetes: 0, valides: 0 };
972
+ for (const t of tous.filter(estDecouverte)) {
973
+ const c = caseDeLaDecouverte(t);
974
+ if (c) {
975
+ decouvertes[c]++;
976
+ }
977
+ }
978
+ const global = { compteurs, jour: somme(duJour), cumul: somme(mesures), decouvertes };
942
979
 
943
980
  // Chantiers.
944
981
  const sous = t => [t, ...(enfants.get(t.id) ?? []).flatMap(sous)];
@@ -1067,7 +1104,12 @@ export function assembler({
1067
1104
  const debutJour = jour;
1068
1105
  const faitsDuJour = tous
1069
1106
  .filter(
1070
- t => travail(t) && !actifs.has(t.id) && t.closed_at && Date.parse(t.closed_at) >= debutJour
1107
+ t =>
1108
+ travail(t) &&
1109
+ !actifs.has(t.id) &&
1110
+ !estDecouverte(t) &&
1111
+ t.closed_at &&
1112
+ Date.parse(t.closed_at) >= debutJour
1071
1113
  )
1072
1114
  .sort((a, b) => Date.parse(b.closed_at) - Date.parse(a.closed_at))
1073
1115
  .map(t => ({
@@ -1142,7 +1184,8 @@ export function assembler({
1142
1184
  alertes.push({
1143
1185
  niveau: 'rouge',
1144
1186
  signe: '🔕',
1145
- texte: 'À corriger : une question au superviseur reste sans réponse, aucune attente ne tourne',
1187
+ texte:
1188
+ 'À corriger : une question au superviseur reste sans réponse, aucune attente ne tourne',
1146
1189
  });
1147
1190
  }
1148
1191
  for (const b of blocs) {
@@ -1348,6 +1391,16 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1348
1391
  )
1349
1392
  );
1350
1393
  }
1394
+ // The discoveries of the day, summed across the projects (grillhouse-3uv.96, criterion 14).
1395
+ const d96 = t.decouvertes ?? { new: 0, check: 0, rejetes: 0, valides: 0 };
1396
+ L(
1397
+ cadre(
1398
+ `🔍 ${d96.new} new · ${d96.check} →check · ${d96.rejetes} rejetés · ${d96.valides} validés`,
1399
+ '',
1400
+ largeur
1401
+ ),
1402
+ 'discret'
1403
+ );
1351
1404
  } else {
1352
1405
  const g = t.global;
1353
1406
  const c = g.compteurs;
@@ -1363,6 +1416,17 @@ export function lignes(t, nom, largeur = LARGEUR, groupes = {}) {
1363
1416
  cadre(`${c.sansGo} sans go · ${c.aValider} à valider · ${c.reportes} reportés`, '', largeur),
1364
1417
  c.sansGo || c.aValider ? 'attention' : undefined
1365
1418
  );
1419
+ // The discoveries of the day, one count per case (grillhouse-3uv.96): always shown, at 0 when
1420
+ // nothing counts, like the other head lines.
1421
+ const d = g.decouvertes ?? { new: 0, check: 0, rejetes: 0, valides: 0 };
1422
+ L(
1423
+ cadre(
1424
+ `🔍 ${d.new} new · ${d.check} →check · ${d.rejetes} rejetés · ${d.valides} validés`,
1425
+ '',
1426
+ largeur
1427
+ ),
1428
+ 'discret'
1429
+ );
1366
1430
  L(
1367
1431
  cadre(
1368
1432
  `jour ${duree(g.jour.travail)} · ${k(g.jour.jetons)} · cumul ${duree(g.cumul.travail)} · ${k(g.cumul.jetons)}`,
@@ -1934,6 +1998,48 @@ const bdJson = (racine, ...args) => {
1934
1998
  }
1935
1999
  };
1936
2000
 
2001
+ // The folder git keeps a repository's shared files in (its common dir), absolute; null when
2002
+ // <racine> is no git repository. The board's cache and the day's marker live there.
2003
+ export function dossierCommun(racine) {
2004
+ try {
2005
+ return execFileSync(
2006
+ 'git',
2007
+ ['-C', racine, 'rev-parse', '--path-format=absolute', '--git-common-dir'],
2008
+ { encoding: 'utf8' }
2009
+ ).trim();
2010
+ } catch {
2011
+ return null;
2012
+ }
2013
+ }
2014
+
2015
+ // The file of the day's marker (grillhouse-3uv.96), beside the board's cache; null without a common
2016
+ // dir. Unversioned, out of the worktree: the board does not reset at midnight.
2017
+ const fichierDuRepere = commun => commun && path.join(commun, 'tableau-repere.json');
2018
+
2019
+ // The day's marker of the project whose common dir is <commun>: the number its file holds, else
2020
+ // midnight of <maintenant> (no file, or no number).
2021
+ export function lireLeRepere(commun, maintenant) {
2022
+ const minuit = new Date(maintenant);
2023
+ minuit.setHours(0, 0, 0, 0);
2024
+ try {
2025
+ const { repere } = JSON.parse(readFileSync(fichierDuRepere(commun), 'utf8'));
2026
+ return typeof repere === 'number' ? repere : minuit.getTime();
2027
+ } catch {
2028
+ return minuit.getTime();
2029
+ }
2030
+ }
2031
+
2032
+ // Sets the day's marker of the project at <racine> to <quand> (now by default), purging FAITS
2033
+ // AUJOURD'HUI and the « rejetés » and « validés » cases up to it (grillhouse-3uv.96, /newday).
2034
+ export function poserLeRepere(racine, quand = Date.now()) {
2035
+ const commun = dossierCommun(racine);
2036
+ if (!commun) {
2037
+ throw new Error('newday : le dossier git commun du projet est introuvable.');
2038
+ }
2039
+ writeFileSync(fichierDuRepere(commun), `${JSON.stringify({ repere: quand })}\n`);
2040
+ return quand;
2041
+ }
2042
+
1937
2043
  // What the board reads of the repository at <racine>, its circuits <circuits> read: its tickets,
1938
2044
  // its prefix, its running agents and its assembled board (`t`), with the folder git keeps its
1939
2045
  // shared files in (`commun`).
@@ -1990,16 +2096,7 @@ function lire(
1990
2096
  verdicts[t.id] = v;
1991
2097
  }
1992
2098
  }
1993
- let commun = null;
1994
- try {
1995
- commun = execFileSync(
1996
- 'git',
1997
- ['-C', racine, 'rev-parse', '--path-format=absolute', '--git-common-dir'],
1998
- { encoding: 'utf8' }
1999
- ).trim();
2000
- } catch {
2001
- commun = null;
2002
- }
2099
+ const commun = dossierCommun(racine);
2003
2100
  const fichierCache = commun && path.join(commun, 'tableau-cache.json');
2004
2101
  let cache = {};
2005
2102
  try {
@@ -2025,8 +2122,6 @@ function lire(
2025
2122
  } catch {
2026
2123
  // A read-only place keeps the board working, without its cache.
2027
2124
  }
2028
- const minuit = new Date(maintenant);
2029
- minuit.setHours(0, 0, 0, 0);
2030
2125
  const t = assembler({
2031
2126
  tous,
2032
2127
  prefix,
@@ -2035,7 +2130,7 @@ function lire(
2035
2130
  circuits,
2036
2131
  verdicts,
2037
2132
  maintenant,
2038
- jour: minuit.getTime(),
2133
+ jour: lireLeRepere(commun, maintenant),
2039
2134
  machine,
2040
2135
  places,
2041
2136
  muet,
@@ -2092,6 +2187,18 @@ export function ensemble(lus) {
2092
2187
  machine: premier.t.machine,
2093
2188
  places: premier.t.places,
2094
2189
  faitsDuJour: tous('faitsDuJour'),
2190
+ decouvertes: lisibles.reduce(
2191
+ (s, l) => {
2192
+ const d = l.t.global.decouvertes ?? {};
2193
+ return {
2194
+ new: s.new + (d.new ?? 0),
2195
+ check: s.check + (d.check ?? 0),
2196
+ rejetes: s.rejetes + (d.rejetes ?? 0),
2197
+ valides: s.valides + (d.valides ?? 0),
2198
+ };
2199
+ },
2200
+ { new: 0, check: 0, rejetes: 0, valides: 0 }
2201
+ ),
2095
2202
  etats: premier.t.etats.map(e => ({
2096
2203
  ...e,
2097
2204
  tickets: lisibles.flatMap(l =>
@@ -52,6 +52,31 @@ export const TESTS_CIBLES = 'GRILLHOUSE_TESTS';
52
52
  export const GRAPHE_JOUE = 'GRILLHOUSE_GRAPHE_JOUE';
53
53
  /** The variable that tells a module it plays after a red one: that pass keeps no green. */
54
54
  export const PASSE_ROUGE = 'GRILLHOUSE_PASSE_ROUGE';
55
+ /** The form of a tranche, as Vitest's `--shard` and nextest's `--partition` read it. */
56
+ export const LA_FORME = 'i/n';
57
+
58
+ /**
59
+ * The tranche <texte> reads, `{ index, count }`, or null when it is not `i/n` with 1 ≤ i ≤ n.
60
+ * @param {unknown} texte
61
+ * @returns {{ index: number, count: number } | null}
62
+ */
63
+ export function lireLaTranche(texte) {
64
+ const m = /^([1-9]\d*)\/([1-9]\d*)$/.exec(typeof texte === 'string' ? texte : '');
65
+ if (!m) {
66
+ return null;
67
+ }
68
+ const index = Number(m[1]);
69
+ const count = Number(m[2]);
70
+ return index <= count ? { index, count } : null;
71
+ }
72
+
73
+ /**
74
+ * Whether the tests a tool cannot split play in the tranche <tranche>: in a pass without a tranche,
75
+ * or in the first; so the n tranches together play them once.
76
+ * @param {{ index: number, count: number } | null | undefined} tranche
77
+ */
78
+ export const joueCeQuiNeSeDivisePas = tranche => !tranche || tranche.index === 1;
79
+
55
80
  /** The beginning of the name of a trace task, the output of a package that another's tests read. */
56
81
  export const TRACE = 'trace:';
57
82
  const SANS_INSTALLER = '--no-install';
@@ -115,17 +140,21 @@ export function testsCibles({ arguments: donnes, force = false }) {
115
140
  * The paths and the options of a task of the tests of a package, run by its script: the paths
116
141
  * <donnes> its script names (its own folder), each replaced by the paths of the variable
117
142
  * `TESTS_CIBLES` of <env> that lie in the same component (<dossierDe>, from an absolute path, the
118
- * folder of its component or null), and the options of the variable. A task with no path of the
119
- * variable in its component plays whole what its script names.
143
+ * variable or null), and the options of the variable. A task with no path of the
144
+ * variable in its component plays whole what its script names. `tranche`: the tranche of a pass the
145
+ * variable carries (`verifier --tranche i/n`), `{ index, count }`, or null; the module of the
146
+ * language plays its part of the tests in it.
120
147
  * @param {{ racine: string, donnes: string[], env?: NodeJS.ProcessEnv,
121
148
  * dossierDe: (absolu: string) => string | null }} o
122
- * @returns {{ chemins: string[], options: string[] }}
149
+ * @returns {{ chemins: string[], options: string[], tranche: { index: number, count: number } | null }}
123
150
  */
124
151
  export function cheminsDeLaTache({ racine, donnes, env = process.env, dossierDe }) {
125
152
  let variable = [];
153
+ let tranche = null;
126
154
  try {
127
- const lu = JSON.parse(env[TESTS_CIBLES] ?? '{}')?.arguments;
128
- variable = Array.isArray(lu) ? lu.map(String) : [];
155
+ const lu = JSON.parse(env[TESTS_CIBLES] ?? '{}');
156
+ variable = Array.isArray(lu?.arguments) ? lu.arguments.map(String) : [];
157
+ tranche = lireLaTranche(lu?.tranche);
129
158
  } catch {
130
159
  variable = [];
131
160
  }
@@ -136,7 +165,11 @@ export function cheminsDeLaTache({ racine, donnes, env = process.env, dossierDe
136
165
  const siens = d === null ? [] : nommes.filter(n => dossier(n) === d);
137
166
  return siens.length ? siens : [g];
138
167
  });
139
- return { chemins: [...new Set(chemins)], options: variable.filter(a => a.startsWith('-')) };
168
+ return {
169
+ chemins: [...new Set(chemins)],
170
+ options: variable.filter(a => a.startsWith('-')),
171
+ tranche,
172
+ };
140
173
  }
141
174
 
142
175
  /**
@@ -28,7 +28,6 @@
28
28
  // step the list does not hold `usage`. Each call is played again from the start of its step with
29
29
  // the facts read so far, as Temporal replays a workflow on its history: the same facts give the
30
30
  // same decision.
31
- import { A_REPASSER } from './codes-de-sortie.mjs';
32
31
  import { ARRETS, boucle, RESPONSABLE, SUITE } from './etapes.mjs';
33
32
  import { attribuerLeRouge } from './reprise.mjs';
34
33
 
@@ -277,6 +276,24 @@ function decider({ etat, memoire = {}, ticket, reprend = false }, lire, partiel)
277
276
  ...extra,
278
277
  });
279
278
  const arreter = (nom, r, options = {}) => decision({ arret: { nom, rapport: r, ...options } });
279
+ // A session relaunched on a conflict of the copy's advance (the gesture `conflit-de-l-avance`,
280
+ // `retourDuConflit`) comes back to the pass that met it, not to the step that follows its role:
281
+ // the pass prepares the copy again, and relaunches the other role while one of its files keeps
282
+ // its marks. Whether the decision went back to it.
283
+ const auRetourDuConflit = role => {
284
+ const retour = m('retourDuConflit');
285
+ if (!retour) {
286
+ return false;
287
+ }
288
+ maj.retourDuConflit = null;
289
+ commenter(
290
+ role,
291
+ `séance ${tentative} finie sur le conflit de l'avance : le circuit revient à la passe.`
292
+ );
293
+ ({ etape, tentative, rapport, finale } = retour);
294
+ relanceSurLeRefus = Boolean(retour.relanceSurLeRefus);
295
+ return true;
296
+ };
280
297
  const plan = ticket.paquets.join(', ');
281
298
 
282
299
  // After the plan: the gesture of a mechanical ticket, the developpeur of a plan without tests,
@@ -370,6 +387,9 @@ function decider({ etat, memoire = {}, ticket, reprend = false }, lire, partiel)
370
387
  rapport = illisible.rapport;
371
388
  return decision();
372
389
  }
390
+ if (auRetourDuConflit('testwriter')) {
391
+ return decision();
392
+ }
373
393
  etape = PREUVE;
374
394
  return decision();
375
395
  }
@@ -445,8 +465,10 @@ function decider({ etat, memoire = {}, ticket, reprend = false }, lire, partiel)
445
465
  }
446
466
  if (etape === INTEGRATION) {
447
467
  const r = lire('integration');
448
- if (r.code === A_REPASSER) {
449
- return arreter('a-repasser', fin(r.sortie, 40));
468
+ if (r.nom) {
469
+ // The resumption stops under a name (`lot-absent`, `copie-gardee`), at the code of the
470
+ // integration stop (17, scripts/etapes.mjs), its piece the output.
471
+ return arreter(r.nom, fin(r.sortie, 60), { piece: fin(r.sortie, 30) });
450
472
  }
451
473
  if (r.code !== 0) {
452
474
  return refuser(
@@ -455,6 +477,16 @@ function decider({ etat, memoire = {}, ticket, reprend = false }, lire, partiel)
455
477
  );
456
478
  }
457
479
  maj.refus = null;
480
+ if (r.deja && !r.enFile) {
481
+ // The lot is already on main: nothing waits for the queue, the ticket goes straight to its
482
+ // tri of discoveries and finishes at integre, as a merge queue closes an entry already merged.
483
+ commenter(
484
+ 'integration',
485
+ 'le commit est déjà sur main ; la copie et son dossier de travail sont retirés.'
486
+ );
487
+ lire('tri');
488
+ return decision({ fin: { code: 0 } });
489
+ }
458
490
  const branche = `agent/${ticket.id}`;
459
491
  const commit = lire('commit');
460
492
  commenter(
@@ -537,6 +569,10 @@ function decider({ etat, memoire = {}, ticket, reprend = false }, lire, partiel)
537
569
  );
538
570
  }
539
571
  maj.renvoiAuTestwriter = sortie;
572
+ if (m('retourDuConflit')) {
573
+ // The testwriter the sending relaunches goes on to the proof, not back to a pass.
574
+ maj.retourDuConflit = null;
575
+ }
540
576
  commenter(
541
577
  'developpeur',
542
578
  `séance ${tentative}${fortement} finie ; sa fiche renvoie le rouge au testwriter : le circuit relance le testwriter, puis la preuve et le développeur.`
@@ -610,6 +646,9 @@ function decider({ etat, memoire = {}, ticket, reprend = false }, lire, partiel)
610
646
  inscrire({ etape: CODE, inchange: true }, 'inchange');
611
647
  maj.rienALivrer = `La séance ${tentative} du développeur ne change aucun fichier du plan (${plan}), et les contrôles restent rouges. Sa passation au ticket dit pourquoi :\n\n${lire('passation') ?? 'aucune'}`;
612
648
  }
649
+ if (auRetourDuConflit('developpeur')) {
650
+ return decision();
651
+ }
613
652
  commenter('developpeur', `séance ${tentative}${fortement} finie, sa fiche lue.`);
614
653
  etape = CONTROLES;
615
654
  return decision();
@@ -1,8 +1,7 @@
1
1
  // The lock of the machine for the heavy measure: one heavy measure at a time on the machine,
2
2
  // whatever repository it plays in, as GNU make's job server shares its slots between every make of
3
3
  // one build, and as Bazel holds a test that declares it wants the whole machine. Taken by every
4
- // `npm run verifier` (scripts/langages/typescript/verifier.mjs: the integration's, the queue's, the night's, a
5
- // supervisor's) and by the heavy passes of the circuit of a ticket (scripts/circuit.mjs: the proof
4
+ // `npm run verifier` (scripts/langages/typescript/verifier.mjs: the night's, a supervisor's) and by the heavy passes of the circuit of a ticket (scripts/circuit.mjs: the proof
6
5
  // of the red and the checks), so that a measure gives the result of the code, not that of another
7
6
  // measure beside it.
8
7
  //
@@ -0,0 +1,75 @@
1
+ // The frame's workflows of GitHub Actions in a project, as a generator rewrites the file whose
2
+ // header says it generated it (the « Généré par … ; ne pas éditer » of the frame's generated files):
3
+ // the CI of a lot (`ci.yml`) and the night of a shared machine (`nuit.yml`), the template's
4
+ // `.github/workflows/` (templates/projet), which `grillhouse init` copies and `grillhouse maj`
5
+ // keeps (scripts/grillhouse-maj.mjs).
6
+ //
7
+ // - A workflow of the frame bears MARQUE on its first line. The update rewrites each workflow of the
8
+ // template that the project holds with it, when its text differs; one without it is the project's,
9
+ // and stays as it is.
10
+ // - A project that holds a workflow of the frame has adopted the frame's CI: it receives each
11
+ // workflow of the template it lacks (the night, for a project that adopted the CI alone). A
12
+ // project that holds none receives none: the update starts no CI on its repository.
13
+ // - The machine of the jobs is the repository's variable RUNNER (`vars.RUNNER`), which lives in the
14
+ // settings of the repository on GitHub, never in a file: the template writes no value of it.
15
+ import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
16
+ import path from 'node:path';
17
+
18
+ /** The directory of the workflows, in a project as in the template. */
19
+ export const WORKFLOWS = '.github/workflows';
20
+ /** The template whose workflows are the frame's, from the frame's files. */
21
+ export const GABARIT_DES_WORKFLOWS = path.join('templates', 'projet', WORKFLOWS);
22
+ /** The head of the first line of a workflow the frame writes. */
23
+ export const MARQUE = '# Généré par `npx grillhouse maj`';
24
+
25
+ /** Whether the text <texte> of a workflow is the frame's: its first line begins with MARQUE. */
26
+ export const estDuCadre = texte => texte.split(/\r?\n/, 1)[0].startsWith(MARQUE);
27
+
28
+ const ESTUN_WORKFLOW = /\.ya?ml$/;
29
+
30
+ // The names of the workflows of the directory <dossier>, sorted; none when it does not exist.
31
+ const workflowsDe = dossier =>
32
+ existsSync(dossier)
33
+ ? readdirSync(dossier)
34
+ .filter(f => ESTUN_WORKFLOW.test(f))
35
+ .sort()
36
+ : [];
37
+
38
+ /**
39
+ * Whether the project at <projet> holds a workflow of the frame: it has adopted the frame's CI.
40
+ * @param {string} projet
41
+ */
42
+ export function aLaCiDuCadre(projet) {
43
+ const dossier = path.join(projet, WORKFLOWS);
44
+ return workflowsDe(dossier).some(f => estDuCadre(readFileSync(path.join(dossier, f), 'utf8')));
45
+ }
46
+
47
+ /**
48
+ * Brings the frame's workflows of the project at <projet> to the template of the frame's files at
49
+ * <source> (see the header). Returns the names of the workflows written, from the project's root,
50
+ * none when nothing changes.
51
+ * @param {string} projet
52
+ * @param {string} source
53
+ * @returns {string[]}
54
+ */
55
+ export function poserLesWorkflows(projet, source) {
56
+ const modeles = path.join(source, GABARIT_DES_WORKFLOWS);
57
+ const dossier = path.join(projet, WORKFLOWS);
58
+ if (!aLaCiDuCadre(projet)) {
59
+ return [];
60
+ }
61
+ const ecrits = [];
62
+ for (const nom of workflowsDe(modeles)) {
63
+ const voulu = readFileSync(path.join(modeles, nom), 'utf8');
64
+ const f = path.join(dossier, nom);
65
+ const actuel = existsSync(f) ? readFileSync(f, 'utf8') : null;
66
+ if (actuel === voulu || (actuel !== null && !estDuCadre(actuel))) {
67
+ continue;
68
+ }
69
+ mkdirSync(dossier, { recursive: true });
70
+ writeFileSync(f, voulu);
71
+ ecrits.push(`${WORKFLOWS}/${nom}`);
72
+ }
73
+ return ecrits;
74
+ }
75
+
@@ -142,12 +142,14 @@ remplace jamais le grill. Les branches de l'arbre :
142
142
  Les mécanismes d'un paquet — sa forme publiée, les outils du projet, le corpus et ses données, les traces, Turborepo et la configuration Vitest — sont dans `references/paquets.md`, à lire au moment de créer un paquet.
143
143
  9. **Les interfaces** — pour chaque frontière : ce qui la traverse, qui offre, qui consomme, qui
144
144
  juge quelle faute, et le garde qui la tiendra.
145
- **Une fois les composants décidés**, la nuit entre dans la table des tâches du poste
146
- (`crontab -e` : `0 3 * * * export PATH=<dossier de Node>:$PATH; cd <racine> && node_modules/.bin/grillhouse nuit`,
147
- la ligne que propose l'ouverture de séance, avec le dossier du Node qui l'exécute, que la table
148
- des tâches ne trouve pas seule) : elle rejoue pour de vrai la passe complète, puis les tests de nuit et les bancs de budget, que le jour ne joue pas. Chaque
149
- intégration joue `npm run verifier` en entier (les gardes, le typage de chaque paquet et les
150
- tests), Turborepo relisant de son cache ce qui n'a pas bougé.
145
+ **Une fois les composants décidés**, la nuit du projet tourne sans rien à écrire : la
146
+ planification des nuits du poste (`npx grillhouse nuit --planifier`, une fois par poste, à 1 h
147
+ sauf `--heure <0-23>`) lance la nuit de chaque projet du registre
148
+ qui a bougé depuis sa dernière nuit verte, l'un après l'autre ; `npx grillhouse nuit <racine>`
149
+ la demande à la main. La nuit rejoue pour de vrai la passe complète, puis les tests de nuit et
150
+ les bancs de budget, que le jour ne joue pas. La CI de
151
+ chaque branche de ticket (`agent/**`, qu'elle écoute) joue `npm run verifier` en entier (les
152
+ gardes, le typage de chaque paquet et les tests) avant que main avance.
151
153
  Restent des choix selon la taille du projet, que le responsable tranche :
152
154
  - **le contrôle de l'interface contre le code** (`packages/grillhouse/scripts/langages/typescript/interfaces-contre-code.mjs`) : une
153
155
  seule passe avant les tests (petit projet), ou un banc par composant qui appelle
@@ -101,8 +101,9 @@ nomme le responsable, ce qui décide, les documents qu'il valide et les commande
101
101
  le ticket, et 3.1 les contrôles du plan), 4 Passe finale et relecture (4.1 la passe
102
102
  finale, 4.2 la régénération des références, 4.3 le relecteur ; le détail de 4.2 est plus bas,
103
103
  « Le circuit d'un ticket »), 5 Intégration (5.1
104
- le commit, 5.2 la file et la lecture de la CI : une CI rouge rouvre le ticket ; un rejeu vert
105
- des jobs rouges, `gh run rerun <id> --failed`, puis `--reprendre`, le ferme ; un test instable
104
+ le commit, 5.2 la file : la branche poussée, sa CI lue, main avancé sur l'arbre qu'elle a jugé
105
+ vert ; une CI rouge rouvre le ticket, main intact ; un rejeu vert des jobs rouges,
106
+ `gh run rerun <id> --failed`, puis `--reprendre`, la fait entrer ; un test instable
106
107
  se met en quarantaine dans le test, avec son ticket ; 5.3 le tri des découvertes par l'explorateur, sur
107
108
  le lot entré sur main, qui ne retarde pas la file et ne défait pas l'intégration) ; aucun composant n'est une unité du circuit, chaque
108
109
  étape joue une fois pour tout le ticket, dans l'enveloppe de tous les paquets du plan ; je dis
@@ -129,8 +130,8 @@ nomme le responsable, ce qui décide, les documents qu'il valide et les commande
129
130
  coûte ni testwriter ni développeur.
130
131
  - **La fin du circuit dit la suite** : à `integre`, le lot est sur main et le ticket fermé ; le
131
132
  panneau le montre, et je lis sa fermeture au tour suivant. Un arrêt me parvient par l'attente
132
- des questions, son code dans l'état du circuit. 75 (`a-repasser` : un contrôle ou l'intégration
133
- encore « à repasser », ou la branche gardée en file) : le jour, un 75 vient de l'attente du
133
+ des questions, son code dans l'état du circuit. 75 (`a-repasser` : un contrôle encore « à
134
+ repasser », ou la branche gardée en file, sa CI non lue comprise) : le jour, un 75 vient de l'attente du
134
135
  verrou de la machine ou de place sous /tmp, à sa borne, et attend mon `--reprendre`, au
135
136
  premier plan, une fois la machine libérée ;
136
137
  repris à l'étape `file`, il relit ce qu'une autre file a fait de la branche, et finit à `integre`