fix(desktop): clarify migration key setup and small-window layout

This commit is contained in:
二丫讲梵 authored and GitHub committed 2026-09-24 12:35:24 +08:00
1 parent 72f1e5e5eb
commit 82a85e6362
13 files changed
+69 -2

No files matched your search

+22
View File
@@ -118,6 +118,28 @@ describe("migration store", () => {
expect(store.state.errorCode).toBe("MISSING_MANAGED_KEY");
});
it("treats an absent platform key as actionable setup before migration", async () => {
const store = useMigrationStore({
migrationStatus: vi.fn().mockResolvedValue({
...pending(),
keyProviderAvailable: false,
keyCreationAllowed: true,
keyStatus: "will_create",
errorCode: "KEY_PROVIDER_UNAVAILABLE",
errorMessage: "The local secret provider is unavailable",
}),
migrationStart: vi.fn(),
migrationRetry: vi.fn(),
migrationCleanupBackups: vi.fn(),
});
await store.initialize();
expect(store.state.error).toBeNull();
expect(store.state.errorCode).toBe("KEY_PROVIDER_UNAVAILABLE");
expect(store.diagnostic().keyStatus).toBe("will_create");
});
it("keeps completion through a failed cleanup and successful cleanup retry", async () => {
let finishCleanup!: () => void;
const cleanup = vi
+2 -1
View File
@@ -22,7 +22,7 @@ export function useMigrationStore(backend: MigrationApi = api) {
// A managed data-directory key is intentionally created when migration
// starts. Its absence during the read-only preflight is actionable, not a
// migration failure, as long as the backend explicitly allows creation.
const hasBlockingError = () => Boolean(state.errorCode && !(state.errorCode === "MISSING_MANAGED_KEY" && state.status?.keyCreationAllowed === true));
const hasBlockingError = () => Boolean(state.errorCode && state.status?.keyStatus !== "will_create" && !(state.errorCode === "MISSING_MANAGED_KEY" && state.status?.keyCreationAllowed === true));
// A retained backup is a recovery asset and must not make the success page
// reappear on later launches. An attempt in this session keeps the wizard
// visible even when its response is lost, until the user enters the app.
@@ -106,6 +106,7 @@ export function useMigrationStore(backend: MigrationApi = api) {
state: s?.state,
counts: s ? { connections: s.connectionCount, databasePlaintext: s.databasePlaintextCount, plugin: s.pluginSecretCount, ai: s.aiSecretCount, tunnel: s.tunnelSecretCount, sync: s.syncCredentialCount } : {},
keyProviderAvailable: s?.keyProviderAvailable,
keyStatus: s?.keyStatus,
backupPath: s?.backupPath,
errorCode: state.errorCode,
};