Repository navigation
fix(provider-github): let a workflow run supersede before it has jobs - #285
Open
ccf-lisa[bot] wants to merge 3 commits into
Open
ccf-lisa[bot] wants to merge 3 commits into
ccf-lisa[bot] wants to merge 3 commits into
Conversation
latestSuites dropped every check suite without check runs before picking the latest suite of a kind, so a re-triggered workflow's newer run did not supersede the run its concurrency group cancelled until its first job showed up. In between, the cancelled run counted as the latest and the PR rolled up failure, settled (compliance-framework/api#587). A suite of a known kind (App, workflow, event) now takes part with or without check runs: as the latest it counts as pending until it concludes, and once completed without jobs (startup failure, cancelled before a job, awaiting approval) by its conclusion. Kind-less suites without check runs (GitHub's never-completing placeholders) are still ignored. ci.rerun's latestRuns reads the runs API, which lists a run from its creation, so it was not affected; its test now covers the shape. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ncel case Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nt what consumers see Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Task: fx/checks-supersede-without-jobs. Patch-release candidate: the deployed dispatcher is v0.6.0.
Bug (prod, v0.6.0, compliance-framework/api#587)
latestSuites(internal/provider/github/observe.go) dropped every check suite withcheckRuns.totalCount == 0before choosing the latest suite of a kind (App + workflow + event). When a workflow fires twice in quick succession (PR opened + labeled gives twopull_requestruns ofpreview, and the concurrency group cancels the older one), the newer run's suite exists for a few seconds with no check runs. In that window the cancelled run counted as the latest of its kind.Timeline on api#587, head
820900a:previewrun 388's check suite createdpreviewrun 387 (suite with 4 check runs) CANCELLED by concurrencycheck_suite completedwebhook for 387; the observation rolls up{state: failure, settled: true}: 388 is skipped (no check runs yet), so 387's CANCELLED is the latestpreviewMeanwhile the catalog rule
fix-failing-bumphad already dispatched a fix on a PR that was green.Fix
suiteKindok: App +workflowRun+workflow) now takes part in superseding whether or not it has check runs. It can be the latest of its kind, and as the latest it counts as pending until it concludes. The api#587 observation now givespending(not settled), so no rule fires.startup_failure, an invalid workflow file), it was cancelled before a job started (cancelled, usually by its concurrency group, and then a later run of the same workflow and event supersedes it), or it is waiting for approval (action_required). None of these passed. Ignoring the run would let an older run of the same workflow, or nothing, stand in for it.checksOf/latestSuitesdoc comments and the GitHub provider LLD (checks roll-up section andci.rerun).ci.rerun(effects_ci.go): not affectedlatestRunsuses the samerunOrdersuperseding but reads the Actions runs API (GET …/actions/runs?head_sha=). That API lists a run from the moment it is created, whether or not it has jobs, andlatestRunsnever filtered on jobs. A queued run 388 therefore already superseded the cancelled 387, and nothing was re-run. No code change: I added a doc line onlatestRuns, andTestApplyCIRerunNothingnow covers the api#587 shape (cancelled run 19 superseded by queued run 20 of the same workflow, nothing re-run).Tests
TestObserveChecks(table, through thegithubtestGraphQL fake; the fake already servescheckRuns.totalCountand theworkflowRunper suite, so no fake change was needed):pending, not settledsuccesspending; an earlier 0-run run is superseded; a lone 0-run run →pendingSTARTUP_FAILURE/CANCELLED→failure,SUCCESS→successworkflowRun, another App's placeholder, a run with a null workflow) are still ignoreda later run without check runs doesn't supersede, which asserted the buggy behaviour; every other case is unchangedI checked that seven of the new cases fail against the old
latestSuites.Verification
make build✅make check-generated,make lint(0 issues),make catalog(66/66),make openapi-lint✅make test: everything passes exceptinternal/agent/host/provisionTestBaseScriptRuns, which fails locally on macOS only (/etc/os-releaseis missing). It is unrelated to this change and runs in CI on Linux.Resolved: kept, reviewed (zero-job runs count by their conclusion)
A workflow run that completes with no jobs used to be ignored. As the latest of its kind it now counts by its conclusion, so these cases now roll up
failure, settled:action_required);startup_failure);Where the run had jobs, these cases were already
failure. Review kept the behaviour: GitHub's PR checks show these runs as not passing, and no catalog rule misfires. Fork PRs get nopr.checks.completed, and the rules that act onfailureare for the factory's own PRs.TestObserveCheckscovers the 0-runACTION_REQUIREDcase, and the LLD names what consumers see.🤖 Generated with Claude Code