记录窗口控制 IPC 失败正文

最大化、订阅和窗口控制失败写入 WebView 诊断

补充窗口测试隔离边界
This commit is contained in:
kdletters
2026-10-06 14:13:50 +08:00
parent a56ec5b495
commit 0cd906700f
2 changed files with 38 additions and 5 deletions
@@ -12,6 +12,10 @@ import brandIcon from '../../../../packages/shared/src/icons/taonier-product-ip.
import { APP_NAME } from '../app/appMetadata';
import { appUpdateCheckEnabled } from '../app/featureFlags';
import { ActiveProjectRunsPanel } from '../features/app-shell/ActiveProjectRunsPanel';
import {
appendWebviewLog,
visibleClientErrorMessage,
} from '../services/errorReporting';
import { subscribeTauriEvent } from '../services/tauriEventSubscription';
import { AppUpdateNotice } from './AppUpdateNotice';
import {
@@ -92,7 +96,12 @@ export function WindowChrome({ children }: WindowChromeProps) {
setIsMaximized(maximized);
}
})
.catch(() => undefined);
.catch((error) => {
appendWebviewLog('error', [
'[AGC] 读取窗口最大化状态失败',
visibleClientErrorMessage(error),
]);
});
};
syncMaximizedState();
@@ -109,7 +118,12 @@ export function WindowChrome({ children }: WindowChromeProps) {
unlistenResize = unlisten;
}
})
.catch(() => undefined);
.catch((error) => {
appendWebviewLog('error', [
'[AGC] 窗口 resize 事件订阅失败',
visibleClientErrorMessage(error),
]);
});
return () => {
disposed = true;
@@ -122,7 +136,12 @@ export function WindowChrome({ children }: WindowChromeProps) {
if (!nativeWindow) {
return;
}
await nativeWindow.minimize().catch(() => undefined);
await nativeWindow.minimize().catch((error) => {
appendWebviewLog('error', [
'[AGC] 最小化窗口失败',
visibleClientErrorMessage(error),
]);
});
}
async function toggleMaximizeWindow() {
@@ -134,7 +153,12 @@ export function WindowChrome({ children }: WindowChromeProps) {
.toggleMaximize()
.then(() => nativeWindow.isMaximized())
.then(setIsMaximized)
.catch(() => undefined);
.catch((error) => {
appendWebviewLog('error', [
'[AGC] 切换窗口最大化状态失败',
visibleClientErrorMessage(error),
]);
});
}
async function closeWindow() {
@@ -142,7 +166,12 @@ export function WindowChrome({ children }: WindowChromeProps) {
if (!nativeWindow) {
return;
}
await nativeWindow.close().catch(() => undefined);
await nativeWindow.close().catch((error) => {
appendWebviewLog('error', [
'[AGC] 关闭窗口失败',
visibleClientErrorMessage(error),
]);
});
}
return (
@@ -32,6 +32,10 @@ Direct 的 Tauri 进度、活动回合和 manifest 事件不能忽略 `app.emit`
插件项目路径清理和本地权限审计属于旁路,但失败仍要写 WebView 诊断;旁路不阻断业务不等于可以静默丢失 IPC/I/O 事实。
窗口标题栏的最大化状态读取、resize 订阅、最小化、最大化和关闭失败也要保留 WebView 诊断,不能用空 catch 让原生窗口 IPC 失败无迹可寻。
`WindowChrome.test.tsx` 当前没有在用例间清理挂载的 `WindowChrome`,多用例运行会出现重复标题和重复窗口按钮;这属于测试隔离问题,不能把它误判成窗口 IPC 行为回归。
## 2026-10-03 AGC 随包 plugins 的 feature 档位必须与消费方一致,且门禁会因 build.rs 未重跑而假通过
- **现象**:Windows 本机 `npm run check:generated-bindings`(`npm run lint` 链内,`scripts/check-repository-ci.sh` 的 Repository checks 也走它)在 `build.rs:167:29` panic:`插件随包资源校验失败:随包插件存在未声明文件:.../src-tauri/resources/plugins/agc-godot-editor/native/gdextension/bin/win-x64/agc_godot_editor.dll(目标 x86_64-pc-windows-msvc 与当前 feature 组合不允许;请先执行随包资源准备步骤)`;树上换成 `agc-unity-editor/dotnet/publish/win-x64/Agc.Unity.Attach.exe` 时报同一类错。反向还有更隐蔽的形态:门禁 2 秒就 exit 0 说「通过」,但 tree 上其实带着编辑器产物。