去除完美像素持久化的输出图片复制
Project CI / Repository checks (pull_request) Failing after 10s
Project CI / Backend tests (pull_request) Failing after 10s
Project CI / Frontend tests (pull_request) Successful in 1m39s
Project CI / Native shell tests (pull_request) Successful in 2m14s

改用按值移交的持久化入口避免复制整份输出图片
补齐禁止退回借用版持久化入口的回归断言

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-31 05:48:29 +00:00
parent 56b65a430d
commit 95443da63c
@@ -4579,11 +4579,14 @@ pub async fn snap_editor_image_to_pixel_art(
})?;
let task_id = build_prefixed_uuid_id("pixel-art-snap-");
let persisted = persist_editor_generated_image(
// 中文注释:尺寸已经在上一步取完,snapped_image 之后不再使用,所以按值移交给 _owned
// 版本。借用版会在内部 `image.bytes.clone()` 复制一整份输出图片;完美像素是同步路径,
// 那份复制会和原图在同一时刻共存。
let persisted = persist_editor_generated_image_owned(
&state,
owner_user_id.as_str(),
task_id.as_str(),
&snapped_image,
snapped_image,
"完美像素",
None,
EDITOR_PIXEL_ART_SNAP_ASSET_KIND,
@@ -10693,7 +10696,7 @@ mod tests {
source,
"pub async fn snap_editor_image_to_pixel_art(",
"async fn validate_editor_background_removal_source",
"persist_editor_generated_image(",
"persist_editor_generated_image_owned(",
1,
);
assert_function_not_contains(
@@ -10708,6 +10711,9 @@ mod tests {
// 中文注释:下载必须走带 deadline 的包装。退回裸调用会让 OSS GET 重新
// 落在 30s 预算之外,请求可以持着最多 32 MiB 无限期排队等 CPU 许可。
"download_editor_persisted_image_object(&state",
// 中文注释:持久化必须走按值移交的 _owned 版本。借用版内部会 clone 一整份
// 输出图片,在同步路径上和原图同时驻留内存。
"persist_editor_generated_image(",
],
);
}