From a89b99b756371fa7fa2b5b55280cb8bf1a3453b0 Mon Sep 17 00:00:00 2001 From: Nicolas Chiaruttini Date: Mon, 12 Oct 2026 14:51:02 +0200 Subject: [PATCH] fix(projects): match git root when Windows drive letter case differs On Windows, Claude Code can record a project path as `f:/repo` while `git rev-parse` reports the root as `F:/repo`. The exact string compare in groupProjects() then found no root project, producing empty "0 projects" groups on the Projects page and hiding their sessions. Normalize the drive letter to uppercase alongside the existing backslash normalization, and add a regression test. Co-Authored-By: Claude Opus 5.5 --- frontend/src/lib/utils/grouped-projects.ts | 7 +++++-- frontend/src/tests/grouped-projects.test.ts | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/frontend/src/lib/utils/grouped-projects.ts b/frontend/src/lib/utils/grouped-projects.ts index 33c6b27a..9bccc24d 100644 --- a/frontend/src/lib/utils/grouped-projects.ts +++ b/frontend/src/lib/utils/grouped-projects.ts @@ -49,8 +49,11 @@ export function groupProjects(projects: Project[]): GroupedProjects { const nonGitProjects = projects.filter((p) => !p.git_root_path); // Normalize path separators for cross-platform comparison (Windows uses backslashes, - // git outputs forward slashes — normalize both to forward slashes before comparing) - const normalizePath = (p: string) => p.replace(/\\/g, '/'); + // git outputs forward slashes — normalize both to forward slashes before comparing). + // Also uppercase the Windows drive letter: Claude Code may record `f:/repo` while + // git reports `F:/repo`, which would otherwise leave the group with 0 projects. + const normalizePath = (p: string) => + p.replace(/\\/g, '/').replace(/^([a-z]):/, (_, d: string) => d.toUpperCase() + ':'); // Step 2: Group git projects by normalized git_root_path const groupMap = new Map(); diff --git a/frontend/src/tests/grouped-projects.test.ts b/frontend/src/tests/grouped-projects.test.ts index bd2e583c..24df5f80 100644 --- a/frontend/src/tests/grouped-projects.test.ts +++ b/frontend/src/tests/grouped-projects.test.ts @@ -251,4 +251,18 @@ describe('groupProjects — Windows paths', () => { const result = groupProjects(projects as any); expect(result.singleGitProjects).toHaveLength(1); }); + + it('matches project to git root when drive letter case differs', () => { + const projects = [ + makeProject({ + encoded_name: 'f--code-journal', + path: 'f:/code/journal', + git_root_path: 'F:/code/journal', + is_nested_project: false + }) + ]; + const result = groupProjects(projects as any); + expect(result.gitRoots).toHaveLength(0); + expect(result.singleGitProjects).toHaveLength(1); + }); });