From dc639d571a988e6d8c676ddb8febb9e820fccdad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Tue, 6 Oct 2026 18:50:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=BA=A2=E4=B9=A6=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E5=89=8D=E6=B8=85=E6=8E=89=E4=B8=8A=E4=B8=80?= =?UTF-8?q?=E6=AC=A1=E7=9A=84=E4=BA=A7=E7=89=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - build.rs 的 run 在启动项目脚本前删除 .export/xhs-minitool.zip(不存在则跳过,删不掉则 fail closed) - 避免 no-op 脚本靠上一轮残留的 zip 被判成功 --- .../src/export/draft/xhs_minitool/build.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/apps/ai-game-creator-shell/src-tauri/src/export/draft/xhs_minitool/build.rs b/apps/ai-game-creator-shell/src-tauri/src/export/draft/xhs_minitool/build.rs index ce40ae903..6393efc00 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/export/draft/xhs_minitool/build.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/export/draft/xhs_minitool/build.rs @@ -42,6 +42,23 @@ pub(crate) async fn run( } })?; + // 产物判据只看「文件非空」,所以先清掉上一次的 zip:脚本这次什么都没写时,残留的旧 zip 会 + // 让 no-op 脚本被判成功,用户上传的其实是上一轮的产物。删不掉(权限等)就 fail closed—— + // 留着旧产物继续判成功,比这次构建失败更糟。 + let artifact = artifact_path(root); + match std::fs::remove_file(&artifact) { + Ok(()) => {} + Err(error) if error.kind() == std::io::ErrorKind::NotFound => {} + Err(error) => { + return Err(XHSMiniToolExportBuildError::ExportUnavailable( + ExportUnavailable::new(format!( + "清理上一次导出产物失败:{}:{error}", + artifact.display() + )), + )); + } + } + let result = run_project_verification_with_commit_at( root, SCRIPT_NAME,