Repository navigation
refactor(ui): 用复制助手替代手写重写,并让单测文件真正进入 CI - #102
Merged
Merged
Conversation
- Express / Marketplace models now expose one with(...) helper that enumerates every
stored field; six duplicated full memberwise constructions are gone.
- MockMarketplaceRepository.updateItem silently dropped typeID (edited items kept
showing the old category) and ownedByCurrentUser. The helper preserves both and now
applies the draft's typeID; RemoteMarketplaceRepository.fetchItemDetail uses the
same helpers.
- New guard tests fail when a stored field is added without updating with(...), and
cover the edit / state-change regressions.
- Convert the unit-test target to a PBXFileSystemSynchronizedRootGroup. Six existing
test files were on disk but never compiled by CI; adding a test file can no longer
be silently ignored.
Verification: swiftc -parse / -typecheck on changed sources and tests, a compiled
executable exercising both helpers, plutil -lint plus reference-integrity check on the
project file, check_localization.py (0 errors), check_hygiene.py (0 errors), and an
equivalent of check_style.sh over all 363 tracked Swift files (0 violations). Xcode is
unavailable locally (CommandLineTools only), so the simulator unit-test run remains for
CI.
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. |
Pigbibi
force-pushed
the
refactor/untangle-ios
branch
from
November 12, 2026 18:30
e658e5e to
0016bf3
Compare
ProfileViewModelTests passed an async call into XCTAssertTrue's autoclosure, which does not support concurrency and fails to compile. The error was latent: this file was on disk but never part of the test target, so it had never been compiled. Making the target a synchronized group surfaced it, which is the point of that change.
The only synchronous test in this @mainactor class crashed the runner with "malloc: pointer being freed was not allocated" while constructing the view model, then passed after the automatic restart. Its async siblings build the same view model and mock repository without incident, so the sync invocation is what differs. Like the rest of the class it tests main-actor state, so declaring it async keeps it on the actor's executor instead of relying on XCTest's synchronous main-actor hop. The file had never been compiled before this branch, so the crash was latent rather than a regression from the model-copy change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动内容
把 Express / Marketplace 六处整结构体重写收成一个
with(...)复制助手,并修掉两处因手写重写导致的数据丢失;同时把单测 target 改成文件系统同步组,让新增测试文件真正进入 CI。不改会怎样
MockMarketplaceRepository.updateItem在重建MarketplaceItem时漏掉typeID和ownedByCurrentUser:用户编辑商品分类后,列表仍显示旧分类;"我发布的"标记也会被抹掉。编译器不会报错——少传一个参数只是用了默认值。怎么验证的
swiftc -parse/-typecheck:改动文件与两个新测试文件均通过。typeID、ownedByCurrentUser等字段被保留。plutil -lint通过;另做了 pbxproj 引用完整性检查(412 个对象、0 个悬空引用)。check_localization.py:0 errors;check_hygiene.py:0 errors。./Tools/check_style.sh未直接执行成功:脚本对全部 Swift 文件逐个 spawngrep(约 900 次),在本机沙箱里被反复终止。改用等价实现(Python 遍历 363 个受跟踪 Swift 文件检查 tab 与行尾空白)验证,0 violations;CI 里跑原脚本。./Tools/build_simulator.sh未在本地执行:本机只装了 CommandLineTools,没有 Xcode 与 iPhone SDK。这是本 PR 唯一的验证缺口,模拟器单测依赖Unit Tests/Build Smoke两个 CI 检查,请以它们为准再合并。检查清单
check_style.sh因沙箱限制改用等价检查,build_simulator.sh因缺 Xcode 交由 CIlocal.properties或环境配置文件涉及隐私、权限或数据流的改动
不涉及。仅涉及客户端内存中的模型复制与 Xcode 工程的测试文件引用方式,未改变网络请求、存储或日志。
关联 Issue
无。
AI 辅助
使用 WorkBuddy 内的 DeepSeek-V4.1-Flash 完成重复构造定位、助手实现与守卫测试编写。
风险
R1(客户端内部重构 + 工程文件变更)
Features/Express、Features/Marketplace共 6 个源文件,2 个新增测试文件,以及project.pbxproj。.pbxproj里删掉了显式测试文件引用、改为PBXFileSystemSynchronizedRootGroup,与 app target 已有的机制一致。副作用是那 6 个此前从未编译的测试文件会第一次进入 CI,如果它们本身有问题,会在这里暴露——这是预期行为,不是本 PR 引入的缺陷。我已静态核对它们引用的 app 符号全部存在。with(...)助手是新增方法,回退后调用点恢复原写法。