feat(render-pipeline): sync task title to preview version, fill slate ShotName
finalizePreview now retitles the export's task so its version suffix matches the preview that was just uploaded (UNG_102_019_010_cmp_TT_v004 -> _v005), which is the rename the manual batch upload already does on rename-and-upload. The new nextTaskTitle helper mirrors nextExrOutputBase so the task title, EXR base and preview filename all derive the suffix the same way. It uses the export's versionString rather than versionNumber, since the DB number is bumped to stay monotonic per task while the filename follows the shot's shotVersion. The rename only fires when a Version was actually created, runs in the same transaction, and is recorded in the ExportEvent note; the finalize response now returns the task id, title and whether it changed. Task status is deliberately untouched (pipeline renders must not resurface in the review flow, S10.0). The headless preview build was addressing the slate's identity fields by index only, so ShotName was never filled on the farm. setSlateIdentity writes both the named property and the index -- the name-with-index-fallback pattern the panel already uses for VersionName -- and warns with the template's actual property names when neither resolves, instead of failing silently. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -129,6 +129,16 @@ export async function createPreviewJob(
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* `UNG_102_019_010_cmp_TT_v004` + v005 → `UNG_102_019_010_cmp_TT_v005`.
|
||||
* Mirrors `nextExrOutputBase` (exports.ts) so the task title, the EXR base and
|
||||
* the preview filename all carry the same version suffix.
|
||||
*/
|
||||
export function nextTaskTitle(current: string, versionString: string): string {
|
||||
if (/_v\d+$/i.test(current)) return current.replace(/_v\d+$/i, `_${versionString}`);
|
||||
return `${current}_${versionString}`;
|
||||
}
|
||||
|
||||
export interface FinalizeInput {
|
||||
artifacts?: {
|
||||
deliveryMovPath?: string;
|
||||
@@ -167,6 +177,7 @@ export async function finalizePreview(jobId: string, machineId: string, body: Fi
|
||||
return {
|
||||
export: { id: exportRow.id, status: exportRow.status },
|
||||
version: { id: exportRow.versionId },
|
||||
task: null,
|
||||
alreadyApplied: true,
|
||||
};
|
||||
}
|
||||
@@ -227,6 +238,29 @@ export async function finalizePreview(jobId: string, machineId: string, body: Fi
|
||||
versionId = version.id;
|
||||
}
|
||||
|
||||
// The task title carries the version it is showing (house convention:
|
||||
// "UNG_102_019_010_cmp_TT_v004"). The preview just uploaded *is* the task's
|
||||
// new latest version, so the title has to follow the file — the same rename
|
||||
// the manual batch upload does on "rename-and-upload".
|
||||
let taskTitle: string | null = null;
|
||||
let taskRenamed = false;
|
||||
if (versionId && exportRow.taskId) {
|
||||
const task = await tx.task.findUnique({
|
||||
where: { id: exportRow.taskId },
|
||||
select: { title: true },
|
||||
});
|
||||
if (task) {
|
||||
taskTitle = nextTaskTitle(task.title, exportRow.versionString);
|
||||
taskRenamed = taskTitle !== task.title;
|
||||
if (taskRenamed) {
|
||||
await tx.task.update({
|
||||
where: { id: exportRow.taskId },
|
||||
data: { title: taskTitle },
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const updated = await applyTransition(
|
||||
tx,
|
||||
exportRow,
|
||||
@@ -234,7 +268,10 @@ export async function finalizePreview(jobId: string, machineId: string, body: Fi
|
||||
{
|
||||
type: "WORKER",
|
||||
id: machineId,
|
||||
note: `Preview complete in ${body.renderStats?.previewSeconds ?? "?"}s${versionId ? " — review version created" : " — no preview media reported"}`,
|
||||
note:
|
||||
`Preview complete in ${body.renderStats?.previewSeconds ?? "?"}s` +
|
||||
(versionId ? " — review version created" : " — no preview media reported") +
|
||||
(taskRenamed ? ` — task renamed to ${taskTitle}` : ""),
|
||||
},
|
||||
{
|
||||
...(versionId ? { versionId } : {}),
|
||||
@@ -248,6 +285,7 @@ export async function finalizePreview(jobId: string, machineId: string, body: Fi
|
||||
return {
|
||||
export: { id: updated.id, status: updated.status },
|
||||
version: versionId ? { id: versionId } : null,
|
||||
task: exportRow.taskId ? { id: exportRow.taskId, title: taskTitle, renamed: taskRenamed } : null,
|
||||
alreadyApplied: false,
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user