Skip to content

ci(spec): run the check:generated ledger reconciliation on every PR - #4257

Merged
os-zhuang merged 1 commit into
mainfrom
claude/check-wrapper-red-issue-5mqj3s
Jul 31, 2026
Merged

ci(spec): run the check:generated ledger reconciliation on every PR#4257
os-zhuang merged 1 commit into
mainfrom
claude/check-wrapper-red-issue-5mqj3s

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Closes #4255. Refs #4203, #4232.

问题

check:generated 的台账双向对账只在聚合入口里跑,而 CI 逐个跑单门、从不跑聚合入口——所以"新增 check:/gen: 脚本而不分类"的 PR 永远 CI 全绿,落地后 main 上 AGENTS.md 规定的本地 wrapper 立刻在对账阶段退出,一个门都不跑。三天内发生两次:

把对账加进 ci.ymlcheck-generated job 无效:该 job 的 generated paths filter 不含 packages/spec/package.json(此形态 PR 必改的唯一文件),实测两个肇事 PR 的改动面对 filter 一条都不命中,job 整体被跳过。

修改

  • check-generated.ts:新增 --reconcile-only 模式——只跑 reconcileLedger 即退出,不跑 8 个门;只读 package.json 与脚本内数组,无需 build,亚秒级。同时把 feat(spec): 让 #4001 严格性账本接受机器校验(首次运行抓到 11 处漂移) #4232check:strictness-ledger 分类进 NO_GENERATOR(审计手写 strictness ledger 文档,无 generator 可登记),恢复 main 的 wrapper 为绿。
  • lint.yml:required 且无 paths filter 的 "TypeScript Type Check" job 新增一步跑该模式——与 check:docs/check:skill-refs/check:react-blocks 放这里的理由同构(门不能休眠)。
  • AGENTS.md:wrapper 一节补一句 CI backstop 的存在。
  • changeset@objectstack/spec patch。

验证

  • --reconcile-only 在本分支树上 exit 0:16 check: + 10 gen: 全部有归属(8 gated / 7 source audits / 2 ungated generators / 1 aggregate),计数自洽;
  • 分类 check:strictness-ledger 之前跑同一命令,即以 feat(spec): 让 #4001 严格性账本接受机器校验(首次运行抓到 11 处漂移) #4232 为真实用例抓出 exit 1——新门首跑即命中实案,与当年 reconcile 首跑抓到自己的 package.json 条目同款;
  • 两个方向的篡改注入均红:加未分类脚本 → exists in package.json but is in neither GATED nor NO_GENERATOR;删台账点名的脚本 → UNGATED_GENERATORS names gen:sbom, which package.json no longer has
  • 默认模式回归不受影响:对账通过后照常进入跑门阶段;
  • lint.yml 经 YAML 解析验证,新步骤位于 install 之后、check:docs 之前。

边界

本步骤不检验任何产物新鲜度(那是各单门的既有职责);它守的是门的花名册本身——覆盖率账本的双向完整性,以及本地 wrapper 在 main 上的可用性。

🤖 Generated with Claude Code

https://claude.ai/code/session_01QCrKazC5o5a77yXd7ykaZg


Generated by Claude Code

…4255)

The aggregate reconciles its GATED/NO_GENERATOR ledger against package.json
on every run, in both directions — but only where the aggregate runs, which
was locally. CI runs the gates as individual steps, so a PR adding a
check:/gen: script without classifying it kept every CI gate green while the
wrapper AGENTS.md prescribes exited red on main at the reconcile stage,
running zero gates.

Twice in three days. #4177 added check:variant-docs and main stayed red for
local wrappers until #4194 collided with the same wall (#4203). Then #4232
added check:strictness-ledger — found unclassified while wiring this fix, so
the wrapper was red on main again at the moment of writing. Classified here
as NO_GENERATOR: it audits the hand-written strictness ledger (docs/audits/)
against the code it describes; there is no generator to name.

The gate is a --reconcile-only mode (reconcile, report, exit — no gates;
reads package.json only, no build, sub-second) wired into lint.yml's
"TypeScript Type Check" job. Deliberately not ci.yml's check-generated job:
its `generated` paths filter does not watch packages/spec/package.json — the
one file every offending PR must touch — and both offenders' changed files
missed every entry in that filter, so both skipped the job entirely. The
typecheck job is unfiltered and required, so the meta-gate cannot go
dormant — the reasoning that already placed check:docs, check:skill-refs and
check:react-blocks there.

Verified: --reconcile-only exits 0 on this tree (16 check: + 10 gen:, all
classified) after catching #4232's script pre-classification; an injected
unclassified script and a deleted ledger-named script both fail with the
existing diagnostics; the default mode still reconciles and then runs the
gates. AGENTS.md's wrapper section now states the CI backstop.

Closes #4255
Refs #4203, #4232

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

vercel Bot commented Jul 31, 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 Jul 31, 2026 12:54am

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation ci/cd tooling size/s labels Jul 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

No hand-written docs reference the 0 changed package(s). ✅

@os-zhuang
os-zhuang marked this pull request as ready for review July 31, 2026 01:57
@os-zhuang
os-zhuang merged commit 59b85c0 into main Jul 31, 2026
18 checks passed
@os-zhuang
os-zhuang deleted the claude/check-wrapper-red-issue-5mqj3s branch July 31, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd documentation Improvements or additions to documentation size/s tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

check:generated 的双向对账从不在 CI 上执行——#4203 关闭次日即被 #4232 原样复现,main 的本地 wrapper 又红了

2 participants