test(launchagent): make the macOS command fixture portable on Linux - #5181
Conversation
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
huangruiteng
left a comment
There was a problem hiding this comment.
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
Reviewed exact head: 5181@68eea26d00634246c4a8f2d5ffc12f917620e125.
动机
Ubuntu 完整 public-smoke CI 在 macOS LaunchAgent 夹具中调用 BSD stat -f%z;GNU stat 不支持该参数,导致日志轮转断言失败。
改动思路
只修现有测试夹具:macOS 继续使用真实 BSD stat;其他平台用实际文件的 os.stat 适配这一种 byte-count 调用。三个 zsh prelude 调用复用同一 fixture PATH。
具体改动
单文件30行新增、7行删除。真实 zsh、cp、原打开 descriptor、原字节断言、失败备份保护和小日志保留全部继续执行。完整 smoke 在原生 macOS 和非 macOS 夹具分支通过;Ruff、diff hygiene、公开边界通过。当地非 macOS 分支运行不等同实际 Ubuntu,最终发布 CI 将单独读回。
对主干的风险
仅测试环境适配;生产脚本、阈值、安装 plist、状态与恢复权限没有改变,无需前端或 Lark companion。没有新协议、默认行为、typed 状态规则或强制义务。真正的轮转失败仍由原断言发现,没有扩大 mock 到文件副作用。
我的整体评价
这是一处必要的 CI 修复;保留原有覆盖,复用现有 smoke 并压缩重复 subprocess 调用。符合仓库低风险测试 PR 自合并范围,发布仍等待最终源完整 CI 与安装读回。
English verdict: APPROVE - 68eea26; existing native and non-macOS fixture smokes pass, production launcher unchanged; final-release CI remains separately pending.
Full-public CI runs the macOS LaunchAgent fixture on Ubuntu, where GNU
statcannot read the BSD-f%zargument. Give the existing macOS command fixture a narrow byte-count adapter on non-macOS hosts and use its PATH for the real zsh rotation prelude.The production launcher and retention thresholds are unchanged. The existing open-descriptor rotation, small-log retention, failed-backup protection, status and upgrade assertions all remain.
Validation: the full LaunchAgent smoke passes on native macOS and through the non-macOS fixture branch; Ruff and diff hygiene pass. Actual Ubuntu CI readback follows on this exact branch.