Skip to content

Commit 11df5c6

Browse files
committed
🤖 Fix: Remove config bypassing in renameWorkspace tests
The renameWorkspace tests were bypassing IPC by manually manipulating config, creating duplicate workspace entries. This caused rename operations to fail in CI. Fixed by removing all manual config.saveConfig() calls - setupWorkspace() already creates workspaces via WORKSPACE_CREATE IPC, which properly adds them to config. _Generated with `cmux`_
1 parent 9ae71fa commit 11df5c6

File tree

1 file changed

+5
-65
lines changed

1 file changed

+5
-65
lines changed

tests/ipcMain/renameWorkspace.test.ts

Lines changed: 5 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,7 @@ describeIntegration("IpcMain rename workspace integration tests", () => {
2626
const { env, workspaceId, workspacePath, tempGitRepo, branchName, cleanup } =
2727
await setupWorkspace("anthropic");
2828
try {
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-
}
29+
// setupWorkspace already creates the workspace and adds it to config via IPC
4230
const oldSessionDir = env.config.getSessionDir(workspaceId);
4331
const oldMetadataResult = await env.mockIpcRenderer.invoke(
4432
IPC_CHANNELS.WORKSPACE_GET_INFO,
@@ -167,19 +155,7 @@ describeIntegration("IpcMain rename workspace integration tests", () => {
167155
const { env, workspaceId, workspacePath, tempGitRepo, branchName, cleanup } =
168156
await setupWorkspace("anthropic");
169157
try {
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-
}
158+
// setupWorkspace already creates the workspace and adds it to config via IPC
183159

184160
// Get current metadata
185161
const oldMetadata = await env.mockIpcRenderer.invoke(
@@ -277,19 +253,7 @@ describeIntegration("IpcMain rename workspace integration tests", () => {
277253
const { env, workspaceId, workspacePath, tempGitRepo, branchName, cleanup } =
278254
await setupWorkspace("anthropic");
279255
try {
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-
}
256+
// setupWorkspace already creates the workspace and adds it to config via IPC
293257
// Send a message to create some history
294258
env.sentEvents.length = 0;
295259
const result = await sendMessageWithModel(env.mockIpcRenderer, workspaceId, "What is 2+2?");
@@ -340,19 +304,7 @@ describeIntegration("IpcMain rename workspace integration tests", () => {
340304
const { env, workspaceId, workspacePath, tempGitRepo, branchName, cleanup } =
341305
await setupWorkspace("anthropic");
342306
try {
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-
}
307+
// setupWorkspace already creates the workspace and adds it to config via IPC
356308

357309
// Send a message to create history before rename
358310
env.sentEvents.length = 0;
@@ -441,19 +393,7 @@ describeIntegration("IpcMain rename workspace integration tests", () => {
441393
const { env, workspaceId, tempGitRepo, branchName, cleanup } =
442394
await setupWorkspace("anthropic");
443395
try {
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-
}
396+
// setupWorkspace already creates the workspace and adds it to config via IPC
457397

458398
// Start a stream (don't await - we want it running)
459399
sendMessageWithModel(

0 commit comments

Comments
 (0)