修复完美像素损坏结果对账
后端返回已鉴权的稳定结果资源 ID 前端按稳定资源与任务双重校验权威结果 补充损坏任务与完整错误收口回归测试 同步图片画布技术方案与共享决策记录
This commit is contained in:
@@ -7101,7 +7101,7 @@
|
||||
- 决策:生成请求勾选 `style="pixelArt"` 与已有图片手动 `POST /api/editor/images/pixel-art-snaps` 共用同一输出语义:snapper 直接编码并持久化唯一的逻辑分辨率 PNG,不再 nearest 恢复到源图、RGBA 输入、业务交付或 generation dialog 占位尺寸。成功输出宽高固定为 `(columns.len() - 1) × (rows.len() - 1)`,允许与输入、交付和占位尺寸不同;响应、project resource、账号素材和结果 layer 一律记录最终 PNG 的实际宽高。
|
||||
- 保留边界:普通图片和角色在规整前执行的 Lanczos 交付尺寸归一继续保留;角色 / 图标的平底网格分析源与透明 RGBA 采样源仍必须同尺寸,Alpha 覆盖、Alpha 加权 RGB、二值 Alpha、P30 步长估算、确定性采样、输入上限、deadline、strict 无网格拒绝和失败降级尺寸守卫全部不变。这些约束保护输入坐标系、资源安全或失败路径,不构成成功输出与输入同尺寸的承诺。
|
||||
- 持久化边界:数量增量保持不变。普通图片只保存一张最终逻辑主图;角色保留一张 provider 原图与一张最终透明逻辑主图;图标保留一张 provider 原图、一张最终透明逻辑图集和原有成功切片;手动完美像素只保存一张最终逻辑 PNG。不得另外保存输入尺寸恢复版、像素化前后双份主图、预览、诊断或报告,不修改 asset kind、队列类型、数据库 schema、路由或请求 / 响应字段形状。
|
||||
- 跨版本重放:手动入口算法指纹升为 `perfect-pixel-v2`。完成请求基础校验、owner-scoped 项目读取与占位验证后,只要同一稳定 `resourceId` 已存在,即在来源解析、OSS GET、像素规整、candidate object key、preflight 与 OSS PUT 前返回 `409 + operationResultAlreadyExists=true`,由客户端 GET 权威项目收口;不再按 candidate object key 继续 exact replay。该分支不带 `resultPersistenceStarted`,因为本请求尚未开始持久化。preflight 到最终提交之间仍无数据库 reservation,滚动发布必须排空旧算法实例,不能把该护栏解释为消除了并发 TOCTOU。
|
||||
- 跨版本重放:手动入口算法指纹升为 `perfect-pixel-v2`。完成请求基础校验、owner-scoped 项目读取与占位验证后,只要同一稳定 `resourceId` 已存在,即在来源解析、OSS GET、像素规整、candidate object key、preflight 与 OSS PUT 前返回 `409 + operationResultAlreadyExists=true` 及已鉴权的稳定 `resultResourceId`,由客户端 GET 权威项目收口;前端按稳定资源 ID 定位后继续复核 task、项目、对象与 dialog/layer 关联,损坏 task 必须明确失败关闭为冲突,不得漏检后持续等待。不再按 candidate object key 继续 exact replay。该分支不带 `resultPersistenceStarted`,因为本请求尚未开始持久化。preflight 到最终提交之间仍无数据库 reservation,滚动发布必须排空旧算法实例,不能把该护栏解释为消除了并发 TOCTOU。
|
||||
- 历史边界:本条覆盖 2026-07-28 首发决策中“逻辑结果 nearest 恢复交付尺寸 / 逻辑图不持久化”和 2026-07-30 手动入口中“右侧新增同尺寸 PNG / 不保存逻辑低分辨率图”的旧口径;旧条目作为历史记录保留,不回写改造。
|
||||
- 关联文档:`docs/technical/【前端架构】图片画布编辑器MVP接入方案-2026-06-11.md`、`docs/【编辑器】画板角色形象生成入口设计-2026-06-15.md`、`docs/【编辑器】画板图标素材生成入口设计-2026-06-15.md`、`docs/【编辑器】图片画布结构化持久化与迁移回滚方案-2026-07-19.md`、`docs/【后端架构】server-rs与SpacetimeDB数据契约-2026-05-15.md`。
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
- 源准备与 operation journal 使用两段绝对预算:`ticket → PUT → confirm` 连同源解析共用 90 秒;confirm 成功后形成稳定 `perfectPixelOperation` 并**同步写入本机账本**(`perfectPixelOperationStore`,owner + project 双键的 localStorage),布局里只留 `perfectPixelOperationId` 标记。原先的 strict layout save 通道(60 秒绝对预算、revision ACK 前 POST 为零)已整体删除:账本不再寄生在用户布局上,本机写入不过网络也不受服务端校验影响,同样能保证请求可被追溯。被解除的是**客户端侧**「拿不到 revision ack 就拒发」这一层阻断;端到端依赖仍在——布局 PATCH 被校验拒绝、占位因此从未落库时,POST 仍会被服务端以 409 拒收。POST 前仍然 `await` 一次 best-effort 布局保存——服务端要求占位**此前已经持久化**,否则 `validate_editor_pixel_art_snap_placeholder_exists` 直接 409;但 best-effort 不再提供成功 ACK,因此客户端**无法证明**该前置已满足,只能提高满足它的概率(占位可能已由此前的自动保存落库,PATCH 也可能成功而 ACK 丢失)。该 flush 没有整体上限,所以 75 秒对账窗口必须在 flush 返回、authority 复核通过之后才锚定,且首次提交与人工重试同此口径;锚定只覆盖 `submittedAt / reconcileUntil`,按同一 `operationId` 覆盖账本,request 与 dialog / operation / task identity 逐字节不变。此阶段失败持久化为 `failed + perfectPixelOperation`,保留同一 `sourceImageSrc / dialogId / taskId / request`;重试请求必须与账本中的 POST JSON byte-for-byte 一致且不得重新上传。**明确接受的行为,不是缺口**:占位恢复可删除之后,用户删掉未收口占位再从源图发起会得到第二个 identity,旧的服务端操作若迟到落库就会多出一份素材,两个 `taskId` 无法幂等合并。按上文的优先级判据,这属于「已生成资源丢失关联」而非主链路故障,代价是用户自行删掉多余素材,**不得**通过让本机账本参与防重来「闭合」——那是被明令禁止的「禁止一张图处理两遍」。confirm 成功后浏览器在 operation 首次 PATCH 落库前立即崩溃仍可能留下 object-only 记录;完全消除该窗口需要服务端 durable upload journal,不属于当前前端修复。
|
||||
- 该已有图片入口使用 strict 语义:只接受静态 PNG / JPEG / WebP,GIF、APNG、动画 WebP、图片序列及其它非静态媒体必须在处理前拒绝。strict 与生成风格复用完全相同的 legacy profile、峰值估算、单轴步长补全、walker、采样和编码;仅当横纵两轴都未检测到步长、legacy 即将使用 `min(width,height)/64` 统一网格兜底时拒绝。任一轴已检测到步长时,两条路径行为和输出必须一致。源图读取、解码、尺寸校验、排队、像素规整或 PNG 编码任一步失败 / 超时 / 不适用时,请求失败,不保留原图副本冒充成功,不执行最终 OSS PUT,也不创建 project resource、账号素材或结果图层。成功时只对唯一的逻辑分辨率 PNG 执行一次 OSS PUT,并至多各创建一个 `editor_project_resource` 和一个 `editor_asset`,再按 `canvasCompletion` 写回一个派生图层;resource、asset、响应与图层使用该 PNG 的实际宽高,不要求与源图或占位尺寸相等,也不得另存输入尺寸恢复版、诊断图或前后对比图。
|
||||
- strict 的本次结果事实零写入边界截至首个最终 PNG PUT:所有可预判的引用、归属、类型、静态编码、元数据、网格适用性和 CPU 处理错误必须在此前失败;前置 owner-scoped 项目 / 素材读取仍可能按既有语义懒建默认 canvas / folder,这些基础记录不属于本次完美像素结果。后端先纯计算精确 object key 和候选 project resource,再调用只读 SpacetimeDB preflight 校验自定义素材目录归属、复用权威 completion planner,并执行 legacy / structured 的 2 MiB 总量与 512 KiB 单项门禁;默认目录尚未创建时允许通过,preflight 不写库。preflight 与 PUT / HEAD / 原子 persist 共用 60 秒绝对 deadline;preflight 失败或超时不得 PUT,也不得带 `resultPersistenceStarted`。最终 PNG 的 OSS PUT / HEAD 位于数据库事务外;验证上传结果后,asset object、project resource、账号素材与可选 canvas completion 由单个受 runtime service identity 保护的 SpacetimeDB procedure 在一次事务中原子提交,并重新校验目录、布局、幂等身份与 revision。preflight 不加锁或 reservation,所以通过后若目录或画布并发漂移,最终事务仍可能在 PUT 后拒绝并留下 OSS 孤儿对象;这是本次最小修复明确保留的 TOCTOU 边界。operation 以 `owner + project + canvasCompletion.dialogId` 为作用域,task / object / resource / asset ID 稳定派生,object key 携带规范请求与输入 / 输出摘要形成的 fingerprint;一旦 owner-scoped 项目快照已发现同 operation 的稳定 resource,本次 POST 不再执行 candidate-key exact replay,而是直接返回 `operationResultAlreadyExists=true` 并交由 GET 对账;输入漂移或部分既有事实失败关闭。HTTP timeout/drop 不能撤销已发往远端的 procedure,客户端仍须按稳定 `taskId / objectKey / resourceId` 对账,不能把未收到回包等同于未提交。
|
||||
- 手动入口的算法指纹随逻辑分辨率输出升级为 `perfect-pixel-v2`。在完成请求基础校验、owner-scoped 项目读取与占位验证后,只要同一稳定 `resourceId` 已存在,后端必须在来源解析、OSS GET、像素规整、candidate object key、preflight 与 OSS PUT 前返回 `409 + operationResultAlreadyExists=true`;不再按 candidate object key 继续 exact replay。前端 initial 与 retry 两条 catch 都按稳定 task GET 项目对账,由权威快照明确 `applied`、`dialog-missing` 或 `conflict`。该标记表示旧权威结果已存在,不得与“本次 PUT 已开始”的 `resultPersistenceStarted` 混用;发布时仍须排空旧算法实例以规避独立新操作在 preflight 到提交之间的跨版本 TOCTOU。
|
||||
- 手动入口的算法指纹随逻辑分辨率输出升级为 `perfect-pixel-v2`。在完成请求基础校验、owner-scoped 项目读取与占位验证后,只要同一稳定 `resourceId` 已存在,后端必须在来源解析、OSS GET、像素规整、candidate object key、preflight 与 OSS PUT 前返回 `409 + operationResultAlreadyExists=true`,并携带已鉴权的稳定 `resultResourceId`;不再按 candidate object key 继续 exact replay。前端 initial 与 retry 两条 catch 都按稳定资源与 task GET 项目对账,由权威快照明确 `applied`、`dialog-missing` 或 `conflict`;即使稳定记录的 `taskId` 损坏,也必须据 `resultResourceId` 找到该记录并失败关闭为冲突,不得持续等待。该标记表示旧权威结果已存在,不得与“本次 PUT 已开始”的 `resultPersistenceStarted` 混用;发布时仍须排空旧算法实例以规避独立新操作在 preflight 到提交之间的跨版本 TOCTOU。
|
||||
- `POST /api/editor/images/pixel-art-snaps` 是有副作用的 unsafe POST。客户端不得为它配置 `EDITOR_REQUEST_RETRY_OPTIONS`,请求字节可能已发出后不因 transport 异常或 `408 / 425 / 429 / 502 / 503 / 504` 自动重放;Bearer 中间件在 handler 前以 `401` 拒绝、刷新 token 后的既有认证恢复不属于业务副作用重放,保持通用行为。POST 回包中的 `project / resource / asset` 不是结果 verdict;首次成功回包、未知异常、人工 exact replay 和刷新恢复都只读取项目 GET。`perfectPixelOperation.submittedAt / reconcileUntil` 在 pre-POST flush 返回、authority 复核通过之后、POST 发出之前建立统一 75 秒绝对窗口(该 flush 没有整体上限,锚在它之前会让窗口在请求发出前就烧光),POST 回包不能续期;读取必须立即执行一次,随后退避间隔不超过 5 秒,窗口已过期时仍执行一次即时 GET。每次项目读取使用 `requestJson.deadlineAt` 覆盖缺 token 补票、业务 fetch、401 refresh、重试退避与响应体读取;窗口内单次最多 10 秒且不得越过 `reconcileUntil`,过期后的唯一即时读取最多额外 10 秒。固定判据为:匹配 task 的唯一 resource 加已收口 dialog / 关联图层才是画布成功;dialog 不存在但存在匹配 task resource 才是 asset-only 成功;dialog 仍 generating、dialog 不存在且无匹配 resource、项目始终不可读或窗口耗尽均保持 unknown。素材库刷新只在项目终态后 fire-and-forget,同步抛错、异步拒绝或永久挂起都不得阻塞 verdict、项目快照应用和执行锁释放。
|
||||
- unknown 状态持久化为原 generation dialog 上的 `pending-confirmation + perfectPixelOperation`(账本在本机,布局只留 `perfectPixelOperationId`)。**用户可以随时删除该占位**,任何状态都不例外、也不弹确认:删除不撤销任何在途请求,结果照常落库并进素材库,服务端发现 dialog 已不在会返回 `DialogMissing`;封锁用户删除自己画布上的元素不是可接受的代价。删除后**结果不再自动回填画布**(服务端发现 dialog 已不在会返回 `DialogMissing`),这是用户主动放弃的结果,不得判定为缺陷;但对账本身不会因此停止——当前标签页已经在飞的 Promise 会继续读到终态,本机账本也会以孤儿身份在下次加载被读一次,结果确已落库时仍会提示用户去素材库取。未删除时用户可继续 GET 对账或显式按原 identity 重放。人工重试在 pre-POST flush **之后**才刷新观察窗口(同上一节的锚定口径),POST JSON 必须与持久请求 byte-for-byte 一致,不得按当前画布、目录、类型或标题重建,也不得创建第二个 dialog / task / object / resource / asset。hydrate 后只做 GET,不自动 POST、上传或重建请求。处理成功但事务内权威 dialog 已删除时,后端保留 object / resource / asset 并返回 asset-only 事实,canvas / revision 不变;前端只有在项目 GET 看见匹配 task resource 后才能提示“已保存到素材库”。现有布局 CAS 没有 deletion tombstone,completion 与其它已持久化布局编辑冲突时继续按权威 revision 守卫收口;尚未防抖落库的本地编辑合并不在本批范围。
|
||||
- 删除 generation dialog 的按钮、快捷键和右键菜单必须在写画布历史、清选择或执行低层移除前经过同一请求保护入口。未收口完美像素 operation 与其它占位同样可被立即删除,写正常的 `delete-generation-result` 历史并清理 identity;删除确认只对**计费**生成成立(现成弹窗讲的是「已消耗的泥点不会返还」,而完美像素 `generation_cost_mud_points = 0`),判据收敛为具名的 `requiresGenerationDeleteConfirmation`。低层 `removeCanvasGenerationDialogById` 必须无条件删除——低层对上层抗命正是「占位未删却写出伪历史」的根因。
|
||||
|
||||
@@ -204,6 +204,7 @@ const EDITOR_PIXEL_ART_MAX_PERSISTENCE_DURATION: Duration = Duration::from_secs(
|
||||
/// 未知结果边界。这个 detail 字段只在该边界之后置位,客户端据此先读权威快照对账。
|
||||
pub(crate) const EDITOR_RESULT_PERSISTENCE_STARTED_DETAIL: &str = "resultPersistenceStarted";
|
||||
const EDITOR_OPERATION_RESULT_ALREADY_EXISTS_DETAIL: &str = "operationResultAlreadyExists";
|
||||
const EDITOR_OPERATION_RESULT_RESOURCE_ID_DETAIL: &str = "resultResourceId";
|
||||
const EDITOR_PIXEL_ART_SNAP_ASSET_KIND: &str = "editor_pixel_art_snap";
|
||||
const EDITOR_PIXEL_ART_SNAP_MODEL: &str = "Perfect Pixel";
|
||||
const EDITOR_PIXEL_ART_SNAP_PROVIDER: &str = "Genarrative";
|
||||
@@ -6811,7 +6812,11 @@ fn ensure_editor_pixel_art_stable_result_is_absent(
|
||||
StatusCode::CONFLICT,
|
||||
"同一完美像素操作已有权威结果,请先读取项目状态对账。",
|
||||
)
|
||||
.with_detail_field(EDITOR_OPERATION_RESULT_ALREADY_EXISTS_DETAIL, json!(true)))
|
||||
.with_detail_field(EDITOR_OPERATION_RESULT_ALREADY_EXISTS_DETAIL, json!(true))
|
||||
.with_detail_field(
|
||||
EDITOR_OPERATION_RESULT_RESOURCE_ID_DETAIL,
|
||||
json!(expected_result_resource_id),
|
||||
))
|
||||
}
|
||||
|
||||
fn resolve_editor_pixel_art_asset_folder_id(asset_folder_id: Option<String>) -> Option<String> {
|
||||
@@ -19607,6 +19612,12 @@ mod tests {
|
||||
.as_bool()),
|
||||
Some(true)
|
||||
);
|
||||
assert_eq!(
|
||||
error
|
||||
.details()
|
||||
.and_then(|details| details[EDITOR_OPERATION_RESULT_RESOURCE_ID_DETAIL].as_str()),
|
||||
Some("editor-resource-stable-result")
|
||||
);
|
||||
assert_eq!(
|
||||
error
|
||||
.details()
|
||||
|
||||
@@ -1416,6 +1416,31 @@ describe('useImageCanvasGenerationWorkflow', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('uses the server-confirmed stable resource id to reject a corrupted task id', () => {
|
||||
const operationId = 'perfect-pixel-corrupted-task';
|
||||
const project = createPerfectPixelProject(operationId, 'dialog-missing');
|
||||
project.resources[0] = {
|
||||
...project.resources[0]!,
|
||||
taskId: 'pixel-art-snap-another-operation',
|
||||
objectKey: null,
|
||||
};
|
||||
|
||||
expect(
|
||||
inspectPerfectPixelProjectSnapshot(
|
||||
project,
|
||||
{
|
||||
operationId,
|
||||
taskId: `pixel-art-snap-${operationId}`,
|
||||
},
|
||||
project.resources[0]!.resourceId,
|
||||
),
|
||||
).toMatchObject({
|
||||
kind: 'conflict',
|
||||
project,
|
||||
message: '完美像素任务资源记录不完整或不属于当前项目,无法自动确认结果。',
|
||||
});
|
||||
});
|
||||
|
||||
it('rejects a settled dialog whose generated layer points at another resource', () => {
|
||||
const operationId = 'perfect-pixel-mismatched-layer';
|
||||
const project = createPerfectPixelProject(operationId, 'applied');
|
||||
@@ -3841,6 +3866,65 @@ describe('useImageCanvasGenerationWorkflow', () => {
|
||||
expect(screen.getByTestId('dialog').textContent).not.toContain('failed');
|
||||
});
|
||||
|
||||
it('uses the server-confirmed stable resource id during existing-result reconciliation', async () => {
|
||||
const applyProjectSnapshot = vi.fn();
|
||||
let reconciledProject: EditorProjectSnapshot | undefined;
|
||||
snapImageToPerfectPixelsMock.mockImplementationOnce(
|
||||
async (request: EditorPixelArtSnapInput) => {
|
||||
const operationId = request.canvasCompletion.dialogId;
|
||||
reconciledProject = createPerfectPixelProject(
|
||||
operationId,
|
||||
'dialog-missing',
|
||||
);
|
||||
reconciledProject.resources[0] = {
|
||||
...reconciledProject.resources[0]!,
|
||||
taskId: 'pixel-art-snap-corrupted-task',
|
||||
objectKey: null,
|
||||
};
|
||||
throw new ApiClientError({
|
||||
message: '同一完美像素操作已有权威结果,请先读取项目状态对账。',
|
||||
status: 409,
|
||||
code: 'HTTP_409',
|
||||
details: {
|
||||
operationResultAlreadyExists: true,
|
||||
resultResourceId: reconciledProject.resources[0]!.resourceId,
|
||||
},
|
||||
});
|
||||
},
|
||||
);
|
||||
loadEditorProjectMock.mockImplementationOnce(async () => {
|
||||
expect(reconciledProject).toBeDefined();
|
||||
return reconciledProject!;
|
||||
});
|
||||
|
||||
render(
|
||||
<GenerationWorkflowHarness
|
||||
projectId="project-1"
|
||||
initialLayers={[
|
||||
createLayer({
|
||||
objectKey: 'generated-images/editor/source.png',
|
||||
src: '/generated-images/editor/source.png',
|
||||
}),
|
||||
]}
|
||||
applyProjectSnapshot={applyProjectSnapshot}
|
||||
flushProjectPersistence={vi.fn(async () => {})}
|
||||
/>,
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: '完美像素' }));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('dialog-error').textContent).toContain(
|
||||
'完美像素任务资源记录不完整或不属于当前项目,无法自动确认结果。',
|
||||
);
|
||||
});
|
||||
expect(loadEditorProjectMock).toHaveBeenCalledTimes(1);
|
||||
expect(applyProjectSnapshot).not.toHaveBeenCalled();
|
||||
expect(screen.getByTestId('dialog').textContent).toContain(
|
||||
'pending-confirmation',
|
||||
);
|
||||
});
|
||||
|
||||
it('skips reconciliation for a responded failure the server did not mark', async () => {
|
||||
// 中文注释:纯校验失败发生在任何 IO 之前,不可能留下对象或素材。服务端不置
|
||||
// resultPersistenceStarted,客户端就不该多打两次读取,也不该附上「请核对素材库」
|
||||
|
||||
@@ -334,9 +334,14 @@ export type PerfectPixelProjectVerdict =
|
||||
export function inspectPerfectPixelProjectSnapshot(
|
||||
project: EditorProjectSnapshot,
|
||||
operation: Pick<PerfectPixelOperationSnapshot, 'operationId' | 'taskId'>,
|
||||
resultResourceId?: string | null,
|
||||
): PerfectPixelProjectVerdict {
|
||||
const normalizedResultResourceId = resultResourceId?.trim() ?? '';
|
||||
const matchingResources = project.resources.filter(
|
||||
(resource) => resource.taskId?.trim() === operation.taskId,
|
||||
(resource) =>
|
||||
resource.taskId?.trim() === operation.taskId ||
|
||||
(normalizedResultResourceId !== '' &&
|
||||
resource.resourceId.trim() === normalizedResultResourceId),
|
||||
);
|
||||
const matchingDialogs = findCanvasGenerationDialogRecords(
|
||||
project,
|
||||
@@ -370,6 +375,9 @@ export function inspectPerfectPixelProjectSnapshot(
|
||||
};
|
||||
}
|
||||
if (
|
||||
(normalizedResultResourceId !== '' &&
|
||||
resource.resourceId.trim() !== normalizedResultResourceId) ||
|
||||
resource.taskId?.trim() !== operation.taskId ||
|
||||
resource.projectId !== project.projectId ||
|
||||
!resource.objectKey?.trim() ||
|
||||
!resource.imageSrc.trim()
|
||||
@@ -447,7 +455,7 @@ function waitForPerfectPixelReconciliationDelay(
|
||||
async function reconcilePerfectPixelProject(
|
||||
projectId: string,
|
||||
operation: PerfectPixelOperationSnapshot,
|
||||
options: { signal?: AbortSignal } = {},
|
||||
options: { signal?: AbortSignal; resultResourceId?: string | null } = {},
|
||||
): Promise<PerfectPixelProjectVerdict> {
|
||||
let attempt = 0;
|
||||
let hasAttemptedRead = false;
|
||||
@@ -489,6 +497,7 @@ async function reconcilePerfectPixelProject(
|
||||
const verdict = inspectPerfectPixelProjectSnapshot(
|
||||
latestProject,
|
||||
operation,
|
||||
options.resultResourceId,
|
||||
);
|
||||
if (verdict.kind !== 'pending') {
|
||||
return verdict;
|
||||
@@ -2796,6 +2805,11 @@ export function useImageCanvasGenerationWorkflow({
|
||||
error instanceof ApiClientError &&
|
||||
(error.details as { operationResultAlreadyExists?: unknown } | null)
|
||||
?.operationResultAlreadyExists === true;
|
||||
const existingResultResourceId =
|
||||
operationResultAlreadyExists && error instanceof ApiClientError
|
||||
? (error.details as { resultResourceId?: unknown } | null)
|
||||
?.resultResourceId
|
||||
: null;
|
||||
const outcomeMayBePersisted =
|
||||
perfectPixelPostAttempted &&
|
||||
Boolean(perfectPixelDialogId) &&
|
||||
@@ -2819,6 +2833,12 @@ export function useImageCanvasGenerationWorkflow({
|
||||
const verdict = await reconcilePerfectPixelProject(
|
||||
normalizedProjectId,
|
||||
perfectPixelOperation,
|
||||
{
|
||||
resultResourceId:
|
||||
typeof existingResultResourceId === 'string'
|
||||
? existingResultResourceId
|
||||
: null,
|
||||
},
|
||||
);
|
||||
if (!isPerfectPixelAuthorityCurrent(operationAuthority)) {
|
||||
return;
|
||||
@@ -3045,6 +3065,11 @@ export function useImageCanvasGenerationWorkflow({
|
||||
error instanceof ApiClientError &&
|
||||
(error.details as { operationResultAlreadyExists?: unknown } | null)
|
||||
?.operationResultAlreadyExists === true;
|
||||
const existingResultResourceId =
|
||||
operationResultAlreadyExists && error instanceof ApiClientError
|
||||
? (error.details as { resultResourceId?: unknown } | null)
|
||||
?.resultResourceId
|
||||
: null;
|
||||
const outcomeMayBePersisted =
|
||||
postAttempted &&
|
||||
(!(error instanceof ApiClientError) ||
|
||||
@@ -3055,6 +3080,12 @@ export function useImageCanvasGenerationWorkflow({
|
||||
const verdict = await reconcilePerfectPixelProject(
|
||||
normalizedProjectId,
|
||||
retriedOperation,
|
||||
{
|
||||
resultResourceId:
|
||||
typeof existingResultResourceId === 'string'
|
||||
? existingResultResourceId
|
||||
: null,
|
||||
},
|
||||
);
|
||||
if (!isPerfectPixelAuthorityCurrent(operationAuthority)) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user