修复macOS主机上AGC发布测试未stub Node运行时staging #444
Reference in New Issue
Block a user
Delete Branch "fix/agc-test-node-runtime-stub"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
现象
macOS 渠道构建自 #439 合入后每一轮都在测试阶段失败(#7 之后 #8/#9/#10 全部 2 分钟内 FAILURE):
为什么之前能过、现在不能
同一条测试,检出内容不同:
1655a2eab(#419,02:02)485ed50b2(#439,02:29)合入485ed50b2#6 的检出里不含 #439:那时
runTauriBuild还没有stageRuntime,用例自然通过。#439 之后,runTauriBuild默认调用真实的stageNodeRuntime(target),而渠道注入用例只注入了spawn、没注入stageRuntime,于是真实 staging 被执行:它拿宿主 Node 的platform/arch去比对发布目标,在非 Windows 主机上必然不匹配(macOS 节点是 darwin/arm64,用例的目标是默认的 windows/x64),直接抛错。Windows 主机上宿主与目标一致,所以该缺陷在 Windows 侧不可见。改动
apps/ai-game-creator-shell/scripts/build-release.test.mjs的渠道注入用例补上stageRuntime: () => {},并注明原因。单文件、3 行。验证
build-release.test.mjs37/37 通过。node --test apps/ai-game-creator-shell/scripts/*.test.mjs:92/92 通过(确认没有其它同类跨平台缺陷)。prettier --check、npm run check:encoding、git diff --check通过。本 PR 未解决、需要单独决策的后续阻塞
修完测试阶段后,macOS 构建会在同一条链路的下一个环节失败:
原因:
stage-node-runtime.mjs的targetRuntime只支持x86_64-pc-windows-msvc/aarch64-apple-darwin/x86_64-apple-darwin;而 macOS 渠道按既定方案构建universal-apple-darwin。同时stageNodeRuntime只从当前运行的 Node(process.execPath)取材,无法产出另一种架构的运行时;Rust 侧resolve_at的allow_development为cfg!(debug_assertions),release 构建没有系统 Node 回退,且代码注释明确禁止「随包缺失就静默用系统 Node」。因此 macOS 要恢复发布,必须真正实现 universal 支持:两份架构运行时(含 x64 Node 分发来源与完整性校验)+ Rust 侧按运行架构选择 + 构建期资源映射调整。这涉及安装包体积增加(Node 单架构约数十 MB,双架构接近翻倍)与分发来源选择,属于 #439 能力范围的设计决策,不在本 PR 内擅自实现。
在它落地之前,macOS 渠道构建仍会在构建阶段失败;本 PR 只把失败点从「测试阶段」推进到真实的该阻塞点,并顺带修掉一个在非 Windows 主机上必然复现的测试缺陷。