From 7eb51bd5ff5b92e24526d6737a2b4a3e8e69e78a Mon Sep 17 00:00:00 2001 From: mesalogo Date: Wed, 7 Oct 2026 23:26:37 +0800 Subject: [PATCH] test: isolate utility process database permissions --- src/main/desktop-storage-electron-fixture.ts | 1 + src/main/readonly-query-reader.test.ts | 9 ++++++--- tests/support/desktop-storage-fault-electron-fixture.ts | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/desktop-storage-electron-fixture.ts b/src/main/desktop-storage-electron-fixture.ts index 2f8aae8a..abceea78 100644 --- a/src/main/desktop-storage-electron-fixture.ts +++ b/src/main/desktop-storage-electron-fixture.ts @@ -12,6 +12,7 @@ import { MAGIC_NOTE_MAX_VIDEO_BYTES, type MagicNoteContent } from '../shared/mag import { createHash } from 'node:crypto' const root = process.env.GB_STORAGE_TEST_ROOT! +process.umask(0o077) app.setPath('userData', join(root, 'electron')) async function run(): Promise { diff --git a/src/main/readonly-query-reader.test.ts b/src/main/readonly-query-reader.test.ts index baf5c681..6b18cda4 100644 --- a/src/main/readonly-query-reader.test.ts +++ b/src/main/readonly-query-reader.test.ts @@ -255,9 +255,12 @@ describe('assistant readonly worker', () => { const inFlight = reader.call('listConversationSummaries', [[conversations[3]!.id]]) await reader.terminateWorkerForTest() - // A fast worker may commit the response before termination; the - // dedicated crash tests cover rejection when failure wins the race. - await expect(inFlight).resolves.toEqual(expected[1]) + // Termination races the response. Either outcome is valid here; the + // dedicated crash tests cover deterministic rejection propagation. + await inFlight.then( + result => expect(result).toEqual(expected[1]), + error => expect(error).toBeInstanceOf(ReadonlyWorkerUnavailableError), + ) } finally { database.close() } }, 60_000) diff --git a/tests/support/desktop-storage-fault-electron-fixture.ts b/tests/support/desktop-storage-fault-electron-fixture.ts index 451667a2..983fb886 100644 --- a/tests/support/desktop-storage-fault-electron-fixture.ts +++ b/tests/support/desktop-storage-fault-electron-fixture.ts @@ -5,6 +5,7 @@ import { DesktopStorageClient } from '../../src/main/desktop-storage-client' import { AssistantDatabase } from '../../src/main/assistant/assistant-database' const root = process.env.GB_STORAGE_FAULT_ROOT! +process.umask(0o077) app.setPath('userData', join(root, 'electron')) function killTransport(storage: DesktopStorageClient): void {