Skip to content

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

TypeScript

fix(desktop): keep ipc harness mocks and uncapped fetch wiring intact (review follow-ups)

Mfd09a2e5cc90
diff --git a/desktop-app/src/gfs/uriHandler.ts b/desktop-app/src/gfs/uriHandler.ts
index 5e650fe9d..62b26f597 100644
--- a/desktop-app/src/gfs/uriHandler.ts
+++ b/desktop-app/src/gfs/uriHandler.ts
@@ -457,10 +457,16 @@ export class GfsClient {
`/api/v1/me/gfs/proxy/${resource.resourceId}?drive=${encodeURIComponent(resource.drive)}`
)
try {
- const bytes = await this.transport.fetchBytes(proxyUrl, token, {
- maxBytes: opts?.maxBytes,
- signal: opts?.signal,
- })
+ // The unbounded call keeps the exact 2-arg `fetchBytes` signature so
+ // existing callers stay byte-for-byte unchanged; any bound or
+ // cancellable call passes the opts object.
+ const bytes =
+ opts?.maxBytes !== undefined || opts?.signal !== undefined
+ ? await this.transport.fetchBytes(proxyUrl, token, {
+ maxBytes: opts?.maxBytes,
+ signal: opts?.signal,
+ })
+ : await this.transport.fetchBytes(proxyUrl, token)
return { resource, bytes }
} catch (error) {
throw surfaceGfsGrantError(error)
diff --git a/desktop-app/test/gfsUriHandler.test.ts b/desktop-app/test/gfsUriHandler.test.ts
index 1c2172faa..0591f0233 100644
--- a/desktop-app/test/gfsUriHandler.test.ts
+++ b/desktop-app/test/gfsUriHandler.test.ts
@@ -109,8 +109,7 @@ describe('GfsClient.download', () => {
expect(new TextDecoder().decode(bytes)).toBe('hello')
expect(t.fetchBytes).toHaveBeenCalledWith(
`https://api.example/api/v1/me/gfs/proxy/${RID}?drive=main`,
- 'tok',
- { maxBytes: undefined, signal: undefined }
+ 'tok'
)
})
})
diff --git a/desktop-app/test/ipc.prewarm.test.ts b/desktop-app/test/ipc.prewarm.test.ts
index 8e24efd01..08a3377c3 100644
--- a/desktop-app/test/ipc.prewarm.test.ts
+++ b/desktop-app/test/ipc.prewarm.test.ts
@@ -7,6 +7,9 @@ const testState = vi.hoisted(() => {
handle: vi.fn((channel: string, handler: (...args: unknown[]) => unknown) => {
handlers.set(channel, handler)
}),
+ // The real ipcMain also carries event listeners (gfs:abort); registration
+ // must not depend on them being exercised.
+ on: vi.fn(),
}
return { handlers, ipcMainMock }
})
diff --git a/desktop-app/test/ipc.test.ts b/desktop-app/test/ipc.test.ts
index 98940595b..ce99607c4 100644
--- a/desktop-app/test/ipc.test.ts
+++ b/desktop-app/test/ipc.test.ts
@@ -18,6 +18,9 @@ const testState = vi.hoisted(() => {
handle: vi.fn((channel: string, handler: (...args: unknown[]) => unknown) => {
handlers.set(channel, handler)
}),
+ // The real ipcMain also carries event listeners (gfs:abort); registration
+ // must not depend on them being exercised.
+ on: vi.fn(),
}
return { handlers, ipcMainMock, downloadsDir }
})