From 17bdae99757659eb28281c2e2c524209cfd31298 Mon Sep 17 00:00:00 2001 From: Menghuan1918 Date: Mon, 5 Oct 2026 02:42:09 +0800 Subject: [PATCH] =?UTF-8?q?docs(fs-search):=20=E8=AF=B4=E6=98=8E=E5=BC=95?= =?UTF-8?q?=E6=93=8E=E8=A1=8C=E9=A2=9D=E4=B8=8E=E6=8E=92=E9=99=A4=E5=90=8E?= =?UTF-8?q?=E7=BD=AE=E8=BF=87=E6=BB=A4=E7=9A=84=E7=9B=B8=E4=BA=92=E4=BD=9C?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 引擎自己的上限(maxMatches + 1 哨兵)在 dispatch 的后置过滤之前生效,所以「前 maxMatches 行恰好全被排除」的根会返回更短的列表但 truncated: true——与遍历被 行额截断时给出的信号一致,不是静默缺口。这条限制写进 dispatch 的文档注释, 避免后人误以为后置过滤能补足到行额。 --- src/fs-search.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/fs-search.ts b/src/fs-search.ts index 48bf6331..183c78d1 100644 --- a/src/fs-search.ts +++ b/src/fs-search.ts @@ -195,6 +195,11 @@ function engineExcludeProbe(root: string, exclude: ExcludeTest): (relativePath: * contract — root-relative, '/'-separated, sorted, and split into * matches/dirs — so the route and the client stay unchanged. A blank query * matches nothing and touches neither the engines nor the filesystem. + * + * The engines keep their own cap (and report it through `truncated`), so a + * root whose first `maxMatches` rows are ALL excluded comes back short with + * `truncated: true` rather than silently hiding the remainder — the same + * signal a budget-cut walk gives. */ export async function searchFiles(root: string, query: string, opts: FsSearchOptions = {}): Promise { const needle = query.trim()