Skip to content

feat: name a required workflow that has no file - #189

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/required-workflow-file-drift
Aug 27, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/required-workflow-file-drift

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Closes #188.

The defect

config/repos.yaml declares required_workflows per group and ci_status.rollup() scores a repo over exactly those. A required workflow with no runs at all is not scored as a failure — it simply never satisfies all_green, so the repo sits at {"conclusion": "", "status": "in_progress"} forever: able to go red, never able to go green, and never CI-clean to the readiness gate.

On the dashboard that is indistinguishable from a run is in flight, which is why the state survives unnoticed. One workspace repo sat in it from whenever it joined its group until 2026-08-24, when a human noticed the asymmetry. A survey of all 15 repos across the four gating groups found it was the only instance and it has since been fixed — so this is a guard against the hole reopening, not a bug hunt. It reopens on every edit to config/repos.yaml: adding a repo to a group, or a workflow to a group's required list, silently makes repos un-greenable and produces no red anything.

What this adds

heart/checks/required_workflow_drift.py — for every repo in a group that declares required_workflows, assert a workflow exists whose name matches each required entry.

Two things it gets right on purpose:

  • It reads the workflow list, not the runs. The runs payload ci_status already fetches cannot separate the two causes of "no runs" — no workflow file, versus a file that has never run on main. Only GET /repos/{owner}/{repo}/actions/workflows can, and the second case is genuinely pending and must stay pending.
  • It matches on name, never the filename. name is what ci_status matches runs against, so a filename-based check could pass while the roll-up still starves. A test pins this.

Wiring: state.py aggregates the sidecar, tick.sh runs it, readiness.py raises YELLOW per missing workflow — a configuration finding, not red CI, because the repo's code is fine and its gate is not wired up; red would misattribute the fault. Mirrors manifest_drift's shape throughout.

Cost — one extra call, not a new tier

The original proposal assumed a periodic Actions-API sweep or a check that runs where sibling checkouts exist. ci_status.sh says otherwise: it already loops every polled repo in parallel making two cheap gh api metadata calls each. A third is the same shape and cost, and only repos in a group that gates need it — 17 today; advisory groups are skipped without a call.

Failing safe

  • No gh (the web/mobile session) → available: false, the check skips. Never a hollow green.
  • A per-repo fetch error → that repo's missing stays empty and readiness gains a stale required workflows unverified reason naming it. Without that leg a missing gate could hide behind a 403.

Verification

  • 15 new tests (tests/test_required_workflow_drift.py, four cases in tests/test_readiness.py). Full suite 656 passed.
  • Every fetch is monkeypatched — the suite stays stdlib + PyYAML and reaches no network, per heart-tests.yml.
  • The tenant-firewall gate (repos_sync.py --only "tenant firewall (organ code)") passes: the new files name no instance fact, so no FIREWALL_ALLOWLIST entry was added. Verified with a canary token that the gate does scan them, then verified clean again with it removed.
  • The API contract was confirmed against a live repo: actions/workflows returns name: "Navigator Check" with path: ".github/workflows/navigator_check.yml" — the exact name ≠ filename case the matching rule exists for.

Deliberately out of scope

  • Folding the finding into ci_status's sidecar or rollup()'s return. rollup() is the release gate; reshaping it to carry a configuration finding would ripple through readiness, dashboard and publish for no gain.
  • The release-ci profile's unobserved list, whose sentence is specifically about dev-box-local evidence. This check is not dev-box-local.

Generated by Claude Code

config/repos.yaml declares required_workflows per group and ci_status.rollup()
scores a repo over exactly those. A required workflow with no runs is not scored
as a failure — it just never satisfies all_green, so the repo sits at
{"conclusion": "", "status": "in_progress"} forever: able to go red, never able
to go green, and never CI-clean to the readiness gate. On the dashboard that is
indistinguishable from a run in flight, which is why the state survives
unnoticed until a human spots the asymmetry.

heart/checks/required_workflow_drift.py makes it nameable. The runs payload
ci_status already fetches cannot separate the two causes of "no runs" — no
workflow file, versus a file that has never run on main. Only the workflow list
can, so that is the one call added: GET /repos/{owner}/{repo}/actions/workflows,
one per repo in a group that gates (17 today), in parallel, the same cheap
metadata read ci_status.sh already makes twice per repo.

Matching is on each workflow's `name` field, never its filename: `name` is what
ci_status matches runs against, so a filename-based check could pass while the
roll-up still starves.

Classified YELLOW and as a configuration finding rather than red CI — the repo's
code is fine, its gate is not wired up, and red would misattribute the fault.
Mirrors manifest_drift's shape (own sidecar, readiness caution, available:false
when it cannot run). Degradation is honest: no gh (the web/mobile session) skips
the check, and a per-repo fetch error becomes a stale "unverified" reason rather
than an implied pass — otherwise a missing gate could hide behind a 403.

Names no instance fact, so it needs no tenant-firewall allowlist entry; verified
with repos_sync.py --only "tenant firewall (organ code)", including a canary that
confirms the gate does scan the new files.

15 new tests; full suite 656 passed.

Refs PyAutoMind draft/feature/pyautoheart/required_workflow_file_drift.md

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KmWbYJw4cJJnt4eK6NoZjL
@Jammy2211
Jammy2211 merged commit 2a1391f into main Aug 27, 2026
2 checks passed
@Jammy2211
Jammy2211 deleted the feature/required-workflow-file-drift branch August 27, 2026 17:35
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.

feat: name a required workflow that has no file (the silent never-green defect)

2 participants