ci: run the workflow guards that nothing was running

Merged
TE
2mo ago
+158-3

Eight tests under tests/ read a file out of .github/workflows/ and assert something about it. No workflow runs any of them. They pass locally, they report nothing when main drifts away from what they assert, and the drift only surfaces when something breaks in production.

guardarrived inwhat it holds
test_tui_publish_dispatch_budget.py#13677the tui dispatcher concludes before its publishers stop waiting
test_ios_upload_array_expansion.py#13666upload-testflight.sh never expands an empty array under set -u
test_release_homebrew_gate.py#13673the cask update reads the signing job's conclusion, not the run's
test_tui_focused_filter_guard.py#11835cmux-tui.yml focused-filter routing
test_triage_radar.py#13520triage-radar.yml scoring
test_ci_release_helper_archs.py#13405the Release helper architecture handoff in ci-macos.yml
test_check_ghostty_zig_workflows.py—Ghostty Zig version pinning across workflows
test_ci_universal_release_settings.sh—GhosttyKit builds universal; Release configs keep ONLY_ACTIVE_ARCH = NO

Three of the eight are mine, from pull requests merged today. The other five are not, and the oldest predates them by hundreds of merges, so this is a property of how guards get added here rather than anybody's slip: writing the test and wiring the test are separate acts, and only the first one is load-bearing at review time.

What it cost

test_tui_publish_dispatch_budget.py was written for a bug and did not stop it. Checked out against 26361c7c7c^ — cmux-tui-release.yml as it stood before #13677 — it fails five assertions by name:

FAIL: the dispatcher sets exactly one shared discovery budget
FAIL: the budget is shared across publishers, not restarted per publisher
FAIL: failing to resolve a publisher run id does not fail the step
FAIL: the lookup returns successfully when it gives up
FAIL: giving up is still reported, so a missing summary link is visible

cmux-tui v0.13.0 failed to publish to npm and PyPI on exactly that regression. A wired guard would have caught the dispatcher's per-call discovery_deadline=$((SECONDS + 300)) outliving the publishers' 120s wait, on the pull request that introduced it.

test_ci_universal_release_settings.sh had been asserting against the wrong file. It required scripts/setup.sh to build GhosttyKit with -Dxcframework-target=universal. setup.sh has no GhosttyKit build left in it — line 89 delegates to scripts/ensure-ghosttykit.sh, which carries the flag at line 240. The guard was green the whole time by never running; had it run it would have been red, and nobody would have been able to tell "the universal build moved" from "the universal build is gone." Its mode was also 644, so ./tests/... could not have executed it in the first place.

Resulting behavior

tests/test_ci_workflow_guards_are_wired.py derives both sides instead of listing either:

  • guards are discovered from what they read — any tracked tests/test_*.{py,sh} whose text reaches into .github/workflows/, so a guard keeps its obligation across a rename or a move;
  • wiring is discovered from what the workflows run — every tests/… path named by a run: in any .github/workflows/*.yml, so it does not care which interpreter a step picks or which workflow owns the step.

It requires the second to cover the first. It is itself a workflow guard, so it holds itself to its own rule, and the ci group runs it.

The eight join the group that owns what they read, which means scripts/ci/workflow_guard_groups.py routes changes to them with no new PATH_OWNERS entry — ownership comes from the run: line, as that module intends. release-notary was the one group running Python guards without the venv step; test_release_homebrew_gate.py imports yaml, so that step's condition gains it. bashlex is already installed for release-tooling, which is what test_check_ghostty_zig_workflows.py needs.

The allowlist

One entry, tests/test_current_cli_workflow.py, and it is a finding rather than an exemption.

It splits cli-pipe-regressions.yml on the step name Exercise bounded read-only current-work consumers and executes that step's script. The step is gone — the closest survivor is Exercise closed consumers and socket disconnects — so the test raises IndexError in setUpClass before one assertion runs. Removing that step also orphaned tests/test_cli_current.py and tests/test_current_command_fixture.py, whose only caller it was. Whether bounded read-only current-work consumers should still be exercised is a question for whoever removed it, not something to answer inside a wiring change.

test_allowlist_does_not_outlive_its_entries evicts an entry once it is wired, deleted, or no longer reads a workflow, so the list cannot quietly become the place guards go to die.

Validation

Two commits, per the repository's regression policy:

  1. 52d9271 adds the guard alone. It fails, naming all seven unwired workflow-readers.
  2. 5a0f173 wires them. It passes.

All eight newly wired guards pass under a venv carrying the exact pins their groups install (PyYAML==6.0.3, bashlex==0.18). Also passing: test_ci_guard_workflow_structure.py, test_ci_release_guard_structure.py, test_ci_app_host_guard_structure.py, test_ci_quality_guard_structure.py, test_ci_source_lint_guard_structure.py, test_ci_linux_guard_routing.py. actionlint reports nothing on ci-guards.yml and the same 2 pre-existing errors repo-wide.

tests/test_ci_change_areas.py fails identically on unmodified main in this environment and is unrelated.

Known gap

The rule covers guards that read a workflow. test_ios_upload_array_expansion.py reads ios/scripts/upload-testflight.sh, so it is wired here but not protected by the ratchet. Widening to every tests/test_* file finds roughly 70 unreferenced files, most of them developer-run rather than CI guards, which needs a judgement call per file that does not belong in this change.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Eight tests that read .github/workflows/ files and assert invariants about them were never run by any workflow, so they passed locally while main drifted away from what they asserted. This adds a ratchet test that derives guards from what they read and wiring from what workflows run, then wires all eight into ci-guards.yml.

The ratchet landed first and failed, naming the unwired workflow-readers; the wiring commit then passes. A follow-up commit fixes test_ci_change_areas.py, which pins the venv-step condition as a literal and broke once release-notary joined the venv scope.

Bug Fixes

  • test_ci_universal_release_settings.sh checked scripts/setup.sh, which no longer builds GhosttyKit; the check now follows the build to scripts/ensure-ghosttykit.sh, and the script is executable.
  • release-notary runs Python guards without a venv, so test_release_homebrew_gate.py (which imports yaml) gains the venv step.

test_current_cli_workflow.py is allowlisted because the workflow step it runs was deleted; the allowlist evicts an entry once it is wired or no longer applies. The ratchet covers guards that read a workflow, so test_ios_upload_array_expansion.py is wired but not protected because it reads ios/scripts/upload-testflight.sh.

Summary by CodeRabbit

  • Tests
    • Expanded CI validation for workflow guard coverage and release-related workflows.
    • Added checks to ensure workflow-reading tests are consistently wired into CI.
    • Added regression coverage for release tooling, iOS uploads, notarization, build settings, and dispatch behavior.
    • Updated universal GhosttyKit validation to check the current build configuration location.
    • Improved safeguards against missing or outdated workflow test coverage.