Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

test(engine): the raw transport line must stay reachable in the app log

purple362899dd6a18
diff --git a/src/api/__tests__/builtin-ensure.test.ts b/src/api/__tests__/builtin-ensure.test.ts
index 1cc7b749..99f06869 100644
--- a/src/api/__tests__/builtin-ensure.test.ts
+++ b/src/api/__tests__/builtin-ensure.test.ts
@@ -117,3 +117,22 @@ describe('ensureBuiltinEngineAlive', () => {
await expect(ensureBuiltinEngineAlive('qwen2.5-0.5b')).rejects.toThrow(/CUDA out of memory/)
})
})
+
+// The translated bubble text may hide the raw Rust line from the user, but a
+// bug report still needs it. The old test pinned the raw text to the bubble;
+// this one pins its replacement path, the app log. Whoever removes the
+// log.warn in explainEngineTransportMessage turns this red.
+import { explainEngineTransportMessage } from '../builtin-ensure'
+import { log } from '../../lib/logger'
+
+describe('explainEngineTransportMessage keeps the raw line reachable', () => {
+ it('logs the verbatim transport error while the bubble gets plain english', () => {
+ const warn = vi.spyOn(log, 'warn').mockImplementation(() => {})
+ const raw = 'proxy_localhost_stream_chunked: error sending request for url (http://127.0.0.1:8127/v1/chat/completions)'
+ const text = explainEngineTransportMessage(raw, 'http://127.0.0.1:8127')
+ expect(text).toMatch(/built-in engine is not answering/)
+ expect(text).not.toContain('proxy_localhost')
+ expect(warn).toHaveBeenCalledWith(expect.any(String), expect.objectContaining({ raw }))
+ warn.mockRestore()
+ })
+})