Skip to content

ci: cancel superseded pull request runs - #4854

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

nodejs.yml already cancelled superseded jobs, but through three per-job concurrency groups that also cancel pushes to main and next. This replaces them with one workflow-level group that only cancels pull request runs.

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

Why the branch pushes should not be superseded

main and next runs publish the coverage later comparisons are measured against, and a cancelled run also hides a breakage that is already on the branch — which is exactly when you want to know.

Note that cancel-in-progress: false alone would not be enough: 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." Hence github.run_id for non-pull-request events: each gets a group of one, so it can be neither cancelled nor evicted.

Why one workflow-level group rather than fixing the three in place

Adding the condition to the existing blocks would have been a smaller diff, but the per-job arrangement has two other costs:

  • It cancels job by job. Each old job dies only as its replacement is queued; a workflow-level group cancels the whole superseded run at once. This workflow is 32 jobs — 30 test cells (three operating systems × five Node.js versions × two dev-server versions) plus lint and smoketests.
  • Every matrix dimension has to be repeated in the group key. The test key currently spells out four of them (os, node-version, webpack-version, dev-server-version); a dimension added later and forgotten would make cells cancel each other, which is a quiet and confusing failure. This is not hypothetical — ci: stop sharding the test matrix and drop Node 25 webpack-dev-server#5741 had to edit its group key purely because the matrix changed. Keying on the workflow and ref cannot drift.

Happy to switch to the minimal version (keep the per-job groups, just add the condition) if you would rather keep the existing shape.

Verification

actionlint 1.7.7 is clean on nodejs.yml, and I checked that this means something by typo'ing the expression to github.event_nam, which it catches at exactly that line. The file is Prettier- and cspell-clean using this repo's .cspell.json.

Unrelated, but worth flagging since you will see it if you run the linter: actionlint reports two pre-existing errors in publish-to-pkg-pr-new.yml (steps.publish.outputs.sha / .urls referencing a step id that is not defined in that job). They reproduce on main untouched, so they are not from this PR and I have left them alone.

Untouched

  • release.yml — already uses the string form, so releases queue instead of cancelling.
  • dependabot.yml, dependency-review.yml, publish-to-pkg-pr-new.yml, update-docs.yml — left as they are to keep this diff to the expensive workflow. publish-to-pkg-pr-new.yml in particular publishes preview packages, so I would not want to add cancellation to it without a maintainer's view.

The same change is already open on tapable (webpack/tapable#273), watchpack (webpack/watchpack#341), webpack-sources (webpack/webpack-sources#282), schema-utils (webpack/schema-utils#228), 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
    • Improved automated workflow run management.
    • Pull request checks now cancel outdated runs when newer updates are available.
    • Push-triggered checks continue running independently without canceling one another.

The per-job concurrency groups already cancelled a superseded job when its
replacement was queued, but they cancelled pushes to the release branches
the same way. Those runs publish coverage, and cancelling one also hides a
breakage that is already on the branch.

Replace them with a single 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.

Besides fixing that, one workflow-level group cancels the whole superseded
run at once rather than job by job as each replacement is queued, it covers
jobs that have no group of their own, and a matrix dimension added later
cannot be forgotten in a group key.

`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: 644636c

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

@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: 32909f66-ca34-4116-8867-e2db1003c2c8

📥 Commits

Reviewing files that changed from the base of the PR and between 6f57992 and 644636c.

📒 Files selected for processing (1)
  • .github/workflows/nodejs.yml

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


Walkthrough

The workflow adds one top-level concurrency block. Pull request runs use a shared workflow-and-ref group and cancel in-progress runs. Push runs use the run ID and do not cancel in-progress runs. The lint, test, and smoketests jobs no longer define separate concurrency blocks.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 64463

Pull-request runs are consolidated and superseded runs are cancelled, while other runs remain independent; no merge-blocking risk was found.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning Issue #673 requires npx webpack-cli init to select no CSS solution when the user selects No. The PR changes only .github/workflows/nodejs.yml concurrency settings. It does not change the wizar… Implement the No selection behavior in the CSS solution wizard and add an automated test that verifies no CSS solution is selected.
Out of Scope Changes check ⚠️ Warning The PR changes workflow-level concurrency in .github/workflows/nodejs.yml. This change has no demonstrated connection to issue #673, which concerns CSS solution selection in npx webpack-cli init. Remove the workflow concurrency changes from this PR, or link them to a requirement that covers workflow concurrency.
✅ Passed checks (3 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 through updated CI concurrency settings.
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…
Full details: Linked Issues check

Explanation

Issue #673 requires npx webpack-cli init to select no CSS solution when the user selects No. The PR changes only .github/workflows/nodejs.yml concurrency settings. It does not change the wizard behavior or add tests for this issue.

  • Fix all pre-merge checks with AI
✨ 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.

@github-actions

github-actions Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

This PR is packaged and the instant preview is available (1dd90a4).

Install it locally:

  • npm
npm i -D webpack-cli@https://pkg.pr.new/webpack-cli@1dd90a4
  • yarn
yarn add -D webpack-cli@https://pkg.pr.new/webpack-cli@1dd90a4
  • pnpm
pnpm add -D webpack-cli@https://pkg.pr.new/webpack-cli@1dd90a4

@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 94.83%. Comparing base (6f57992) to head (644636c).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4854      +/-   ##
==========================================
+ Coverage   94.81%   94.83%   +0.01%     
==========================================
  Files          14       14              
  Lines        5598     5598              
  Branches      837      837              
==========================================
+ Hits         5308     5309       +1     
+ Misses        289      288       -1     
  Partials        1        1              

see 1 file with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6f57992...644636c. Read the comment docs.

🚀 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 1dd90a4 into main Sep 18, 2026
41 checks passed
@alexander-akait
alexander-akait deleted the ci/cancel-outdated-runs branch September 18, 2026 18:46
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