Skip to content

package-files-exist 门禁的 ratchet 失败消息只描述了两条陈旧路径中的一条(「the path now resolves」) #3674

Description

@yinlianghui

发现于 #3665 的实施(PR 待开)。观察类记录,不在该单完成范围内(#3665 的文件面明确 ⛔ 该测试文件其余断言一行不动)。

事实

scripts/__tests__/package-files-exist.test.ts 的 ratchet 断言 the objectui#3647 baseline only shrinks,其失败消息首行写死为:

A KNOWN_MISSING entry is stale — the path now resolves, so the defect is fixed.
Delete its line from KNOWN_MISSING in this file to bank the progress.

stale 的判据是 !stillMissing.has(relPath),missing 又是从 declared(= 各包 files 展开)里筛出来的。所以一条基线条目变陈旧有两条路径:

  1. 路径被创建 —— 条目仍在 files 里,但 fs.existsSync 为真。这是消息描述的那条,也是 PR test(scripts): 补门禁——package.json files 声明的条目必须在磁盘真实存在 (#3663) #3667 逆向验证 C 实测的那条(建出 packages/cli/templates/)。
  2. 声明被删除 —— 条目从 files 里删掉,于是它根本不再进入 declared,自然也不在 stillMissing 里。

#3665 走的正是第 2 条(两个 templates 目录从未存在、也不该存在,正确修法是删声明)。实测输出:

AssertionError: A KNOWN_MISSING entry is stale — the path now resolves, so the defect is fixed.
Delete its line from KNOWN_MISSING in this file to bank the progress.

packages/cli/templates (objectui#3665)
packages/create-plugin/templates (objectui#3665)

此时 packages/cli/templates 并没有 resolve —— 它依然不存在,只是不再被声明。消息的诊断句与现场不符。

影响(为什么记为观察类)

  • 补救指令仍然正确:「Delete its line from KNOWN_MISSING」在两条路径下都是该做的事,所以不会把人引向错误动作。
  • 失真的只是诊断句里的归因:读者按字面去 ls 那个路径会发现它不存在,从而怀疑门禁自身坏了。
  • #3665 落地后 KNOWN_MISSING 已清空,这条消息在下一条基线条目被挂账之前不会再触发 —— 所以今天没有人会撞上。

可能的处置(供分诊裁决,未实施)

把首行改成同时覆盖两条路径,例如:

A KNOWN_MISSING entry is stale — the path now exists, or the `files` entry that
declared it is gone. Either way the defect is fixed.

#3665 的 PR 里已经把这两条路径写进 KNOWN_MISSING 上方的文档注释(该注释本就是描述被删条目的,必须随之更新),但断言消息本身未动 —— 那超出该单的文件面。


Generated by Claude Code

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions