feat(pipeline): MOV review delivery packages from selected shots
Deploy / deploy (push) Successful in 7m28s

A formal review is shared as a flat, dated folder of the preview MOVs —
{deliveryRoot}/PRODUCER_REVIEWS/20260828_Producer_review, then _02, _03
for further reviews the same day. It reuses the delivery package's
machinery end to end: DeliveryPackage/DeliveryItem, the DELIVERY_BUILD
job, the same claim path and the same hardlink-or-copy builder, with
DeliveryPackage.kind telling the two apart.

Three things separate a review from a delivery:

A review never advances an Export. Reviews happen throughout a shot's
life, long before QC passes it, and the same version is routinely shown
twice — so nothing is marked PACKAGED, and markDelivered() refuses a
review package outright (the button is hidden too).

Selection is by shot, not by export. Shot Status → Bulk Actions → Build
MOV Review Package; the server resolves each shot to its newest export
that actually has a deliveryMovPath, which is not always its newest
export — a shot whose latest version is still rendering belongs in the
review as the version that can be watched. Shots with no MOV at all are
listed in the confirm dialog with the reason rather than silently
shrinking the folder.

The folder is exactly the MOVs. No CSV, no manifest.json written beside
them; the manifest still returns to the server, so the record of what was
shared is kept without cluttering the share. Names follow the same
client-naming rule as a delivery, so a shot reads identically in a review
folder and in the delivery that follows it.

Verification (DeliveryStage.BuildReviewItem) is proportional as it is for
EXRs, adapted to a single file with no validation-time digest: a hard
link is the source and needs nothing, a copy is checked against its
source by length always and by full hash under "always-hash". A missing
MOV fails the item here — in an EXR delivery the MOV is a viewing copy
beside the real deliverable, but in a review it is the deliverable, and a
review folder quietly one shot short is worse than one that says so.

