Skip to content

Fix breaking-change check flagging pre-existing major changesets on main#7533

Merged
alfonso-noriega merged 1 commit into
mainfrom
scope-checkchangesets-to-pr-diff
May 12, 2026
Merged

Fix breaking-change check flagging pre-existing major changesets on main#7533
alfonso-noriega merged 1 commit into
mainfrom
scope-checkchangesets-to-pr-diff

Conversation

@alfonso-noriega
Copy link
Copy Markdown
Contributor

@alfonso-noriega alfonso-noriega commented May 12, 2026

WHY are these changes introduced?

The breaking-change detection job currently fails on every PR opened against main while a major-bump changeset is staged for the next major release (e.g. thin-webs-notice.md), even when the PR's own diff has nothing to do with breaking changes. See PR #7532 — it modifies a single test file and still fails the gate.

WHAT is this pull request doing?

workspace/src/major-change-check.js already scopes its OCLIF manifest and Zod schema scans to files actually modified in the PR (via changedFiles), but checkChangesets() was scanning every .changeset/*.md regardless. This change scopes it the same way:

  • Pre-existing major changesets on main that the PR doesn't touch are ignored.
  • Major changesets added or modified by the PR are still flagged.
  • Legacy "scan everything" behaviour is preserved when the script is invoked locally without GITHUB_BASE_REF.

Adds three regression tests: PR-introduced changeset is flagged, pre-existing one is ignored, and the local fallback still scans everything.

How to test your changes?

node --test workspace/src/major-change-check.test.js

All 16 tests pass. To verify against a real PR, rerun the Breaking change detection job on a PR whose only changes don't include a .changeset/ file — the job should now log No changeset files changed in this PR, skipping and pass.

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — N/A, CI-only change to workspace/src/, no changeset needed.

The breaking-change detection script already scopes its OCLIF manifest
and Zod schema scans to files actually modified in the PR diff, but
checkChangesets() was scanning every .changeset/*.md regardless. That
meant a major changeset already merged to main (e.g. one staged for the
next major release) would re-fail the breaking-change job on every
unrelated PR.

Scope checkChangesets() to changedFiles the same way as the manifest and
schema scans, preserving the legacy 'scan everything' behavior when the
script is invoked locally without GITHUB_BASE_REF.

Adds three regression tests:
- only PR-introduced major changesets are flagged
- legacy local mode (no changedFiles) still scans everything
- no flag when the PR doesn't touch any changeset
@alfonso-noriega alfonso-noriega requested a review from a team as a code owner May 12, 2026 10:52
Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@alfonso-noriega alfonso-noriega changed the title Scope checkChangesets() to PR-diffed files Fix breaking-change check flagging pre-existing major changesets on main May 12, 2026
@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label May 12, 2026
@alfonso-noriega alfonso-noriega added this pull request to the merge queue May 12, 2026
Merged via the queue into main with commit ab07b6a May 12, 2026
28 of 30 checks passed
@alfonso-noriega alfonso-noriega deleted the scope-checkchangesets-to-pr-diff branch May 12, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants