From 5ba127e3322a56cf6d07a5fc7b94516cb94059eb Mon Sep 17 00:00:00 2001 From: mesalogo Date: Thu, 8 Oct 2026 02:16:49 +0800 Subject: [PATCH] test: accept storage readiness loss during crash --- src/main/desktop-storage-electron-fixture.ts | 2 +- tests/support/desktop-storage-fault-electron-fixture.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/desktop-storage-electron-fixture.ts b/src/main/desktop-storage-electron-fixture.ts index 5353632f..073fed24 100644 --- a/src/main/desktop-storage-electron-fixture.ts +++ b/src/main/desktop-storage-electron-fixture.ts @@ -218,7 +218,7 @@ async function run(): Promise { const neverReplayId = randomUUID() await assert.rejects(lost.call('assistant', 'saveLocalConversations', [[{ header: { id: neverReplayId, title: 'Never replay', updatedAt: 123 }, messages: histories - }]]), { code: 'STORAGE_UNCONFIRMED' }) + }]]), error => error?.code === 'STORAGE_UNCONFIRMED' || error?.message === 'Storage is not ready') await assert.rejects(lost.call('assistant', 'listProjects', []), /not ready/) await lost.retry() await lost.ready diff --git a/tests/support/desktop-storage-fault-electron-fixture.ts b/tests/support/desktop-storage-fault-electron-fixture.ts index ac92049d..576d2b1a 100644 --- a/tests/support/desktop-storage-fault-electron-fixture.ts +++ b/tests/support/desktop-storage-fault-electron-fixture.ts @@ -56,6 +56,7 @@ async function run(): Promise { ] requests.push(...Array.from({ length: 40 }, () => storage.call('assistant', 'listConversationSummaries', []))) killTransport(storage) + while (Reflect.get(storage, 'state') !== 'failed') await new Promise(resolve => setImmediate(resolve)) requests.push(storage.call('assistant', 'listConversationSummaries', [])) const settled = await Promise.allSettled(requests) assert.ok(settled.some(result => result.status === 'rejected'))