fix(i18n): 删掉九份 i18n-extract 配置里未声明的 name: 键 - #4803
Merged
Merged
Conversation
… configs
All nine `scripts/i18n-extract.config.ts` opened their `defineStack({ … })`
with a top-level `name:` that `ObjectStackDefinitionSchema` does not declare.
The parse dropped the value at load and the #4167 unknown-stack-key lint
reported it once per package on every `pnpm check:i18n` run — a warning that
appeared in an otherwise fully green run, which is exactly how a team learns
to read warnings as noise.
The lint was correct; the configs were not. Nothing has ever read a stack's
top-level `name`: `os i18n extract` is handed the *parsed* `defineStack`
result, from which the key is already gone before the extractor starts. So
the fix belongs at the producer (delete the nine keys), not in `packages/spec`
as a new authorable key invented to accommodate one typo copied nine times
(Prime Directive #12 — fix the metadata, not the runtime).
Extraction output is unchanged and verified, not assumed: after the deletion
`node scripts/check-i18n-bundles.mjs --write` regenerates all 40 bundles
across the nine packages byte-identically (`git status` clean for every
`src/translations/**`), and `pnpm check:i18n` stays green — now silent.
Fixes #4736
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Br2xsJsczFsTR9bvbh2Ny
…n-extract-stack-name
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckNo hand-written docs reference the 0 changed package(s). ✅ |
os-zhuang
marked this pull request as ready for review
August 3, 2026 07:55
This was referenced Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4736
问题
九份
scripts/i18n-extract.config.ts都在defineStack({ … })顶层写了一个name:。ObjectStackDefinitionSchema并未声明这个键,parse 时值被直接丢弃,#4167 的 unknown-stack-key lint 于是每个包都报一次 —— 出现在一次全绿的pnpm check:i18n运行里:lint 是对的,配置是错的。绿色运行里稳定出现的 warning 会训练人(和 agent)把 warning 读成噪音,这本身就是成本;而且同一个错被拷贝了九份,说明后来者是照着第一份抄的。
处置:方案 A(删掉九处
name:),不走 B按 issue 里 PM 的裁定取 A。核实过前提确实成立 —— 没有任何东西读过 stack 顶层的
name:ObjectStackDefinitionSchema的顶层键里没有name(manifest/objects/translations/i18n/ … 均在,name不在);export default defineStack({ … }),导出的是 parse 之后的结果,name在这一步就已经没了;os i18n extract通过loadConfig拿到的正是那个 default 导出,它读i18n/objects/apps,从头到尾没有碰过name;package.json的i18n:extract、scripts/check-i18n-bundles.mjs),都走同一条os i18n extract路径。所以 B(把
name走 spec 正路声明成 authorable key)是为了迁就九份互相拷贝的笔误去扩大公开契约面,以后还要一直养着它(生成物、文档、退役流程)。按 Prime Directive #12,修在 producer 一侧,而不是让 spec 或 lint 去容忍。本 PR 不动 lint 规则、不动
defineStack的 schema、packages/spec/**零改动。 改动面 = 九个scripts/i18n-extract.config.ts+ 一份 changeset,共 10 行删除。提取结果不变 —— 实测,不是假设
改动前
check:i18n九个包全部 in sync(共 40 个 bundle)。删掉name:之后:pnpm check:i18n仍然九个包全部 in sync,bundle 数一致,且那条 warning 不再出现;node scripts/check-i18n-bundles.mjs --write—— 40 个 bundle 全部重写后git status对src/translations/**干净,即提取产物逐字节一致。合并
origin/main(带入了platform-objects/src与objectql/src的改动)后重新构建并复跑check:i18n,依旧全绿且无 warning。关于测试
没有新增单测,理由:改动是九个构建期夹具里的纯删除,
scripts/不在任何包的files里(只发布dist),也不在各包 tsconfig 的include里,没有自然的单测落点。真正执行这些文件的是check:i18n门禁本身(它通过bundleRequire实打实加载并运行每一份配置),所以证据用它的实测输出:见上。顺带一提:能防住"第十份照抄"的最廉价办法是把这条 lint 升级为
check:i18n的硬失败 —— 但那会改变 gate 行为,属于另一个决定,按 issue 的范围约束不在本 PR 实现,只在报告里提出建议。验证
pnpm check:i18n(改动前)pnpm check:i18n(改动后 / 合并 main 后)node scripts/check-i18n-bundles.mjs --writeturbo run typecheck(九个受影响包)turbo run test(九个受影响包)🤖 Generated with Claude Code
https://claude.ai/code/session_015Br2xsJsczFsTR9bvbh2Ny
Generated by Claude Code