Skip to content

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

Closed

Description

@os-zhuang

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

实测

objectstack origin/main @ 81087877e,packages/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 的渲染那一段走一遍,看报告是在读的时候丢的还是在渲染的时候丢的。

Activity

  1. added
    pm:queueReady for the PM dispatch loop
    domain:cliRetired 2026-10-22, alias of domain:server (cli surface); in-flight cards keep it until they land
    on Aug 5, 2026
  2. os-zhuang commented on Aug 5, 2026

    @os-zhuang
    ContributorAuthor

    分诊:入队 pm:queue + domain:cli。

    本评论来自分诊座位 Routine(#5474 试点),不构成认领。


    Generated by Claude Code

  3. self-assigned this
    on Aug 5, 2026
  4. baozhoutao commented on Aug 5, 2026

    @baozhoutao
    Contributor

    认领(PM 会话 session_016FNvXhtSdnEGEfLEsMmvxh,cli 车道)

    • 分支:claude/issue-5612-doctor-ledger-report-face
    • 工作树:../objectstack-5612(os-dev 自建)
    • 文件面:packages/cli doctor 报告链(LocalManifestSource.list() → 渲染段)+ 该测试文件;按 issue 建议第一步先分辨「CI 同红 vs CI 绿本地红」——前者是报告面真丢,后者是环境依赖的可复现性缺陷,两者都在本单内但修法不同,先定性再动手。
    • 注意:今日多个 dev 的 pnpm --filter @objectstack/cli test 全量都是绿的(82 文件 812 例),而单文件直跑红——「全量绿 + 单跑红」本身就是重要线索(测试间状态泄漏 / 配置差异),测绘时纳入。
    • 与 os doctor 的两条 ledger 健康行都锁在 isolated posture 之内 —— 换个 posture,同一个坏 ledger 一行都不报 #5429(posture 条件,决策箱)现象不同不收敛,撞见其证据只记不修。

    Generated by Claude Code

  5. baozhoutao commented on Aug 5, 2026

    @baozhoutao
    Contributor

    开工(os-dev 会话 session_016FNvXhtSdnEGEfLEsMmvxh,cli 车道)


    Generated by Claude Code

  6. baozhoutao commented on Aug 5, 2026

    @baozhoutao
    Contributor

    结论:前提被证伪 —— 报告面没有丢。 详细证据见 draft PR #5643(CI 已收敛,全绿)。

    判别变量既不是本单猜的三条,也不是 PM 认领评论假设的「测试间状态泄漏」,而是这个 worktree 有没有构建 packages/cloud-connection:

    worktree 状态 单文件直跑 --filter @objectstack/cli test 全量
    cloud-connection/dist 存在 17/17 绿 82 文件 / 812 例 全绿
    cloud-connection/dist 缺失 7 failed / 10 passed 7 failed / 800 passed

    同一份 worktree 里把 dist 移走再移回,红绿来回翻转;失败用例名与本单正文逐条一致,计数 7 failed | 10 passed (17) 完全一致。关键的一格是右下角:dist 缺失时全量跑同样是红的,所以「今日多个 dev 全量绿」只说明他们的 worktree 已经构建过,不构成「单跑 vs 全量」的差异。

    根因链:doctor 通过动态 import('@objectstack/cloud-connection') 读 ledger,那个 catch 故意静默(doctor.ts:869-878 —— os doctor 必须能在从未装过该可选包的 checkout 里跑完)。包没构建 → 加载失败 → 被当成「什么都没装」→ ledger 一行不报、✓ Unique scope 照打。#5412/#5413/#5424 的实现与报告面都完好。

    PR #5643 修的是由此暴露的真实缺陷:这个文件在依赖未构建时静默降级成 7 份误导性断言 diff,而不是一条说得清的错误。加前置断言(不动产品码、不放宽任何断言),失败改为一条点名该包并给出构建命令的错误。

    另立 #5644:doctor 把「该包没装」和「装了但加载不了」当同一件事 —— #5412 假 PASS 的上一层,也是本单看起来像报告面回退的产品面根因。修它要先定输出契约,故未顺手改。


    Generated by Claude Code

  7. baozhoutao commented on Aug 5, 2026

    @baozhoutao
    Contributor

    ACCEPT → PR #5643(PM 会话 session_016FNvXhtSdnEGEfLEsMmvxh,cli 车道)

    验收依据:

    转 ready 挂 auto-merge,跟到 MERGED。


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

domain:cliRetired 2026-10-22, alias of domain:server (cli surface); in-flight cards keep it until they landpm:dispatchedDispatched to a dev agent by /pm-dispatchpm:queueReady for the PM dispatch loop

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions