@@ -76,6 +76,23 @@ describe("groupCatalogSessionsByProject", () => {
7676 expect ( result . ungrouped . map ( ( item ) => item . threadId ) ) . toEqual ( [ "missing" , "blank" ] ) ;
7777 } ) ;
7878
79+ it ( "leaves Windows filesystem roots and root worktrees ungrouped" , ( ) => {
80+ const result = groupCatalogSessionsByProject ( [
81+ session ( "drive-root" , "C:\\" ) ,
82+ session ( "drive-root-worktree" , "c:\\.CLAUDE\\WORKTREES\\fix-1\\src" ) ,
83+ session ( "current-drive-root" , "\\" ) ,
84+ session ( "current-drive-root-worktree" , "\\.claude\\worktrees\\fix-2\\src" ) ,
85+ ] ) ;
86+
87+ expect ( result . groups ) . toHaveLength ( 0 ) ;
88+ expect ( result . ungrouped . map ( ( item ) => item . threadId ) ) . toEqual ( [
89+ "drive-root" ,
90+ "drive-root-worktree" ,
91+ "current-drive-root" ,
92+ "current-drive-root-worktree" ,
93+ ] ) ;
94+ } ) ;
95+
7996 it . each ( [
8097 [ " /Users/dev/openclaw/// " , "/Users/dev/openclaw" , "openclaw" ] ,
8198 [ "C:\\Users\\dev\\openclaw\\" , "C:\\Users\\dev\\openclaw" , "openclaw" ] ,
@@ -109,6 +126,34 @@ describe("groupCatalogSessionsByProject", () => {
109126 ] ) ;
110127 } ) ;
111128
129+ it ( "preserves Windows root kinds while grouping equivalent UNC paths" , ( ) => {
130+ const result = groupCatalogSessionsByProject ( [
131+ session ( "unc-first" , "\\\\Server\\Share\\Project" ) ,
132+ session ( "unc-second" , "\\\\server\\share\\project" ) ,
133+ session ( "current-drive-rooted" , "\\Server\\Share\\Project" ) ,
134+ ] ) ;
135+
136+ expect ( result . groups ) . toHaveLength ( 2 ) ;
137+ expect ( result . groups [ 0 ] ?. sessions . map ( ( item ) => item . threadId ) ) . toEqual ( [
138+ "unc-first" ,
139+ "unc-second" ,
140+ ] ) ;
141+ expect ( result . groups [ 1 ] ?. sessions . map ( ( item ) => item . threadId ) ) . toEqual ( [
142+ "current-drive-rooted" ,
143+ ] ) ;
144+ } ) ;
145+
146+ it ( "keeps an UNC share root groupable as a project root" , ( ) => {
147+ const result = groupCatalogSessionsByProject ( [
148+ session ( "first" , "\\\\Server\\Share\\" ) ,
149+ session ( "second" , "\\\\server\\share" ) ,
150+ ] ) ;
151+
152+ expect ( result . groups ) . toHaveLength ( 1 ) ;
153+ expect ( result . groups [ 0 ] ?. sessions . map ( ( item ) => item . threadId ) ) . toEqual ( [ "first" , "second" ] ) ;
154+ expect ( result . ungrouped ) . toHaveLength ( 0 ) ;
155+ } ) ;
156+
112157 it ( "folds case-varied Windows worktree paths into their origin project" , ( ) => {
113158 const result = groupCatalogSessionsByProject ( [
114159 session ( "direct" , "C:\\Work\\OpenClaw" ) ,
0 commit comments