Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

chore(desktop): 精简启动期的重复噪声日志

hairyfa33aba7c26fc
diff --git a/src-tauri/src/desktop/notification.rs b/src-tauri/src/desktop/notification.rs
index 3cc23b4e..b61fec30 100644
--- a/src-tauri/src/desktop/notification.rs
+++ b/src-tauri/src/desktop/notification.rs
@@ -251,6 +251,10 @@ pub fn enable_notification_permissions(
};
for origin in origins {
+ // 每个 origin 要写 12 种 permission:逐个 INFO 会在一毫秒内刷出二十多行,
+ // 把 desktop.log 真正有用的行挤走。正常路径只留一条 debug 汇总
+ // (`RUST_LOG=debug` 可见),失败仍逐次告警。
+ log::debug!("[permission] resetting persisted permissions for {origin}");
for kind in permission_kinds() {
let origin_str = origin.clone();
let hstring = HSTRING::from(origin.as_str());
@@ -264,7 +268,6 @@ pub fn enable_notification_permissions(
COREWEBVIEW2_PERMISSION_STATE_ALLOW
};
- log::info!("[permission] setting persisted permission for {origin_str}");
profile4.SetPermissionState(
kind,
&hstring,
diff --git a/src/store/modules/harness/utils.ts b/src/store/modules/harness/utils.ts
index 3e957a19..1cda8b19 100644
--- a/src/store/modules/harness/utils.ts
+++ b/src/store/modules/harness/utils.ts
@@ -85,7 +85,8 @@ export async function checkHealthViaProxy(): Promise<ReadinessProbeResult> {
const lower = result.toLowerCase()
if (lower.startsWith('healthy')) {
- console.warn('[Harness] health check passed:', result.split(' - <!doctype html>')[0])
+ // 正常路径不写日志:探测每次启动至少跑两遍(就绪轮询 + completeReadiness 复核),
+ // 成功噪音只会盖住真正有用的失败重试行。
return {
healthy: true,
notOwned: false,
diff --git a/test/harness-health-logging.test.ts b/test/harness-health-logging.test.ts
new file mode 100644
index 00000000..2eaeddda
--- /dev/null
+++ b/test/harness-health-logging.test.ts
@@ -0,0 +1,39 @@
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import { checkHealthViaProxy } from '../src/store/modules/harness/utils'
+
+const invokeMock = vi.hoisted(() => vi.fn())
+
+vi.mock('@tauri-apps/api/core', () => ({ invoke: invokeMock }))
+
+describe('harness health probe logging', () => {
+ afterEach(() => {
+ invokeMock.mockReset()
+ vi.restoreAllMocks()
+ })
+
+ it('keeps a healthy probe silent so startup noise cannot bury the retry lines', async () => {
+ invokeMock.mockResolvedValue('healthy - 70/70 client modules ready')
+ const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
+
+ const result = await checkHealthViaProxy()
+
+ expect(result.healthy).toBe(true)
+ expect(result.reason).toBe('healthy - 70/70 client modules ready')
+ expect(warn).not.toHaveBeenCalled()
+ })
+
+ it('still records one retry line with the reason when the probe fails', async () => {
+ invokeMock.mockRejectedValue(new Error('HARNESS_NOT_READY: boot page returned 404 Not Found'))
+ const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
+
+ const result = await checkHealthViaProxy()
+
+ expect(result.healthy).toBe(false)
+ expect(result.phase).toBe('process-boot')
+ expect(warn).toHaveBeenCalledTimes(1)
+ expect(warn).toHaveBeenCalledWith(
+ '[Harness] health check failed, retrying:',
+ expect.objectContaining({ message: 'HARNESS_NOT_READY: boot page returned 404 Not Found' }),
+ )
+ })
+})