Skip to content

doctor-ledger-read-failure.test.ts 整块 7 条在 origin/main 上就是红的 —— os doctor 对坏 ledger 一行都不报,#5413/#5424 的报告面测不出来 #5612

Description

@os-zhuang

发现于#4645 Phase A 跑 @objectstack/cli 全量测试时撞上。#4645 无关——已按下面的方法证伪过因果。

实测

objectstack origin/main @ 81087877epackages/cli

$ pnpm exec vitest run src/commands/doctor-ledger-read-failure.test.ts

 × withholds the clean bill of health when the ledger cannot be read
 × expands the detail under --verbose, and only under --verbose
 × still reports this project's own findings when only the ledger half failed
 × an intact ledger WITH a global unique is still reported the way it always was
 × reports a CORRUPT ENTRY by name instead of skipping it in silence
 × withholds the clean bill when the ONLY finding is an unparseable entry
 × names EVERY unparseable entry, and expands the causes under --verbose

 Test Files  1 failed (1)
      Tests  7 failed | 10 passed (17)

describe('os doctor, end to end, against an unreadable installed-package ledger') 这一整块 7 条全红;同文件另外 10 条(不属于这个 describe)全绿。

症状:doctor 跑通了,就是不报 ledger

失败断言的实际输出显示 os doctor 正常跑完了每一项,只是 ledger 那一行根本没出现:

+   ✓ Platform spec         Declared specVersion is current with the installed platform
+   ✓ Dependencies          No circular references detected
+   ⚠ Object "account" is defined but not referenced by any view, flow, app, or lookup field
+   ✓ Unique scope          No unconfirmed installation-wide uniques for this 'isolated' environment
+ ⚠️  Environment is functional but has some warnings.

期望里的 2 installed-package ledger entries… / (+1 more) 一个都没有。注意最后一行 —— ledger 里明明放着坏条目,✓ Unique scope 却照样打了 clean bill,这正是 #5412/#5414 修掉的那个形状,而 #5413/#5424 又在它上面加了"报告读不到的条目"。两轮修复的报告面,现在测不出来。

已排除的因果

#5429 的关系

#5429 说的是"两条 ledger 健康行都锁在 isolated posture 之内,换个 posture 一行都不报"。这个单不是它:这里 posture 就是 isolated(测试自己设的),条件满足,却仍然一行不报。两者可能同源(都指向那两行的触发条件),但现象不同,需要分别核实。

建议的下一步

先确认 CI 上这块是不是也红(如果 CI 绿而本地红,那是环境依赖,本身就是个要修的可复现性问题);然后从 LocalManifestSource.list()#5413/#5424)往 doctor 的渲染那一段走一遍,看报告是在读的时候丢的还是在渲染的时候丢的。

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions