Skip to content

fix(server): file search keeps symlinks when a link's name looks like a git pathspec - #42436

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
only21mil:fix/server-workspace-search-ignore-pathspec
Nov 24, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
only21mil:fix/server-workspace-search-ignore-pathspec

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

Problem

When a symlink directly in a repository root (or nested repo root) has a name Git parses as pathspec magic, such as :(link), git check-ignore --no-index -z --stdin exits 128 for the whole batch (fatal: Invalid pathspec magic 'link' in ':(link)'). WorkspaceSearchIndex then treats every symlink in that repository as ignored, hiding all of them from file search (composer @ mentions and quick open).

Change

Because fff skips symlinks, WorkspaceSearchIndex checks their ignore status itself in listGitIgnored (apps/server/src/workspace/WorkspaceSearchIndex.ts). I prefixed each repository-relative stdin path with ./ (pathspec magic only applies to a leading :) and stripped ./ from Git's echoed output before prepending the repository folder. This covers :!x, :^x, and :(glob)*, which exit 128 the same way, as well as plain :link, which Git reads as link and answers wrong in either direction whenever the two have different ignore rules. --literal-pathspecs, GIT_LITERAL_PATHSPECS, and :(literal) are not options because git check-ignore rejects them for every path (exit 128: pathspec magic not supported by this command: 'literal'). The paths are already POSIX (joinEntryPath), and this is the same ./-prefixed stdin input #42333 already sends from WorkspaceEntries.ts on main. In apps/server/src/workspace/WorkspaceSearchIndex.test.ts, I added one git-backed symlink test next to the non-git symlink tests. The test stages ignored-link with git add -f so only listGitIgnored can hide it, which also catches a missing ./ strip.

Scope

Bug fix for wrong data (symlinks missing from file search). No issue: this is a small fix for an obvious bug where one symlink name at a repository root hides every symlink in that repository.

Verification

Steps (Linux): git init demo-project, add .gitignore (ignored-link), create README.md, notes.md, docs/guide.md, and symlinks docs-link -> docs, :(link) -> notes.md, ignored-link -> notes.md → add the folder as a project → new thread → type @link in the composer.

Setup: Linux (Ubuntu 26.04), web client in T3's built-in browser panel, light theme, 1280x800 viewport, fresh isolated dev data per commit (vp run dev --no-seed), synthetic demo repo, server named "Test machine".

54ba240 2b85ab5
@link lists only .gitignore; docs-link and :(link) are missing
@link lists only .gitignore; docs-link and :(link) are missing
@link lists :(link) and docs-link; the gitignored ignored-link stays hidden
@link lists :(link) and docs-link; the gitignored ignored-link stays hidden

Tests (Node 26.13.1): On 54ba240, the new symlink test fails (1 failed | 17 passed); on 2b85ab5, WorkspaceSearchIndex.test.ts passes 18/18 three times (and fails if the ./ strip is removed) and vp run check:changed passes.

Merged tree: 2b85ab5's parent is 54ba240, the newest green upstream main when checked (33 success, 50 skipped, 0 failed), and later main commits do not touch these files or the lockfile.

Test output
# 54ba240 — WorkspaceSearchIndex.test.ts on base source
 FAIL  |t3| src/workspace/WorkspaceSearchIndex.test.ts > keeps symlinks Git does not ignore when a link's name looks like a git pathspec
AssertionError: expected [] to deeply equal [ ':(link)', 'docs-link' ]

- Expected
+ Received

- [
-   ":(link)",
-   "docs-link",
- ]
+ []
 Test Files  1 failed (1)
      Tests  1 failed | 17 passed (18)
# 2b85ab5 run 1
 Test Files  1 passed (1)
      Tests  18 passed (18)
# 2b85ab5 run 2
 Test Files  1 passed (1)
      Tests  18 passed (18)
# 2b85ab5 run 3
 Test Files  1 passed (1)
      Tests  18 passed (18)
