fix(tooling): anchor the Biome worktree exclusion so lint runs inside a worktree (#444) - #445
Conversation
#439's exclusion was `!!**/.claude/worktrees`. Biome matches the traversal root by absolute path, so when Biome runs *from* a worktree under that path the root matches its own exclusion: `biome check .` reports "Checked 0 files", exits 1, and takes pre-commit and pre-push with it. The gate looks like it ran and failed without having inspected a single file — the same class of misdirection #439 was opened about. Anchoring the pattern (no `**/`) keeps the original direction working: from the root checkout Biome still refuses to descend into a nested worktree, so its nested root biome.json no longer aborts the run. Reverting either half fails the tests below. Biome's own `useBiomeIgnoreFolder` rules out the other candidate fix, `!!**/.claude/worktrees/**`: it works, but Biome warns on it and its safe fix rewrites it back to the broken form, so `pnpm lint:fix` would silently reinstate the bug. `.gitignore` keeps `**/` on purpose — git has no equivalent reverse failure, so it can afford to also cover a worktree created under a subdirectory's `.claude/`. The two patterns are now deliberately different and say so. Adds a behavioural test that runs the real binary against a synthetic project root in a temp dir, asserting both directions from the traversal evidence (which run reports the planted error) rather than from a file count. Refs #444 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
代码评审报告: fix(tooling): anchor the Biome worktree exclusion so lint runs inside a worktree (#444)
风险等级: 低
处理建议: 评论
决策摘要: 修复方向正确、证据充分(行为测试跑真实 biome 二进制并同时钉住两个方向),可以合并;合并前只需确认 CI 的 pnpm lint 对新测试的调用排版为绿,并明确「子目录 worktree 不再被 biome 排除」这一有意的覆盖收窄。
级联分析
- 变更符号: 无代码符号。
biome.jsonfiles.includes[15]、.gitignore注释块、workflow-rules.test.mjs两处测试。 - 受影响流程:
pnpm lint/lint:fix/format(biome check .)→quality:precommit、quality:ci(.github/workflows/ci.yml:28)、pre-commit / pre-push 钩子;pnpm test:workflows(package.json:40)新增一个会真实 spawn biome 的用例。 - 变更集外调用方: 无。全仓文本搜索
\.claude/worktrees只命中biome.json:62、.gitignore:60、本测试文件与 CHANGELOG,无文档/skill/hook 中的过期!!**/.claude/worktrees引用 (text search)。@biomejs/biome是根 devDependency(package.json:78),因此 CIpnpm install后node_modules/.bin/biome存在,新测试在 Linux CI 上会真实执行而不是静默 skip (已核对)。 - 置信度: medium(无代码图谱可用,结论基于 checkout 内文件核对与文本搜索;无法在此环境执行 biome 验证运行时行为)
问题发现
-
[中] biome 侧对子目录下的 worktree 失去排除,#439 在该位置可复发,且文档未说明
- 证据:
.gitignore:55-57的新注释明确保留**/的理由是「在子目录里启动 Claude Code 时 worktree 会落在该子目录的.claude/下」;而biome.json:62改为锚定后只覆盖仓库根。两处依据互相矛盾——issue #444 的理由是「该目录只可能出现在仓库根」,.gitignore注释则说它可能出现在子目录。若 worktree 落在packages/*/.claude/worktrees/,从根跑biome check .会重新命中 #439 的 nested-root-configuration 中止(.gitignore对此无能为力:biome 不读.gitignore,这正是 #439 记录的结论)。 - 受影响调用方/流程: 根检出下的
pnpm lint→quality:precommit/quality:ci/ pre-commit / pre-push。 - 最小可行修复: 不改模式(现有取舍是对的:
**/的反向失效更严重,!!**/.claude/worktrees/**会被useBiomeIgnoreFolder的 safe fix 改回坏形式)。在biome.json旁的注释或 CHANGELOG 里补一句「子目录下的 worktree 不在 biome 排除范围内,仍会触发 #439」,并把两处注释与 #444 的「只可能出现在仓库根」表述统一;如判断子目录场景真实存在,另开 follow-up。
- 证据:
-
[低] 新测试的调用参数排版可能不是 Biome 的输出形态,需靠 CI lint 确认
- 证据:
scripts/tests/workflow-rules.test.mjs:558-560写成test('…', {\n skip: …,\n}, () => {。第二个参数是会硬换行的对象字面量、最后一个参数才是函数,这不属于 Prettier/Biome 识别的 test-call 形态(要求第二参为函数),last-argument hugging 通常会因非末位参数强制换行而回退为全参数展开。全仓仅此一处这种排版(scripts/workflows/contract-check.mjs:254是对象作为末位参数的合法 hug)。我在此环境无法执行 biome,无法给出确定结论。 - 受影响调用方/流程:
pnpm lint→ 整个quality:ci(若命中,PR 会让 CI 红,且讽刺地卡在它要修的那道门禁上)。 - 最小可行修复: 在分支上跑一次
pnpm lint;若报格式差异,按biome format --write的输出(全参数展开)提交,或改用条件test.skip避免 options 对象。CI 绿则本条作废。
- 证据:
行级发现
- [biome.json:62] 锚定后只覆盖仓库根的
.claude/worktrees;.gitignore:55-57的新注释同时声称 worktree 可能落在子目录的.claude/下——请在此处(或 CHANGELOG)明确子目录 worktree 仍会触发 #439 的 nested-root-config 中止,别让读者以为两条规则等价保护。 - [scripts/tests/workflow-rules.test.mjs:558]
test(name, {…}, fn)的中间对象参数排版很可能不是 Biome 的格式化输出(本仓无同形先例),会让pnpm lint失败;跑一次pnpm lint确认,必要时采用biome format --write的全参数展开写法。
Karpathy 评审
- 假设: 关键假设「biome 按绝对路径匹配遍历根」已被行为测试固化,不再只存在于注释里,这点做得好。未言明的假设是「worktree 只会出现在仓库根」——它与
.gitignore注释冲突(发现 1)。 - 简洁性: 一行配置改动 + 一个行为测试,没有引入抽象、flag 或间接层。拒绝
!!**/.claude/worktrees/**的理由(lint:fix的 safe fix 会把 bug 写回来)是有价值的、可验证的取舍记录。 - 结构质量: 无退化。测试文件 801 行,未跨 1000 行边界;新用例自带 setup/teardown(
finally里rmSync),不污染仓库;复用真实biome.json而非手写 stub 是正确选择。 - 变更范围: 完全对齐 #444,无夹带重构或格式噪声。CHANGELOG 与既有条目风格一致。
- 验证: 强于变更风险。行为测试同时钉住 #439(根不下钻)与 #444(worktree 内仍检查),且断言的是「哪一次运行报出
noDoubleEquals」而非文件计数——这排除了「只检查了配置文件」的假阳性。配置形状断言在二进制缺席/Windows 上仍生效,是合理的双层防护而非重复。作者给出的证伪路径(还原**/挂 2 个测试)可信。
缺失覆盖
- 子目录 worktree(如
packages/x/.claude/worktrees/b)从根运行biome check .的行为无覆盖:要么加一个断言其当前行为(会中止)并标注为已知限制,要么在注释中声明该场景不受支持。 - 无(也不必要)覆盖 skip 分支;但请确认 CI 日志中该用例确实是 pass 而非 skip——
node --test的 skip 不会让test:workflows变红,这道新门禁的价值完全依赖它在 CI 上真实执行。
| "!!**/docs", | ||
| "!!**/benchmarks", | ||
| "!!**/.claude/worktrees" | ||
| "!!.claude/worktrees" |
There was a problem hiding this comment.
锚定后只覆盖仓库根的 .claude/worktrees;.gitignore:55-57 的新注释同时声称 worktree 可能落在子目录的 .claude/ 下——请在此处(或 CHANGELOG)明确子目录 worktree 仍会触发 #439 的 nested-root-config 中止,别让读者以为两条规则等价保护。
| // (#444). Skipped when the binary is absent (no `pnpm install`) or on Windows, | ||
| // where the shim name differs — CI runs this on Linux. | ||
| const biomeBin = join('node_modules', '.bin', 'biome'); | ||
| test('biome ignores a nested worktree from the root but still checks one from inside', { |
There was a problem hiding this comment.
test(name, {…}, fn) 的中间对象参数排版很可能不是 Biome 的格式化输出(本仓无同形先例),会让 pnpm lint 失败;跑一次 pnpm lint 确认,必要时采用 biome format --write 的全参数展开写法。
repo-guard on #445: the .gitignore comment justifies keeping `**/` by saying a worktree can land under a subdirectory's .claude/, while #444 argues the anchored Biome pattern is fine because it only lands at the repo root. Both cannot be true, and a reader could take the two rules for equivalent protection. The narrower Biome coverage is a known limitation, not an oversight: a subdirectory worktree still trips #439's nested-root-configuration abort from a root `biome check .`. Recording that, with the workaround and with why neither alternative pattern is available. Refs #444 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
repo-guard 的两条都已处理: 发现 1(中,文档矛盾) — 已在 发现 2(低,排版) — 已作废。 「确认是 pass 而非 skip」 — 已核对 CI 日志(run 30740333031),两个 node 版本上都是真实执行: 不带 |
There was a problem hiding this comment.
代码评审报告: fix(tooling): anchor the Biome worktree exclusion so lint runs inside a worktree (#444)
风险等级: 中
处理建议: 请求修改
决策摘要: biome 锚定修复本身正确、有行为级测试覆盖,可以合并;但这个 PR 同时提交了 .gitnexus/lbug 与 .gitnexus/meta.json 的索引漂移(+146/−121),这与仓库自己的文档规则冲突且不在声明范围内,去掉这两个文件后即可合入。
级联分析
- 变更符号: 无代码符号。
biome.json的files.includes一项(!!**/.claude/worktrees→!!.claude/worktrees,biome.json:62)、.gitignore注释、scripts/tests/workflow-rules.test.mjs新增断言与一个行为测试、CHANGELOG 一条、.gitnexus/*生成物。 - 受影响流程:
pnpm lint/pnpm lint:fix(package.json:35-36)→.githooks的 pre-commit / pre-push → CIpnpm quality:ci(.github/workflows/ci.yml:28,含pnpm test:workflows,因此新行为测试会在 Linux +pnpm install后真实执行)。 - 变更集外调用方:
biome.json只被 biome 二进制读取,仓库内无 importer(grep 确认除测试外无引用);turbo test按 workspace 包运行,不会被嵌套 worktree 波及;.gitnexus/*由 gitnexus 工具与本地 agent 消费。仓库内没有其它工具配置排除.claude/worktrees(全仓 grepworktrees仅命中本次测试、contract-check.mjs:89的提示文案和历史 plan 文档)。 - 置信度: medium — 配置、CI、脚本、文档均已在 checkout 中读过;但本环境无法执行 biome,"遍历根按绝对路径匹配" 这一核心机制依赖 issue #444 的实测记录和作者报告的门禁运行,属 (inferred/作者证据),未由我复算。
问题发现
-
[中]
.gitnexus/*索引漂移超出 PR 声明范围,且与仓库明文规则冲突- 证据: diff 含
.gitnexus/meta.json+146/−121 与二进制.gitnexus/lbug;docs/knowledge-contract.md:65-70写明「contributors should not include index-only churn in ordinary PRs… Only commit.gitnexus/*changes when the task explicitly refreshes the repository knowledge base, changes the Harness/GitNexus contract, or a maintainer requests a canonical index update」,docs/oss-harness-engineering-workflow.md:134同义。本 PR 三者都不属于。PR 的 Impact Scope 只列了 4 个文件并写「No application code」,完全没有提到这两个文件,与实际 6 文件的变更集不符。另外.gitnexus/meta.json:2把共享种子索引的repoPath从/Users/a86198/Desktop/FrontAgent改成/Users/a86198/Desktop/resume/refs/FrontAgent/.claude/worktrees/biome-worktree-lint—— 指向一个用完即弃的 worktree 目录,作为仓库内 canonical seed 比原值更差。(索引内容本身与当前树一致:抽查packages/core/src/filesense/path-grounding.ts、benchmarks/eval/tasks-deep.json均存在,所以问题是范围与规则,不是内容错误。) - 受影响调用方/流程: 使用仓库种子索引的本地 code intelligence 与 agent 流程;以及 review 可读性(267 行生成物淹没了 4 行真实变更)。
- 最小可行修复: 从本 PR 撤掉这两个文件(
git restore --source=origin/develop -- .gitnexus后 amend/push),其余不动。
- 证据: diff 含
-
[低] 行为测试隐式依赖
noDoubleEquals规则保持启用,失效时会给出误导性失败- 证据:
scripts/tests/workflow-rules.test.mjs:568-577把真实biome.json复制进临时工程,再用/noDoubleEquals/u判定「谁检查了 worktree」(:585-589、:598-602)。若日后有人在biome.json的suspicious段关掉noDoubleEquals(该段已经关了 5 条规则),worktree 那次运行不再输出该规则名,测试会以worktree contents must still be checked (#444)失败 —— 但遍历行为其实完好。这正是 #439/#444 抱怨的那类「报错指向错误的原因」。 - 受影响调用方/流程:
pnpm test:workflows(本地门禁与 CI check job)。 - 最小可行修复: 在断言前先从已解析的
biomeConfig确认该规则未被禁用(现成的biomeConfig变量在同文件 :526 已有先例),或改用测试自己固定的规则配置作为探针,让规则被关闭时以明确信息失败。
- 证据:
行级发现
- [.gitnexus/meta.json:2] 共享种子索引的
repoPath被写成一次性 worktree 的本机绝对路径;这两个.gitnexus/*文件应整体退出本 PR,而不是就地改回旧路径。 - [scripts/tests/workflow-rules.test.mjs:598] 该断言把「worktree 被遍历」等同于「输出里出现 noDoubleEquals」;先断言复制进 fixture 的配置确实启用了这条规则,否则规则被禁用时会伪装成 #444 回归。
Karpathy 评审
- 假设: 核心假设「biome 对遍历根按绝对路径匹配、对显式子路径按相对路径匹配」已在 issue #444 中实测并由 :558-606 的行为测试固化,未留在注释层面。被接受的已知限制(子目录下的 worktree 只被 git 忽略、仍会触发 #439 中止)在 .gitignore:60-65 与 CHANGELOG:18 明确写出,没有伪装成等价保护。
- 简洁性: 修复是单个配置值,方向正确;被否掉的
!!**/.claude/worktrees/**连同useBiomeIgnoreFoldersafe fix 会写回坏形式的理由也记录在案。唯一多余处是同一段论证现在存在三份(.gitignore:55-65、CHANGELOG.md:18、测试注释 :550-556),模式再变一次就要同步三处;不构成阻塞。 - 结构质量: 无新增分支、wrapper 或抽象层;测试新增的是一个自包含、临时目录内自清理(:603-605
finally)的用例,没有污染既有 helper。workflow-rules.test.mjs已超 800 行,但本次增量有清晰的用例边界,不构成新的拆分要求。 - 变更范围: 4 个文件符合目标;
.gitnexus/lbug与.gitnexus/meta.json属于范围外的生成物漂移(见发现 1),且 PR 正文的 Impact Scope 未如实包含它们。 - 验证: 行为测试同时钉住两个方向,并刻意避开文件计数这一会被「只检查了配置文件」满足的弱证据,取证方式合理;CI 在 Linux 上带
pnpm install运行,跳过条件(Windows / 无二进制)不会掩盖 CI 覆盖。作者声称的证伪路径(还原**/使 2 个测试失败)我无法在本环境复算。
缺失覆盖
- 已知限制「子目录
.claude/worktrees不在 biome 排除范围」没有任何断言或探测:若未来 biome 改变匹配语义使该限制消失或恶化,仓库不会有信号。可选补一条记录当前语义的测试或在 issue 中登记跟踪。 - 无二进制时
pnpm test:workflows会静默跳过该行为测试,本地门禁在未pnpm install的环境下不构成保护;CI 已覆盖,属可接受的剩余风险,但值得知晓。 - 本次评审未能执行 biome,
!!.claude/worktrees在根检出方向仍然阻断嵌套配置(#439)这一点,最终依赖 CI 的checkjob 结果确认。
| "repoPath": "/Users/a86198/Desktop/FrontAgent", | ||
| "lastCommit": "51fd4bbaf69ea926cd670f6708dbbbc6b5b52327", | ||
| "indexedAt": "2026-07-12T08:26:27.526Z", | ||
| "repoPath": "/Users/a86198/Desktop/resume/refs/FrontAgent/.claude/worktrees/biome-worktree-lint", |
There was a problem hiding this comment.
共享种子索引的 repoPath 被写成一次性 worktree 的本机绝对路径;这两个 .gitnexus/* 文件应整体退出本 PR,而不是就地改回旧路径。
| const worktreeOutput = `${fromWorktree.stdout}${fromWorktree.stderr}`; | ||
| // With a `**/` pattern this run reports "Checked 0 files" and exits 1 — | ||
| // the gate looks like it ran and failed, without inspecting anything. | ||
| assert.match( |
There was a problem hiding this comment.
该断言把「worktree 被遍历」等同于「输出里出现 noDoubleEquals」;先断言复制进 fixture 的配置确实启用了这条规则,否则规则被禁用时会伪装成 #444 回归。
… rule repo-guard on #445, both findings. The .gitnexus/* churn was swept in by a blanket `git add -A`: the pre-push gate runs `gitnexus analyze`, which rewrites the index and stamps `repoPath` with wherever it ran — here a throwaway worktree, a strictly worse value for a committed seed index than the one on develop. docs/knowledge-contract.md reserves `.gitnexus/*` commits for tasks that explicitly refresh the knowledge base; this is not one. Restored from develop, so the PR's net diff no longer touches them. The behavioural test reads "did biome traverse here?" off a planted noDoubleEquals diagnostic. Disabling that rule — the `suspicious` group already disables five — would make the worktree run report nothing and fail with "worktree contents must still be checked (#444)", blaming traversal for a config edit. That is the misdirected-error failure mode both #439 and #444 were opened about. It now fails on the real cause, naming the rule and the fix. Refs #444 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
两条都已处理( 发现 1(中, 发现 2(低,探针规则) — 已修。测试用「有没有报出 证伪已验证:把 |
There was a problem hiding this comment.
代码评审报告: fix(tooling): anchor the Biome worktree exclusion so lint runs inside a worktree (#444)
风险等级: 中
处理建议: 评论
决策摘要: ** 可以合并——修复与 issue #444 提出的方案一致、方向正确,且由一个跑真实 biome 二进制的双向行为测试兜底;剩余问题都是注释与守卫的健壮性,不阻塞。
级联分析
- 变更符号: 原始模型未提供结构化级联字段。
- 受影响流程: 原始模型未提供结构化级联字段。
- 变更集外调用方: unknown
- 置信度: degraded
问题发现
- [低] 探针守卫只识别字符串形式的规则关闭
- 证据:
scripts/tests/workflow-rules.test.mjs:568-573用assert.notEqual(linterRules?.suspicious?.noDoubleEquals, 'off')保护「用 noDoubleEquals 当遍历探针」这一前提。Biome 同时支持对象形式{"level": "off"},也支持用suspicious.recommended: false或顶层recommended: false关闭整组。这三种写法都能绕过守卫。 - 受影响调用方/流程: 只影响本测试的失败信息质量。绕过后行为测试仍会失败,但报的是
worktree contents must still be checked (#444),正是这个守卫想避免的误导性错误——和 #439/#444 的失败模式同构。 - 最小可行修复: 归一化后再断言,例如取
typeof rule === 'string' ? rule : rule?.level,必要时一并断言linterRules?.recommended !== false。
- 证据:
- [低] 被否决方案的结论以事实口吻写进注释,但没有测试覆盖
- 证据:
.gitignore:63断言!!**/.claude/worktrees/**「两边都成立」,只因useBiomeIgnoreFolder的 safe fix 会改回坏形式才被否决。falsification 只覆盖了!!.claude/worktrees与!!**/.claude/worktrees两种形式;/**后缀形式没有断言保护。若该结论有偏差(/**后缀在按绝对路径匹配遍历根时可能同样命中),后来的维护者会据此重新引入 #444。 - 受影响调用方/流程: 未来对
biome.json排除规则的修改决策。 - 最小可行修复: 把措辞降为「实测于 biome 2.4.16」或直接说明未纳入回归覆盖;更彻底的做法是在行为测试里加一轮该形式的断言。
- 证据:
- [低] 同一份理由复制在四处,而本 PR 修的正是它上一次漂移
- 证据:
.gitignore:53-65、scripts/tests/workflow-rules.test.mjs:531-535、同文件550-556、CHANGELOG.md:18各自完整复述了「biome 锚定 / git 保留**/」的推理。PR 描述里明确写到「stale comment claiming the two patterns are aligned is corrected」——上一版正是因为同样的复述而与实现脱节。 - 受影响调用方/流程: 后续修改该排除规则时的注释同步成本。
- 最小可行修复: 保留
.gitignore里 2-3 行结论 + 指向#444与行为测试,把完整推导只留在测试注释这一处。属于取舍建议,不必在本次合并前处理。
- 证据:
行级发现
- [scripts/tests/workflow-rules.test.mjs:570] 守卫只比对字符串
'off',{"level": "off"}或suspicious.recommended: false都能绕过并让下方行为断言报出误导性失败;归一化取 level 后再断言。 - [.gitignore:63] !!/.claude/worktrees/`「两边都成立」这一结论没有回归测试覆盖,却写成了后人可直接采纳的事实;建议限定为特定 biome 版本的实测结论,或补一条断言。
Karpathy 评审
- 假设: 模型输出需要归一化为固定 Markdown 契约。
- 简洁性: 已提取 summary、finding、evidence 与 fix;原始 prose 不再附在评论中,避免占用下游解析与代理上下文。
- 变更范围: 原始模型未提供结构化范围字段。
- 验证: 需要查看 CI、测试或人工 CR 证据补强合并信心。
缺失覆盖
- 输出未命中 Repo Guard Markdown 契约;建议补充真实模型质量评估覆盖。
| // this is not a hypothetical edit. | ||
| const linterRules = JSON.parse(readFileSync('biome.json', 'utf8')).linter?.rules; | ||
| assert.notEqual( | ||
| linterRules?.suspicious?.noDoubleEquals, |
There was a problem hiding this comment.
守卫只比对字符串 'off',{"level": "off"} 或 suspicious.recommended: false 都能绕过并让下方行为断言报出误导性失败;归一化取 level 后再断言。
| # 子目录下的 worktree(如 packages/x/.claude/worktrees/b)只被 git 忽略,不在 | ||
| # biome 的排除范围内——从仓库根跑 `biome check .` 仍会撞上 #439 的 | ||
| # nested-root-configuration 中止。已知限制,不是疏漏:`**/` 的反向失效(worktree | ||
| # 里所有门禁全灭)比它更严重,而 `!!**/.claude/worktrees/**` 虽然两边都成立,却会 |
There was a problem hiding this comment.
!!/.claude/worktrees/`「两边都成立」这一结论没有回归测试覆盖,却写成了后人可直接采纳的事实;建议限定为特定 biome 版本的实测结论,或补一条断言。
…-pattern claim repo-guard on #445, both low findings. The probe guard only recognised the string form `"off"`. Biome also accepts `{ level: "off" }` and dropping the recommended preset at either the group or the linter level; all three slipped past it and left the behavioural assertion to fail with "worktree contents must still be checked (#444)" — blaming traversal for a config edit, the exact misdirection the guard exists to prevent. Normalised, and each bypass verified to fail on the guard instead. The .gitignore comment stated as fact that `!!**/.claude/worktrees/**` satisfies both directions. That was measured, not covered by a test — the falsification path only exercises the anchored and `**/`-prefixed forms. Marked as a biome 2.4.16 measurement to re-verify on upgrade, so a later maintainer does not adopt it as a settled conclusion and reintroduce #444. Refs #444 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
代码评审报告: fix(tooling): anchor the Biome worktree exclusion so lint runs inside a worktree (#444)
风险等级: 低
处理建议: 评论
决策摘要: 可以合并——修复方向与 #444 的根因和验收标准一致,且被一个跑真实 biome 二进制的双向行为测试钉住;两处非阻塞问题是「探针守卫仍有一个绕过口」和「子目录 worktree 的覆盖收窄没有任何回归信号」。
级联分析
- 变更符号: 无。diff 只有一个
files.includes配置值(biome.json:62)、一段注释(.gitignore:53-66)、一条 CHANGELOG 条目和纯测试代码;没有导出符号签名变化。 - 受影响流程:
pnpm lint=biome check .(package.json:35)→quality:precommit/quality:ci/quality:local(package.json:28-30)→.githooks/pre-commit、.githooks/pre-push(两者都只调用这两个 pnpm 脚本)→ CIcheckjob(.github/workflows/ci.yml:25-28,ubuntu-latest,Node 20/22,pnpm install --frozen-lockfile后跑quality:ci)。PR 声称「CI 在 Linux 上装完依赖后会跑这个新测试」,已核对属实:test:workflows在quality:ci链上(package.json:29,40),skip 条件(win32 / 缺node_modules/.bin/biome)在该 job 上都不成立。 - 变更集外调用方: 无 (text search)。全仓只有一个
biome.json(Glob),biome check只在根脚本package.json:35-36出现,其余命中都在 docs/plans 和 CHANGELOG 里;旧模式串**/.claude/worktrees在变更集外没有任何残留引用(Grep)。biome.json由 biome 二进制读取,无仓内 importer。 - 置信度: medium — 无代码图谱,结论来自 Read/Grep (text search);核心行为断言(biome 2.4.16 对遍历根按绝对路径匹配、锚定模式两个方向都成立)我无法在本次评审中执行验证,只能依赖 PR 内的实测记录和新测试在 CI 上的执行。
问题发现
-
[中] 子目录 worktree 的排除覆盖被收窄,且没有留下任何自动信号
- 证据:
biome.json:62由!!**/.claude/worktrees改为!!.claude/worktrees,只锚定项目根。.gitignore:60-66明确承认packages/x/.claude/worktrees/b仍被 git 忽略但不在 biome 排除范围内,从仓库根跑biome check .仍会撞上 #439 的 nested-root-configuration 中止。仓库确实是 monorepo(packages/、apps/desktop),在子目录启动 Claude Code 是.gitignore自己给**/保留的理由,所以这条路径不是纯理论。 - 受影响调用方/流程: 仓库根
pnpm lint→ pre-commit / pre-push / CIquality:ci。失败形态正是 #439 抱怨过的误导性报错(报配置问题而不是 worktree)。 - 最小可行修复: 不必在本 PR 改模式(
**/的反向失效更严重,取舍成立)。最小动作是开一个 follow-up issue 记录这个已知缺口,或在scripts/tests/workflow-rules.test.mjs的配置断言旁加一行注释级 TODO 指向它,避免这条限制只活在.gitignore注释里。
- 证据:
-
[低] 探针守卫仍留了一个与它要防的编辑同类的绕过口
- 证据:
scripts/tests/workflow-rules.test.mjs:571-581覆盖了noDoubleEquals: "off"、{ level: "off" }、rules.recommended: false、suspicious.recommended: false四种写法,但读的是linter?.rules,没有看linter.enabled。若biome.json的linter.enabled被设为false(或将来加overrides关掉该规则),worktree 那次运行不再报noDoubleEquals,测试会以worktree contents must still be checked (#444)失败——正是这段守卫想避免的「报错指向错误原因」。 - 受影响调用方/流程:
pnpm test:workflows(本地门禁 + CIcheck)的可诊断性;不影响当前行为,biome.json:4-5现在是"enabled": true。 - 最小可行修复: 在同一处多读一层并加一条断言,如
const linter = JSON.parse(...).linter;后assert.notEqual(linter?.enabled, false, probeMessage);。
- 证据:
行级发现
- [biome.json:62] 锚定后不再覆盖子目录下的
.claude/worktrees(如packages/x/.claude/worktrees/b),从仓库根跑biome check .会重现 #439 的 nested-root-configuration 中止;取舍本身合理,但建议补一个 follow-up issue 编号,别让这条限制只留在.gitignore注释里。 - [scripts/tests/workflow-rules.test.mjs:571] 这里只读
linter?.rules,linter.enabled: false能绕过全部三条探针守卫并让失败信息指向 traversal 而非真实原因;顺手多读一层linter,加一条assert.notEqual(linter?.enabled, false, probeMessage)。
Karpathy 评审
- 假设: 关键假设「biome 对遍历根按绝对路径匹配、对显式子路径按相对路径匹配」是 biome 2.4.16 的实测行为而非文档契约,PR 已在
.gitignore:65-66显式标注「换 biome 版本后要重新验证再采信」,并用行为测试而非文字承诺来兜底——这是这个 PR 处理隐藏假设最好的部分。被接受但未自动化的假设是「子目录 worktree 不会真出现」。 - 简洁性: 方案是单字符级别的最小修复(去掉
**/),没有引入新抽象、新层或新配置开关。测试用真实biome.json而不是手写 stub,是恰当的证据选择。 - 结构质量: 无退化。没有新分支、新 flag、新 wrapper,也没有把逻辑放到错误层。测试文件从 ~520 行增至 ~627 行,仍在可扫描范围内,新增块自带边界清晰的注释。同一份 rationale 现在同时存在于
.gitignore注释、测试注释和 CHANGELOG,属于可接受的重复(与该仓库既有的长解释性注释风格一致),但下次改模式时三处都要同步。 - 变更范围: 与既定目标严格对齐——一个配置值、一段解释、一条 CHANGELOG、两处测试。没有夹带无关重构或格式噪声。
- 验证: 强度匹配风险。行为测试断言的是「哪一次运行报出被种下的
noDoubleEquals」而不是文件计数,这个选择正确地排除了「只检查了配置文件」的假通过;根方向的假通过(检查 0 文件但退出 0)由assert.equal(fromRoot.status, 0)间接挡住,因为 biome 在 0 文件时退出 1。可证伪性成立:把模式改回!!**/.claude/worktrees会让配置断言和行为断言同时失败。
缺失覆盖
- 子目录 worktree(
<subdir>/.claude/worktrees/<name>)从仓库根跑biome check .的行为没有测试,也没有 issue 记录;这是本 PR 相对 #442 主动收窄的那部分覆盖。 - 「
!!**/.claude/worktrees/**会被useBiomeIgnoreFolder的 safe fix 改回坏形式」是拒绝备选方案的核心理由,但只有人工实测记录、没有回归覆盖;biome 升版后这条结论需要重新验证(.gitignore:65-66已自陈这一点)。 - 探针守卫未覆盖
linter.enabled: false与overrides关规则两种配置编辑(见 finding 2)。
| "!!**/docs", | ||
| "!!**/benchmarks", | ||
| "!!**/.claude/worktrees" | ||
| "!!.claude/worktrees" |
There was a problem hiding this comment.
锚定后不再覆盖子目录下的 .claude/worktrees(如 packages/x/.claude/worktrees/b),从仓库根跑 biome check . 会重现 #439 的 nested-root-configuration 中止;取舍本身合理,但建议补一个 follow-up issue 编号,别让这条限制只留在 .gitignore 注释里。
| // Biome accepts three ways to switch the probe off — `"off"`, `{ level: | ||
| // "off" }`, and dropping the recommended preset at either level — so check | ||
| // all of them rather than the one spelling in use today. | ||
| const linterRules = JSON.parse(readFileSync('biome.json', 'utf8')).linter?.rules; |
There was a problem hiding this comment.
这里只读 linter?.rules,linter.enabled: false 能绕过全部三条探针守卫并让失败信息指向 traversal 而非真实原因;顺手多读一层 linter,加一条 assert.notEqual(linter?.enabled, false, probeMessage)。
Linked Issue Or Context
Summary
biome.json:!!**/.claude/worktrees→!!.claude/worktrees.Biome matches the traversal root by absolute path, so a
**/-prefixed pattern also matches the worktree itself when Biome runs from inside one.pnpm lintthere reportedChecked 0 filesand exited 1 — the gate looked like it ran and failed without having inspected a single file, and pre-commit / pre-push went down with it. That is the same class of misdirection #439 was opened about, in the opposite direction.Anchoring keeps the original direction intact: from the root checkout Biome still refuses to descend into a nested worktree, so its nested root
biome.jsonno longer aborts the run.Rejected alternative:
!!**/.claude/worktrees/**also works, but Biome's ownlint/suspicious/useBiomeIgnoreFolderwarns on it and its safe fix rewrites it back to the broken form —pnpm lint:fixwould silently reinstate the bug..gitignoredeliberately keeps**/: git has no equivalent reverse failure, so it can afford to also cover a worktree created under a subdirectory's.claude/. The stale comment claiming the two patterns are aligned is corrected to say why they now differ.Impact Scope
biome.json— onefiles.includesentry..gitignore— comment only, no rule change.scripts/tests/workflow-rules.test.mjs— tightened the existing config assertion, added one behavioural test.CHANGELOG.md—[Unreleased] → Fixed.No application code. Blast radius is the local gates plus CI's
pnpm lintstep.GitNexus Impact Summary
classifyContractPathsreturns no critical entry for this diff (repo-harnesscovers.github/workflows/,.claude/workflows/,.claude/skills/,.githooks/,scripts/workflows/;scripts/tests/is only a test pattern). Contract Guard is advisory here by its own rules.detect_changesreports no symbol-level change — the diff is one config value, one comment block, one changelog entry, and test-only code.contexton the touched surface finds no importer:biome.jsonis read by the Biome binary, not by repo code, and the new test's only in-repo dependency isnode_modules/.bin/biome. There is no call graph to trace, so noimpactquery applies.pnpm quality:precommit(lint / typecheck / test / test:workflows) and the fullpnpm quality:localpre-push gate both passed from inside a worktree — which is itself the fix under test; ondevelopthe same command exits 1 atbiome check ..Verification
Both directions are pinned by
biome ignores a nested worktree from the root but still checks one from inside, which runs the real binary against a synthetic project root in a temp dir. It asserts on which run reports a plantednoDoubleEqualserror, not on a file count — a count would also be satisfied by Biome checking only the config files.Falsification: restoring
!!**/.claude/worktreesfails 2 tests (the behavioural one and the tightened config assertion); dropping the exclusion entirely reproduces #439's nested-root-configuration abort.Manual:
biome check .from inside the worktree — 422 files before/after the fix vs.Checked 0 files+ exit 1 ondevelop.The test skips on Windows (shim name differs) and when
node_modules/.bin/biomeis absent; CI'scheckjob runs it on Linux afterpnpm install.Checklist
pnpm quality:precommit, or explained why it could not run.pnpm quality:localfor critical skeleton changes, or explained why it could not run.