Repository navigation
fleet-ops: run the required-context preflight in the read-only check - #294
Conversation
…293) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review (haiku, claude-review.yml)Review of #294: fleet-ops: run the required-context preflight in the read-only check I read the diff and the full
The PR-workflow items pass. The body has |
Review triageFinding 1 (summary hint says to run Finding 2 (no automated coverage of the seen/unseen comparison): declined. Both findings are triaged, so I'm arming auto-merge. |
Closes #293
Summary
fleet-ops/README.mddescribes the read-onlyfleet-apply.shcheck as the home of the required-context preflight: the proof that a context has reported on a recent PR before anything requires it. The script did not match that.seen_contextsran only inside the mutating--require-checkspath. Sinceterraform/took over required checks, the README itself describes that path as racing the Terraform state, so the fleet had no supported way to run the preflight without writing to an enforced ruleset. For #291 the preflight had to be run by extracting the function by hand.This PR makes the read-only check run the preflight itself. For each repo where
required-checks.jsonlists contexts the live ruleset does not require yet (⧗ req-checks missing=[…]), it calls the existingseen_contextsand appends✗ req-checks never-seen-on-a-PR=[…]for any context that has not reported on the repo's five most recent PRs. That is exactly the state of a branch that adds a context, before its Terraform apply. With the change, the README's existing claim is accurate. One sentence is added to therequired-checks.jsonsection documenting the new marker.Fix the code or fix the docs
The alternative was to correct the README to say only
--require-checksruns the preflight. That would have documented a preflight you can only run by mutating live state on a Terraform-enforced surface, which is what the README warns against. The code change is 9 added lines plus one wideneddeclare, not a one-liner. It reusesseen_contextsunchanged and only adds API calls for repos with missing contexts, so a fleet-wide sweep with no rollout pending costs the same as before.Testing
I ran a scratch copy of the script against a scratch
required-checks.jsonthat adds two contexts to epigaea:YAML Lint, which reports on epigaea PRs but is not required, andBatz, which is bogus.Against the real config, where epigaea has no missing contexts and the preflight is not run:
shellcheck fleet-ops/fleet-apply.shis clean andpython3 ci/validate.pypasses.Scope
Nothing else in
fleet-apply.shchanges. That includes the--require-checkspath, its own preflight, and the end-of-run summary hints.🤖 Generated with Claude Code