收口桌面壳生命周期诊断日志

桌面壳生命周期事件失败只记录固定阶段标签

扩展桌面壳配置门禁禁止生命周期日志输出 Tauri 错误细节

补充宿主壳方案和共享决策中的生命周期诊断边界
This commit is contained in:
2026-06-21 02:35:24 +08:00
parent f262c69041
commit 6066a7be4f
4 changed files with 48 additions and 5 deletions
@@ -2976,6 +2976,7 @@
- 背景:Tauri 桌面壳 `app.lifecycle` 事件会驱动 H5 游戏循环、背景音乐和固定玩法音频暂停 / 恢复;如果 `is_visible()`、`is_minimized()` 或 `is_focused()` 读取失败后静默使用默认值,生命周期状态可能错误且难以排查。
- 决策:`emit_current_desktop_lifecycle_event(...)` 必须通过 `resolve_desktop_lifecycle_window_flag(...)` 读取窗口可见、最小化和焦点状态;读取失败时记录 `desktop host event failed for app.lifecycle.<field>`,再使用保守默认值。桌面壳配置检查拒绝重新出现 `window.is_visible().unwrap_or(...)`、`window.is_minimized().unwrap_or(...)` 或 `window.is_focused().unwrap_or(...)`。
- 2026-06-21 调整:生命周期窗口状态读取失败和 `app.lifecycle` / `navigation.canGoBack` 等桌面宿主事件注入失败只记录固定阶段标签,不把 Tauri 错误详情写入可分发桌面壳 stderr;配置检查拒绝生命周期日志重新输出 `: {error}` 详情。
- 影响范围:`apps/desktop-shell/src-tauri/src/shell/lifecycle.rs`、`apps/desktop-shell/scripts/check-config.mjs`。
- 验证方式:`cargo test --manifest-path apps/desktop-shell/src-tauri/Cargo.toml shell::lifecycle`、`npm run desktop-shell:typecheck`、`npm run check:native-shells`、`npm run check:encoding`、`git diff --check`。