Skip to content

ci(changeset-check): gate on changesets the PR adds, not a non-empty dir - #3376

Merged
os-zhuang merged 1 commit into
mainfrom
fix/changeset-gate-diff
Jul 21, 2026
Merged

ci(changeset-check): gate on changesets the PR adds, not a non-empty dir#3376
os-zhuang merged 1 commit into
mainfrom
fix/changeset-gate-diff

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Why

changeset 是不是坏了 — no. But the Check Changeset gate is falsely green, which is why real changes (e.g. the #3373 spec fix) slipped onto main with no changeset and won't be released.

The gate counted every .md in .changeset/:

CHANGESET_COUNT=$(find .changeset -name '*.md'! -name 'README.md'| wc -l)

That only asserts the directory is non-empty — never that this PR added a changeset. In pre-release (RC) modechangeset versionretains consumed changeset files, so the directory is permanently non-empty and the gate can never go red. Evidence: #3373 merged a real @objectstack/spec / api-surface.json fix with no changeset while this step reported Found 104 changeset(s).

What

  • Rewrite the check to diff against the base commit and count only the changesets the PR itself adds (git diff --diff-filter=A "$BASE_SHA" HEAD -- '.changeset/*.md'). RC residue no longer masks a missing changeset. An empty-frontmatter changeset still counts — it is the sanctioned "this PR releases nothing" declaration, on par with the skip-changeset label.
  • Backfill the missing fix(spec): enforce ViewFilterRule operator enum with legacy-alias normalization #3373 changeset (@objectstack/spec patch) so the ViewFilterRule operator-enum fix actually ships in the next RC instead of being stranded on main.

Proof it can go red (防假绿)

Ran the new one-liner against real commits:

DiffAdded changesetsVerdict
old gate @ main HEADfind = 104always GREEN (the bug)
#3373d419826a8^..d419826a8 (spec fix, no changeset)0RED
#33602b5d7258d^..2b5d7258d (adds a changeset)1GREEN

This PR adds its own changeset, so it passes its own gate.

Note: Check Changeset is not a required status check, so it still won't hard-block merges on its own — but it will now actually go red and show up as a failed check instead of silently passing.

🤖 Generated with Claude Code

…ty dir
The `Check Changeset` gate counted every `.md` in `.changeset/`
(`find | wc -l`), so it only asserted the directory was non-empty — never
that THIS PR contributed a changeset. In pre-release (RC) mode `changeset
version` retains consumed changeset files, so the directory is permanently
non-empty and the gate can never go red: #3373 merged a real spec /
api-surface fix with no changeset while the step reported "Found 104
changeset(s)".
Diff the base commit instead and count only changesets the PR adds. An
empty-frontmatter changeset still counts — it is the sanctioned "releases
nothing" declaration. Proven to go RED on #3373's diff (0 added) and GREEN
on #3360's (1 added).
Also backfills the missing #3373 changeset so the ViewFilterRule operator
enum fix actually ships in the next release.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercelBot commented Jul 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
specReadyReadyPreview, CommentJul 21, 2026 4:21am

Request Review

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation ci/cd tooling size/s and removed documentation Improvements or additions to documentation ci/cd tooling labels Jul 21, 2026
@os-zhuang
os-zhuang merged commit 8ff9210 into mainJul 21, 2026
15 checks passed
@os-zhuang
os-zhuang deleted the fix/changeset-gate-diff branch July 21, 2026 04:34
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@os-zhuang