Skip to content

fix(search): 补齐注解搜索与保留查询切换的回归 - #2326

Merged
1lck merged 3 commits into
mainfrom
lithe-support/issue-2150-search-text-hint
Nov 24, 2026
Merged

1lck merged 3 commits into
mainfrom
lithe-support/issue-2150-search-text-hint

Conversation

@lithe-support

@lithe-support lithe-support Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

关联 Issue / Linked issue

PR 类型 / Type

  • feat:新功能或用户可见的改进
  • fix:缺陷修复
  • docs:文档、Agent Note、Skill 等规则文件
  • release:稳定版发布准备

改动说明 / What changes

背景 / Why

#2150 报告 v0.8.5 默认“全部”搜索 @xxl 没有结果,切到“文本”则有八行命中。核对当前 main 后确认:#2213 已把 content 加入“全部”的默认来源(desktop/internal/workbench/search_everywhere.go 的 everywhereKinds 包含 file、type、symbol、content),原报告中“全部不搜索正文”的前提已经消失。

现有 TestProjectSearchReadsUnsavedTextAndAllSearchesContents 验证的是编辑器中未保存的普通单词,没有覆盖原报告中的未打开磁盘文件、@ 前缀、大小写不敏感,以及来源过滤后的页签切换。本 PR 补齐这条真实用户流程,沿用已经合入的搜索行为。

改动 / Changes

  • desktop/internal/workbench/search_everywhere_test.go:新增 TestEverywhereAllFindsAnnotationTextAndTextTabRetainsQuery。在临时项目中写入包含八行 @XxlJob 注解的合成 Demo.java,通过顶栏按钮和键盘输入小写 @xxl,使用真实 Core 搜索。
    • 验证默认“全部”返回八条 content 结果、准确路径与行号(i*2+2),且没有打开该文件或依赖语言插件。
    • 点击实际筛选控件关闭“文本”来源,确认“全部”的结果变为空;随后点击独立“文本”页签(scope == 5),确认原查询保留、八条正文结果重新出现。
  • shared/platform-feature-matrix/features/search-global.json:补充 #2150 回归验证动作,保留 macOS/Windows 的原生验收 pending 状态。
  • 合并最新 origin/main(883fce9c6)以对齐最新仓库状态与固定 Core 修订(076ce04e314ecdde790b36ee3f374becb11951a0)。

不在本 PR 范围内 / Out of scope

本 PR 没有改动生产搜索代码、默认范围、界面文案或布局。原建议中的“全部只搜索文件名、类和符号”已不符合当前实现,因此没有加入该提示。macOS/Windows 原生窗口交互验收不在本次无头本地验证内。

类型专属:fix

复现与根因

  • 复现步骤、实际结果、期望结果:v0.8.5 中 everywhereKinds 只有 file、type、symbol,输入 @xxl 在“全部”下无命中;feat(search): 支持分页分组、未保存内容和搜索大小设置 #2213(bcdb1094a04e167fff0b93ae6edef00cb4c8ebba)加入 content 后“全部”直接命中八行注解正文,并在筛选隐藏“文本”后切到“文本”页签保留原查询返回结果。
  • 根因(引入该行为的提交或 PR):原 v0.8.5 everywhereKinds 缺少 content;已由 feat(search): 支持分页分组、未保存内容和搜索大小设置 #2213 修复。原创建分支时使用 Go overlay 仅还原该行三来源清单,新用例在 150 ms 内按预期失败(0 条结果),去掉 overlay 后通过。
  • 影响平台:macOS、Windows、Linux 共用 Viva/Go 与 Rust Core 搜索实现。

检查项

  • 已先写回归测试,确认它在修复前失败、修复后通过;测试路径:desktop/internal/workbench/search_everywhere_test.go(TestEverywhereAllFindsAnnotationTextAndTextTabRetainsQuery),旧三来源语义下输出 annotation search: failed=false, matches=[]; want eight content rows
  • [N/A] 手动复现:原报告关键输入已通过真实 Core 的无头用户流程验证
  • 已搜索被修改函数、类型、契约字段的全部调用方(核对 everywhereKinds、resultKinds、options、updateEverywhere、来源筛选和页签点击路径;“文本”页签不继承“全部”的来源隐藏开关)
  • 已检查另一平台是否有同类缺陷:macOS、Windows、Linux 共用被验证的 Viva/Go 搜索实现
  • 只改了修复所需的代码,没有夹带重构;发现的无用代码或可重构之处:无
  • [N/A] Agent Note:本次不改变行为约束;既有搜索 Note 已记录“全部”包含正文的决策

范围检查 / Scope checks

功能矩阵 / Feature matrix

  • 已更新 shared/platform-feature-matrix/features/search-global.json:补充 #2150 回归验证动作;macOS/Windows 的 verificationStatus 如实保留 pending
  • 已运行 ./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh 和 ./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD(222 项能力通过)
  • 没有提交 .artifacts/ 下生成的矩阵视图
  • [N/A] 不适用:已更新矩阵验证动作

插件归属 / Plugin ownership

  • 已在仓库根目录运行 develop-lithe 第三节“插件归属与宿主零依赖”的自查命令,结果为空
  • 新增测试仅使用临时目录合成 Demo.java 与内联 testKernel(嵌入真实 core.Client),无真实插件 ID、无插件包依赖、无“缺少插件时跳过”
  • 矩阵记录的是宿主正文搜索能力,不引用具体插件
  • 插件文案未写入 shared/i18n/,构建步骤未写入宿主文档
  • [N/A] 插件消费者验证:未修改通用扩展点、协议或 SDK

