Repository navigation
test(workbench): 避免 macOS 项目树取消测试等待未驱动的目录读取(#2221) - #2347
Merged
Merged
Conversation
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.
关联 Issue / Linked issue
PR 类型 / Type
改动说明 / What changes
背景 / Why
macOS CI 的
TestProjectTreeDirectoryReadCancelsWhenProjectCloses偶发filetree_test.go:119: directory read did not start(#2221,失败作业 44554059512、44666328097),阻塞其他 PR 的 macOS CI 通道。本 PR 修复该测试的并发竞态,同步更新跨平台功能矩阵的验证记录并合入最新main。改动 / Changes
desktop/internal/workbench/filetree_test.go:在TestProjectTreeDirectoryReadCancelsWhenProjectCloses中,h.openTree返回后、调用h.app.closeTree(p)、kernel.armed.Store(true)与h.app.listTree(p, "")前,新增h.await("initial project tree listings", func() bool { return treeIdle(p) }),先在窗口线程排空初始目录 listing 与 macOS 递归 watch ready/resync 触发的根目录读取,避免后续listTree因tree.reading == true只进入pending队列而不再触发kernel.ListDirectories。保留 8 秒有界等待、ctx.Done()取消观察、kernel.stopped确认、t.Cleanup释放与关闭项目后不得恢复项目的断言。shared/platform-feature-matrix/features/file-explorer.json:更新file-explorer的verification字段,记录TestProjectTreeDirectoryReadCancelsWhenProjectCloses在 macOS-race -count=50下对初始 listing/watch resync 空闲等待与取消关闭验证的回归证据(两端verificationStatus保持pending,原生窗口仍待实机验收)。origin/main(ec18e02e4)。不在本 PR 范围内 / Out of scope
类型专属:fix
复现与根因
macos-26)跑完整internal/workbench套件时,TestProjectTreeDirectoryReadCancelsWhenProjectCloses偶发等待 8 秒后报错directory read did not start;修复后期望每次都确定性触发ListDirectories并在关闭项目时取消。git log -S或git blame查):TestProjectTreeDirectoryReadCancelsWhenProjectCloses引入于 fix(workspace): 修复项目树目录读取误用计算超时 #2045(e84c2a6fa)。h.openTree只等待首次p.tree.root.listed并调用h.settle()(先h.app.wait()再h.driver.Pump());在启用递归目录监听的平台(macOS/Windows),Pump()期间drainProjectSearchWatch->applyTreeRecursiveWatch->resyncTreeListings会再次调用listTree(p, "")将p.tree.reading置为true。原测试未等待treeIdle(p)即直接closeTree、armed.Store(true)并listTree,导致新的listTree被合并进pending,而测试随即阻塞等待kernel.started不再 Pump 窗口,旧请求回调无法应用,8 秒后超时失败。treeUsesRecursiveWatch() == true)。检查项
desktop/internal/workbench/filetree_test.go的TestProjectTreeDirectoryReadCancelsWhenProjectCloses(修复前 macOS CI 偶发filetree_test.go:119: directory read did not start;修复后本地 macOS-race -count=5050 次全部通过)TestProjectTreeDirectoryReadCancelsWhenProjectCloses在 Windows 与 macOS 共用同一测试代码与treeUsesRecursiveWatch()路径,本次同步修复.agents/notes/implemented/bug-fix/记录:纯单测同步等待修复,未改变生产行为约束范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/<id>.json:已更新shared/platform-feature-matrix/features/file-explorer.json的verification字段;未改变verificationStatus(两端保持pending)./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh;改了平台实现路径的,还运行了./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD.artifacts/下生成的矩阵视图插件归属 / Plugin ownership
develop-lithe第三节“插件归属与宿主零依赖”的自查命令,结果为空shared/i18n/;未改动docs/ci-builds.md、Agent Note 或 SkillUI 验证 / UI evidence
N/A:纯测试同步修复与功能矩阵验证记录更新,无 UI、布局、控件、样式或文案变更。
统一日志系统 / Structured logging
N/A:未新增或修改任何生命周期日志事件或错误处理路径。
界面文案 / i18n
N/A:未新增或修改任何用户可见文案(已运行
verify-app-language-localization.mjs与generate-i18n.mjs --check验证无回归)。逻辑归属 / Logic placement
N/A:未新增或修改任何业务逻辑,仅调整 Go 单元测试等待前置状态空闲。
性能与内存 / Performance and memory
N/A:未改动生产代码、后台任务、缓存或渲染热路径。
设置 / Settings
N/A:未新增或修改任何设置项或设置页。
插件契约 / Plugin contract
N/A:未改动插件契约、能力版本或插件函数协议。
发行包与资源 / Bundle and resources
N/A:未新增或修改运行时资源、缓存或打包步骤。
无用代码与重构 / Dead code and refactoring
refactor标签的 Issue:本次改动范围内未发现既有无用代码或需重构债务验证 / Verification
(cd desktop && gofmt -l .)git diff --check origin/main...HEAD./scripts/desktop/desktop-go.sh vet ./...&vet -tags dev ./..../scripts/desktop/desktop-go.sh test -race -tags 'dev vivahead' -count=50 -run '^TestProjectTreeDirectoryReadCancelsWhenProjectCloses$' ./internal/workbench6.733s)node .agents/skills/write-stable-tests/scripts/run-go-tests-with-timing.mjs -- ./scripts/desktop/desktop-go.sh test -json -tags 'dev vivahead' -count=1 -p=1 -parallel=1 -run '^TestProjectTreeDirectoryReadCancelsWhenProjectCloses$' ./internal/workbench340ms)./scripts/desktop/desktop-go.sh test -tags 'dev vivahead' -count=1 ./internal/workbench356.453s)./.agents/skills/write-stable-tests/scripts/verify-test-stability.sh --base origin/main-race -count=50+ 计时验证)./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEADmatrix change gate passed)./scripts/platform-feature-matrix/verify-platform-feature-matrix.shvalidated 222 platform capabilities)node scripts/i18n/verify-app-language-localization.mjs&node scripts/i18n/generate-i18n.mjs --check&node --test --test-timeout=60000 scripts/i18n/test-i18n.mjs./scripts/agent-notes/verify-agent-notes.shrg自查未能执行的检查和原因:
shared/platform-feature-matrix/features/file-explorer.json两端verificationStatus保持pending。提交前确认 / Final checks
main创建(已合并origin/main);目标分支:main.build/、target/、dist/、.artifacts/等产物,没有凭据、个人路径和未脱敏的日志或截图