@@ -22,20 +22,15 @@ import {
2222 resolveProjectPath ,
2323 touchMeta ,
2424} from '../../src/main/channels/utils/chat-store' ;
25- import type { ChatKind } from '../../src/types' ;
2625
2726const PROJECT_ID = 'project-a' ;
2827
29- function createChat (
30- projectId : string ,
31- kind : ChatKind = 'general' ,
32- title ?: string
33- ) {
28+ function createChat ( projectId : string , title ?: string ) {
3429 const projectPath = resolveProjectPath ( projectId ) ;
3530 if ( ! projectPath ) {
3631 return null ;
3732 }
38- return touchMeta ( projectPath , randomUUID ( ) , { kind , title } ) ;
33+ return touchMeta ( projectPath , randomUUID ( ) , { title } ) ;
3934}
4035
4136function listChats ( projectId : string ) {
@@ -56,13 +51,13 @@ describe( 'chat-store: multi-chat per project', () => {
5651 } ) ;
5752
5853 test ( 'touchMeta produces distinct ids and they appear in readMetaFile' , ( ) => {
59- const a = createChat ( PROJECT_ID , 'ideas' , ' Ideas' ) ;
60- const b = createChat ( PROJECT_ID , 'draft' , ' Draft' ) ;
54+ const a = createChat ( PROJECT_ID , 'Ideas' ) ;
55+ const b = createChat ( PROJECT_ID , 'Draft' ) ;
6156 expect ( a ) . not . toBeNull ( ) ;
6257 expect ( b ) . not . toBeNull ( ) ;
6358 expect ( a ! . id ) . not . toBe ( b ! . id ) ;
64- expect ( a ! . kind ) . toBe ( 'ideas ' ) ;
65- expect ( b ! . kind ) . toBe ( 'draft ' ) ;
59+ expect ( a ! . title ) . toBe ( 'Ideas ' ) ;
60+ expect ( b ! . title ) . toBe ( 'Draft ' ) ;
6661
6762 const list = listChats ( PROJECT_ID ) ;
6863 expect ( list ) . toHaveLength ( 2 ) ;
@@ -119,10 +114,10 @@ describe( 'chat-store: multi-chat per project', () => {
119114 expect ( bLog ) . not . toContain ( 'hello-a' ) ;
120115 } ) ;
121116
122- test ( 'readMetaFile normalizes legacy entries that predate the kind field' , ( ) => {
123- // Write a pre-migration chats.json: no `kind` key.
117+ test ( 'readMetaFile drops unknown keys (legacy entries with kind still load)' , ( ) => {
124118 const legacyChat = {
125119 id : DEFAULT_CHAT_ID ,
120+ kind : 'general' ,
126121 sessionId : 'legacy-session' ,
127122 createdAt : 1000 ,
128123 lastMessageAt : 2000 ,
@@ -137,7 +132,6 @@ describe( 'chat-store: multi-chat per project', () => {
137132 const list = listChats ( PROJECT_ID ) ;
138133 expect ( list ) . toHaveLength ( 1 ) ;
139134 expect ( list [ 0 ] . id ) . toBe ( DEFAULT_CHAT_ID ) ;
140- expect ( list [ 0 ] . kind ) . toBe ( 'general' ) ;
141135 expect ( list [ 0 ] . sessionId ) . toBe ( 'legacy-session' ) ;
142136 } ) ;
143137
0 commit comments