Repository navigation
fix(pr-triage): count only the newest run of each check in the readiness step - #246
Merged
Merged
Conversation
…ess step filter=latest gives the latest check run per check suite, and each workflow run is its own check suite. A run that a newer workflow run of the same check cancelled stayed in the list, so the readiness step saw a cancelled check and removed ready-for-human although every check was green (frostyard/updex#515 at bb9c272). The step now keeps only the newest run (highest id) of each check name and app. A cancelled, failed or unfinished newest run still counts as not green.
bketelsen
approved these changes
Nov 14, 2026
This was referenced Nov 14, 2026
Merged
Merged
Merged
Merged
Merged
Merged
Merged
This was referenced Nov 14, 2026
Merged
Merged
Merged
Merged
Merged
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
The
readinessstep ofpr-triage.ymlremovedready-for-humanfrom pull requests whose checks were all green.Cause: the step reads
check-runs?filter=latest. That filter gives the latest run of each check name per check suite, and each workflow run is a check suite of its own. When a newer workflow run of a check cancels an older one (aconcurrencygroup withcancel-in-progress, for example a PR-title check that re-runs onedited), the cancelled run stays in the list. The step counted it as not green.Evidence: frostyard/updex#515 at
bb9c272. All 19 checks pass, butfilter=latestlists 3Conventional PR titleruns (ids 132236621585 success, 132237066225 cancelled, 132237129379 success). Run 43530255879 loggedreadiness: not green {"kind":"check run","name":"Conventional PR title","state":"cancelled"}and removed the label at 23:52Z; the same happened at 23:32Z.Fix:
scripts/lib/pr-triage.mjs: new exportnewestCheckRuns. Per check name and app (app.id, elseapp.slug), it keeps only the run with the highestid(GitHub gives check run ids in creation order).evaluateChecksuses it after it leaves out thepr-triageruns. A cancelled, failed or unfinished newest run still counts as not green. When a run of a group has no integerid, the group keeps every run (the old behaviour).docs/specs/pr-triage.mdrule D: replaces the false statement thatfilter=latestgives 1 run per check name, and states the new rule.scripts/lib/risk-paths.mjs: comment only, onlistCheckRuns(same false statement). No code or export change..github/workflows/pr-triage.yml: the embedded copies, rewritten bynpm run sync:risk-paths-workflow.test/pr-triage.test.mjs: 5 tests. The updex#515 test (the 3 real runs) fails without the fix; others pin a cancelled newest run, an in-progress newest run, the same name from 2 apps, andnewestCheckRunsitself..memory/corrections/(ADR-0081).Rollout: each caller pins
pr-triage.ymlto a core SHA (ADR-0021), so the fix reaches a repository only when its caller's pin moves to the merge commit of this PR. 35 callers today: 32 pinc996ea3, 3 pin267421d(apt-publisher, pocket, bketelsen/fleet). The pin bumps follow in 1 PR per repository after this merges.Risk tier
Risk tier: 3 —
risk:high. Paths that match.github/risk-paths.json, and why the change is safe:.github/workflows/pr-triage.yml(L2,.github/workflows/**): only the 2 embedded library blocks change, byte-for-byte equal to the libraries (npm run check:risk-pathspasses). No trigger, permission, action or step change.scripts/lib/pr-triage.mjs(L2): the readiness step can now only keep a label it removed before when the not-green run has a newer run of the same name and app at the same head. It removes no new label and changes no other step (levels,shadow).scripts/lib/risk-paths.mjs(L2): a comment only. Exports and their results do not change; vendored copies with asha256pin keep working at their pinned bytes.Verification
make verifygreen locally (851 tests, 0 fail;check:docs,check:corrections,check:risk-pathsok)newestCheckRunstest failCross-review
anthropic/claude-opus-5-5. Reviewer:openai/gpt-6.1-sol(read only).bee643e3d634168802713a38387ca8ddaac050a0(basea9694f7ec745b0bcb1012cf98fdc2cfeb23c64d3): Ready, Blocking: none. 1 low finding: rule D did not name theapp.slugfallback and the safe-integerid. Fixed incdf1a5c.bee643e..cdf1a5cdelta: no findings. Ready, Blocking: none.bee643e,scripts/lib/pr-triage.mjsand the workflow restored froma9694f7(withnewestCheckRunsas the identity function),node --test test/pr-triage.test.mjs: failsa cancelled run that a newer run of the same check replaced does not count (updex#515)andnewestCheckRuns keeps the highest id per name and app, ...on assertions. At the head: 128 pass, 0 fail.