Skip to content

[Bug][dsh] dsh-ledger treats the peer suffix after the version in pnpm lockfile as part of the version: healthy profiles | [Bug][dsh] dsh-ledger 把 pnpm lockfile 里版本后面的 peer 后缀当成版本的一部分:健康的 profile 被报 copy-vs-lock,bili doctor --fix 还会改写 lockfile #6320

Open

Description

@BBleae

摘要

src/dsh-ledger.ts 读 pnpm lockfile 时,把 importer 条目里 version: 的整串当成版本号。包本身(或它依赖的某个包)有 peer、而项目又满足了这个 peer 时,pnpm 会在解析出的版本后面接一段 peer 后缀,于是 dsh profile 三本账(manifest 声明 / lockfile 记录 / 盘上副本)明明一致,也会被判成漂移:审计报 copy-vs-lock,bili doctor --fix 再去「修」,把这一行改写掉。

对照的代码是 master 的 c26c31ace(package.json 里的版本是 0.1.213)。

lockfile 长什么样

importers:
  .:
    dependencies:
      billion-context:
        specifier: 0.1.213
        version: 0.1.213(@types/node@16.9.1)

这种写法在真实的 DSH profile 里就有(pnpm v9 lockfile,后缀是 (@types/node@…)),不是少见的形状。

现在的行为

  • readPnpmLockResolution 把 0.1.213(@types/node@16.9.1) 整串作为 lockVersion 返回,dshProfileLedgerFindings 拿它和副本的 0.1.213 按字符串比较。健康的 profile 因此出一条 copy-vs-lock finding;master 上调用这项审计的 bili doctor --fix(fixDshLedgers)会把它当成要修的漂移。
  • patchNestedEntries 也是这样比的,所以 convergeDshLedger(bili doctor --fix,以及原地更新之后的收敛)会把这一行改写成不带后缀的 version: 0.1.213。

影响

  • 什么都没漂移的 profile 也会被写一次 lockfile。
  • 写完以后 importer 指向 billion-context@0.1.213,而 snapshots: 下的键还是 billion-context@0.1.213(@types/node@16.9.1),两处对不上。

重现

  1. 准备一个 pnpm v9 lockfile:importer 里 billion-context 的 version: 带 peer 后缀(如上),packages: 下是不带后缀的键,snapshots: 下是带后缀的键;manifest 声明和盘上副本都是 0.1.213。
  2. 对这个 profile 跑账本审计(dshProfileLedgerFindings):lockVersion 读出来是 0.1.213(@types/node@16.9.1),出现一条 copy-vs-lock finding。
  3. 跑收敛(bili doctor --fix):importer 那一行被改成 version: 0.1.213,pnpm-lock.yaml 被写了一次。

预期:lockVersion 是不带后缀的版本,三本账一致时没有 finding、一个字节都不写。

相关

这两条讲的都不是 peer 后缀;搜了 peer suffix、copy-vs-lock、lockVersion,没有找到讲这件事的 issue。

修复在 #6314。

Activity

  1. changed the title [-][Bug][dsh] dsh-ledger 把 pnpm lockfile 里版本后面的 peer 后缀当成版本的一部分:健康的 profile 被报 copy-vs-lock,bili doctor --fix 还会改写 lockfile[/-] [+][Bug][dsh] dsh-ledger treats the peer suffix after the version in pnpm lockfile as part of the version: healthy profiles | [Bug][dsh] dsh-ledger 把 pnpm lockfile 里版本后面的 peer 后缀当成版本的一部分:健康的 profile 被报 copy-vs-lock,bili doctor --fix 还会改写 lockfile[/+] on Nov 12, 2026
  2. ranxianglei commented on Nov 12, 2026

    @ranxianglei
    Owner

    该issue已按根因归类纳入 [storage] 根因汇总 #6267,由汇总单统一跟踪处理;本单不再单独跟进,故关闭。如认为归类有误或问题仍未解决,请直接回复,会重新打开。

  3. ranxianglei commented on Nov 12, 2026

    @ranxianglei
    Owner

    状态更正(自动化脚本误操作): 本单此前被「纳入根因聚合」流程误关闭, 现重新打开。机器人工作已停, 本单由根因聚合线程统一跟踪, 根因修复落地后请手动关闭或在本单回复「close」。
    [automated: re-open after bot-stop-only policy]

  4. ranxianglei commented on Nov 12, 2026

    @ranxianglei
    Owner

    重新打开:此前被归类聚合脚本误关。按 owner 口径,纳入根因聚合的 issue 只停机器人、不关闭,由根因聚合线程统一跟踪,根因修复落地后统一关闭。
    (reopened: absorbed issues must not be closed, only bot work stopped — owner policy 2026-11-12)

  5. ranxianglei commented on Nov 12, 2026

    @ranxianglei
    Owner

    (更正)此前按"清理"口径误关闭;按 owner 口径纠正:被根因聚合纳入的 issue 只停机器人、不关闭。本 issue 重新打开,机器人工作已停。

  6. ranxianglei commented on Nov 12, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

    (ai: vllm-qwen/qwen3.8-27b)

    收到,确认 owner 口径(2026-11-12):本单已纳入 [storage] 根因汇总 #6267 统一跟踪,机器人在本单上的工作已停止。

  7. ranxianglei commented on Nov 12, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

    (ai: vllm-qwen/qwen3.8-27b)

    已核实(live)当前状态:

    按 owner 口径(2026-11-12):本单机器人工作已停,不单独跟进、不重复关闭;待 #6314 合并后由聚合线程统一关闭。本条为最终确认,后续不再在本单做任何机器人操作。

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions