Repository navigation
fix(desktop): 修复大量同层目录导致项目树读取失败 - #2053
Merged
Merged
Conversation
lithe-support
Bot
requested review from
1lck,
Mucheen and
xiaoyumuxi
as code owners
November 16, 2026 13:57
…ge-directory-project-tree # Conflicts: # scripts/desktop/build-desktop-core.sh # shared/platform-feature-matrix/features/file-explorer.json
xiaoyumuxi
deleted the
lithe-support/fix-large-directory-project-tree
branch
November 20, 2026 01:35
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
0d6e16c(含 fix: keep large run logs responsive #72/lithe 0.2.2 #74/[Feature] Windows 工作台 UI 视觉重构 #76/[Feature] Windows 多会话终端与 Git 体验完善 #77),本 PR 固定合并后的 HEAD10fd6f8ae847868a7d5255195bf1a5b9ef84844f。Core docs: add v0.2.2 release notes #73 合入后需把固定版本换成 Core main 上的 commit 再合入本 PR。PR 类型 / Type
改动说明 / What changes
背景 / Why
项目目录存在且可读时,同层有很多被 Git 忽略的目录,项目树仍可能显示“读取失败:项目目录不可用”,用户无法从树中打开文件。
按需列目录的 Core 路径已把
git check-ignore合并查询,却仍为每个 ignored 普通目录单独启动git ls-files,确认其中有没有已跟踪文件。进程启动开销累积后超过桌面端两秒读取预算。Core #60 优化的是全树预取,缺少完整预取答案时仍走这条逐目录路径。改动 / Changes
scripts/desktop/build-desktop-core.sh固定到 Core10fd6f8ae847868a7d5255195bf1a5b9ef84844f(docs: add v0.2.2 release notes #73 合并 Core main 后的 HEAD;原先固定的bad1694基于旧 main5a8d786,会把 main 已固定的 Core fix: keep large run logs responsive #72/lithe 0.2.2 #74/[Feature] Windows 工作台 UI 视觉重构 #76/[Feature] Windows 多会话终端与 Git 体验完善 #77 改动回退掉),接入 docs: add v0.2.2 release notes #73 的按需批量查询:复用tracked_directories,按 16 KiB 路径参数预算分批;保留已跟踪后代、嵌套仓库、无法可靠批量回答时的逐目录回退及取消语义。不增加全树预扫、常驻缓存或新接口。desktop/internal/workbench/filetree_large_directory_visual_test.go:真实临时 Git 仓库、500 个同层忽略目录、真实 Core;检查根目录加载、普通源码目录展开、文件打开后的内容。显式使用vivahead,lithevisual标签,保存浅色中文、深色英文截图,失败时也保留项目树截图。file-explorer.json增加证据和验证动作;macOS、Windows 仍为partial/pending,不把 Linux 无头结果记成两端原生验收。不在本 PR 范围内 / Out of scope
类型专属:fix
复现与根因
.gitignore中忽略generated*/,建立 500 个同层generated*目录和可见源码文件,开启默认 Git 索引排除后打开项目。rust/lithe-core/src/project/indexing.rs::prepare_parent,在候选目录循环内逐个执行ls-files;已核验该 PR diff,HEAD 为1a82ddfa480169c670991132781b05c2552e6b87。迁入独立 Core 仓库后该路径保留,Fix WinUI workspace and editor interactions #60 未移除它。检查项
TestVisualProjectTreeLargeDirectory在旧 Core 下退出码 1、树读取失败,修复后退出码 0,覆盖展开目录及文件内容;Core 进程数量与兼容行为回归见 docs: add v0.2.2 release notes #73。ListDirectories和共享接口;命令、字段、C ABI 与插件协议未变,独立复查未发现阻塞问题。.agents/notes/implemented/bug-fix/2026-11-16-project-tree-batched-git-lookups.md。范围检查 / Scope checks
功能矩阵 / Feature matrix
file-explorer.json的真实证据与验证动作,两端状态不提前升级。git diff --check已在本地合成基线c1541962→a7b31f78再次通过。本地 HEAD 与远端14f3c2cd的 18 个根条目 SHA 全部一致;两轮main更新仅发布资料/元数据,执行源码未变。.artifacts/生成视图。matrix-exempt。插件归属 / Plugin ownership
develop-lithe第三节自查命中为空;新增测试只使用合成临时仓库、系统 Git 和真实 Core,不读取插件包或真实插件 ID。UI 验证 / UI evidence
修复前:Core
5a8d786e9b44a5a8c7a977a8b376264fa941dcd9的项目树读取失败;修复后使用bad169425069788b0b81c6823f87c393b3731376(截图时的 #73 HEAD,Rust 改动与现固定的10fd6f8相同)。桌面执行源码在所测试的主干与本 PR 基线之间完全相同。修复后:浅色 /
zh-Hans,项目树与打开的文件。修复后:深色 /
en-US,项目树与打开的文件。统一日志系统 / Structured logging
N/A:桌面端未新增日志事件或生命周期分支。Core 批量无法回答时保留原逐目录回退、失败信号和宿主读取失败记录;没有逐目录 INFO 输出。旧日志门禁缺失的部分不记为通过。
界面文案 / i18n
N/A:未改产品文案或翻译生成文件;测试文件内容是合成用户数据。仓库要求的 i18n 检查已通过,覆盖 11,362 条词条和两种语言。
逻辑归属 / Logic placement
性能与内存 / Performance and memory
同机 Linux、debug Core C ABI
workspace.listDirectories:停止本地编译与测试后,每个规模使用 3 个全新真实 Git 仓库,旧 Core5a8d786e9b44a5a8c7a977a8b376264fa941dcd9/ 新 Corebad169425069788b0b81c6823f87c393b3731376交替测量。系统 Git 计数 wrapper 仅转发命令,不注入延时。git ls-files调用数每次
git check-ignore始终为 1 次。数据只覆盖上述列目录调用;GUI 整体启动时间、常驻内存和 macOS / Windows 原生耗时不在此次测量范围内。设置 / Settings
N/A:没有设置项或配置来源变化。
插件契约 / Plugin contract
N/A:未修改插件契约、能力版本、宿主方法、通知或 SDK。
发行包与资源 / Bundle and resources
N/A:只更新既有 Core 修订,不新增生产下载、解压或缓存路径。临时仓库由测试清理,截图不入发行包;运行时发行目录只读检查通过。
无用代码与重构 / Dead code and refactoring
验证 / Verification
desktop-go.sh test -json -count=1 -p=1 -parallel=1 -timeout=600s ./...internal/workbench单独补跑-test.count=1 -test.parallel=1 -test.timeout=330s:976 pass、20 skip,退出码 0internal/wslpath末尾包补查no test files,不计作新增测试通过git diff --check均通过全量测试失败的具体归类
TestIntegratedSystemBashReportsEachCommandLineOnce:断言命令开始声明应为一次,实际为 2。该包不依赖 Core;直接用 Go 对未修改源码单独复跑仍出现同一错误,证据与本次 Core pin 无关。TestKeymapAddRecordsTheChordPressedAfterIt:已有夹具使用Ctrl+Alt+Shift+J,而editor.selectAllOccurrences已占用该组合;本次未修改快捷键默认值、夹具或设置窗口实现。TestClosingAnIntegratedShellHangsUpTheShellAndItsJobs、TestClosingAnIntegratedShellRightAfterACommandHangsUpItsJobs:首轮的 Bash 子场景及父测试记录失败;对原样localshell源码单独复跑,两族及全部子场景均通过。这只能说明单独复跑通过,不声称它们在原始基线上稳定失败,也不把首轮失败改记为通过。竞态验证
GOGC=50、GOMEMLIMIT=4GiB,独立编译并串行运行通过,保留首次资源限制记录。其中 500 目录可视化子测试浅色 /
zh-Hans为 5.35 秒、深色 /en-US为 4.48 秒;父测试 9.84 秒,低于 15 秒测试门槛。这些是 race 模式下的测试耗时,性能对照采用上方独立基准。验证范围与限制
LITHE_CORE_RUST_DIR使用对应 Core 检出;修复文件的 Git blob 与远端bad1694已核对一致。当前桌面工作树与远端14f3c2cd的根目录树条目也完全一致;未混用旧 Core 构建产物。Go 测试经过计时执行器生成 JSON、HTML、JUnit 报告,单项门槛 15 秒。提交前确认 / Final checks
lithe-support/fix-large-directory-project-tree,HEAD14f3c2cddd354aa86d0175193bb1d433d228db5a,目标main,已核验基线f6f1dc12e1d15e20cdf6d27c7aa967993df22026。两轮上游更新仅发布资料/元数据,执行源码未变,与本修复四个文件无冲突。