Repository navigation
fix(mobile): 提前检查模拟器构建工具并改善诊断流程 - #7814
Conversation
Codex Review SummaryThis 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. |
[Medium impact] The changes affect local Mobile simulator build and identity-check workflows. 本 PR 看起来可以合并;建议补齐 Metro 身份查询超时的诊断回执。 Findings
Fix with agent prompt### Issue 1
apps/mobile/scripts/sim-metro.mjs:240
新增的 5 秒超时会被 `commandOfPid`、`cwdOfPid` 和 `gitSourceOfPid` 的 `catch` 吞掉。如果已找到监听中的 Metro,但其中一次身份查询超时,`whoami` 仍会返回 `probeErrors: []`,把它标成未知进程,甚至提示“没发现 Metro”。开发者因此看不到具体失败项,反而收到启动 Metro 的提示。
建议把查询超时传回 `probeMetroOwnership`,再由 `whoami` 记录,区分检查失败和身份信息确实缺失。
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dbf2b43d1e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
dbf2b43 to
ea628c0
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea628c03d8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
PR #7814 独立代码审查报告(auto / heavy 档)
Findings没有 P0/P1。 (P2 级观察,不阻断、不发帖:a) Rule coverage按 rule-map 读取并逐项核对(只审本 PR 新增/修改的代码与文档):
固定问题逐条:① 单一目的(模拟器构建预检查 + whoami 诊断),描述/测试/风险一致;② 共享符号( Verification实际运行(worktree
CI: Intent alignment
Overallpass —— 没有 P0/P1,原意一致性复核完成且无待裁定的核心方向问题,可以进入 guarded Approve 与合并。合并后需知悉: |
这次改了什么
摘要
模拟器截图任务可能在生成原生工程后才发现缺少 CocoaPods;
whoami又逐端口运行lsof,遇到慢查询时长时间没有进度,容易被误判为需要重新编译。本 PR 保留兼容原生包优先复用的现有机制,补充缓存拒绝原因,在缓存未命中时先检查 Xcode、Simulator SDK 和 CocoaPods,再执行 prebuild。
whoami增加阶段耗时与超时诊断,并将端口查询合并为一次,区分检查失败和没有监听进程。仓库文档补齐工具链准备、截图验收及通用流程与个人配置的边界。已找到监听 PID 后,命令、cwd、源码身份和 Windows 进程快照的查询失败同样传入
probeErrors,附端口、阶段和受限错误码,并抑制“没发现 Metro/启动一个 Metro”的误导提示;回执不包含命令输出或进程环境。Metro 回执和启动提示判断由可直接导入的
inspectSimMetroIdentity统一完成,CLI 与单测调用同一生产入口;单测只注入只读进程 I/O,不读取、截取或执行源码文本。变更类型
feat新功能fix缺陷修复refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
UI 变化
不涉及 App UI。
怎么验证的
自动验证
新增测试均并入已有文件,无新增测试文件、固定端口或真实等待:
simRebuildScript.test.tsmobileSimSource.test.tsinspectMetroListeners;原检查逐端口查询且把错误当空端口mobileSimWhoami.test.tsresolveMobileSimulatorBundleId;原配置解析没有超时分类simNativeIdentity.test.tsinspectSimulatorNativeIdentity;原 unknown 未区分资源缺失与计算失败mobileMetroOwnership.test.tsinspectSimMetroIdentity与probeMetroOwnership;原覆盖只验证端口发现,未验证进程身份错误到回执与提示判断的传递表中执行耗时来自各自的定向验证,单文件墙钟另行标注;没有新增测试文件。既有
simPodInstall.test.ts的真实子进程看门狗测试约 7.9 秒,本 PR 未修改其测试实现。手工验证
node apps/mobile/scripts/sim-whoami.mjs --region=global --mock --json:在dash/mobile-sim-preflight工作目录实际运行约 9 秒,端口探测约 0.7 秒,probeErrors=[];正确识别另一 worktree 的 Metro 为occupied-foreign。没有已启动的目标模拟器,健康检查按预期非零;未接管 Metro,不将其宣称为 App 启动验收。未执行的验证
__DEV__build label 的运行验收证据。风险
风险分类
影响与回滚
提交前检查
git commit -s,见 DCO)