Skip to content

fix: nested @ file mention lookup and store link button labels#250

Merged
su-fen merged 2 commits into
mainfrom
fix/render-link-button-labels
Jul 23, 2026
Merged

fix: nested @ file mention lookup and store link button labels#250
su-fen merged 2 commits into
mainfrom
fix/render-link-button-labels

Conversation

@su-fen

@su-fen su-fen commented Jul 23, 2026

Copy link
Copy Markdown
Member

概述

修复 #249 报告的两个问题:

1. @ 引用多层嵌套目录下的文件时搜索不到

大仓库中文件索引快照被截断(上限 20k 条)时,前端仍在本地窄化过滤,导致深层嵌套路径的文件永远不出现在候选里。修复后由 mentionSnapshotCoversQuery 单一裁决快照是否覆盖当前查询,不覆盖则重新请求后端检索:

  • 截断快照禁止本地窄化,fetch 在途按悲观 truncated 处理
  • 150ms 防抖 + keepEntries 避免列表闪烁,pending 状态并入 popupLoading
  • Rust 端空 query 也走 20k 候选池按路径浅度排序,保证浅层条目优先
  • 新增 mention-refetch 测试并强制 GUI/WebUI 两端逐字节一致

2. MCP 商店 / Skills 商店详情页“打开外部链接”按钮无任何文字

两端 Button 均为 Base UI useRenderrender 元素自带的 children 会覆盖 Button 自身 children。原代码给 <a> 塞了一个 sr-only span(为通过 biome useAnchorContent 规则),结果把图标和可见文字整体覆盖成隐藏文本,按钮视觉空白。

修复:把图标 + 文字移入 render 的 <a> 元素内部、Button 不留 children(与 ChatHistorySidebar 既有 render 用法一致)。共修复 4 处:GUI/WebUI 的 McpRegistryBrowser.tsxSkillsHubPage.tsx 详情抽屉。

验证

  • 两端 biome check 通过(原 GUI 端 2 个 useAnchorContent error 随修复消除)
  • 两端 tsc --noEmit 无错误
  • mention-refetch 单测覆盖截断快照重取逻辑

Closes #249

🤖 Generated with Claude Code

su-fen and others added 2 commits July 23, 2026 21:33
…uncated

In workspaces with more than 5000 entries the backend caps the mention
list and reports `truncated`, but both composers ignored the flag: the
session fetched once with the empty at-open query and every keystroke
only narrowed that incomplete snapshot locally (the empty string is a
prefix of every query, so the refetch condition never fired). Files
outside the first walk-order batch could never be found by typing.

- Add mentionSnapshotCoversQuery as the single coverage decision: a
  snapshot answers a new query locally only when it is complete for the
  fetched query (or the query is unchanged); anything else goes back to
  the backend. Mirrored byte-identically on both frontends and enforced
  by the new mention-refetch test.
- Track `truncated` on the fetch snapshot, pessimistically true while a
  fetch is in flight and corrected by the response.
- Debounce file refetches (150ms) and keep the current entries while
  loading so fast typing neither walks a large workspace per keystroke
  nor flashes the popup empty; a pending refetch reports as loading
  instead of a premature "no matching files".
- Rust: use the 20k candidate pool for empty queries too so depth-first
  walk order cannot fill the cap from one large directory and drop
  shallow entries; break unconditionally once the pool is full instead
  of walking the remaining tree; sort with sort_by_cached_key.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The Base UI render prop gives the render element's own props priority
over the component's, children included. The external-link buttons in
the MCP store and Skills store detail drawers passed an <a> whose only
child was an sr-only span (added to satisfy biome's useAnchorContent),
so it replaced the Button's icon and visible label with hidden text.

Move the icon and label inside the render <a> element and drop the
Button children, matching the existing render usage elsewhere. Applied
to both GUI and WebUI mirrors of McpRegistryBrowser and SkillsHubPage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@su-fen
su-fen merged commit a22bd6f into main Jul 23, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

项目有多个嵌套式无法找到文件

1 participant