Repository navigation
fix(workspace): 修复项目树目录读取误用计算超时 (#2045) - #2056
Merged
Merged
Conversation
1lck
marked this pull request as ready for review
November 16, 2026 14:19
27 of 28 tasks
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
main的冲突,压缩为单个提交合入)PR 类型 / Type
改动说明 / What changes
背景 / Why
Windows 0.8.0 打开一个实际存在、可以正常读取的 Git 项目时,Git 分支与提交记录正常,项目树却显示“读取失败:项目目录不可用”。重复关闭、重新打开仍然失败。日志中的实际错误是
project_tree_list: context deadline exceeded。改动 / Changes
desktop/internal/workbench/filetree.go:项目树每批目录列表改用独立的 30 秒 I/O 限时treeListingTimeout,不再沿用仅用于纯 Core 计算的 2 秒kernelCallTimeout。目录列表会读取磁盘、判断可见子目录并执行 Git 忽略检查;诊断中的原生 Git 检查耗时 2.412 秒,已超过旧限时。desktop/internal/workbench/filetree_test.go:新增TestProjectTreeDirectoryReadsAllowNativeIO(无需真实等待超时的预算回归)和TestProjectTreeDirectoryReadCancelsWhenProjectCloses(受控读取在项目关闭后取消、不恢复已关闭项目)。测试阻塞点由 channel 驱动,断言失败后的清理会释放受控请求。shared/platform-feature-matrix/features/file-explorer.json:补充 I/O 限时的验证动作,并与main上 [Bug] 导入Springboot项目出现异常 #2009(Unix 文件名反斜杠)的验证说明合并;macOS 与 Windows 继续保留partial/pending。.agents/notes/implemented/bug-fix/2026-11-16-project-tree-directory-io-timeout.md:记录 I/O 限时、Core 规则归属、验证范围及独立 Core 优化与本 PR 的边界。冲突处理 / Conflict resolution
main(f6f1dc12e)只有shared/platform-feature-matrix/features/file-explorer.json的verification字段冲突:保留main上 [Bug] 导入Springboot项目出现异常 #2009 的反斜杠文件名验证说明,并在句首加入本 PR 的 I/O 限时验证动作。filetree_test.go自动合并,main新增的TestProjectTreeShowsUnixNamesWithBackslashes与本次新增的两个测试共存;filetree.go无冲突。zhengfuping与原始提交信息),没有其他行为改动。不在本 PR 范围内 / Out of scope
PINNED_CORE_REVISION,可以基于当前固定 Core 独立合入。类型专属:fix
复现与根因
filetree.go将原生目录与 Git I/O 交给kernelCallTimeout;该常量在catalog.go中明确用于通常低于 1 ms 的纯计算。引入路径可追溯到0faecba49/ Epic(0.7.0): 基于 Viva 框架的跨平台方案的迁移(#1794) #1799(git log -S 'a.background(p, kernelCallTimeout')。检查项
TestProjectTreeDirectoryReadsAllowNativeIO修复前失败、修复后通过;本 PR 在解决冲突后的树上运行通过。路径:desktop/internal/workbench/filetree_test.go。pumpTreeListings、listTree、background、closeTree、项目关闭与所有ListDirectories调用;不改变 Core 命令/参数/返回结构、插件或 SDK 消费者。.agents/notes/implemented/bug-fix/2026-11-16-project-tree-directory-io-timeout.md。范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/file-explorer.json的真实验证动作,两端状态不提前标记verified。node scripts/platform-feature-matrix/generate-platform-feature-matrix.mjs --check;改动只涉及验证动作文本,平台实现路径未变化。.artifacts/下生成的矩阵视图。matrix-exempt。插件归属 / Plugin ownership
develop-lithe第三节“插件归属与宿主零依赖”的自查命令,结果为空。core.NewClient(),没有读取具体插件的插件包、仓库检出、构建产物或清单,没有真实插件 ID,没有“缺少插件时跳过”的测试。UI 验证 / UI evidence
N/A:未修改视图、布局、样式、文案、菜单或控件状态实现;变更位于目录 I/O 请求的生命周期边界,项目树行为由无头测试覆盖。
统一日志系统 / Structured logging
界面文案 / i18n
N/A:未新增或修改用户可见文字、翻译或生成文件;已运行
node scripts/i18n/verify-app-language-localization.mjs和node scripts/i18n/generate-i18n.mjs --check,均通过,没有放宽脚本或豁免。逻辑归属 / Logic placement
性能与内存 / Performance and memory
设置 / Settings
N/A:没有设置或配置来源变化。
插件契约 / Plugin contract
N/A:没有插件契约、能力版本、函数协议、宿主方法或通知变化。
发行包与资源 / Bundle and resources
无用代码与重构 / Dead code and refactoring
验证 / Verification
./scripts/desktop/desktop-go.sh test -race -count=1 -p=1 -parallel=1 -timeout=180s -run '^TestProjectTreeDirectoryRead' ./internal/workbench./scripts/desktop/desktop-go.sh test -race -count=1 -p=1 -parallel=2 -timeout=300s -run 'TestProjectTree|TestProjectSearch|TestEverywhere' ./internal/workbenchmain上 #2009 的反斜杠文件名测试node scripts/agent-notes/verify-agent-notes.mjsnode scripts/platform-feature-matrix/generate-platform-feature-matrix.mjs --checknode scripts/i18n/verify-app-language-localization.mjs、node scripts/i18n/generate-i18n.mjs --check./.agents/skills/write-stable-tests/scripts/verify-test-stability.shdevelop-lithe插件零依赖自查命令未能执行的检查和原因: Windows 原生复现与整机验收未在本机执行(原作者已在 Windows amd64 复现并验证该修复);
desktop-go.sh test ./...全量未在本机跑完,本机 Git 子进程存在既有夹具问题,不声称全量测试通过。Desktop CI gate 以本 PR 的 ready 运行结果为准。提交前确认 / Final checks
main创建;目标分支:main。.build/、target/、dist/、.artifacts/等产物,没有凭据、个人路径和未脱敏日志。