Repository navigation
fix(release): count only the latest check run per name in the CI-green gate - #1537
Merged
Merged
Conversation
Add tests/test_ci_green_gate.py: it extracts the release-PR CI gate's real bash from all six copies (release.yml, release-core.yml, and the validate + merge gates of both promote-release.yml copies) and runs it against fixture statusCheckRollup payloads. Shape assertions cannot distinguish a correct per-name dedup from a plausible one, so the #1516 stale-FAILURE scenario is pinned as behavior. extract_ci_gate/run_ci_gate join the shared workflow_scaffold helpers. Refs: #1522
…n gate The release-PR CI gate counted every FAILURE/ERROR entry in the head SHA's statusCheckRollup. A superseded workflow run leaves its check runs attached to that same SHA, so the gate refused a branch that `gh pr checks` — which keeps only the latest run per name — reported green; the 1.10.0 train had to delete the superseded run to proceed (#1516). Each gate now groups the rollup by check name and derives CI_FAILED, CI_PENDING and CI_SUCCESS from the latest run of each. Recency keys on startedAt, not completedAt: completedAt is null while a re-run is in flight, which would rank the live run oldest and let the stale FAILURE win. StatusContexts carry no name/startedAt, so they key on context/createdAt and keep their current treatment. The issue names release.yml and release-core.yml; the four promote-release.yml gates (validate and merge, both copies) carry the identical logic and the identical hazard, so all six sites are fixed together. Refs: #1522
This was referenced Aug 17, 2026
Closed
c-vigo
added a commit
that referenced
this pull request
Aug 17, 2026
## Summary Implements #1538 (follow-up to #1537): the six CI-green gates classified every rollup entry by `.conclusion` — a CheckRun-only field — so a StatusContext (commit status API, which carries `state`) always fell into the pending bucket: a red commit status could never block as failed (on the failures-only `release-core.yml` gate it passed outright), and a green one held the pending gates open forever. Latent today (no org repo publishes commit statuses); real the day a consumer adds a status-API tool. All three counts now bind one normalized verdict per entry — `(.conclusion // .state) as $v` — and compare against it: FAILURE/ERROR → failed, SUCCESS → success, null/""/PENDING/IN_PROGRESS/QUEUED/**EXPECTED** → pending. Field shapes were verified live via GraphQL introspection, not assumed: `StatusState` is exactly `EXPECTED, ERROR, FAILURE, PENDING, SUCCESS`, and CheckRun has no `state` field, so nothing can double-classify; an in-progress CheckRun (`conclusion: null`) resolves `null // null` → still pending, and `conclusion: ""` stays pending via the retained `== ""` arm (empty string is truthy in jq, no fall-through). Applied at all six sites (#1537 scope); the #1537 dedup expression is untouched, and its comment blocks were corrected where they claimed StatusContexts "keep counting as before". ## Test plan `tests/test_ci_green_gate.py`: the deliberately-pinned StatusContext test from #1537 is inverted as the issue prescribed, replaced by seven new scenario families x six sites — red status blocks as failed (sharpest red case: previously *passed* the release-core gate), green status passes / counts as a successful check, PENDING/EXPECTED still hold, mixed rollups classify each kind independently, same-keyed vs distinctly-keyed StatusContext/CheckRun grouping pinned as #1537 actually behaves. TDD red: 34 failed before the fix; 90 passed after. Combined gate suites: 128 passed; `prek run --all-files` exit 0 (verified independently of the implementation run). Closes #1538
c-vigo
added a commit
that referenced
this pull request
Aug 17, 2026
The gh-issues PR table kept the latest run of each check name by completedAt, which is null while a rerun is in flight: the live run ranked as the oldest of its name and the FAILURE it supersedes won the CI cell during exactly the window someone watches a rerun. Key on startedAt with a createdAt fallback for StatusContexts, mirroring the release-workflow CI-green gates fixed in #1537. Refs: #1539
c-vigo
added a commit
that referenced
this pull request
Aug 17, 2026
## Summary Implements #1539 (follow-up to #1537): `_dedupe_status_checks` — feeding the `just gh-issues` PR table — keyed recency on `completedAt`, which is null while a re-run is in flight, so the table showed the superseded FAILURE during exactly the window someone is watching a re-run. The recency key is now a helper mirroring the release gates' jq expression: `startedAt or createdAt or ""` (the `createdAt` arm covers StatusContexts, which have no `startedAt`; `completedAt` is deliberately absent — a completed CheckRun always has `startedAt`, so it would only reintroduce the skew). Grouping key, tie-breaking (`>=`, last wins), insertion order, and output shape unchanged; the #176-era no-timestamps behavior (last in list wins) is preserved and still pinned. Display-only fix — no gate behavior changes. ## Found during implementation, deliberately out of scope Two more latent StatusContext gaps in the same file, the display-table analogues of #1538: grouping uses `name` only (all commit statuses would collapse into one `"?"` bucket; gates use `.name // .context`), and `_format_ci_status` classifies on `conclusion` only (a red commit status would render pending). Latent today — zero StatusContext entries across the last 40 devkit PRs. Follow-up candidates. ## Test plan New `TestDedupeStatusChecks` (6 tests): in-progress re-run beats older completed FAILURE (TDD red: 3 failed pre-fix), newer SUCCESS beats older FAILURE, distinct names untouched, order-independence, StatusContext `createdAt` fallback, and an end-to-end pin that the CI cell renders `⏳ 0/1` rather than `✗ 0/1`. `packages/vig-utils/tests`: 529 passed; `prek run --all-files` exit 0 (verified independently of the implementation run). Closes #1539
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.
Summary
Implements #1522 (follow-up to the #1516 train blocker): the CI-green gate counted every FAILURE/ERROR in the release PR head SHA's
statusCheckRollup, so stale check runs left by a superseded workflow run (e.g. after a close/reopen re-run) blocked a branch thatgh pr checkscorrectly reported green — during the 1.10.0 train this forced deleting the superseded run.The gate now dedups the rollup once into a latest-per-name set and derives all three counts (
CI_FAILED,CI_PENDING,CI_SUCCESS) from it, matchinggh pr checkssemantics:startedAt, notcompletedAt:completedAtis null while a re-run is in flight, which would rank the live run oldest and let the superseded FAILURE win — the exact inversion of the intended behavior..name // .context: StatusContexts have noname; they key oncontext, are each their own latest, and keep their pre-existing pending treatment (pinned by test, not changed).release.yml, bothpromote-release.ymlgates (devkit + scaffold), and the consumerrelease-core.yml. Sync topology verified first: none of these four files is manifest-generated, so each was edited as an independent source.Test plan
New
tests/test_ci_green_gate.py: 7 scenarios x 6 sites = 42 tests that execute the real extracted bash+jq against fixture rollups (harness intests/workflow_scaffold.py) — superseded FAILURE passes (the #1516 case, red before the fix: 18 failed), latest-run FAILURE still blocks, in-progress re-run counts pending not failed, distinct-name FAILURE still blocks, StatusContext treatment unchanged, distinct StatusContexts not collapsed, order-independence across permutations. Naming each site explicitly also closes the historical scaffold-vs-devkit copy blind spot.Existing suites untouched and green:
test_release_validate_gate.py+test_promote_release.py+test_release_core.py(80 passed with the new suite),just test-bats552 passed,prek run --all-filesexit 0 (verified independently of the implementation run).Follow-up candidates noted in review (not in scope): StatusContexts always count as pending in these gates (pre-existing), and
vig_utils/gh_issues.py::_dedupe_status_checksstill keys oncompletedAt.Closes #1522