Skip to content

ci: a check of an absence in a step can fail: no command negated with ! (FRU-222) - #292

Merged
Mheaus merged 1 commit into
mainfrom
mathieu/fru-222-ci-negative-checks
Oct 13, 2026
Merged

Mheaus merged 1 commit into
mainfrom
mathieu/fru-222-ci-negative-checks

Conversation

@sakuga-agent

@sakuga-agent sakuga-agent Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

For Mathieu to read: CI and the release workflow. Stack: #290 → this PR. Merge #290 first.

Refs FRU-222 (follow-up of #290: the one finding of its heavy review, P2, true)

The defect

GitHub runs a run step with bash -e, and bash does not apply errexit to a command that ! inverts. Three checks of the job docker image and one of check-console were written ! grep -q …: with 'unsafe-inline' in the policy of the console, or the origin of one worker in the policy of the other, the step stayed green. The step that #290 replaced on main had the same form.

The fix

  • ci.yml: a function absent, which exits by itself; release-image.yml: if … grep -q …; then exit 1; fi.
  • workflows.test.ts: a new case fails on any line of a workflow that negates a command with !, with a control on the form that was there.
  • docs/decisions/image.md: the rule.

Proof

Not verified

check-console of release-image.yml has not run: no dispatch, no push to a registry.

🤖 Generated with Claude Code


Sakuga Review · Score de confiance : 4/5

La PR peut être fusionnée : le correctif remplace les ! grep de deux étapes par des tests qui échouent réellement, et la garde de workflow est ajoutée. Le seul point à corriger est une garde qui laisse passer des formes proches de ! grep.

Constats

  1. P2 La garde ne couvre pas tous les ! négatifs apps/worker/src/workflows.test.ts:448
    La regex ^\s+! \S.*$ ne voit que les lignes qui commencent par ! . Une étape écrite run: ! grep -q x fichier sur une seule ligne, une liste - ! grep …, ou une chaîne grep a && ! grep b ne sont pas détectées. Sous bash -e, ces formes ne font pas échouer l'étape, et le test reste vert. Correction : Élargir la regex pour attraper ! après run:, -, &&, ||, | ou ;, et ajouter un témoin pour chacune de ces formes.
  2. P2 absent réussit si le fichier est absent .github/workflows/ci.yml:405
    absent appelle grep -q puis agit seulement si la sortie vaut 0. Si le fichier de contrôle n'existe pas, grep sort avec 2, la condition est fausse, et la fonction réussit sans rien vérifier. L'étape reste verte alors que la vérification n'a pas eu lieu. Le CLAUDE.md demande un contrôle qui échoue sur une violation planté, et aucun n'est ajouté ici. Correction : Dans absent, tester le code de sortie de grep : sortie 0 échoue, sortie 2 échoue aussi avec un message, sortie 1 réussit. Ajouter un contrôle qui vérifie que la fonction échoue sur une politique contenant la chaîne.
Résumé

La PR remplace les ! grep dans les étapes de ci.yml (fonction absent) et de release-image.yml par if grep …; then exit 1; fi, car sous bash -e un ! ne fait pas échouer l'étape. Elle ajoute un test dans workflows.test.ts qui cherche les lignes commençant par ! et une section dans image.md. J'ai vérifié les deux nouvelles formes et le test : elles échouent bien quand la condition est présente. Je n'ai pas pu exécuter les workflows ni vérifier les numéros de ligne exacts de ci.yml.

Non relu
  • .github/workflows/ci.yml: numéros de ligne exacts de absent non vérifiés, les lignes de la PR ont été comptées approximativement
  • apps/worker/src/workflows.test.ts: le corps de la fonction workflows() n'est pas dans le diff, je n'ai pas pu confirmer qu'elle lit tous les workflows

Revues (2) · Dernier commit relu : ci: a check of an absence in a step can fail: n... · Niveau lite · anthropic/claude-haiku-5.5 · 0,005 $

@sakuga-review sakuga-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Score de confiance : 4/5 · ⚠️ Rien de bloquant · La PR peut être fusionnée : les deux étapes qui vérifiaient une absence utilisent désormais if grep …; then exit 1; fi, et le test de garde couvre le cas. Le seul point restant est un trou du test, de sévérité mineure.

Niveau lite · anthropic/claude-haiku-5.5 · 0,005 $ · Le résumé, le diagramme et la liste des constats sont à la fin de la description de la PR.

@sakuga-review sakuga-review Bot added the review: 4/5 Score de confiance de Sakuga Review (5 : prête à merger) label Oct 13, 2026
@sakuga-agent

sakuga-agent Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Sakuga Review (lite, 4/5) on cb8b763, one P2 (workflows.test.ts:448): the guard sees only a line that begins with !. True, and left as it is: this pull request is green, and the limit is a known one. The guard catches the form that was there, four times. A wider pattern (! after &&, ||, ; or on the line of run:) would also fail on if ! command; then, which is the form that does stop, so it needs a parser of the shell and not one more expression. No workflow holds the other forms today: grep -rn '&& !\|; !\|run: !' .github/workflows finds nothing.

@Mheaus
Mheaus added this pull request to stack #297 October 13, 2026 17:46
Base automatically changed from mathieu/fru-222-host-la-console-pour-un-auto-hebergeur to main October 13, 2026 17:46
… ! (FRU-222)

GitHub runs a step with bash -e, and bash does not stop on a command that ! inverts. The steps of
the console looked for unsafe-inline and for the origin of the other worker with ! grep: with
either in the policy, the step stayed green. They now exit by themselves, and workflows.test.ts
fails on a negated command in any workflow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Mheaus
Mheaus force-pushed the mathieu/fru-222-ci-negative-checks branch from cb8b763 to ae08b17 Compare October 13, 2026 17:46

@sakuga-review sakuga-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Score de confiance : 4/5 · ⚠️ Rien de bloquant · La PR peut être fusionnée : le correctif remplace les ! grep de deux étapes par des tests qui échouent réellement, et la garde de workflow est ajoutée. Le seul point à corriger est une garde qui laisse passer des formes proches de ! grep.

Niveau lite · anthropic/claude-haiku-5.5 · 0,005 $ · Le résumé, le diagramme et la liste des constats sont à la fin de la description de la PR.

@Mheaus
Mheaus merged commit 272167a into main Oct 13, 2026
13 checks passed
@Mheaus
Mheaus deleted the mathieu/fru-222-ci-negative-checks branch October 13, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review: 4/5 Score de confiance de Sakuga Review (5 : prête à merger)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant