@@ -26,7 +26,19 @@ describeIntegration("IpcMain rename workspace integration tests", () => {
2626 const { env, workspaceId, workspacePath, tempGitRepo, branchName, cleanup } =
2727 await setupWorkspace ( "anthropic" ) ;
2828 try {
29- // setupWorkspace already creates the workspace and adds it to config via IPC
29+ // Add project and workspace to config via IPC
30+ await env . mockIpcRenderer . invoke ( IPC_CHANNELS . PROJECT_CREATE , tempGitRepo ) ;
31+ // Manually add workspace to the project (normally done by WORKSPACE_CREATE)
32+ const projectsConfig = env . config . loadConfigOrDefault ( ) ;
33+ const projectConfig = projectsConfig . projects . get ( tempGitRepo ) ;
34+ if ( projectConfig ) {
35+ projectConfig . workspaces . push ( {
36+ path : workspacePath ,
37+ id : workspaceId ,
38+ name : branchName ,
39+ } ) ;
40+ env . config . saveConfig ( projectsConfig ) ;
41+ }
3042 const oldSessionDir = env . config . getSessionDir ( workspaceId ) ;
3143 const oldMetadataResult = await env . mockIpcRenderer . invoke (
3244 IPC_CHANNELS . WORKSPACE_GET_INFO ,
@@ -155,7 +167,19 @@ describeIntegration("IpcMain rename workspace integration tests", () => {
155167 const { env, workspaceId, workspacePath, tempGitRepo, branchName, cleanup } =
156168 await setupWorkspace ( "anthropic" ) ;
157169 try {
158- // setupWorkspace already creates the workspace and adds it to config via IPC
170+ // Add project and workspace to config via IPC
171+ await env . mockIpcRenderer . invoke ( IPC_CHANNELS . PROJECT_CREATE , tempGitRepo ) ;
172+ // Manually add workspace to the project (normally done by WORKSPACE_CREATE)
173+ const projectsConfig = env . config . loadConfigOrDefault ( ) ;
174+ const projectConfig = projectsConfig . projects . get ( tempGitRepo ) ;
175+ if ( projectConfig ) {
176+ projectConfig . workspaces . push ( {
177+ path : workspacePath ,
178+ id : workspaceId ,
179+ name : branchName ,
180+ } ) ;
181+ env . config . saveConfig ( projectsConfig ) ;
182+ }
159183
160184 // Get current metadata
161185 const oldMetadata = await env . mockIpcRenderer . invoke (
@@ -253,7 +277,19 @@ describeIntegration("IpcMain rename workspace integration tests", () => {
253277 const { env, workspaceId, workspacePath, tempGitRepo, branchName, cleanup } =
254278 await setupWorkspace ( "anthropic" ) ;
255279 try {
256- // setupWorkspace already creates the workspace and adds it to config via IPC
280+ // Add project and workspace to config via IPC
281+ await env . mockIpcRenderer . invoke ( IPC_CHANNELS . PROJECT_CREATE , tempGitRepo ) ;
282+ // Manually add workspace to the project (normally done by WORKSPACE_CREATE)
283+ const projectsConfig = env . config . loadConfigOrDefault ( ) ;
284+ const projectConfig = projectsConfig . projects . get ( tempGitRepo ) ;
285+ if ( projectConfig ) {
286+ projectConfig . workspaces . push ( {
287+ path : workspacePath ,
288+ id : workspaceId ,
289+ name : branchName ,
290+ } ) ;
291+ env . config . saveConfig ( projectsConfig ) ;
292+ }
257293 // Send a message to create some history
258294 env . sentEvents . length = 0 ;
259295 const result = await sendMessageWithModel ( env . mockIpcRenderer , workspaceId , "What is 2+2?" ) ;
@@ -304,7 +340,19 @@ describeIntegration("IpcMain rename workspace integration tests", () => {
304340 const { env, workspaceId, workspacePath, tempGitRepo, branchName, cleanup } =
305341 await setupWorkspace ( "anthropic" ) ;
306342 try {
307- // setupWorkspace already creates the workspace and adds it to config via IPC
343+ // Add project and workspace to config via IPC
344+ await env . mockIpcRenderer . invoke ( IPC_CHANNELS . PROJECT_CREATE , tempGitRepo ) ;
345+ // Manually add workspace to the project (normally done by WORKSPACE_CREATE)
346+ const projectsConfig = env . config . loadConfigOrDefault ( ) ;
347+ const projectConfig = projectsConfig . projects . get ( tempGitRepo ) ;
348+ if ( projectConfig ) {
349+ projectConfig . workspaces . push ( {
350+ path : workspacePath ,
351+ id : workspaceId ,
352+ name : branchName ,
353+ } ) ;
354+ env . config . saveConfig ( projectsConfig ) ;
355+ }
308356
309357 // Send a message to create history before rename
310358 env . sentEvents . length = 0 ;
@@ -393,7 +441,19 @@ describeIntegration("IpcMain rename workspace integration tests", () => {
393441 const { env, workspaceId, tempGitRepo, branchName, cleanup } =
394442 await setupWorkspace ( "anthropic" ) ;
395443 try {
396- // setupWorkspace already creates the workspace and adds it to config via IPC
444+ // Add project and workspace to config via IPC
445+ await env . mockIpcRenderer . invoke ( IPC_CHANNELS . PROJECT_CREATE , tempGitRepo ) ;
446+ const projectsConfig = env . config . loadConfigOrDefault ( ) ;
447+ const projectConfig = projectsConfig . projects . get ( tempGitRepo ) ;
448+ if ( projectConfig ) {
449+ const workspacePath = env . config . getWorkspacePath ( tempGitRepo , branchName ) ;
450+ projectConfig . workspaces . push ( {
451+ path : workspacePath ,
452+ id : workspaceId ,
453+ name : branchName ,
454+ } ) ;
455+ env . config . saveConfig ( projectsConfig ) ;
456+ }
397457
398458 // Start a stream (don't await - we want it running)
399459 sendMessageWithModel (
0 commit comments