Skip to content

ci: skip core test jobs that the changes cannot affect - #342729

Merged
Bryan Chen (bryanchen-d) merged 1 commit into
mainfrom
copilot/vscode/required-check-reporters
Oct 20, 2026
Merged

Bryan Chen (bryanchen-d) merged 1 commit into
mainfrom
copilot/vscode/required-check-reporters

Conversation

@bryanchen-d

Copy link
Copy Markdown
Collaborator

The core PR test jobs run for every pull request, even when the changes cannot affect them: a README edit, a Rust change in cli/, or a change confined to the Copilot extension still runs about 270 runner-minutes of core tests. This PR lets those jobs skip, building on the Detect Changes job from #342091, and keeps every required check name unchanged.

Why a reporter job

The required checks are named <OS> / Electron-Unit, Electron, Electron-Smoke, Browser and Remote. The reusable test workflows name their single job ${{ inputs.job_name }}, and GitHub does not evaluate the name of a skipped job (the cause of #342134), so these jobs cannot skip under their required names. Instead:

  • The test jobs are renamed to <OS> (run) / <job>, <OS> (unit) / Browser, <OS> (integration & smoke) / Browser and <OS> (shard n/2) / Electron-Smoke, and skip with a job-level if: in the calling job. The reusable workflows are unchanged.
  • A required-checks job reports the 15 required checks. It replaces electron-smoke-checks and browser-checks, which already used this pattern. A check passes when each of its jobs succeeded, or was skipped while change detection succeeded and said the changes cannot affect it. Any other result fails the check, including an unexpected skip, failed detection or a missing output.
  • Browser parts are separate jobs instead of a matrix, because a job-level if: cannot depend on the matrix and the two parts skip under different rules.

What skips

detect-changes gets three outputs. Each is false only when every changed file is one those tests cannot read; any other path, including a new kind of file, runs the jobs.

Output Jobs Skips when every change is
unit-tests Electron-Unit, Browser (unit) docs, cli/, copilot_shim/, or a built-in extension the unit tests do not read
browser-integration Browser (integration & smoke) docs, cli/, copilot_shim/, or extensions/copilot/
product-tests Electron, Electron-Smoke, Remote docs, cli/ or copilot_shim/
  • Docs means Markdown outside src/, test/ and extensions/, which use Markdown files as test inputs.
  • Extensions read by unit tests: the component fixtures load the theme-* extensions and the css, html, javascript, json and typescript-basics grammars, so changes there still run the unit tests. A test fails when a core test starts reading another extension.
  • Copilot: the Electron integration tests (copilot suite) and the Electron and remote smoke tests load the Copilot extension, so they keep running for Copilot changes.
  • Fail-open: as before, every job runs when the changed-file lookup fails, is incomplete, or returns no files.

Expected impact

Based on the 744 PRs merged Oct 9–19 and average job times from 25 recent successful runs:

PR type Share Saved per run
Copilot extension only 6.3% ~108 runner-min (Electron-Unit, Browser unit and integration & smoke)
Other built-in extension only 1.9% ~81 runner-min (Electron-Unit, Browser unit)
Docs, cli/ or copilot_shim/ only 1.1% ~272 runner-min (all core test jobs)

Across all PRs that is about 11 runner-minutes per run (~4%), about 4.4 of them on the Windows 1ES pool. It frees capacity rather than shortening runs, because Windows / Electron stays the longest job. More importantly, this sets up the reporter that later rules need, such as skipping unit test jobs based on which tests the changes import.

Trade-offs

  • The test jobs start after Detect Changes, which finishes 10–15 seconds into the run.
  • The 15 required checks report together when the last test job finishes, instead of one by one. The renamed test jobs still report as soon as they finish.

How to test

  • This PR edits pr.yml, so every job runs and every required check should pass through required-checks.
  • Already run:
    • node --test lib/test/detectChanges.test.ts in build/: rule table, renames, fail-open behavior, the extension scan and the pr.yml wiring. I confirmed the tests fail when an extension the tests read is made skippable, and when a test job reports a required name itself.
    • The required-checks script against 8 simulated needs results: success, intended skips, an unexpected skip, failed detection, a missing output, a failure and a cancellation.
    • A docs-only pull request in a fork, based on this change (run): Detect Changes reported all three outputs as false, every core test job was skipped, and all 15 required checks reported success under their exact names.
    • actionlint on pr.yml: no new findings compared with main. npm run eslint and a strict tsc --noEmit on the changed TypeScript passed.
  • After merge: the first Copilot-only PR should show the Electron-Unit and Browser test jobs as skipped and every required check as passing.

Authored with Copilot

Copilot AI balanced review requested due to automatic review settings October 19, 2026 22:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Migrating 15 merge-blocking checks warrants human confirmation of live mixed-skip, failure, and cancellation behavior.

No open issues 🎉

What changed in this PR

Extends change detection to skip unaffected core test jobs while preserving all 15 required check names.

Changes:

  • Adds separate skip rules for unit, browser integration, and product tests.
  • Splits browser jobs and consolidates required-check reporting.
  • Adds detector and workflow-wiring tests and updates smoke-test documentation.
File Description
build/​lib/​test/​detectChanges.test.ts Tests skip rules, fail-open behavior, extension dependencies, and workflow wiring.
.github/​workflows/​pr.yml Gates test jobs and reports stable required checks.
.github/​skills/​smoke-tests/​SKILL.md Documents the new reporter and intentional skips.
.github/​actions/​detect-changes/​detect.ts Defines core-test skip rules.
.github/​actions/​detect-changes/​action.yml Exposes three new detection outputs.

Review effort: Balanced

Report the required "<OS> / <job>" checks from a required-checks gate job so
the Electron-Unit, Electron, Electron-Smoke, Browser and Remote jobs can skip
when every changed file is documentation, a Rust crate, or (for the unit and
browser integration tests) a built-in extension the tests do not read.

Co-authored-by: Copilot <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Moving all core required checks behind a new reporter warrants maintainer verification of successful, failed, cancelled, and intentionally skipped CI runs.

No open issues 🎉

Review effort: Balanced

@bryanchen-d

Copy link
Copy Markdown
Collaborator Author

Copilot's review asks a maintainer to confirm how required-checks behaves when jobs succeed, fail, get cancelled or are skipped on purpose. Here's what has been checked so far:

Case Evidence
Success, nothing skipped This PR's own run (39351581469, head 8844770). pr.yml changed, so every job ran, and required-checks reported all 15 <OS> / <job> checks as passing.
Intentional skip A throwaway docs-only PR in a fork, built on this change (run 39336962178). Detect Changes reported unit-tests, browser-integration and product-tests as false, every core test job was skipped, and all 15 required checks reported success under their exact names. The reporter logged, for example, windows-browser-unit-tests was skipped because the changes cannot affect it (unit-tests: false).
Failure, cancellation and unexpected skips I ran the required-checks script locally against 8 simulated needs results. It passes only on success, or on a skip where detection succeeded and the matching output is false. It fails on a job failure, a cancellation, a skip while the output is true, a skip after detection failed, and a skip with the output missing. Real GitHub runs have only covered success and intentional skips.
Rules and wiring build/lib/test/detectChanges.test.ts runs in test-build-scripts, which passed in CI. I checked that it fails when an extension the unit tests read is made skippable, and when a test job reports a required check name itself.

The first real Copilot-only or docs-only PR after merge will be the first live skip on microsoft/vscode.

Co-authored with Copilot

@bryanchen-d
Bryan Chen (bryanchen-d) merged commit 0db0bce into main Oct 20, 2026
59 checks passed
@bryanchen-d
Bryan Chen (bryanchen-d) deleted the copilot/vscode/required-check-reporters branch October 20, 2026 22:14
@vs-code-engineering vs-code-engineering Bot added this to the 1.144.0 milestone Oct 20, 2026
Alexandru Dima (alexdima) added a commit that referenced this pull request Oct 20, 2026
…b-pr-checks-efficiency

main now skips the core test jobs that a change cannot affect (#342729),
and its tests require the Detect Changes job to expose exactly the
detector's outputs. The macOS and Windows unit test jobs therefore opt
into the plan with `unit_test_selection: true` instead of reading a
job output: the unit-test-plan artifact only exists when the plan
selects files, and without it those jobs run every unit test.

Co-authored-by: Copilot <[email protected]>
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.

3 participants