Skip to content

fix(tooling): objectui-range 改读 objectui 声明的 changeset,不再按 commit 类型猜 (#4843) - #4905

Merged
xuyushun441-sys merged 1 commit into
mainfrom
claude/issue-4843-objectui-range-read-changesets
Aug 3, 2026
Merged

fix(tooling): objectui-range 改读 objectui 声明的 changeset,不再按 commit 类型猜 (#4843)#4905
xuyushun441-sys merged 1 commit into
mainfrom
claude/issue-4843-objectui-range-read-changesets

Conversation

@xuyushun441-sys

@xuyushun441-sys xuyushun441-sys commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #4843

问题

scripts/objectui-range.mjs 的产物是发布页 Console 段落的正文。它一直沿用 #4731 已经从 bump-objectui.sh 里拆掉的那套猜测:

const KEEP = ALL_TYPES ? null : new Set(['feat', 'fix']);

#4731 轻的地方:过滤在 --help 里写明了,也有 --all。重的地方:读者拿到的是一份看不出被过滤过的 markdown —— 尾部没有任何「另有 N 条被排除」的说明,而 --all 不是默认。

实测(真实 objectui 检出,非构造)

区间 7d9734d5e321..785b8a5d432c,53 个非 merge 提交。跑新旧两套逻辑做集合差:

条数
真正发版、但被类型过滤丢掉 13
其中带 ! 的破坏性变更 6
在 objectui 侧 release-nothing、却被类型过滤误收 5

丢掉的 13 条里包括 refactor(layout)!: delete PageNodeRenderer、burn ledger batch 2/4/5/6/7,以及 chore(deps): lockstep the @objectstack family onto 17.0.0-rc.1。误收的 5 条里有两条 fix(ci)(一条完全没有 changeset,一条 changeset 的 frontmatter 是空的)。

这三个数字与议题正文完全一致 —— 我用真实检出复核过,没有偏差。

破坏性变更是唯一被类型过滤结构性挡在门外的一类,而它出现在一份「以破坏性变更打头」的产物里。

改动

1. 两处收敛到同一个判据,而不是各写一份

判据抽成 scripts/objectui-changeset-digest.mjs 导出的 classifyRange(),buildDigest()(即 bump-objectui.sh 走的路径)和 objectui-range.mjs 都走它。复制一份平行实现两边必然漂,而第一个漂掉的就是已经掉过一次的那一类。

复用的既有导出:collectAddedChangesets() / parseChangeset() / highestLevel() / clampSummary()。对公开面只做了两处小幅扩展,没有新写平行逻辑:

  • collectAddedChangesets() 多返回 commits(区间内全部非 merge 提交)和 commitsWithChangesetShas,这样调用方能点名被排除的提交,而不只是数出来;
  • 新增 classifyRange(),把原先内嵌在 buildDigest() 里的分类循环提出来 —— buildDigest() 的返回字段和行为一字未改,它自己的 --self-test 20 条断言全绿即为证。

2. 排除必须出声

产物是发布页正文,所以账目是无条件打印的,零也打印:

_Derived from the changesets objectui declared over this range — 44 releasing of 48
added across 53 non-merge commit(s). Excluded as shipping no package code:
4 release-nothing changesets, 7 commits carrying no changeset (run with `--all` to list them)._

只在「有东西被丢掉时」才出现的脚注,仍然让读者分不清「没丢东西」和「脚注没实现」。

--all 语义随之改变:过滤已经不存在了,所以它从「包含所有 commit 类型」变成「逐条点名被排除的条目」(release-nothing 的 changeset + 无 changeset 的提交),--help 里写明。

3. 分组是呈现,不是筛选

标题按 objectui 声明的级别分组(Breaking changes / Features / Fixes),正好对上发布页的结构(破坏性 → 迁移,minor → 新能力,patch → 修复)。没有任何一处再读 commit 类型来决定收不收 —— commit 的 scope 只用来生成 _Largest areas_ 那一行和条目前缀,纯呈现。

验证

--self-test(按 scripts/ 既有惯例,折进已有的 pnpm check:objectui-changeset)

构造一次性 git 仓库复刻实测到的五种形态,跑真实代码,断言产物:

objectui-range --self-test
  ✓ a BREAKING `refactor(...)!` commit IS in the pasteable list
  ✓ breaking changes get their own leading section (declared major)
  ✓ a releasing non-feat/fix `chore(deps)` commit IS in the list
  ✓ commit type never filters: all 3 releasing changesets are listed
  ✓ a `fix(ci)` with an EMPTY frontmatter changeset is NOT listed
  ✓ a `fix(ci)` with no changeset at all is NOT listed
  ✓ the release-nothing count is spoken IN THE MARKDOWN, not just in JSON
  ✓ the no-changeset commit count is spoken IN THE MARKDOWN
  ✓ the accounting footer is unconditional and states the totals
  ✓ a range excluding nothing STILL prints the accounting (0, not silence)
  ✓ `--all` itemizes the excluded commits by subject
  ✓ the CLI markdown carries the breaking entry and not the ci noise
  ✓ the CLI JSON reports the declared criterion and the excluded counts
  ✓ every listed entry carries the level objectui declared
✓ objectui-range --self-test: all checks passed

objectui-changeset-digest --self-test 的 20 条断言同样全绿(重构未改行为)。

反向验证 —— 证明这些用例是有承重的

同一份构造 fixture 喂给 origin/main 上改动前的 objectui-range.mjs,再用新用例的断言去评它。改动前的产物长这样:

(下面第一行本是一条 HTML 注释,GitHub 正文会把它整行吞掉,这里去掉尖括号写出)
!-- objectui 5b86f5727c8e..3d662d017506 — 3 commit(s) --

_Largest areas: ci (2), grid (1)_

### Features
- **grid** — aggregate single-call mode for bulk actions (#3201)

### Fixes
- **ci** — never render a budget FAIL for a run that measured nothing (#3198)
- **ci** — hand the cross-repo token to github-script (#3186)

失效模式在这几行里一览无余:破坏性的 refactor(layout)! 不见了,列出来的两条 fix(ci) 恰恰是 objectui 侧什么都不发版的两条,计数写的是「3 commit(s)」而真实区间有 5 条,而且没有任何一处提示这份清单被过滤过。

断言评估结果:

  ✗ FAILS (load-bearing) — a BREAKING `refactor(...)!` commit IS in the pasteable list
  ✗ FAILS (load-bearing) — breaking changes get their own leading section
  ✗ FAILS (load-bearing) — a releasing non-feat/fix `chore(deps)` commit IS in the list
  ✗ FAILS (load-bearing) — a `fix(ci)` with an EMPTY frontmatter changeset is NOT listed
  ✗ FAILS (load-bearing) — a `fix(ci)` with no changeset at all is NOT listed
  ✗ FAILS (load-bearing) — the release-nothing count is spoken IN THE MARKDOWN
  ✗ FAILS (load-bearing) — the no-changeset commit count is spoken IN THE MARKDOWN
  ✗ FAILS (load-bearing) — the accounting footer is unconditional and states the totals

=> 8 of 8 new assertions FAIL against the pre-change script (0 would mean the tests assert nothing).

8/8 全部失败 —— 用例确实压在改动上,不是一组什么都断言不到的绿灯。

其他

  • npx eslint scripts/objectui-range.mjs scripts/objectui-changeset-digest.mjs --no-inline-config → exit 0
  • pnpm check:objectui-changeset → exit 0(两个 self-test 串起来)
  • 在真实检出上跑了 --json / --all / --help / 无 objectui 检出的降级路径

⚠️ 需要排队的共享文件

本 PR 动了两个本仓最热的合并冲突点,已尽量压到最小:

  • package.json —— 改了 1 行既有的(check:objectui-changeset 后面串上第二个 self-test),没有新增 script key;
  • .github/workflows/lint.yml —— 只加了 3 行注释,step 名和 run: 都没动。

请据此安排合并顺序。

与议题描述的出入

无。议题正文的三个数字(丢 13 / 其中 6 条带 ! / 误收 5 条含两条 fix(ci))我在真实 objectui 检出上逐条复核过,全部吻合。

一处议题没提、实测才看到的事实值得记一笔:被排除的 7 条「无 changeset」提交里,有两条确实改了已发布包的源码 —— fix(charts): name the slices(动了 packages/plugin-charts/src/packages/plugin-dashboard/src/)和 fix(i18n): resolve qualified view ids(动了 packages/i18n/src/)。旧口径碰巧收了它们,但那是因为 subject 以 fix 开头,和是否发版无关;真正的洞在 objectui 侧没有「改了包源码就必须带 changeset」的门禁,以致这两条在 objectui 自己的 CHANGELOG 里也查不到。本 PR 之后它们至少不再无声(计数 + --all 点名),但出声不等于修好 —— 已按 Prime Directive #10 另立 #4904(未认领),未在本 PR 内扩范围。

关联

…t commit types (#4843)

`scripts/objectui-range.mjs` — whose output is pasted into a release page's
Console section — kept the `feat|fix` subject-line guess that #4731 removed from
`bump-objectui.sh`. Measured on the same real range (7d9734d5e321..785b8a5d432c,
53 non-merge objectui commits) the default output dropped 13 commits that
actually released, 6 of them breaking `refactor(...)!`, and listed 5 that release
nothing in objectui.

The two scripts now share ONE criterion instead of each carrying a copy: the
classification moved into an exported `classifyRange()` in
objectui-changeset-digest.mjs, used by both the pin changeset (the platform
release record) and this release-page aggregation.

Because the output IS release-page body text, the accounting is unconditional —
every run states how many changesets released of how many were added across how
many commits, plus the excluded counts (release-nothing changesets,
changeset-less commits), zeros included. `--all` now names those entries instead
of switching a filter off. Headings group by declared level; grouping is
presentation, never a filter.

Guarded by `objectui-range.mjs --self-test`, folded into the existing
`pnpm check:objectui-changeset` gate.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iARDqtrhQgz6fVHDeDkbQ
@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
objectstack Ignored Ignored Aug 3, 2026 3:09pm

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation ci/cd dependencies Pull requests that update a dependency file tooling size/l labels Aug 3, 2026
@xuyushun441-sys
xuyushun441-sys marked this pull request as ready for review August 3, 2026 15:14
@xuyushun441-sys
xuyushun441-sys added this pull request to the merge queue Aug 3, 2026
Merged via the queue into main with commit 50c2f64 Aug 3, 2026
24 checks passed
@xuyushun441-sys
xuyushun441-sys deleted the claude/issue-4843-objectui-range-read-changesets branch August 3, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation size/l tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

objectui-range.mjs 默认仍按 feat|fix 类型过滤 —— 发布页 Console 段落同样会丢掉破坏性 refactor!

2 participants