test(ci): exercise the broken-main notifier while main is green - #2057
Merged
Merged
Conversation
Contributor
🔍 Rendered manifest diff — this PR vs
|
`notify-main-broken` runs `if: failure() && github.event_name == 'push'`, so a healthy repository never runs it and the first run that matters is also the first run ever. It shipped broken in #2052 for exactly that reason -- no checkout step, so every `gh` call died with failed to run git: fatal: not a git repository and a red `main` went unreported, the one outcome the job exists to prevent. #2053 fixed it with GH_REPO, but nothing proves it stays fixed: the job still cannot run until `main` actually breaks. This suite runs it offline. It extracts the step's `run:` block as the runner sees it -- after YAML block-scalar de-indentation, which is why it parses YAML rather than slicing with sed, since the body holds a heredoc whose terminator must land at column zero -- and drives it from a directory that is not a git repository, against a `gh` stub that refuses exactly as the real one does. It takes the step's `env:` FROM THE WORKFLOW rather than supplying its own, and that is the whole design. Two earlier versions of this test exported GH_REPO themselves and asserted only the branch logic; both passed against a workflow with no GH_REPO at all -- the same "tested the logic, not the invocation context" gap as the defect they were written for. Verified by mutation: removing the GH_REPO line from ci.yaml fails the suite with the production error message, and restoring it passes. Runs in the `links` job, which already installs the pyyaml it needs; the shellcheck job installs only shellcheck, and this repo does not treat "it happens to be in the runner image" as a dependency declaration.
Smana
force-pushed
the
test/ci-notify-main-broken
branch
from
September 17, 2026 19:43
8810cf0 to
ef310ca
Compare
This was referenced Sep 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔍 test
📝 Summary
notify-main-brokenrunsif: failure() && github.event_name == 'push', so a healthyrepository never runs it — its first run that matters is also its first run ever. It
shipped broken in #2052 for exactly that reason, and a red
mainwent unreported, theone outcome the job exists to prevent. #2053 fixed it, but nothing proves it stays fixed:
the job still cannot run until
mainactually breaks.This runs it offline, every PR.
🎯 Changes
scripts/test-ci-notify-main-broken.shlinksjob, which already installs pyyamlscripts/AGENTS.mdrecords what it covers and why📊 Flow
flowchart LR yaml["ci.yaml"] -->|"run: + env:"| extract["Extract as the runner sees it"]:::new extract --> syntax["bash -n + heredoc column"]:::new extract --> drive["Drive from a non-git dir<br/>against a gh stub"]:::new drive --> cases["create · comment · must-fail"]:::new classDef new fill:#1e3a8a,stroke:#3b82f6,stroke-width:3px,color:#fff🗂️ Files
scripts/test-ci-notify-main-broken.sh.github/workflows/ci.yamllinksjobscripts/AGENTS.mdThe design point: the env comes from the workflow
Two earlier versions of this test passed against a workflow with no
GH_REPOat all.They exported
GH_REPOthemselves and then asserted the branch logic — open a new issuevs comment on the open one. That is the same gap as the defect they were written for:
testing the script's logic while the break was in how the workflow invokes it.
This version reads the step's
env:out ofci.yamland runs with that. Verified bymutation rather than assertion — removing the
GH_REPOline:That is the production error message, reproduced offline. Restored, it passes:
The third case drops
GH_REPOdeliberately and requires the failure to come back — withoutit the first two could pass for the wrong reason.
Why it parses YAML instead of slicing with sed
The
run:block is a YAML block scalar containing a heredoc, and the heredoc terminatorhas to land at column zero after YAML strips the common indent. Get that wrong and the
step is still valid YAML while being broken bash — invisible to every other gate here.
So the suite asserts the terminator's column explicitly, then
bash -ns the result.It runs in the
linksjob rather thanshellcheckbecause it needs that pyyaml. Theshellcheck job installs only shellcheck, and this repo does not treat "it happens to be in
the runner image" as a dependency declaration — the same reasoning the two checks above it
already carry.
🏷️ Labels
Tests, configuration changes