From 20a7db5455af416d076c01b4d6989ad8833e1c2b Mon Sep 17 00:00:00 2001 From: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Date: Tue, 21 Jul 2026 12:18:28 +0800 Subject: [PATCH] ci(changeset-check): detect changesets added by the PR, not a non-empty dir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../viewfilterrule-operator-enum-3373.md | 14 +++++++++++ .github/workflows/pr-automation.yml | 24 ++++++++++++++----- 2 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 .changeset/viewfilterrule-operator-enum-3373.md diff --git a/.changeset/viewfilterrule-operator-enum-3373.md b/.changeset/viewfilterrule-operator-enum-3373.md new file mode 100644 index 0000000000..f80cad2bc2 --- /dev/null +++ b/.changeset/viewfilterrule-operator-enum-3373.md @@ -0,0 +1,14 @@ +--- +"@objectstack/spec": patch +--- + +fix(spec): enforce the `ViewFilterRule` operator enum with legacy-alias +normalization (#3373) + +`ViewFilterRule.operator` was previously an open string, so views could persist +operators the runtime cannot evaluate. The Zod schema now constrains it to the +supported operator enum and normalizes the known legacy aliases to their +canonical form on parse. This is a public spec/api-surface change +(`packages/spec/api-surface.json`) that landed on `main` in #3373 without a +changeset; this backfills it so the fix ships in the next release instead of +being silently stranded. diff --git a/.github/workflows/pr-automation.yml b/.github/workflows/pr-automation.yml index a77d8e97ff..9e2c9f7191 100644 --- a/.github/workflows/pr-automation.yml +++ b/.github/workflows/pr-automation.yml @@ -71,19 +71,31 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile - - name: Check for changesets + - name: Check for a changeset added by this PR + env: + BASE_SHA: ${{ github.event.pull_request.base.sha }} run: | if [ ! -d ".changeset" ]; then echo "::warning::.changeset directory not found. Skipping changeset check." exit 0 fi - CHANGESET_COUNT=$(find .changeset -name '*.md' ! -name 'README.md' | wc -l) - if [ "$CHANGESET_COUNT" -eq 0 ]; then - echo "::error::No changeset found. Add one with 'pnpm changeset' if this PR includes user-facing changes, or apply the 'skip-changeset' label if it doesn't." + # Count changesets THIS PR adds (diff against the base commit), NOT + # the whole .changeset directory. A global `find | wc -l` is unsound: + # in pre-release (RC) mode `changeset version` RETAINS every consumed + # .md file, 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 this step happily reported "Found 104 changeset(s)". + # Diffing against BASE_SHA ignores that residue and sees only what the + # PR itself introduced. An empty-frontmatter changeset still counts — + # it is the sanctioned "this PR releases nothing" declaration, on par + # with the skip-changeset label. + ADDED=$(git diff --name-only --diff-filter=A "$BASE_SHA" HEAD -- '.changeset/*.md' \ + | grep -v '/README\.md$' | wc -l | tr -d '[:space:]') + if [ "$ADDED" -eq 0 ]; then + echo "::error::This PR adds no changeset. Run 'pnpm changeset' (an empty changeset is fine for changes that release nothing), or apply the 'skip-changeset' label if it does not need one." exit 1 - else - echo "Found $CHANGESET_COUNT changeset(s)" fi + echo "This PR adds $ADDED changeset(s)." - name: Guard against accidental major bumps (launch window) # Every publishable package is in one Changesets "fixed" (lockstep) group,