支持 macOS 通用包构建时的 Node 运行时暂存
Project CI / Frontend tests (push) Has been cancelled
Project CI / Native shell tests (push) Has been cancelled
Project CI / AI game creator shell Rust smoke (push) Has been cancelled
Project CI / AI game creator shell Rust crates (push) Has been cancelled
Project CI / Backend tests (push) Has been cancelled
Project CI / AI game creator shell Rust lane 2/2 (push) Has been cancelled
Project CI / Repository checks (push) Has been cancelled
Project CI / AI game creator shell web tests (push) Has been cancelled
Project CI / AI game creator shell Rust lane 1/2 (push) Has been cancelled

- stage-node-runtime 的 targetRuntime 支持 universal-apple-darwin:在 macOS 宿主上按宿主架构暂存官方 Node(通用包自检按 process.arch 校验),非 darwin 宿主仍失败关闭
- 同步 stage-node-runtime 测试期望:darwin 宿主可用、linux 宿主仍拒绝,Universal Node 合并(lipo)留作未完成项
- 共享记忆记录该限制:当前通用包侧车仍是宿主架构,Intel Mac 需等待真正的通用 Node
This commit is contained in:
2026-09-21 12:15:28 +08:00
parent 9bf35e8745
commit 55cb047654
3 changed files with 35 additions and 2 deletions
@@ -59,12 +59,27 @@ export function readInstalledNodeLicense(
return result.content;
}
export function targetRuntime(target) {
export function targetRuntime(
target,
{ platform = process.platform, arch = process.arch } = {},
) {
const targets = {
'x86_64-pc-windows-msvc': ['win32', 'x64'],
'aarch64-apple-darwin': ['darwin', 'arm64'],
'x86_64-apple-darwin': ['darwin', 'x64'],
};
if (target === 'universal-apple-darwin') {
// Tauri 通用包含 arm64+x86_64 两个 slice,而这里的 Node 便携运行时是
// 「构建宿主架构」的单架构发行版:macOS 构建机(当前为 arm64)只能提供
// 自身架构的官方 Node。真正的通用 Node 需要另行下载另一架构发行版并
// 用 lipo 合并,属未完成项;在此之前 non-darwin 宿主必须失败关闭。
if (platform !== 'darwin') {
throw new Error(
`Node 运行时不支持在 ${platform}/${arch} 宿主构建通用 macOS 包:${target}`,
);
}
return { platform: 'darwin', arch };
}
const value = targets[target];
if (!value) throw new Error(`Node 运行时不支持发布目标:${target}`);
return { platform: value[0], arch: value[1] };
@@ -281,7 +281,21 @@ test('native target and macOS dynamic dependency policy reject nonportable Node'
platform: 'darwin',
arch: 'arm64',
});
assert.throws(() => targetRuntime('universal-apple-darwin'), /不支持/u);
assert.deepEqual(
targetRuntime('universal-apple-darwin', {
platform: 'darwin',
arch: 'arm64',
}),
{ platform: 'darwin', arch: 'arm64' },
);
assert.throws(
() =>
targetRuntime('universal-apple-darwin', {
platform: 'linux',
arch: 'x64',
}),
/不支持在 linux\/x64 宿主构建通用 macOS 包/u,
);
assertPortableMacNode(
'/node:\n\t/usr/lib/libSystem.B.dylib (compatibility version 1)\n',
);
@@ -1,5 +1,9 @@
# 踩坑与排障记录
## macOS 通用包里的 Node 便携运行时仍是宿主架构
`stage-node-runtime.mjs` 只把**构建宿主的 Node** 打成便携运行时(`targetRuntime` 只支持 per-arch 目标),而 `build-macos-ci.mjs` 构建的是 `universal-apple-darwin`2026-09-21 macOS Job #13 因此在 `stageNodeRuntime` 直接抛 `Node 运行时不支持发布目标:universal-apple-darwin`。当前按「通用包 + 宿主架构(arm64 构建机 → arm64Node」放行:`check-macos-bundle.mjs``process.arch` 校验,所以本机自检通过,但**Intel Mac 上该侧车不可执行**。要真正通用需要另行下载另一架构官方 Node 发行版并用 `lipo -create` 合并,同时把 bundle 检查改成接受 `universal` 并核验 `lipo -archs node = arm64 x86_64`;在此之前不得宣称 macOS 通用包在 Intel 上可用。
## release 冷备空间不足会把生产留在维护态
`Genarrative-Stdb-Module-Publish` 先进入维护模式、停掉 API/controller/worker,再执行发布前冷备份;archive 口径要求 `data × 1.1`40.6GiB 数据 → 44.7GiB,加上生产根盘只剩 13.5GiB),于是 2026-09-21 的 release 发布在停服后失败并保持维护态,站点 503 直到人工恢复。规则:空间预检必须先于 `maintenance-on` 与停服;archive 不足且未显式禁用降级时改用 files(`max(data × 0.05, 2GiB)`,不落地本地归档,但 files 不支持 `--defer-upload`,会从 async 收敛为 sync);只有真正开始 `spacetime publish` 之后的失败才允许保持维护态。另:定时备份的失效锁在当前仓库版本会自动清理,但生产机 `/var/lib/genarrative/backup-tools/database-backup-to-oss.mjs` 若是旧版会拒绝抢锁并要求人工删锁,需随 provision 更新。