From e32dedcf4c0f45470303eba6ed66e10c21097c72 Mon Sep 17 00:00:00 2001 From: Tam Nhu Tran Date: Wed, 25 Feb 2026 17:00:39 +0700 Subject: [PATCH] fix(api): remove stale legacy profile target mappings - delete profile_targets entry when deleting a legacy API profile - prune empty profile_targets object to avoid config drift --- src/api/services/profile-writer.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/api/services/profile-writer.ts b/src/api/services/profile-writer.ts index fa8ff9c4..f90455c2 100644 --- a/src/api/services/profile-writer.ts +++ b/src/api/services/profile-writer.ts @@ -251,6 +251,12 @@ function removeApiProfileUnified(name: string): void { function removeApiProfileLegacy(name: string): void { const config = loadConfigSafe(); delete config.profiles[name]; + if (config.profile_targets) { + delete config.profile_targets[name]; + if (Object.keys(config.profile_targets).length === 0) { + delete config.profile_targets; + } + } const configPath = getConfigPath(); const tempPath = configPath + '.tmp';