Worker bumped to 1.6.0 for the new manifest field (DeliveryManifest.Kind).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
twotalesanimation
2026-08-28 08:58:21 +02:00
parent ed9f9b13c1
commit 7f066c1372
15 changed files with 1216 additions and 20 deletions
@@ -29,6 +29,7 @@ interface PackageRow {
id: string;
packageNumber: number;
name: string;
kind: "EXR_DELIVERY" | "MOV_REVIEW";
episode: string;
status: string;
rootPath: string | null;
@@ -242,6 +243,11 @@ export function DeliveriesClient({ canBuild }: { canBuild: boolean }) {
<summary className="flex items-center gap-3 px-4 py-3 cursor-pointer hover:bg-zinc-900/60 flex-wrap">
<span className="text-sm text-white font-medium">#{p.packageNumber}</span>
<span className="text-sm text-zinc-300">{p.name}</span>
{p.kind === "MOV_REVIEW" && (
<span className="rounded-full border border-violet-500/30 bg-violet-500/10 px-2 py-0.5 text-xs text-violet-300">
MOV review
</span>
)}
<span
className={cn(
"rounded-full border px-2 py-0.5 text-xs",
@@ -257,7 +263,7 @@ export function DeliveriesClient({ canBuild }: { canBuild: boolean }) {
<span className="text-xs text-zinc-600">{new Date(p.createdAt).toLocaleDateString()}</span>
{p.status === "BUILDING" && <RefreshCw className="h-3.5 w-3.5 text-blue-400 animate-spin" />}
<span className="ml-auto flex items-center gap-2">
{canBuild && p.status === "READY" && (
{canBuild && p.status === "READY" && p.kind === "EXR_DELIVERY" && (
<Button
size="sm"
variant="outline"
@@ -309,7 +315,9 @@ export function DeliveriesClient({ canBuild }: { canBuild: boolean }) {
</span>
<span className="text-zinc-300">{item.shotCode}</span>
<span className="text-zinc-500">{item.versionString}</span>
{item.fileCount != null && <span className="text-zinc-600">{item.fileCount}f</span>}
{p.kind === "EXR_DELIVERY" && item.fileCount != null && (
<span className="text-zinc-600">{item.fileCount}f</span>
)}
{item.linkMode && <span className="text-zinc-600">{item.linkMode}</span>}
{item.errorMessage && <span className="text-red-400">{item.errorMessage}</span>}
</div>
@@ -30,6 +30,7 @@ import { Button } from "@/components/ui/button";
import { Textarea } from "@/components/ui/textarea";
import { cn } from "@/lib/utils";
import { updateShotNotes, bulkUpdateDueDates, bulkDeleteShots, toggleKeyShot } from "@/actions/shots";
import { previewMovReview, buildMovReview } from "@/actions/deliveries";
import { useToast } from "@/components/ui/use-toast";
import {
Film,
@@ -47,6 +48,7 @@ import {
Star,
Trash2,
ChevronsUpDown,
Clapperboard,
} from "lucide-react";
import { format } from "date-fns";
import { shotThumbnail } from "@/lib/shot-thumbnail";
@@ -270,6 +272,153 @@ function BulkDeleteDialog({
);
}
// ── MovReviewDialog ───────────────────────────────────────────────────────────
type ReviewPreview = Awaited<ReturnType<typeof previewMovReview>>;
/**
* Confirm what a MOV review package would contain before building it
* (RenderPipeline2 §11.6).
*
* The version each shot resolves to is the newest one that actually has a
* preview MOV, which is not always the newest one full stop — so the dialog
* names the version per shot rather than making anyone guess, and lists the
* shots with no MOV at all instead of quietly building a smaller folder.
*/
function MovReviewDialog({
open,
onClose,
onBuilt,
shotIds,
}: {
open: boolean;
onClose: () => void;
onBuilt: () => void;
shotIds: string[];
}) {
const { toast } = useToast();
const [preview, setPreview] = useState<ReviewPreview | null>(null);
const [loading, setLoading] = useState(false);
const [isPending, startTransition] = useTransition();
useEffect(() => {
if (!open) {
setPreview(null);
return;
}
let cancelled = false;
setLoading(true);
previewMovReview(shotIds)
.then((result) => {
if (!cancelled) setPreview(result);
})
.finally(() => {
if (!cancelled) setLoading(false);
});
return () => {
cancelled = true;
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [open]);
const ready = preview?.ok ? preview.candidates : [];
const skipped = preview?.ok ? preview.skipped : [];
const handleBuild = () => {
startTransition(async () => {
const result = await buildMovReview(shotIds);
if (!result.ok) {
toast({ title: "Could not build review package", description: result.error, variant: "destructive" });
return;
}
toast({
title: `${result.package.name} queued`,
description: `${result.package.itemCount} MOV${result.package.itemCount !== 1 ? "s" : ""} → ${result.package.rootPath}`,
});
onBuilt();
});
};
return (
<Dialog open={open} onOpenChange={(o) => { if (!o && !isPending) onClose(); }}>
<DialogContent className="sm:max-w-lg">
<DialogHeader>
<DialogTitle>Build MOV review package</DialogTitle>
</DialogHeader>
{loading && (
<p className="text-sm text-zinc-400 flex items-center gap-2">
<Loader2 className="h-3.5 w-3.5 animate-spin" />
Working out what each shot would contribute…
</p>
)}
{!loading && preview && !preview.ok && (
<p className="text-sm text-red-400">{preview.error}</p>
)}
{!loading && preview?.ok && (
<div className="space-y-4">
<div className="rounded-md border border-zinc-800 bg-zinc-900/60 px-3 py-2">
<div className="text-xs text-zinc-500">Folder</div>
<div className="text-sm text-white font-medium break-all">{preview.packageName}</div>
<div className="text-xs text-zinc-500 break-all">{preview.packageDir}</div>
</div>
{ready.length > 0 && (
<div className="space-y-1.5">
<div className="text-xs font-medium text-zinc-400">
{ready.length} MOV{ready.length !== 1 ? "s" : ""}
</div>
<div className="max-h-52 overflow-y-auto rounded-md border border-zinc-800 divide-y divide-zinc-800/60">
{ready.map((c) => (
<div key={c.shotId} className="flex items-center gap-2 px-3 py-1.5 text-xs">
<span className="text-zinc-200">{c.shotCode}</span>
<span className="text-zinc-500">{c.versionString}</span>
<span className="ml-auto text-zinc-600 truncate">{c.deliveredName}</span>
</div>
))}
</div>
</div>
)}
{skipped.length > 0 && (
<div className="space-y-1.5">
<div className="text-xs font-medium text-amber-400">
{skipped.length} shot{skipped.length !== 1 ? "s" : ""} left out
</div>
<div className="max-h-32 overflow-y-auto rounded-md border border-amber-500/20 bg-amber-500/5 divide-y divide-amber-500/10">
{skipped.map((sk) => (
<div key={sk.shotId} className="flex items-center gap-2 px-3 py-1.5 text-xs">
<span className="text-zinc-300">{sk.shotCode}</span>
<span className="text-amber-400/80">{sk.reason}</span>
</div>
))}
</div>
</div>
)}
<p className="text-xs text-zinc-500">
A render machine builds the folder. Nothing about these shots changes — a review is
not a delivery, so the versions stay exactly where they are in the pipeline.
</p>
</div>
)}
<DialogFooter className="mt-2">
<Button variant="ghost" onClick={onClose} disabled={isPending}>
Cancel
</Button>
<Button onClick={handleBuild} disabled={isPending || loading || ready.length === 0}>
{isPending && <Loader2 className="h-3.5 w-3.5 mr-1.5 animate-spin" />}
{isPending ? "Queueing…" : `Build with ${ready.length} MOV${ready.length !== 1 ? "s" : ""}`}
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
);
}
// ── NotesCell ─────────────────────────────────────────────────────────────────
function NotesCell({
@@ -575,6 +724,7 @@ export function ShotStatusClient({
}, [selectedProjectId]);
const [dueDateDialogOpen, setDueDateDialogOpen] = useState(false);
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
const [movReviewDialogOpen, setMovReviewDialogOpen] = useState(false);
const toggleEpisode = (ep: string) =>
setExpandedEpisodes((prev) => {
@@ -820,6 +970,10 @@ export function ShotStatusClient({
<CalendarDays className="h-3.5 w-3.5 mr-2" />
Change Due Date
</DropdownMenuItem>
<DropdownMenuItem onClick={() => setMovReviewDialogOpen(true)}>
<Clapperboard className="h-3.5 w-3.5 mr-2" />
Build MOV Review Package
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem
onClick={() => setDeleteDialogOpen(true)}
@@ -1032,6 +1186,17 @@ export function ShotStatusClient({
onConfirm={handleBulkDelete}
count={selectionCount}
/>
{/* MOV review package (§11.6) */}
<MovReviewDialog
open={movReviewDialogOpen}
onClose={() => setMovReviewDialogOpen(false)}
onBuilt={() => {
setMovReviewDialogOpen(false);
clearSelection();
}}
shotIds={[...selectedIds]}
/>
</div>
);
}