Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

docs(ci): stop hand-maintaining a repo-wide warning count in two places (#3274) - #3278

Merged
xuyushun441-sys merged 1 commit into
mainfrom
claude/issue-3274-lint-warning-count-drift
Aug 3, 2026
Merged

xuyushun441-sys merged 1 commit into
mainfrom
claude/issue-3274-lint-warning-count-drift

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Fixes #3274

问题

.github/workflows/lint.yml 第三段注释和 scripts/check-lint-coverage.mjs:30 各存了一份同一个手工维护的数字,用来论证「--max-warnings 故意不设」:

the 7,724 warnings repo-wide are 81% `no-explicit-any`
(7,724 warnings repo-wide are dominated by `no-explicit-any`; see #2923)

这和 #3261(PR #3273)修掉的是同一个缺陷类,只是漂移得更快:仓库里每加一个 any、每新增一个包,7,724 和 81% 就更旧一点,没有任何东西会在它变旧时报警。而且两份副本会各自独立地旧掉 —— 已经具备了 #3212 那种「同一个事实多个数字」的全部条件。

按 issue 的判断,这里修的不是「它今天是错的」(没有证据说它错,本 PR 也没去跑全仓 ESLint 核对 —— 核对只会把同一个时钟重新上一遍发条),而是**「它注定会错」**。

改动

两处都改成只讲量级、不点精确整数的写法,论证一字未失(它本来就只需要「warning 是一笔已知的、成千上万条的历史欠账,主体是 no-explicit-any 和被刻意降级的 React Compiler 规则,所以这道门禁只管 error」):

  • .github/workflows/lint.yml — warnings repo-wide run into the thousands, dominated by ...,并写明为何不再点数字、以及另一份副本在哪。
  • scripts/check-lint-coverage.mjs — 同样去数字,并反向指回 lint.yml,两处互相说明。

两处必须同一个 PR 一起改:只改一处,会把「两份一致但过期」变成「两份互相矛盾」,比现状更糟。

顺带确认:content/docs/guide/ci-cd-pipeline.md 早就是去数字写法(the repository carries thousands of warnings (overwhelmingly no-explicit-any ...)),本 PR 的措辞与它对齐,不需要改。全仓 grep 7,724|7724|81% 除这两处外只剩向量样例数据里的巧合匹配。

刻意不加断言钉住这个数字

与 #3261 相反的取舍,原因是成本差了几个数量级:#3261 的守卫是纯文本 + 读已求值的 flat config,毫秒级;而钉住 warning 数意味着在测试里跑全仓 ESLint(分钟级),并且此后任何地方新增一个 any 都会让一个不相干的测试变红。这条门禁本身就是「只管 error」,再引入一个对 warning 数量敏感的机械门禁与它的立意直接矛盾。

测试

$ node scripts/check-lint-coverage.mjs
✅  lint coverage: 45/45 packages linted, 0 with outstanding errors (0 total).
EXIT=0

$ pnpm exec vitest run scripts/__tests__
 Test Files  5 passed (5)
      Tests  41 passed (41)

其中 scripts/__tests__/lint-workflow.test.ts(#3273 新增,断言这段注释不得再手工点数)5 项全过 —— 新措辞里的 thousands 不是它匹配的基数词,#3274 这类 issue 号也不落在 object-ui/ratchet 的邻域内。另外用 js-yaml 复核了 lint.yml 仍能解析(top keys: name, on, concurrency, permissions, jobs;triggers: push, pull_request, workflow_dispatch)—— 改的是 on: 之上的注释,但这个文件的正确性就是它能被 Actions 读懂。

无 changeset

只改了一条 CI workflow 的注释和一个仓库内部脚本的注释,不发布任何东西,也没有任何用户可见行为变化;按 AGENTS.md「功能改进才写 changeset」这里不需要。(顺带:lint.yml/ci.yml 都把 .changeset/** 放进了 paths-ignore。)

🤖 Generated with Claude Code

https://claude.ai/code/session_01NVPjPzmmAJ2Ngtvgg5MSRa


Generated by Claude Code

…es (#3274)

`.github/workflows/lint.yml` and `scripts/check-lint-coverage.mjs` both quoted
the same hand-maintained figure ("7,724 warnings repo-wide are 81%
`no-explicit-any`") to justify leaving `--max-warnings` unset. Every added
`any` and every new package aged it, nothing recomputed it, and nothing warned
when it went stale — the same defect class as #3261, but drifting faster, and
with two copies free to drift apart from each other as well as from reality.

Both copies now state the order of magnitude ("run into the thousands,
dominated by `no-explicit-any`"), which is all the argument ever depended on
and matches how content/docs/guide/ci-cd-pipeline.md already phrases it.

Deliberately no assertion pinning the figure: unlike #3261's guard (text plus
an already-evaluated flat config, milliseconds), pinning a warning count means
running repo-wide ESLint inside a test — minutes, and every new `any` anywhere
would fail an unrelated test.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NVPjPzmmAJ2Ngtvgg5MSRa
@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)
objectui Ignored Ignored Aug 3, 2026 10:13am

Request Review

@xuyushun441-sys
xuyushun441-sys marked this pull request as ready for review August 3, 2026 10:18
@xuyushun441-sys
xuyushun441-sys added this pull request to the merge queue Aug 3, 2026
Merged via the queue into main with commit a069a30 Aug 3, 2026
14 checks passed
@xuyushun441-sys
xuyushun441-sys deleted the claude/issue-3274-lint-warning-count-drift branch August 3, 2026 10:19
akarma-synetal pushed a commit to akarma-synetal/objectui that referenced this pull request Aug 10, 2026
…bjectstack-ai#3279) (objectstack-ai#3784)

`scripts/check-lint-coverage.mjs` 的文件头 docblock 说 `eslint.config.js` 把
**three** 条 `object-ui/*` 规则设成了 `error`,并在括号里手工列举来源(ADR-0054
Phase 5、objectstack-ai#2879、objectql.ts ratchet)。这是 objectstack-ai#3261 从 `.github/workflows/lint.yml`
里删掉的那句话的逐字副本,连漏掉的规则都是同一条:配置里设成 `error` 的
`object-ui/*` 规则实际有四条 —— L59 no-synthetic-event-trigger、L65
no-try-catch-around-hook、L98 no-dynamic-import-in-test-hook、L111
no-inline-spec-config,漏的是第三条。objectstack-ai#3261 只改了 workflow,这份副本原样留着,
所以它今天就是错的,而不是"将来会错"。

## 头注改法

按 objectstack-ai#3261 / PR objectstack-ai#3273 在 `lint.yml` 里确立的写法去数字化:不点数、不在括号里列
来源,改成「every `object-ui/*` rule that `eslint.config.js` sets to `error`」
这种永真表述。这段话本身正确的主张一字未动 —— 没有 `lint` script 的包不是干净
而是没被 lint 过,ratchet 在那里一文不值。同时按 `lint.yml` 的同构做法补一段,
说明为什么这里刻意不点数也不列举,以及唯一诚实的清单是 `eslint.config.js`
本身(每条规则自己的 ADR/issue 就写在它旁边的注释里)。

## 守卫扩面

`scripts/__tests__/lint-workflow.test.ts`(objectstack-ai#3273 新增)的两条断言 —— 不得点数、
不得按名列举 —— 此前只扫 `lint.yml`,看不见这第二份副本,所以它是被人顺手读到
(objectstack-ai#3274)而不是被门禁挡下来的。现在把扫描面参数化成一个 prose surface 列表,
`lint.yml` 与 `check-lint-coverage.mjs` 各出一项,判定逻辑(点数正则、规则名
比对)原样复用,只是按 surface 取注释:

- 注释块提取按标记参数化 —— YAML 的 `#` 行首标记与 docblock 的星号行首标记共用
  一个 `unwrap(block, marker)`,`\s+` 折行还原照旧,因为 objectstack-ai#3261 那句话正是断在
  "sets three" 与 "`object-ui/*` rules" 之间的。
- 点数正则只读各文件的解释性注释,不读整个文件。对这个脚本这条限定是必需的而
  非洁癖:它的 `Known gaps` 注释合法地在数**包**(「the last two …, 14 errors」),
  整文件扫描会把它当成规则条数报出来。
- 规则名比对仍读整个文件 —— 规则名出现在这两个文件的任何位置,都是
  `eslint.config.js` 的第二份拷贝。

原来那条「eslint.config.js 确实还有 `object-ui/*` 规则设成 error」的前提断言
现在被两份注释共用,单独提成一个 describe;`lint.yml` 专属的两条触发器断言
(仍跑 pull_request、ignore 列表不吞 .ts/.tsx)留在原处不动。

## 验证

- `grep -n 'object-ui/' eslint.config.js` 确认四条 error 规则现状。
- 仓库根 `pnpm vitest run scripts/__tests__/lint-workflow.test.ts`:7 passed
  (扩面前 5:2 条守卫 × 2 个 surface + 1 前提 + 2 触发器)。
- `pnpm type-check:scripts` 干净通过。
- `node scripts/check-control-bytes.mjs` OK;改动文件另做一次
  `grep -naP '[\x00-\x08\x0b\x0c\x0e-\x1f]'` 自扫,零控制字节。
- 变异自证:把原来那句点数写回 mjs 头注,`check-lint-coverage.mjs` 的
  never-hand-counts 一条变红(counted 报出 "three `object-ui"),其余六条仍绿;
  变异不入 commit。

不带 changeset:`scripts/**` 不在 `check-changeset-presence.mjs` 的守卫面
(`<pkg>/src/**`,取自 `.changeset/config.json` 的 fixed 组)之内,且先例
PR objectstack-ai#3273 / objectstack-ai#3278 改的正是这两个文件、均未带 changeset。

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

2 participants