# 2b85ab5 check:changed
check:changed summary
  pass  format  0.2s
  pass  lint  0.3s
  pass  knip 1/2  8.0s
  pass  knip 2/2  13.6s
  pass  graphql (apps/server)  0.4s
  pass  typecheck (3 packages)  10.0s
  pass  test (2 files)  12.4s
  CI also runs: full test suites, build
  unused patch check skipped: no dependency files changed

Not checked: Windows and macOS (: is illegal in Windows filenames; the new test skips win32); desktop and mobile clients (same server search; no client code changed); nested repos in the app (same per-repo path with repo-relative paths).

Who tested: An AI agent ran every check.

Generated with Gemini 4 Neon in T3 Code Nightly

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 24, 2026
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 2b85ab5 and 650a294.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The workspace search index now prefixes paths with ./ when checking Git ignore status and removes the prefix from returned paths. A non-Windows regression test covers symlinks with pathspec-like names.

Changes: Git-ignore path handling

Layer / File(s) Summary
Ignore-check path handling and regression test
apps/server/src/workspace/WorkspaceSearchIndex.ts, apps/server/src/workspace/WorkspaceSearchIndex.test.ts
listGitIgnored prefixes submitted paths with ./ and removes that prefix from returned paths. A non-Windows test checks that pathspec-like symlinks remain listed unless Git ignores them, including a force-staged ignored symlink.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge, voltcrash

Merge Risk: Minimal · previous review 2b85a

This change stops symlinks with pathspec-like names from disappearing from file search. The change is small and has a regression test. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(server): file search keeps symlinks when a link's name looks like a git pathspec" matches the main change. The PR prefixes repo-relative paths with './' before calling git check-ignore,…
Description check Passed The description covers the problem, the change, scope, and verification. It follows the template sections: Problem, Change, Scope, Verification. The Problem section explains the failure and its impact…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(server): file search keeps symlinks when a link's name looks like a git pathspec" matches the main change. The PR prefixes repo-relative paths with './' before calling git check-ignore, so symlinks named like pathspec magic (e.g. ':(link)') are no longer hidden from file search. The title is specific and follows conventional commit format. It is 84 characters, which is somewhat long but acceptable.

Full details: Description check

Explanation

The description covers the problem, the change, scope, and verification. It follows the template sections: Problem, Change, Scope, Verification. The Problem section explains the failure and its impact. The Change section explains the './' prefix approach and why alternatives such as --literal-pathspecs were rejected. The Scope section states this is a bug fix and explains why no issue is linked. The Verification section gives concrete steps, before/after screenshots, and test output, and it lists what was not checked (Windows, macOS, desktop, mobile). The template's closing line about naming the model and harness is satisfied by 'Generated with Gemini 4 Neon in T3 Code Nightly'. The description is thorough, and the only possible gap is that the Scope section does not link an issue, but the author explains why none is needed.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 68d6ef6 and 2b85ab5.

Files selected for processing: 2

  • apps/server/src/workspace/WorkspaceSearchIndex.test.ts
  • apps/server/src/workspace/WorkspaceSearchIndex.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 24, 2026
…search-ignore-pathspec

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Created three synthetic Git repositories with committed notes.md, docs/guide.md, and .gitignore ignoring ignored-link. Added untracked symlinks as reported, opened a Replay thread in each, and typed @link. Real web app, Chromium, light theme, 1280×900, fresh database per commit.

Proven: base loses eligible symlinks only when :(link) exists; head shows both eligible symlinks and continues hiding ignored-link. The scenario runner exited 0.

Search Before — 924d9c1fff After — 650a294837
Control Before: control shows docs-link After: control shows docs-link
Renamed Before: plain-link and docs-link visible After: plain-link and docs-link visible
:(link) repository Before: only .gitignore appears After: :(link) and docs-link appear, ignored-link stays hidden
Assertion failure Before: docs-link missing at assertion failure Passed

Scenario source · Before recording · After recording

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 24, 2026
@juliusmarminge
juliusmarminge merged commit edeb3bf into pingdotgg:main Nov 24, 2026
55 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants