Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test: protect directory profile identity during discovery replay

Josué6b087f58a77c
diff --git a/desktop-app/src/__tests__/appService.directoryDiscoveryBinding.test.ts b/desktop-app/src/__tests__/appService.directoryDiscoveryBinding.test.ts
index 7bf2da6b7..514e0e248 100644
--- a/desktop-app/src/__tests__/appService.directoryDiscoveryBinding.test.ts
+++ b/desktop-app/src/__tests__/appService.directoryDiscoveryBinding.test.ts
@@ -110,3 +110,15 @@ it('does not route a surviving session through another profile after an index wr
expect(config.getDesktopRuntimeConfigState().activeOptionId).toBe(b.id)
expect(config.config.rpcProxyBaseUrl).toBe('')
})
+
+it('does not persist another directory profile discovery on logout after an index write rejection', async () => {
+ const { service, config, store, b, key, index } = await selectSiblingAfterIndexFailure()
+ await service.logout()
+ expect(service.getCachedUserId()).toBeNull()
+ expect(await store.getSessionToken(key)).toBeNull()
+ expect(config.getDesktopRuntimeConfigState().activeOptionId).toBe(b.id)
+ expect(config.config.rpcProxyBaseUrl).toBe('')
+ // A later successful native save persists B, never A's stale discovery.
+ await service.selectRuntimeConfig(b.id)
+ expect(JSON.parse(await fs.readFile(index, 'utf8')).activeProfileId).toBe(b.id)
+})