Repository navigation
fix(desktop): 补齐启动所需的 Unicode 11 终端依赖 - #3969
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
你好,这个 PR 的自动评审群已建,麻烦点击链接加入群聊、查看评审意见并跟进后续修改: 另外你暂时不在自动拉群名单里,也可以把 GitHub 账号和飞书信息补进名单文档,补好后后续评审会自动拉你进群:https://bytedance.larkoffice.com/wiki/WJ1nwWbtxi89erkNGNbcgkt9nUe (本条为自动流程发出的提示消息) |
deepcoldy
left a comment
There was a problem hiding this comment.
审查结论:代码层面可合,未发现 P1/P2/P3 问题。
审查对象:head c8b955ab6ba608c47f0e2d3951f8875fdbd3ea01,base 64ada8a24ee7317b976ccfc826ca6cade2cd8521;3 个文件,+9/-2。合并状态为 MERGEABLE。
根因与影响面核验
src/adapters/backend/hc/screen-mirror.ts:9与src/core/traex-first-prompt-readiness.ts:13都在模块顶层静态导入@xterm/addon-unicode11,并经src/worker.ts:529、src/worker.ts:755进入 worker 的静态模块图。生产安装漏包时,Node 会在模块图加载阶段直接抛ERR_MODULE_NOT_FOUND,模块内部兜底没有机会执行。scripts/prepare-desktop-runtime.mjs:49-56使用bun install --production --frozen-lockfile --ignore-scripts --os darwin --cpu '*',因此package.json:78的依赖分类正是桌面运行时是否携带该包的决定因素;bun.lock:12同步移动 workspace 清单,解析条目仍锁定0.9.0,integrity 未变且没有传递依赖。- 其余仍留在 devDependencies 的 xterm 浏览器包只由 dashboard 浏览器入口或构建脚本引用;worker 的 Web 终端 vendor 资源来自生成的内嵌数据,不在运行时逐一
require.resolve这些包。未发现需要随本 PR 一并移动的同类运行时依赖。 test/desktop/desktop-bundled-runtime.test.ts:95-100新增的生产依赖分类断言覆盖了本次回归点,未新增 src 文本快照式断言。
本轮实际验证
bun run test test/desktop/desktop-bundled-runtime.test.ts test/desktop-bundle-contract.test.ts test/hc-screen-mirror.test.ts test/terminal-width-generated.test.ts:4 个文件、49/49 通过。bun run typecheck:通过。bun run build && bun run desktop:bundle:均通过;构建审计与资源审计通过。- 在两个仓库外的空目录中,分别使用 base/head 的清单与锁文件,按桌面脚本相同参数做隔离生产安装:base 的 202 个包中没有该 addon;head 的 203 个包中包含
@xterm/[email protected],并由 Node 实际解析、动态导入,确认Unicode11Addon导出为函数;两种安装均未带入 electron。 - 变异复验:将该包从 dependencies 移回 devDependencies 后,新增用例在
test/desktop/desktop-bundled-runtime.test.ts:99按预期失败;恢复后工作树干净。 - 本机 Bun 为
1.4.4,与packageManager钉版一致;git diff --check通过。
验证边界与 CI
本轮在 Linux 上验证,没有重新执行 macOS Electron 真机启动;PR 描述中的 macOS arm64 打包运行时前后对照覆盖该项。外部 fork 的 workflow 已获批,完整 CI、bun-test、bun-binary 与 PostgreSQL 检查当前已开始排队,合码前仍需等待这些检查在该 head 上全部通过。
|
感谢贡献!这个问题的定位很准确:桌面运行时用 |
|
🚀 Released in v3.59.37 |
问题与修复
在 macOS 桌面版 3.59.35 点击「启动」时,内置 CLI 报
ERR_MODULE_NOT_FOUND: Cannot find package '@xterm/addon-unicode11'。CLI 启动时会加载 HC 的screen-mirror,其中静态导入了这个包。桌面打包脚本使用bun install --production,因此原先列在devDependencies的插件没有进入安装包。将
@xterm/addon-unicode11移入dependencies并同步bun.lock,沿用已锁定的 0.9.0。桌面运行时测试增加了对该生产依赖的检查。验证
scripts/prepare-desktop-runtime.mjs,将生成的运行时解压到仓库外,避免从开发环境加载依赖。用打包脚本提供的 Node 22.20.0 执行dist/cli.js --version,修复前复现上述错误(退出码 1),修复后输出源码版本0.0.0(退出码 0)。bun run build和bun run desktop:bundle均通过。bun run test test/desktop/desktop-bundled-runtime.test.ts test/desktop-bundle-contract.test.ts test/hc-screen-mirror.test.ts test/terminal-width-generated.test.ts通过,共 49 项。新增用例在原依赖清单上失败,调整后通过。