UI 验证 / UI evidence

N/A:本 PR 无生产 UI、布局、文案或交互状态变更(仅新增测试与功能矩阵验证说明);同时已运行 TestVisualSearch* 确认现有视觉搜索场景通过。

统一日志系统 / Structured logging

N/A:没有新增或修改生产日志、失败路径或用户操作事件。

界面文案 / i18n

N/A:没有新增用户可见文案;i18n 语言与生成物检查通过。

逻辑归属 / Logic placement

N/A:没有新增或修改生产业务逻辑。

性能与内存 / Performance and memory

N/A:没有生产搜索、索引、后台任务、缓存或运行时依赖变更;测试使用单一小型合成文件,无真实时间 sleep,等待使用 h.await 事件唤醒与 8 秒本地期限,退出清理完整。

设置 / Settings

N/A:没有设置项或持久化行为变化。

插件契约 / Plugin contract

N/A:没有插件契约、宿主方法、能力版本或 SDK 变化。

发行包与资源 / Bundle and resources

N/A:没有运行时资源或发行包变化;verify-runtime-bundle-immutability.sh 通过。

无用代码与重构 / Dead code and refactoring

  • [N/A] 本次仅新增回归测试与矩阵验证说明,未使既有代码失去调用方
  • [N/A] 当前范围内未发现需要额外建单的存量问题

验证 / Verification

环境:macOS arm64,Go 1.27.4,固定 Core 076ce04e314ecdde790b36ee3f374becb11951a0(合并 origin/main 883fce9c6 后)。

命令或操作 平台 结果
gofmt -l desktop/ & git diff --check origin/main...HEAD macOS arm64 通过(无输出)
./scripts/desktop/desktop-go.sh vet ./... & vet -tags dev ./... macOS arm64 通过
./.agents/skills/write-stable-tests/scripts/test-stability-macos.sh --package ./internal/workbench -- --filter '^(TestEverywhere|TestSearchPanels|TestProjectSearchReadsUnsavedTextAndAllSearchesContents)' macOS arm64 通过,20/20(TestEverywhereAllFindsAnnotationTextAndTextTabRetainsQuery 100ms,最慢 TestEverywhereFindsPagesAndOpensSelectedFile 740ms;报告 .artifacts/test-stability/index.html)
./scripts/desktop/desktop-go.sh test -race -count=5 ./internal/workbench -run '^(TestEverywhere|TestSearchPanels|TestProjectSearchReadsUnsavedTextAndAllSearchesContents)' macOS arm64 通过(ok ... 20.816s)
./scripts/desktop/desktop-go.sh test -tags 'dev vivahead' -count=5 ./internal/workbench -run '^(TestEverywhere|TestSearchPanels|TestProjectSearchReadsUnsavedTextAndAllSearchesContents)' macOS arm64 通过(ok ... 11.970s)
LITHE_VISUAL_OUTPUT_DIR=... ./scripts/desktop/desktop-go.sh test -tags 'dev vivahead lithevisual' -count=1 ./internal/workbench -run '^TestVisualSearch' macOS arm64 通过(ok ... 7.231s,临时截图目录已清理)
./scripts/desktop/desktop-go.sh test -count=1 ./internal/core -run 'TestEverywhere|TestWorkspaceSearch' macOS arm64 通过(ok ... 1.343s)
./.agents/skills/write-stable-tests/scripts/verify-test-stability.sh --base origin/main macOS arm64 通过(Rust N/A,Go 稳定性已通过计时 + -race + 人工审查确认)
./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD & verify-platform-feature-matrix.sh macOS arm64 通过(222 项能力)
./scripts/agent-notes/verify-agent-notes.sh macOS arm64 通过(204 篇 Note)
node scripts/i18n/verify-app-language-localization.mjs & node scripts/i18n/generate-i18n.mjs --check macOS arm64 通过(12628/12628)
./scripts/desktop/verify/verify-runtime-bundle-immutability.sh macOS arm64 通过
插件零依赖自查 rg & node scripts/desktop/validate-pins.mjs macOS arm64 通过(rg 0 命中;pins 有效可达)

未能执行的检查和原因: macOS/Windows 原生窗口交互验收未在桌面应用界面运行(保持矩阵 verificationStatus: pending);未重跑无关模块全量 Go 测试(仅验证搜索与 Core 搜索受影响包)。

提交前确认 / Final checks

  • 分支已合并最新 origin/main(883fce9c6),目标分支为 main
  • 以 Draft 保留,待评审前由维护者标记 ready
  • 没有无关改动,没有提交 .build/、target/、dist/、.artifacts/、PNG 或 extension-host/
  • 本次测试启动的进程已全部退出,无残留 Lithe 进程

@ghfind-review ghfind-review Bot added the review: no-score ghfind author score missing (not zero) label Nov 23, 2026
@1lck
1lck marked this pull request as ready for review November 23, 2026 17:11
@1lck
1lck merged commit 8ec323d into main Nov 24, 2026
10 checks passed
@1lck
1lck deleted the lithe-support/issue-2150-search-text-hint branch November 24, 2026 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review: no-score ghfind author score missing (not zero)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] 全局搜索「全部」无匹配时提示切换「文本」搜索文件正文

1 participant