Repository navigation
fix(search): bound workspace queries with cancellable multi-root snapshots - #1116
Open
kogekiplay wants to merge 3 commits into
Open
kogekiplay wants to merge 3 commits into
kogekiplay wants to merge 3 commits into
Conversation
kogekiplay
force-pushed
the
fix/memory-search-latest
branch
from
November 10, 2026 10:13
62da274 to
b64ef86
Compare
Collaborator
|
codeg work task |
kogekiplay
force-pushed
the
fix/memory-search-latest
branch
from
November 11, 2026 02:47
b64ef86 to
c4c095c
Compare
kogekiplay
marked this pull request as ready for review
November 11, 2026 02:56
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.
工作区搜索原来会在输入框挂载时把整个目录列表送进每个渲染端,并生成路径、小写副本和 JS 对象。一个真实工作区此前测得 5,308,089 条条目、970,417,831 字节 JSON;旧客户端仅启动页面就发起 8 次全量列表请求。
本 PR 将发现、索引和排名留在原生端。前端只接收当前查询的结果(API 最多 200 条),输入框挂载和关闭的搜索窗口都不触发发现。已补齐原草稿的调度、多根缓存和超预算复用问题。
实现
tempfile::tempfile,Unix 创建即 unlink,Windows delete-on-close;取消、失败、淘汰和进程退出都关闭文件。无需新增数据库依赖或持久目录迁移。list_workspace_files或 prepare 调用。实现与边界见
docs/workspace-search-design.md。验证
基于最新官方 main
c340c76e34075da83602712e07352b543e6aa380,本次提交c4c095c8。cargo check、clippy --all-targets --features test-utils -- -D warnings通过。Desktop 完整 tests(含集成及 doc tests)共 6,784 项通过、7 项忽略,仅过滤下述本机网络测试;相关签名测试单独及最终全量复跑通过。cargo check、完整 lib/bin tests(6,366 项通过、6 项忽略)和clippy -D warnings通过,最终 head 复验同样通过。MCP-onlycargo check和clippy -D warnings也通过。本机既有测试限制:
commands::remote_proxy::tests::an_event_socket_gets_past_an_address_that_never_answers在本机 IPv6/TEST-NET 超时场景下失败,单独复跑也超时。相关remote_proxy.rs与官方 main 逐字节相同,本 PR 未改这项测试;完整未过滤首轮失败如实保留,最终本地 desktop 轮次仅过滤这一项。当前 head 的远端 CI 单独核对。真实大目录测量与限制
在
/Users/kogeki/dev的真实大目录上(debug binary、并行进行其他测试),连续三次查询只遍历 1 次:快照 833,353,343 B(约 795 MiB),保留 compact-index bytes 为 0;单独测试进程物理 footprint 峰值约 109.4 MiB、末次约 17.4 MiB。该测量在 basename 剪枝的最后一次小优化前完成,只用于证明发现复用/预算行为,不冒充最终 head 的性能基准。
磁盘评分仍为 O(N),首次发现和超大目录的后续查询仍可能慢;这不是常数时间索引,也不能证明整个 Codeg 的长期内存增长已全部解决。嵌套 ignore/普通文件变化按 5 分钟 TTL 或显式 refresh 更新。内存预算针对索引、构建及评分工作集,OS page cache、文件遍历器和进程其他模块不在此会计内。
Refs #1097