From 296502333768b8908d5eddc4df5b8f4d9d538458 Mon Sep 17 00:00:00 2001 From: Suzumiya Date: Tue, 6 Oct 2026 18:40:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(agc):=20=E4=BF=AE=20Linux=20=E7=9B=AE?= =?UTF-8?q?=E6=A0=87=E4=B8=8B=E8=A2=AB=E6=96=B0=E8=AD=A6=E5=91=8A=E9=97=A8?= =?UTF-8?q?=E7=A6=81=E5=88=A4=E6=AD=BB=E7=9A=84=E4=B8=A4=E4=B8=AA=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=20crate=EF=BC=88CI=20=E7=BA=A2=E5=9B=A0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因(CI run 3572 的 job 日志):godot-editor-bridge 的 src/files.rs:346 `pub fn verified_module_path` 在 Linux 库构建里无调用方(唯一库内调用点在 platform.rs 的 #[cfg(windows)] 分支),被切片一新增的 [lints.rust] warnings = "deny" 判为 `-D dead-code` 错误;5 个 job(Rust lane 1/2、lane 2/2、Rust crates、Native shell tests、Repository checks)全部死在这一条上。 修法(godot):给 `verified_module_path` 加 `#[cfg(any(windows, test))]` 并补 3 行文档说明——Windows 库路径才是它的活调用方,跨平台单测 official_loader_copy_requires_exact_parent_and_trusted_bytes 继续在 Linux 覆盖该逻辑;不新增 allow、不删测试、不改实现。 修法(unity):tests/protocol.rs 里 Windows-only 用例(shared_service_executes_serially_and_retains_uncertain_state_across_instances)专用的 2 条 import(editor_adapter_api::EditorAdapter、unity_editor_bridge::{configure_helper_candidates, disconnect_unity_editor, execute_unity_editor_code_for_project, UnityEditorAdapter})与 `fn project()` helper 补上与该用例一致的 `#[cfg(all(windows, target_arch = "x86_64"))]`;Linux 侧仍保留 helper_timeout_eof_oversized_frame_and_blocked_write_are_bounded 用例。 验证(本地复现 CI 的 Linux 口径:cargo check --target x86_64-unknown-linux-gnu --all-targets + 门禁):godot bridge RC=0、unity bridge RC=0、cocos bridge RC=0;3 个 exclude crate(agent-runtime-core / agent-runtime-orchestration / editor-adapter-api)RC=0;platform-agent 仅因本机缺 x86_64-linux-gnu-gcc 交叉编译器而失败(环境性,CI 原生 Linux 构建)。 验证(Windows 口径不变):unity bridge --all-targets RC=0、godot bridge --all-targets RC=0;godot 单测 30 passed(含受影响用例)、unity 单测 12 passed + 集成 3 passed,全 0 failed。 验证(仓库检查):npm run check:rustfmt(4 个 workspace)rc=0、npm run check:encoding rc=0(5406 文件)、git diff --check rc=0;零新增 #[allow]。 --- .../agc-godot-editor/native/godot-editor-bridge/src/files.rs | 5 +++++ .../native/unity-editor-bridge/tests/protocol.rs | 3 +++ 2 files changed, 8 insertions(+) diff --git a/plugins/agc-godot-editor/native/godot-editor-bridge/src/files.rs b/plugins/agc-godot-editor/native/godot-editor-bridge/src/files.rs index 0cc8e5a53..2a4b98807 100644 --- a/plugins/agc-godot-editor/native/godot-editor-bridge/src/files.rs +++ b/plugins/agc-godot-editor/native/godot-editor-bridge/src/files.rs @@ -343,6 +343,11 @@ pub fn verify_dll_hash(path: &Path, expected: &str) -> Result<(), String> { } /// Godot 4.7 的 Windows 编辑器 loader 只允许在同目录派生 ~ 前缀副本。 +/// +/// 库内只有 Windows 编辑器探测路径会调用它(`platform.rs` 的 `#[cfg(windows)]` 分支); +/// 另由跨平台单测 `official_loader_copy_requires_exact_parent_and_trusted_bytes` 直接覆盖, +/// 因此非 Windows 的库构建不编译它,避免 Linux 目标把它判成 dead code。 +#[cfg(any(windows, test))] pub fn verified_module_path(actual: &Path, descriptor: &Descriptor) -> Result { let key = |p: &Path| { p.to_string_lossy() diff --git a/plugins/agc-unity-editor/native/unity-editor-bridge/tests/protocol.rs b/plugins/agc-unity-editor/native/unity-editor-bridge/tests/protocol.rs index fa377d786..c01b29c10 100644 --- a/plugins/agc-unity-editor/native/unity-editor-bridge/tests/protocol.rs +++ b/plugins/agc-unity-editor/native/unity-editor-bridge/tests/protocol.rs @@ -1,7 +1,9 @@ +#[cfg(all(windows, target_arch = "x86_64"))] use editor_adapter_api::EditorAdapter; use serde_json::json; use std::path::PathBuf; use std::time::{Duration, Instant}; +#[cfg(all(windows, target_arch = "x86_64"))] use unity_editor_bridge::{ configure_helper_candidates, disconnect_unity_editor, execute_unity_editor_code_for_project, UnityEditorAdapter, @@ -25,6 +27,7 @@ fn fixture() -> (tempfile::TempDir, PathBuf) { (directory, executable) } +#[cfg(all(windows, target_arch = "x86_64"))] fn project() -> tempfile::TempDir { let directory = tempfile::tempdir().unwrap(); for path in ["Assets", "Packages", "ProjectSettings"] {