From 4d8b5f9251390fa4ea0d1dd951406b2f44e5a12f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Veith=20R=C3=B6thlingsh=C3=B6fer?= Date: Mon, 22 Dec 2025 11:19:35 +0100 Subject: [PATCH 1/5] Don't try to delete non-existent files --- src/tools/sync/yml.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/tools/sync/yml.ts b/src/tools/sync/yml.ts index d94e74f..e40a7fd 100644 --- a/src/tools/sync/yml.ts +++ b/src/tools/sync/yml.ts @@ -192,7 +192,7 @@ export const cleanupFilesystem = ({ newTestCases: SyncTestCase[]; destination: string | undefined; }) => { - const rootFolderPath = destination ?? "./"; + const rootFolderPath = destination ?? process.cwd(); const existingtestCases = readTestCasesFromDir(rootFolderPath); @@ -203,6 +203,7 @@ export const cleanupFilesystem = ({ for (const testCase of newTestCases) { const existingTestCase = existingTestCasesById.get(testCase.id); if (existingTestCase) { + // This does not hold if the test was moved to a different dependency const existingTestCasePath = buildFilename( existingTestCase, rootFolderPath, @@ -211,9 +212,19 @@ export const cleanupFilesystem = ({ rootFolderPath, existingTestCasePath.replace(/\.yaml$/, ""), ); - - if (existingTestCase.description !== testCase.description) { - fs.unlinkSync(path.join(rootFolderPath, existingTestCasePath)); + const oldFilePath = path.join(rootFolderPath, existingTestCasePath); + + if ( + existingTestCase.description !== testCase.description || + existingTestCase.dependencyId !== testCase.dependencyId + ) { + if (fs.existsSync(oldFilePath)) { + fs.unlinkSync(oldFilePath); + } else { + console.log( + `Looking for old file ${oldFilePath} but it does not exist`, + ); + } if (fs.existsSync(oldFolderPath)) { fs.rmSync(oldFolderPath, { recursive: true, force: true }); From f67e65f07ff5597a7702cce7af555c2de66d8569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Veith=20R=C3=B6thlingsh=C3=B6fer?= Date: Mon, 22 Dec 2025 11:24:04 +0100 Subject: [PATCH 2/5] Comments --- src/tools/sync/yml.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/tools/sync/yml.ts b/src/tools/sync/yml.ts index e40a7fd..e537111 100644 --- a/src/tools/sync/yml.ts +++ b/src/tools/sync/yml.ts @@ -200,10 +200,15 @@ export const cleanupFilesystem = ({ existingtestCases.map((tc) => [tc.id, tc]), ); + // There is generally a bigger issue here: + // We need a better check what changed locally. + // Imagine you rename a test case remotely, and then you locally change steps in child test case. + // Then you pull, and you local changes will just be deleted. + // Same applies for changing the dependency, as it will be in a different folder. We also don't clean up these folders properly. + for (const testCase of newTestCases) { const existingTestCase = existingTestCasesById.get(testCase.id); if (existingTestCase) { - // This does not hold if the test was moved to a different dependency const existingTestCasePath = buildFilename( existingTestCase, rootFolderPath, @@ -220,10 +225,6 @@ export const cleanupFilesystem = ({ ) { if (fs.existsSync(oldFilePath)) { fs.unlinkSync(oldFilePath); - } else { - console.log( - `Looking for old file ${oldFilePath} but it does not exist`, - ); } if (fs.existsSync(oldFolderPath)) { From 1521c290acccdc2e2f98b8403370e26e0ba77048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Veith=20R=C3=B6thlingsh=C3=B6fer?= Date: Mon, 22 Dec 2025 14:14:46 +0100 Subject: [PATCH 3/5] Remove unneeded line --- src/tools/sync/yml.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tools/sync/yml.ts b/src/tools/sync/yml.ts index e537111..727a7ce 100644 --- a/src/tools/sync/yml.ts +++ b/src/tools/sync/yml.ts @@ -220,8 +220,7 @@ export const cleanupFilesystem = ({ const oldFilePath = path.join(rootFolderPath, existingTestCasePath); if ( - existingTestCase.description !== testCase.description || - existingTestCase.dependencyId !== testCase.dependencyId + existingTestCase.description !== testCase.description ) { if (fs.existsSync(oldFilePath)) { fs.unlinkSync(oldFilePath); From 0cbcbec67844de7436a1257395029414f7b8e3d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Veith=20R=C3=B6thlingsh=C3=B6fer?= Date: Mon, 22 Dec 2025 14:16:19 +0100 Subject: [PATCH 4/5] biome --- src/tools/sync/yml.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/tools/sync/yml.ts b/src/tools/sync/yml.ts index 727a7ce..f0aa73e 100644 --- a/src/tools/sync/yml.ts +++ b/src/tools/sync/yml.ts @@ -219,9 +219,7 @@ export const cleanupFilesystem = ({ ); const oldFilePath = path.join(rootFolderPath, existingTestCasePath); - if ( - existingTestCase.description !== testCase.description - ) { + if (existingTestCase.description !== testCase.description) { if (fs.existsSync(oldFilePath)) { fs.unlinkSync(oldFilePath); } From 4196a2cd884b5243e7d167eee429e89461b7fcf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Veith=20R=C3=B6thlingsh=C3=B6fer?= Date: Mon, 22 Dec 2025 14:18:37 +0100 Subject: [PATCH 5/5] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 878d004..6d524ca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@octomind/octomind", - "version": "3.8.0", + "version": "3.8.1", "description": "a command line client for octomind apis", "main": "./dist/index.js", "packageManager": "pnpm@10.26.0+sha512.3b3f6c725ebe712506c0ab1ad4133cf86b1f4b687effce62a9b38b4d72e3954242e643190fc51fa1642949c735f403debd44f5cb0edd657abe63a8b6a7e1e402",