修复AI游戏创作壳跨平台启动
Project CI / Frontend tests (pull_request) Successful in 2m28s
Project CI / Repository checks (pull_request) Successful in 3m17s
Project CI / Backend tests (pull_request) Successful in 10m26s
Project CI / Native shell tests (pull_request) Failing after 6m19s

修复 macOS 下 Unix 文件身份比较和临时目录测试兼容
隔离 AI 游戏创作本地数据库与发布身份并阻止旧 schema 降级启动
完善 Tauri 开发栈错误传播和 POSIX 子进程树清理
跳过 macOS 不支持的进程指标回调以消除周期告警
补充开发调度测试、技术方案和团队排障记忆
This commit is contained in:
2026-07-22 15:21:33 +08:00
parent 017e956724
commit 034a7f6651
10 changed files with 150 additions and 22 deletions
@@ -13,6 +13,7 @@ const viteUrl = `http://${viteHost}:${vitePort}/`;
const viteMarkerUrl = `${viteUrl}__agc_dev_server.json`;
const defaultApiTarget = process.env.RUST_SERVER_TARGET || 'http://127.0.0.1:8082';
const backendDatabase = 'genarrative-game-creator-dev';
const backendSpacetimeDataDir = 'server-rs/.spacetimedb/ai-game-creator/data';
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
function readJson(path) {
@@ -146,9 +147,13 @@ async function isExistingVitePairedWithBackend(apiTarget) {
}
function spawnChild(command, args, options) {
const useShell = process.platform === 'win32';
return spawn(command, args, {
...options,
shell: true,
shell: useShell,
// POSIX 下让每个长驻服务拥有独立进程组,退出时可以连同 npm、
// Node、Cargo 及其子进程一起清理,避免残留订阅任务持续刷日志。
detached: !useShell,
stdio: 'inherit',
});
}
@@ -158,9 +163,17 @@ function stopChild(child, signal = 'SIGTERM') {
return;
}
try {
child.kill(signal);
if (process.platform !== 'win32' && Number.isInteger(child.pid)) {
process.kill(-child.pid, signal);
} else {
child.kill(signal);
}
} catch {
// ignore cleanup races
try {
child.kill(signal);
} catch {
// ignore cleanup races
}
}
}
@@ -200,6 +213,8 @@ async function ensureBackend() {
'--',
'--database',
backendDatabase,
'--spacetime-data-dir',
backendSpacetimeDataDir,
'--no-interactive',
],
{ cwd: appRoot },