Repository navigation
fix(server): keep normalized workspace paths unique - #7354
ralphsmith80 wants to merge 3 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a localized workspace-search bug fix that normalizes and deduplicates server results before they reach the file UI, with focused regression coverage. It introduces no schema, security, deployment, product-default, or static-analysis-policy changes. Notes:
You can add or adjust custom eligibility rules. Learn more. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 696eb7c. Configure here.
|
Note: GPT-6 on behalf of shivam (@shivamhwp).
Normalize and deduplicate the entries after adding directory ancestors, retaining directory precedence. Add the trailing-space directory case alongside the existing filename collision cases. |
Dismissing prior approval to re-evaluate 378f54f
|
Note Written by Hi! We are cleaning up open PRs, and this one appears to have been created with an older model ( |

What this does
Workspace file listings no longer send duplicate paths after wire normalization. A legal Linux or macOS filename with trailing whitespace can no longer make the entire Files panel fail with a duplicate-path error.
Fixes #5501.
Verification
pnpm exec vp test run apps/server/src/workspace/WorkspaceSearchIndex.test.ts(10 tests passed)pnpm --filter t3 typecheckIntentional decisions
The existing project-entry contract trims surrounding whitespace. This change preserves that contract and drops normalized collisions before they reach the client instead of expanding this fix into a wire-format migration.
Generated with GPT-5.6 in the Codex harness through T3 Code.
Note
Low Risk
Scoped to workspace search index mapping and response shaping; no auth or persistence changes, with behavior limited to collapsing paths that only differed after normalization.
Overview
Fixes workspace list/search responses that could emit duplicate
ProjectEntry.pathvalues after wire normalization (e.g. trailing whitespace or newline on an otherwise valid filename), which broke the Files UI with a duplicate-path error (#5501).WorkspaceSearchIndexnow centralizes path shaping innormalizeProjectEntryPath(POSIX, trim then drop trailing/) and runs all file/directory/mixed mappers throughuniqueProjectEntries, which keeps one row per normalized path and prefersdirectoryoverfilewhen both collide.truncatedfor mixed/file results can reflect deduped counts, not only raw index hits.New unit tests cover wire-normalized dedup and the file→directory upgrade when a trailing-space file path collides with a real folder.
Reviewed by Cursor Bugbot for commit 378f54f. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Deduplicate normalized workspace paths in
WorkspaceSearchIndexnormalizeProjectEntryPathinWorkspaceSearchIndex.tsto trim wire-level whitespace before removing trailing directory separators, centralizing path normalization.uniqueProjectEntriesto collapse duplicate paths across file, directory, and mixed search results, with directory entries taking precedence over file entries on collision.truncatedcan be true even when the raw item count is under the limit.Macroscope summarized 378f54f.