Skip to content

ci(gate): teach the planner and the gate about called workflows, and run the mutants in ci-scripts (stage 0.3) - #245

Merged
aRustyDev merged 3 commits into
mainfrom
chore/ci-gate-callees
Nov 16, 2026
Merged

aRustyDev merged 3 commits into
mainfrom
chore/ci-gate-callees

Conversation

@aRustyDev

@aRustyDev aRustyDev commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

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.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 instead of passing: KNOWN_JOBS, CHANGES_JOB, CELL_JOB, VERDICT_JOBS. A job 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 (the spike, research 0018).
  • plan-ci.py knows about called workflows. A WORKFLOWS map, 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 (what ci.yml's gate expects), workflows
    and plans (what each called workflow is given). While the map is empty, top equals jobs. Its rule for the workflow files
    that run checks names the ones the migration adds, 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.
  • mutate_gate.py is committed and is the last line of ci-scripts (your decision). 53 hand mutants, one at a time, in
    the 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 WORKFLOWS empty
    plans={} is right either way, so my CLI test could not tell a working line from a broken one. It now runs the same command
    line on a copy of the planner whose map has two workflows. Run 2: 53 of 53 killed.

  • A design refinement. The phase plan made ci a one-entry WORKFLOWS holding every job. That makes ci mean two things
    (a workflow, and "the jobs left in ci.yml"), so a job in no workflow is a job of ci.yml and the map starts empty. The phase
    document 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, main moved twice. The second
    move, #238 (a second e2e suite), added a pass, e2e-mail, to four planner rules; two of my mutants named those rules by the
    exact text of their pass list, so mutate_gate.py reported 2 BROKEN in CI and ci-scripts failed, correctly: a mutant
    that 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 now
    find the rule by its pattern (each regex checked to match exactly once before and after #238), so a pass or a job added to
    a 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-scripts red until its author edited mutate_gate.py.

Cost, measured

ci-scripts took 119 s and 126 s in the two green runs, against a median of 71 s before, so the driver adds under a
minute
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.py and assert-gate.sh are each in the planner's run-everything rules, so the run on this PR is the full
pipeline
: 39 checks, none skipped, none failed. On the last head (99fa7fb): gate green, mutate_gate.py 53 killed, 0
survived, 0 broken, both equivalent mutants survived.

This branch has two merge commits of main (they carry the verification in their messages); main is merged, not force-pushed.

Verification

  • test-ci-scripts.sh: 173 cases pass under dash and under the macOS sh; test_plan_ci.py: 6,763 checks pass (6,760 before the merges of main).
  • mutate_gate.py: 53 of 53 killed, both equivalent mutants survive.
  • lint-all-workflows.sh, test-lint-workflow.sh (17) and test-lint-all-workflows.sh (126) pass.
  • cicd.md no longer says the mutants are "not yet in CI", and its test_plan_ci.py count 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

aRustyDev and others added 3 commits November 16, 2026 17:39
…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]>
@aRustyDev
aRustyDev merged commit 6a985c7 into main Nov 16, 2026
39 checks passed
@aRustyDev
aRustyDev deleted the chore/ci-gate-callees branch November 16, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant