Files
apes-sidebar/docs
NolanHo 0d9fee85b8 fix(fs-search): direct-open for pasted paths + fragment path matching (#879)
A query carrying a path separator can never match an entry NAME — names
never contain separators — so pasting any path into the search box was
structurally guaranteed to return {matches:[],truncated:true} while the
walk burned its full 100k-visit budget (measured: 1.9s on a Rust repo
whose two worktree forests alone held 97k entries; real directories were
never reached).

searchFiles now routes by query shape, all three modalities sharing one
result contract:

- A query naming one path (absolute, ~/…, ./x, ../x) resolves through
  resolveTarget — the SAME primitive fs.read uses, so ~ expands (#713),
  dot-anchored spellings join onto the session cwd, and win32
  WSL/dsh-remote namespaces reinterpret — then stats the target. The hit
  is the RESOLVED path (resolve() strips shell-completion trailing
  separators, which the client's exact-string row comparisons could never
  match); a missing target answers empty immediately. Directory targets
  ride the #801 dirs contract. The exclude pref does not apply: a pasted
  path is explicit intent, same as the fs.read the click performs.
- A separator-carrying relative fragment (records/exp1) matches by
  root-relative PATH in the walk; the engines are name matchers (fd has
  no --full-path here, rg's globs are single-segment) so argv
  construction is untouched.
- Plain name queries are unchanged, and no NAME query is stolen: on
  POSIX a backslash is a name character (the ~\ gesture counts only on
  win32; util.ts~ / ~$doc.docx / .env stay name queries).

SKIP_DIR_NAMES gains the budget-eating forests seen in the wild:
.worktrees/.worktree (git worktree layouts), target, venv/.venv and
__pycache__ — shared by the walk and both engine argvs as before.

Client: a directory hit OUTSIDE the cwd (newly reachable via the paste
branch) only clears the query — the tree is cwd-rooted, and the old
ancestorDirs call synthesized junk expanded entries for foreign paths.

Verified: vitest fs-search/smoke/search-persist suites green; full run
2171 passed with one failure proven pre-existing on the clean tree
(git.spec checkout case, host git lacks --end-of-options; #841);
typecheck/lint clean.
2026-10-06 08:25:30 -07:00
..