From 1f3069f3594d9738474a2a5014ac31556e170516 Mon Sep 17 00:00:00 2001 From: digua Date: Sat, 18 Jul 2026 14:42:50 +0800 Subject: [PATCH] fix(data): harden migration cleanup flow Show the pending cleanup notice in CLI Web after initialization while excluding the browser-only runtime.\n\nStub config persistence in the cleanup test so it cannot overwrite the user's real data directory settings. --- packages/node-runtime/src/data-dir-switch.test.ts | 9 ++++++++- src/App.vue | 10 ++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/node-runtime/src/data-dir-switch.test.ts b/packages/node-runtime/src/data-dir-switch.test.ts index 96f988bf..cc22752c 100644 --- a/packages/node-runtime/src/data-dir-switch.test.ts +++ b/packages/node-runtime/src/data-dir-switch.test.ts @@ -274,7 +274,14 @@ test('pending data directory cleanup can be dismissed and deleted explicitly', ( const switchResult = createNodeDataDirSwitch({ systemDir, currentDir, targetDir, migrate: true }) assert.equal(switchResult.success, true) - assert.equal(applyPendingNodeDataDirMigration(systemDir).success, true) + assert.equal( + applyPendingNodeDataDirMigration(systemDir, { + writeConfigField() { + // Config persistence is covered by the preceding adapter-level test. + }, + }).success, + true + ) const [cleanup] = getPendingDataDirCleanups(systemDir) assert.ok(cleanup) diff --git a/src/App.vue b/src/App.vue index 5f2791cd..8fdf4ebf 100644 --- a/src/App.vue +++ b/src/App.vue @@ -21,15 +21,13 @@ import { initServices } from '@/services' import { initPreferencesSync } from '@/composables/usePreferencesSync' import { useWindowsTitleBarOverlay } from '@/composables/useWindowsTitleBarOverlay' import { configureHttpClient } from '@/services/utils/http' -import { IS_ELECTRON } from '@/utils/platform' +import { IS_BROWSER_STANDALONE, IS_ELECTRON } from '@/utils/platform' import { usePlatformService } from '@/services' import { resolvePageTransitionKey } from '@/routes/page-transition-key' import { useLockScreenBootstrap } from '@/components/lock-screen/bootstrap' const LockScreen = IS_ELECTRON ? defineAsyncComponent(() => import('@/components/lock-screen/LockScreen.vue')) : null -const DataDirCleanupNotice = IS_ELECTRON - ? defineAsyncComponent(() => import('@/components/common/DataDirCleanupNotice.vue')) - : null +const DataDirCleanupNotice = defineAsyncComponent(() => import('@/components/common/DataDirCleanupNotice.vue')) const { t } = useI18n() @@ -224,8 +222,8 @@ onUnmounted(() => { - - + +