Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test: replace R7-L5 planted discovery state with native producers
Josué8bb1e9eecc68
diff --git a/desktop-app/src/__tests__/appService.discoveryLifecycle.test.ts b/desktop-app/src/__tests__/appService.discoveryLifecycle.test.tsindex bae0a5567..c902b63b0 100644--- a/desktop-app/src/__tests__/appService.discoveryLifecycle.test.ts+++ b/desktop-app/src/__tests__/appService.discoveryLifecycle.test.ts@@ -108,6 +108,24 @@ describe('RPC discovery lifecycle through native producers', () => {expect(config.config.rpcProxyBaseUrl).toBe('')})+ it('retires pending discovery when a durable RPC endpoint is configured on the same profile', async () => {+ const { service, config, rest } = await fixture()+ await service.googleLogin('synthetic-google-token')+ await service.getDependenciesHealth()+ await service.saveRuntimeConfig({+ externalRestApiBaseUrl: rest,+ rpcProxyBaseUrl: 'https://durable-rpc.example.test',+ })+ expect(+ (service as unknown as { pendingRuntimeConfigDiscovery: unknown })+ .pendingRuntimeConfigDiscovery+ ).toBeNull()+ expect(config.config.rpcProxyBaseUrl).toBe('https://durable-rpc.example.test')+ expect(service.getCachedUserId()).toBeNull()+ await service.getDependenciesHealth()+ expect(config.config.rpcProxyBaseUrl).toBe('https://durable-rpc.example.test')+ })+it('drops discovery for A that settles after native setup has selected B', async () => {const { service, config, rest, rpc, discovery } = await fixture()await service.googleLogin('synthetic-google-token')diff --git a/desktop-app/src/__tests__/appService.runtimeConfigResolution.test.ts b/desktop-app/src/__tests__/appService.runtimeConfigResolution.test.tsindex d29bc0d02..5377422e3 100644--- a/desktop-app/src/__tests__/appService.runtimeConfigResolution.test.ts+++ b/desktop-app/src/__tests__/appService.runtimeConfigResolution.test.ts@@ -260,31 +260,39 @@ describe('AppService runtime config discovery ownership', () => {authClient: {getDesktopEnvironment: ReturnType<typeof vi.fn>googleLogin: ReturnType<typeof vi.fn>+ getMe: ReturnType<typeof vi.fn>+ health: ReturnType<typeof vi.fn>}- restoreSavedSessionInFlight: Promise<unknown>- restoreSavedSessionReservationStarted: boolean- pendingRuntimeConfigDiscovery:- | (DesktopEnvironmentDiscovery & { profileId: string | null })- | null- }- app.restoreSavedSessionInFlight = Promise.resolve({ authenticated: false })- app.restoreSavedSessionReservationStarted = true- app.pendingRuntimeConfigDiscovery = {- profileId: runtimeConfig.getDesktopRuntimeConfigState().activeOptionId,- externalRestApiBaseUrl: restA,- rpcProxyBaseUrl: 'https://rpc-discovered.example.test',- appName: 'Environment A',+ getDependenciesHealth: () => Promise<unknown>}+ const restoredMe = deferred<ReturnType<typeof testSessionMe>>()+ const restoreStarted = deferred<void>()+ const { RpcProxyClient } = await import('../rpcProxyClient.js')+ vi.spyOn(RpcProxyClient.prototype, 'health').mockResolvedValue({ status: 'ok' })+ service.tokenStore.getSessionToken.mockResolvedValue('synthetic-saved-session')app.authClient = {- getDesktopEnvironment: vi.fn().mockResolvedValue({- externalRestApiBaseUrl: restA,- rpcProxyBaseUrl: 'https://rpc-discovered.example.test',- appName: 'Environment A',- }),+ getDesktopEnvironment: vi+ .fn()+ .mockRejectedValueOnce(new Error('initial discovery unavailable'))+ .mockResolvedValue({+ externalRestApiBaseUrl: restA,+ rpcProxyBaseUrl: 'https://rpc-discovered.example.test',+ appName: 'Environment A',+ }),googleLogin: vi.fn().mockResolvedValue(testLoginResult('session-token-a', testSessionMe())),+ getMe: vi.fn(() => {+ restoreStarted.resolve()+ return restoredMe.promise+ }),+ health: vi.fn().mockResolvedValue({ status: 'ok' }),}+ const restore = service.getSessionState()+ await restoreStarted.promise+ await app.getDependenciesHealth()await service.googleLogin('google-token-a')+ restoredMe.resolve(testSessionMe())+ await restoreconst rpcAwareEnvKey = runtimeConfig.getDesktopRuntimeConfigState().envKeyexpect(rpcAwareEnvKey).not.toBe(restOnlyEnvKey)@@ -324,13 +332,21 @@ describe('AppService runtime config discovery ownership', () => {| nullgetEffectiveRpcProxyBaseUrl: () => string}- app.effectiveRuntimeRpcEndpoint = {- profileId: optionA.id,- externalRestApiBaseUrl: restA,- rpcProxyBaseUrl: 'https://rpc-discovered.example.test',- appName: 'Environment A',- }- app.pendingRuntimeConfigDiscovery = app.effectiveRuntimeRpcEndpoint+ const { AuthClient } = await import('../authClient.js')+ vi.spyOn(AuthClient.prototype, 'getDesktopEnvironment')+ .mockRejectedValueOnce(new Error('initial discovery unavailable'))+ .mockResolvedValue({+ externalRestApiBaseUrl: restA,+ rpcProxyBaseUrl: 'https://rpc-discovered.example.test',+ appName: 'A',+ })+ vi.spyOn(AuthClient.prototype, 'googleLogin').mockResolvedValue(testLoginResult())+ vi.spyOn(AuthClient.prototype, 'health').mockResolvedValue({ status: 'ok' })+ const { RpcProxyClient } = await import('../rpcProxyClient.js')+ vi.spyOn(RpcProxyClient.prototype, 'health').mockResolvedValue({ status: 'ok' })+ await service.googleLogin('synthetic-google')+ const { AppService } = await import('../appService.js')+ await (service as unknown as InstanceType<typeof AppService>).getDependenciesHealth()await service.selectRuntimeConfig(optionB.id)