Skip to content

localMarkdownImages 单测在 macOS 上因 /var realpath 不匹配而失败(#1134 引入) #1233

Description

@dashhuang

现象

apps/desktop/src/main/im/shared/__tests__/localMarkdownImages.test.ts 的用例「已由 tool_result 收集的同一受管图片只清理正文,不重复追加」在 macOS 上稳定失败(main @ f5d6279 即可复现),Linux CI 不受影响,所以 #1134 合并时门禁是绿的。

原因

该用例把 os.tmpdir() 下未经 realpath 的路径直接放进 existingAbsPaths,而实现侧用 fs.realpath 后的路径做去重比较。macOS 上 /var 是指向 /private/var 的符号链接,两者不相等,于是判定为「未收集过」,absPaths 多出一项:

- "absPaths": [],
+ "absPaths": ["/private/var/folders/.../stored.png"],

建议修法

测试侧把 existingAbsPaths 也过一遍 fs.realpath(与同文件上一个用例的断言写法一致);或实现侧对 existingAbsPaths 归一化后再比较(后者顺带修掉真实调用方传入未归一路径时的同类漏判,建议评估)。

影响

macOS 本地跑全量单测门禁的开发者都会被这条无关失败拦住(在 PR #1230 的门禁运行中撞到,该 PR 未触碰 im/ 目录,已比对与 main 逐字节一致)。

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions