Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
test(device-link): 覆盖共享任务重连同步的故障半径
david1ab729358777
diff --git a/apps/desktop/src/main/device-link/__tests__/sharedTaskHost.test.ts b/apps/desktop/src/main/device-link/__tests__/sharedTaskHost.test.tsindex 60aba87e70..f7119b77a1 100644--- a/apps/desktop/src/main/device-link/__tests__/sharedTaskHost.test.ts+++ b/apps/desktop/src/main/device-link/__tests__/sharedTaskHost.test.ts@@ -211,6 +211,20 @@ describe('task host sharedTask lifecycle', () => {await host.restore();expect(host.needsAuthorityRefresh()).toBe(false);});+ // Fault radius of the reconnect sync: with two guests, an unchanged or failed+ // server read revokes nobody; existing captures stay valid.+ it('keeps every guest of an open share unaffected by reconnect syncs', async () => {+ await host.open('session');+ const capture = host.capturePeer(sharedTaskGuestPeer('sharedTask', 'member-a', 'phone-a'))!;+ vi.mocked(options.revoke).mockClear();+ await host.restore();+ api.list.mockRejectedValueOnce(new Error('offline'));+ await expect(host.restore()).rejects.toThrow('offline');+ expect(options.revoke).not.toHaveBeenCalled();+ expect(canRead('a')).toBe(true);+ expect(canRead('b')).toBe(true);+ expect(capture.isCurrent()).toBe(true);+ });it('allows first sharing after an unshared task is archived and restored', async () => {await host.closeLocallyForBoundary('session');options.readSession = vi.fn(async (id) => ({ id, title: 'Task', status: 'archived' }));diff --git a/apps/desktop/src/main/device-link/__tests__/sharedTaskRuntime.test.ts b/apps/desktop/src/main/device-link/__tests__/sharedTaskRuntime.test.tsindex 56cffec30b..cc9cf2d2d3 100644--- a/apps/desktop/src/main/device-link/__tests__/sharedTaskRuntime.test.ts+++ b/apps/desktop/src/main/device-link/__tests__/sharedTaskRuntime.test.ts@@ -156,6 +156,11 @@ describe('shared runtime stable owner recommit', () => {expect(serverReads()).toBe(4);// The reconnect sync must not reuse a list cached before the reconnect.expect(state.forgetList).toHaveBeenCalledOnce();+ // Fault radius: a reconnect, even with a failed sync, is answered by an HTTP+ // read only; no relay restart and no peer/share revocation.+ expect(relay.start).not.toHaveBeenCalled();+ expect(relay.stop).not.toHaveBeenCalled();+ expect(relay.revoke).not.toHaveBeenCalled();// A failed sync retries after the server interval, not on every local tick.await vi.advanceTimersByTimeAsync(25_000);expect(serverReads()).toBe(4);