fix(pipeline): keep an urgent export urgent through a validation override
Deploy / deploy (push) Successful in 6m11s
Deploy / deploy (push) Successful in 6m11s
Overriding a failed validation queued the preview at priority 50 regardless. It took its rank from the export's last PREVIEW_ONLY job — but validation runs before the preview stage, so a VALIDATION_FAILED export has never had one, and the missing row fell through to a hardcoded normal priority. An urgent shot lost its urgency at exactly the moment someone was standing over it waiting. Every preview now derives its rank from the export's AE_RENDER priority rather than from a previous preview. That fixes the missing-row case and also removes a slow drift: a preview's priority is already boosted, so re-deriving from it moved an export a step up the queue on every retry. createPreviewJob takes the render priority and the attempt number, so the first build, a retry, a regenerate and an override all rank identically. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@ import { db } from "@/lib/db";
|
||||
import { PipelineError } from "./errors";
|
||||
import { applyTransition } from "./transitions";
|
||||
import { getConfigBoolean, getConfigNumber, getConfigValue, getPreviewConfig } from "./config";
|
||||
import { buildPreviewManifest, createPreviewJob, inheritPreviewMedia } from "./preview";
|
||||
import { buildPreviewManifest, createPreviewJob, inheritPreviewMedia, renderPriorityFor } from "./preview";
|
||||
|
||||
/**
|
||||
* Validation engine results (RenderPipeline2 §8). The worker runs the checks —
|
||||
@@ -301,17 +301,20 @@ export async function overrideValidation(
|
||||
const last = await tx.renderJob.findFirst({
|
||||
where: { exportId, type: "PREVIEW_ONLY" },
|
||||
orderBy: { attempt: "desc" },
|
||||
select: { attempt: true },
|
||||
});
|
||||
const previewJob = await tx.renderJob.create({
|
||||
data: {
|
||||
type: "PREVIEW_ONLY",
|
||||
exportId,
|
||||
attempt: (last?.attempt ?? 0) + 1,
|
||||
maxAttempts,
|
||||
priority: last?.priority ?? 50,
|
||||
manifest: manifest as unknown as Prisma.InputJsonValue,
|
||||
},
|
||||
});
|
||||
// An export that failed validation has never had a preview job — validation
|
||||
// runs before the preview stage — so the rank comes from its render, which
|
||||
// is what keeps an urgent export urgent through an override. Someone is
|
||||
// usually standing over an urgent shot when they wave a check through.
|
||||
const previewJob = await createPreviewJob(
|
||||
tx,
|
||||
exportRow,
|
||||
manifest,
|
||||
maxAttempts,
|
||||
await renderPriorityFor(tx, exportId),
|
||||
(last?.attempt ?? 0) + 1
|
||||
);
|
||||
|
||||
const updated = await applyTransition(tx, exportRow, "GENERATING_PREVIEW", {
|
||||
type: "USER",
|
||||
|
||||
Reference in New Issue
Block a user