Repository navigation
ci(gate): teach the planner and the gate about called workflows, and run the mutants in ci-scripts (stage 0.3) - #245
Merged
Merged
Conversation
…run the mutants in ci-scripts Stage 0.3 of Phase 0 of the CI split (ADR-0102). No workflow calls another yet, so nothing CI plans or judges changes: the 5,022 checks of the planner's test and the 109 of the gate's, written before this, pass unchanged. assert-gate.sh is the one script at every level. It takes four optional inputs, each defaulting to what ci.yml's gate needs, so a level that forgets one fails and does not pass: KNOWN_JOBS, CHANGES_JOB, CELL_JOB and VERDICT_JOBS. A job named in VERDICT_JOBS must have succeeded AND carry the output verdict=pass, because a called workflow whose own verdict job was skipped is success and proves nothing (research 0018). plan-ci.py gets a WORKFLOWS map, empty today, that check_workflows refuses unless it is a partition of the jobs, and three outputs beside the old ones: top (what ci.yml's own gate expects), workflows (the called workflows with a planned job) and plans (what each is given). While the map is empty, top equals jobs. Its rule for the workflow files that run the checks names the ones the migration adds (test, lint, documentation, security, web), and test_plan_ci.py lists .github/workflows/ and fails for a file that is neither one of those nor one that runs no check, so a new workflow cannot fall into the generic rule and run no test. tests/mutate_gate.py plants 53 hand mutants, one at a time, in plan-ci.py and assert-gate.sh, and each must fail the tests of its file; it is the last line of the ci-scripts job. It refuses to answer when the tests fail unmutated, when the text a mutant replaces is not found exactly once, or when a mutant does not compile, and two mutants that change nothing must survive. Its first run found a real gap, a CLI test that could not tell a working `plans` line from a broken one while the map is empty, now closed. It takes 77 s at four workers. The tests grow to 173 cases for the gate and 6,760 checks for the planner. CI runs everything on this pull request: ci.yml, the planner and the gate are each in the planner's run-everything rules. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
main moved by five commits while CI ran on this branch, among them the contract suite on nextest (#243), which edits plan-ci.py, test_plan_ci.py, ci.yml and cicd.md as this branch does. The merge is textually clean; it was tested before it was committed, because a clean merge of two CI changes is not evidence that they agree: - test_plan_ci.py: 6,761 checks pass - test-ci-scripts.sh under dash: 173 cases pass - mutate_gate.py: 53 of 53 mutants killed, none broken (so every text a mutant replaces is still found exactly once in the merged files), and both equivalent mutants survive - lint-all-workflows.sh exits 0 on the merged ci.yml Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ants by pattern main moved again while CI ran on the last merge: #238, a second e2e suite, adds the pass `e2e-mail` to four planner rules. Two of this branch's mutants named those rules by the exact text of their pass list, so in CI mutate_gate.py reported 2 BROKEN (the text to replace was found 0 times) and ci-scripts failed, as it should when a mutant tests nothing. This merge carries the fix, which is why it is more than a merge: the four mutants of a rule's effect (web/, the CA root, e2e.sh, the oracle) now find the rule by its pattern and change its effect, so a rule that gains a pass or a job no longer breaks them. Each regex was checked to match exactly once in the planner before #238 and after it. A rule that is renamed or removed still breaks its mutant, which is the signal. Tested on the merged tree before this commit: - test_plan_ci.py: 6,763 checks pass - test-ci-scripts.sh under dash: 173 cases pass - mutate_gate.py: 53 of 53 mutants killed, none broken, both equivalent mutants survive - lint-all-workflows.sh exits 0 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This was referenced Nov 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.
What
Stage 0.3 of Phase 0 of the CI split (plan, ADR-0102):
the planner and the gate learn what a called workflow needs, and the mutants that prove their tests can fail are committed and run.
Nothing CI plans or judges changes. No workflow calls another yet. The planner's 5,022 existing checks pass unchanged against
the new code, and so do 108 of the gate's 109 existing cases (I ran both before adding any case). The 109th,
same_jobs,reads the gate's default job list, which moved into a
${KNOWN_JOBS:-...}expression, so its one line that reads it follows it.(The commit message says all 109 passed unchanged; it is 108 and one updated.)
The three changes
assert-gate.shis the one script at every level. It takes four optional inputs, each defaulting to whatci.yml's gateneeds, so a level that forgets one fails instead of passing:
KNOWN_JOBS,CHANGES_JOB,CELL_JOB,VERDICT_JOBS. A job inVERDICT_JOBSmust have succeeded and carry the outputverdict=pass, because a called workflow whose ownverdictjobwas skipped is
successand proves nothing (the spike, research 0018).plan-ci.pyknows about called workflows. AWORKFLOWSmap, empty today, refused unless it is a partition of the jobs(before the planner prints a line), and three outputs beside the old ones:
top(whatci.yml's gate expects),workflowsand
plans(what each called workflow is given). While the map is empty,topequalsjobs. Its rule for the workflow filesthat run checks names the ones the migration adds, and
test_plan_ci.pylists.github/workflows/and fails for a file thatis neither one of those nor one that runs no check, so a new workflow cannot fall into the generic rule and run no test.
mutate_gate.pyis committed and is the last line ofci-scripts(your decision). 53 hand mutants, one at a time, inthe planner and the gate; each must fail the tests of its file.
What building it found
The first mutant run found a real gap, not a theory: mutant "the planner prints no plans" survived. With
WORKFLOWSemptyplans={}is right either way, so my CLI test could not tell a working line from a broken one. It now runs the same commandline on a copy of the planner whose map has two workflows. Run 2: 53 of 53 killed.
A design refinement. The phase plan made
cia one-entryWORKFLOWSholding every job. That makescimean two things(a workflow, and "the jobs left in
ci.yml"), so a job in no workflow is a job ofci.ymland the map starts empty. The phasedocument says so.
The old driver's weaknesses were not carried over. It was a session scratchpad file with hard-coded paths, and it counted a
mutant whose target text no longer exists as a "noop" and went on (one of its 34 is that today). The committed one reports
such a mutant as BROKEN, runs the tests unmutated first, checks each mutant compiles, and requires two do-nothing mutants to
survive, so a driver that kills everything is caught.
CI caught the driver's own maintenance cost, once, and it is fixed. While this PR was open,
mainmoved twice. The secondmove,
#238(a second e2e suite), added a pass,e2e-mail, to four planner rules; two of my mutants named those rules by theexact text of their pass list, so
mutate_gate.pyreported 2 BROKEN in CI andci-scriptsfailed, correctly: a mutantthat tests nothing is not allowed to look like one that passed. The first run of that merge passed locally and failed in CI
only because CI tests the PR merged into the current
main, which had moved since. The four mutants of a rule's effect nowfind the rule by its pattern (each regex checked to match exactly once before and after
#238), so a pass or a job added toa rule no longer breaks them; a rule that is renamed or removed still does. Without this, every unrelated PR that edits a
planner rule would have turned
ci-scriptsred until its author editedmutate_gate.py.Cost, measured
ci-scriptstook 119 s and 126 s in the two green runs, against a median of 71 s before, so the driver adds under aminute on a hosted runner (it is 77 s at four workers on a laptop; the 10-minute limit is far away). Pass 7 may shorten it.
What CI did
ci.yml,plan-ci.pyandassert-gate.share each in the planner's run-everything rules, so the run on this PR is the fullpipeline: 39 checks, none skipped, none failed. On the last head (
99fa7fb):gategreen,mutate_gate.py53 killed, 0survived, 0 broken, both equivalent mutants survived.
This branch has two merge commits of
main(they carry the verification in their messages);mainis merged, not force-pushed.Verification
test-ci-scripts.sh: 173 cases pass underdashand under the macOSsh;test_plan_ci.py: 6,763 checks pass (6,760 before the merges ofmain).mutate_gate.py: 53 of 53 killed, both equivalent mutants survive.lint-all-workflows.sh,test-lint-workflow.sh(17) andtest-lint-all-workflows.sh(126) pass.cicd.mdno longer says the mutants are "not yet in CI", and itstest_plan_ci.pycount and stale marker are corrected.Next: stage 0.4 (the lint rules,
actionlint, the two indexes), the last of Phase 0.🤖 Generated with Claude Code