perf(ios-simulator): 构建链路优化(arch 预检 + 缓存复用 + 回收) - #2899
Conversation
|
| Filename | Overview |
|---|---|
| apps/desktop/src/main/mcp-integrations/ios-simulator.ts | 实现共享构建缓存、实时安全回收、同键构建串行化以及不可变产物的 pin 与淘汰生命周期;此前相关进程内竞态在当前 HEAD 中已处理。 |
| packages/ios-simulator-runtime/src/project-adapter.ts | 增加架构预检、App target 识别和受限的 SPM resolved-file 回退;此前错误选择首个 target 的路径已移除。 |
| apps/desktop/src/main/mcp-integrations/tests/ios-simulator.test.ts | 增加缓存 TTL、活动缓存保护、产物 pin/淘汰、符号链接清理和容器级缓存隔离的回归覆盖。 |
| packages/ios-simulator-runtime/src/project-adapter.test.ts | 覆盖多 target 架构选择、架构不匹配和 SPM 回退行为。 |
Reviews (21): Last reviewed commit: "fix(ios-simulator): ARCH 预检文案只指向 app tar..." | Re-trigger Greptile
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 44349254a6
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b9536be675
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
cindy/apps/desktop/src/main/mcp-integrations/ios-simulator.ts
Lines 5695 to 5699 in e185250
When Cindy shuts down or restarts after successful builds, dispose() still calls only appArtifacts.clear() and never invokes discardArtifactCopy, leaving every copied .app on disk even though its in-memory handle is gone. Fresh evidence in the final tree is the unchanged clear-only disposal at line 6376; because later builds refresh the cache directory mtime, these orphaned copies can accumulate indefinitely despite the new stale-cache sweep.
AGENTS.md reference: AGENTS.md:L36-L37
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5cdeff2363
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b0cb35f5b9
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
声称修复后的新证据是 rm 仍为异步操作:最终一次 isSkip 检查结束后,此处会在递归删除期间让出事件循环,而另一个 build_app 可在这时把同一键加入 activeBuildCacheKeys 并启动 xcodebuild。因此,当一个构建回收旧键、另一个构建同时开始使用该键时,DerivedData 或 SPM checkout 仍可能从正在运行的构建下方被删除;应让删除候选参与同一准入锁,并保持占用直到 rm 完成。
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bd660b2b6a
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 347e6036ab
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 976d66cbf0
ℹ️ 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".
|
@BarneyZhaoooo 👋 这个 PR 还有 3 条 review conversation 没 resolve(apps/desktop/src/main/mcp-integrations/ios-simulator.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2aa24a9aee
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b56d257cd5
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 53b4657b80
ℹ️ 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".
53b4657 to
3fa0bba
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3fa0bbac9e
ℹ️ 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".
3fa0bba to
d106270
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d10627062b
ℹ️ 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".
d106270 to
369f87d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 369f87df36
ℹ️ 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".
369f87d to
d880ab5
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d880ab5401
ℹ️ 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".
同一 worktree 反复 build 从分钟级全量降到秒级增量,build 前说清目标 arch。 - arch 预检:build 前 -showBuildSettings 读所有 target 的 ARCHS−EXCLUDED_ARCHS, 定位 .app target,不匹配抛 APP_ARCH_MISMATCH,避免白编译。 - 缓存复用:derivedDataPath/SPM checkout 按 sha256(worktree+arch) 跨 session 复用, 加 -onlyUsePackageVersionsFromResolvedFile(无 resolved 时 fallback resolve)。 - 并发:同 key 进程内互斥 + prune 实时 isSkip 回调 + renameSync 原子分离。 - artifact 生命周期:cp verbatimSymlinks 到 immutable 副本,每 instance 上限 4, install 期间 pin,unpin 归零/dispose 时回收;dispose 等待删除完成。 Refs makecindy#2891 Signed-off-by: han <zhaohan@xd.com>
d880ab5 to
a804d31
Compare
|
⏸️ 本 PR 触发 arch 维护者确认门。 iOS Simulator 构建链路优化涉及架构级改动(约 2000 行),需维护者在 PR 上 Approve 后方可合并。 讨论 issue 已创建,详见上方链接。 讨论 issue:#2958 |
回应 makecindy#2958:prune 按显式 lastUsed,不再把 cache-key 目录 mtime 当最后使用; SPM 仅在 Xcode 明确报 Package.resolved 缺失/不可用时去掉 resolved-file pin 重试。 7 天策略是机会式 TTL,不是磁盘配额。 Refs makecindy#2891 makecindy#2958 Signed-off-by: han <zhaohan@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fa1eaf0dde
ℹ️ 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".
Codex P2:全文分别匹配 Package.resolved 和 missing/no such file,会把 「一行提 lockfile、另一行缺头文件」误判成 resolved 缺失并再跑一轮完整 xcodebuild。改为同一诊断行同时点名 Package.resolved 且表示该文件不可用。 Refs makecindy#2899 makecindy#2958 Signed-off-by: han <zhaohan@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 66bdb67a97
ℹ️ 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".
预检只读 .app 的 ARCHS − EXCLUDED_ARCHS,报错却让用户去查依赖排除, 会把人带到 Pod/SPM。改成说明 app target 有效架构与模拟器需求不匹配。 Refs makecindy#2899 Signed-off-by: han <zhaohan@xd.com>
这次改了什么
摘要
降低用户在 Cindy 里「构建 + 运行 iOS App 到模拟器」的端到端成本(时间 / 失败率 / 磁盘)。四个改动:
-showBuildSettings读ARCHS − EXCLUDED_ARCHS,与目标模拟器架构比对,不匹配提前抛APP_ARCH_MISMATCH——避免「build 出 x86 装不进 arm64 模拟器再换架构全量重编」。对 Pod / SPM / 纯源码一视同仁,读的是 Xcode 最终裁决,不猜真凶、不 pin arch。derivedDataPath/ SPM checkout 由按 session 隔离改为按 worktree+arch 复用,重复 build 走增量(Xcode 自动处理源码变化)。-onlyUsePackageVersionsFromResolvedFile;仅当 Xcode 明确报 Package.resolved 缺失/不可用时,才去掉该参数重试一次。变更类型
refactor/perf重构或性能优化范围
apps/mobile原生配置(不触冷更);不改用户项目的 Podfile/Package.swift;不显式 pin archUI 变化
不涉及
怎么验证的
自动验证
手工验证
不涉及(本机 Xcode 26.5 + arm64,未在真实模拟器 build 跑通全链路)。
未执行的验证
ARCHS/EXCLUDED_ARCHS的 key 名与值格式基于 Xcode 标准 build setting,且用「ARCHS − EXCLUDED_ARCHS」兜底、不依赖NATIVE_ARCH_ACTUAL等版本敏感 key,需在真实项目首跑确认。风险
风险分类
影响与回滚
userData/ios-simulator/projects|spm)备注
pnpm test:unit:related里 desktop 整包有 2 个既有的ghostInstallReceipt失败(still reads normalized setup receipts),已用git stash在干净 main 复现、与本次改动无关,已单开 issue #2897。提交前检查
git commit -s)