Skip to content

ci: cancel superseded pull request runs - #341

Merged
alexander-akait merged 1 commit into
mainfrom
ci/cancel-outdated-runs
Sep 18, 2026
Merged

alexander-akait merged 1 commit into
mainfrom
ci/cancel-outdated-runs

Conversation

@alexander-akait

@alexander-akait alexander-akait commented Sep 18, 2026

Copy link
Copy Markdown
Member

test.yml has no concurrency control at all, so pushing a new commit to a pull request leaves the previous commit's 43 jobs running to completion even though nobody will read their results. That is the largest fan-out of any repository I have looked at in this pass — three operating systems × eight Node.js versions × polling on/off, minus six exclusions, plus lint.

concurrency:
  group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

Why non-pull-request runs get their own group

Only pull request runs share a group. Everything else gets github.run_id, a group of one, and the reason is not obvious:

cancel-in-progress: false protects only the run that is already executing. A concurrency group holds at most one pending run, and GitHub evicts that pending run whenever a newer one enters the group regardless of the flag — "any existing pending job or workflow in the same concurrency group will be canceled and the new queued job or workflow will take its place." With one main run executing and a second waiting, a third push would evict the second. A group of one cannot be cancelled or evicted.

That matters because main runs publish the coverage later comparisons are measured against, and losing one also hides a breakage that is already on the default branch.

benchmarks.yml also fixed

It already had a group, but with an unconditional cancel-in-progress: true — so a push to main cancels the in-flight benchmark run for the previous main commit. CodSpeed compares a pull request against the benchmark result of its base commit, so two merges in quick succession leave later comparisons without a baseline to use. It now uses the same expression.

Untouched

  • release.yml — already uses the string form concurrency: ${{ github.workflow }}-${{ github.ref }}, which leaves cancel-in-progress false, so releases queue instead of cancelling.
  • dependabot.yml — one short job that approves and enables auto-merge; cancelling it halfway could leave a pull request without the auto-merge it was about to turn on.

Verification

actionlint 1.7.7 is clean on all four workflows, and I checked that this means something by typo'ing the expression to github.event_nam, which it catches at exactly that line. Both files are Prettier-clean.

The same change is going to tapable (webpack/tapable#273), webpack-sources, schema-utils and webpack-cli, and is already open on enhanced-resolve (webpack/enhanced-resolve#673), webpack-dev-server (webpack/webpack-dev-server#5742) and webpack-dev-middleware (webpack/webpack-dev-middleware#2412).

🤖 Generated with Claude Code

https://claude.ai/code/session_016aGHrb1YaEvaGwNELGEHjF


Generated by Claude Code

Summary by CodeRabbit

  • Chores
    • Updated automated test and benchmark runs to manage concurrent executions more reliably.
    • Newer pull request commits supersede earlier in-progress runs.
    • Pushes to the main branch and manually triggered runs continue independently, preserving benchmark baselines for pull request comparisons.

`test.yml` has no concurrency control, so pushing a new commit to a pull
request leaves the previous commit's jobs running to completion even though
nobody will read their results.

Add a workflow-level group. Only pull request runs share it; every other run
gets `github.run_id`, a group of one, because a group holds at most one
pending run and GitHub evicts that pending run whenever a newer one enters
the group — `cancel-in-progress` protects the running run, not the queued
one. Pushes to `main` therefore always complete: they publish the coverage
later comparisons are measured against, and losing one would also hide a
breakage already on the default branch.

`benchmarks.yml` already had a group, but with an unconditional
`cancel-in-progress: true`, so a push to `main` cancelled the in-flight
benchmark run for the previous `main` commit. CodSpeed compares a pull
request against the benchmark result of its base commit, so that leaves
later comparisons without a baseline. It now uses the same expression.

`release.yml` is untouched: its string-form group leaves `cancel-in-progress`
false, so releases queue rather than cancel.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016aGHrb1YaEvaGwNELGEHjF
@changeset-bot

changeset-bot Bot commented Sep 18, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: a791b0d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codspeed

codspeed Bot commented Sep 18, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 36 untouched benchmarks


Comparing ci/cancel-outdated-runs (a791b0d) with main (a8c0f78)

Open in CodSpeed

@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 1b6af529-85aa-4249-9468-962bd6cc40af

📥 Commits

Reviewing files that changed from the base of the PR and between a8c0f78 and a791b0d.

📒 Files selected for processing (2)
  • .github/workflows/benchmarks.yml
  • .github/workflows/test.yml

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


Walkthrough

The benchmarks and test workflows now use event-specific concurrency policies. Pull request runs share a ref-based group and cancel older runs. Pushes to main and manual runs use unique run-based groups and do not cancel in-progress runs.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to a791b

No merge-blocking workflow concurrency issue was identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: cancelling superseded pull request workflow runs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.19%. Comparing base (a8c0f78) to head (a791b0d).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #341   +/-   ##
=======================================
  Coverage   92.19%   92.19%           
=======================================
  Files           8        8           
  Lines        1307     1307           
  Branches      385      385           
=======================================
  Hits         1205     1205           
  Misses         96       96           
  Partials        6        6           
Flag Coverage Δ
integration 92.19% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@alexander-akait
alexander-akait merged commit 2b27b7d into main Sep 18, 2026
50 of 51 checks passed
@alexander-akait
alexander-akait deleted the ci/cancel-outdated-runs branch September 18, 2026 17:21
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.

1 participant