修复自动切分问题节点恢复与临时文件清理
Project CI / AI game creator shell Rust shard 1/4 (pull_request) Successful in 5m3s
Project CI / AI game creator shell Rust shard 2/4 (pull_request) Successful in 4m46s
Project CI / AI game creator shell Rust shard 3/4 (pull_request) Successful in 4m46s
Project CI / AI game creator shell Rust shard 4/4 (pull_request) Successful in 4m4s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m33s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 2m3s
Project CI / Frontend tests (pull_request) Successful in 4m13s
Project CI / Repository checks (pull_request) Successful in 3m26s
Project CI / Native shell tests (pull_request) Successful in 6m30s
Project CI / Backend tests (pull_request) Successful in 7m27s
Project CI / AI game creator shell web tests (pull_request) Successful in 3m14s
Project CI / AI game creator shell Rust shard 1/4 (push) Has been cancelled
Project CI / AI game creator shell Rust shard 2/4 (push) Has been cancelled
Project CI / AI game creator shell Rust shard 3/4 (push) Has been cancelled
Project CI / AI game creator shell Rust shard 4/4 (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 / Native shell tests (push) Has been cancelled
Project CI / Frontend tests (push) Has been cancelled
Project CI / Repository checks (push) Has been cancelled
Project CI / AI game creator shell web tests (push) Has been cancelled

将 problematic_nodes 纳入失败判定并保留恢复状态
清理完成或放弃流程产生的 processed 和 binding 临时文件
This commit was merged in pull request #357.
This commit is contained in:
2026-09-14 19:11:27 +08:00
parent 411f49a65d
commit a7c40da6cf
2 changed files with 38 additions and 3 deletions
@@ -265,11 +265,11 @@ pub fn inspect_separation_recovery(
}
pub fn finalize_separation(root: &Path, asset_id: &str) -> Result<(), String> {
remove_separation_state(root, asset_id)
remove_separation_recovery_files(root, asset_id)
}
pub fn discard_separation_recovery(root: &Path, asset_id: &str) -> Result<(), String> {
remove_separation_state(root, asset_id)
remove_separation_recovery_files(root, asset_id)
}
fn remove_separation_state(root: &Path, asset_id: &str) -> Result<(), String> {
@@ -281,6 +281,33 @@ fn remove_separation_state(root: &Path, asset_id: &str) -> Result<(), String> {
}
}
fn remove_separation_recovery_files(root: &Path, asset_id: &str) -> Result<(), String> {
let sidecar = separation_sidecar_dir(root, asset_id)?;
remove_separation_state(root, asset_id)?;
let entries = match fs::read_dir(&sidecar) {
Ok(entries) => entries,
Err(error) if error.kind() == std::io::ErrorKind::NotFound => return Ok(()),
Err(error) => return Err(format!("读取 separation 临时文件失败:{error}")),
};
for entry in entries {
let entry = entry.map_err(|error| format!("读取 separation 临时文件失败:{error}"))?;
let name = entry.file_name();
let name = name.to_string_lossy();
if name.starts_with("processed-") || name.starts_with("binding-") {
let path = entry.path();
if entry
.file_type()
.map_err(|error| format!("检查 separation 临时文件失败:{error}"))?
.is_file()
{
fs::remove_file(&path)
.map_err(|error| format!("删除 separation 临时文件失败:{error}"))?;
}
}
}
Ok(())
}
#[cfg(test)]
mod tests {
use super::*;
@@ -1212,7 +1212,15 @@ export function useUiEditorSession(
'自动切分素材结果已写入编辑器,但 State 保存失败;sidecar 已保留,可继续恢复。',
);
}
if (backfillErrors.length > 0) {
if (
backfillErrors.length > 0 ||
completedResult.problematic_nodes.length > 0
) {
if (completedResult.problematic_nodes.length > 0) {
backfillErrors.push(
`${completedResult.problematic_nodes.length} 个节点达到返工上限,需要人工处理`,
);
}
const recovery = await invoke<SeparationRecoveryDTO>(
'inspect_separation_recovery',
{ projectPath, assetId: resourceId },