feat(pipeline): MOV review delivery packages from selected shots
Deploy / deploy (push) Successful in 7m28s
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:
@@ -0,0 +1,193 @@
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using VFXReviewWorker;
|
||||
using Xunit;
|
||||
|
||||
namespace VFXReviewWorker.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// MOV review packages (RenderPipeline2 §11.6). A review folder is opened
|
||||
/// directly by a producer, so the things pinned here are the ones they would
|
||||
/// notice: it is flat, it carries the client's own naming, and it contains the
|
||||
/// MOVs and nothing else.
|
||||
/// </summary>
|
||||
public class MovReviewStageTests : IDisposable
|
||||
{
|
||||
private readonly string _root = Path.Combine(Path.GetTempPath(), $"vfxr_review_{Guid.NewGuid():N}");
|
||||
private readonly string _renderDir;
|
||||
private readonly string _reviewDir;
|
||||
|
||||
public MovReviewStageTests()
|
||||
{
|
||||
_renderDir = Path.Combine(_root, "renders", "SHOT_001", "v004");
|
||||
_reviewDir = Path.Combine(_root, "DELIVERY", "PRODUCER_REVIEWS", "20260828_Producer_review");
|
||||
Directory.CreateDirectory(_renderDir);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
try { Directory.Delete(_root, recursive: true); } catch { }
|
||||
}
|
||||
|
||||
private string WriteMov(string shotCode, string version, string contents = "mov bytes")
|
||||
{
|
||||
var path = Path.Combine(_renderDir, $"{shotCode}_cmp_TT_{version}.mov");
|
||||
File.WriteAllText(path, contents);
|
||||
return path;
|
||||
}
|
||||
|
||||
private DeliveryManifest Manifest(params DeliveryManifestItem[] items) => new()
|
||||
{
|
||||
Kind = "MOV_REVIEW",
|
||||
PackageId = "pkg1",
|
||||
PackageName = "20260828_Producer_review",
|
||||
PackageNumber = 7,
|
||||
Episode = "101",
|
||||
PackageDir = _reviewDir,
|
||||
// A review writes no report; the server keeps the record instead.
|
||||
ReportFile = "",
|
||||
Items = items.ToList(),
|
||||
};
|
||||
|
||||
private DeliveryManifestItem Item(
|
||||
string shotCode, string version, string? movPath, string? deliveredBase = null) => new()
|
||||
{
|
||||
ItemId = $"item_{shotCode}",
|
||||
ExportId = $"exp_{shotCode}",
|
||||
ShotCode = shotCode,
|
||||
VersionString = version,
|
||||
SourceDir = "",
|
||||
OutputPattern = "",
|
||||
FrameStart = 1001,
|
||||
FrameEnd = 1050,
|
||||
DeliveryMovPath = movPath,
|
||||
// Flat: every item's folder is the package folder itself.
|
||||
ShotDir = _reviewDir,
|
||||
DeliveredBaseName = deliveredBase ?? $"{shotCode}_cmp_TT_{version}",
|
||||
};
|
||||
|
||||
private DeliveryStage NewStage() => new(
|
||||
new WorkerOptions { ServerUrl = "n/a", ApiKey = "n/a" },
|
||||
new ApiClient(new WorkerOptions { ServerUrl = "http://localhost:1", ApiKey = "x" }, NullLogger<ApiClient>.Instance),
|
||||
NullLogger<DeliveryStage>.Instance);
|
||||
|
||||
[Fact]
|
||||
public async Task BuildsAFlatFolderOfMovsUnderTheClientFacingName()
|
||||
{
|
||||
var mov = WriteMov("SHOT_001", "v004");
|
||||
var manifest = Manifest(Item("SHOT_001", "v004", mov, deliveredBase: "EP6_VFX_012_v004"));
|
||||
|
||||
var result = await NewStage().RunAsync(new ClaimedJob { Id = "job1" }, manifest, "machine1",
|
||||
CancellationToken.None, CancellationToken.None);
|
||||
|
||||
Assert.True(result.Ok);
|
||||
var item = Assert.Single(result.Items);
|
||||
Assert.Equal("VERIFIED", item.Status);
|
||||
Assert.Equal(1, item.FileCount);
|
||||
// No shot subfolder: the MOVs sit beside each other to be scrubbed through.
|
||||
Assert.Null(item.ExrPath);
|
||||
Assert.Equal(Path.Combine(_reviewDir, "EP6_VFX_012_v004.mov"), item.MovPath);
|
||||
Assert.Single(Directory.GetDirectories(_reviewDir).Concat(Directory.GetFiles(_reviewDir)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task LeavesNoReportOrManifestBesideTheMovs()
|
||||
{
|
||||
var manifest = Manifest(Item("SHOT_001", "v004", WriteMov("SHOT_001", "v004")));
|
||||
|
||||
var result = await NewStage().RunAsync(new ClaimedJob { Id = "job1" }, manifest, "machine1",
|
||||
CancellationToken.None, CancellationToken.None);
|
||||
|
||||
Assert.True(result.Ok);
|
||||
Assert.Null(result.ReportPath);
|
||||
// What a producer opens is exactly the MOVs — no manifest.json, no CSV.
|
||||
Assert.False(File.Exists(Path.Combine(_reviewDir, "manifest.json")));
|
||||
Assert.All(Directory.GetFiles(_reviewDir), f => Assert.EndsWith(".mov", f));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task HardLinksSoASeventyShotReviewCostsNoDisk()
|
||||
{
|
||||
var mov = WriteMov("SHOT_001", "v004");
|
||||
var manifest = Manifest(Item("SHOT_001", "v004", mov));
|
||||
|
||||
var result = await NewStage().RunAsync(new ClaimedJob { Id = "job1" }, manifest, "machine1",
|
||||
CancellationToken.None, CancellationToken.None);
|
||||
|
||||
Assert.Equal("hardlink", result.Items[0].LinkMode);
|
||||
File.WriteAllText(mov, "rewritten");
|
||||
Assert.Equal("rewritten", File.ReadAllText(result.Items[0].MovPath!));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AlwaysCopyModeProducesAnIndependentFile()
|
||||
{
|
||||
var mov = WriteMov("SHOT_001", "v004");
|
||||
var manifest = Manifest(Item("SHOT_001", "v004", mov));
|
||||
manifest.CopyMode = "always-copy";
|
||||
|
||||
var result = await NewStage().RunAsync(new ClaimedJob { Id = "job1" }, manifest, "machine1",
|
||||
CancellationToken.None, CancellationToken.None);
|
||||
|
||||
Assert.True(result.Ok);
|
||||
Assert.Equal("copy", result.Items[0].LinkMode);
|
||||
File.WriteAllText(mov, "rewritten");
|
||||
Assert.NotEqual("rewritten", File.ReadAllText(result.Items[0].MovPath!));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AMissingMovFailsTheReviewRatherThanShippingItShort()
|
||||
{
|
||||
// In an EXR delivery a missing MOV is a missing viewing copy and the
|
||||
// package continues. In a review the MOV *is* the deliverable.
|
||||
var manifest = Manifest(Item("SHOT_001", "v004", Path.Combine(_renderDir, "never_rendered.mov")));
|
||||
|
||||
var result = await NewStage().RunAsync(new ClaimedJob { Id = "job1" }, manifest, "machine1",
|
||||
CancellationToken.None, CancellationToken.None);
|
||||
|
||||
Assert.False(result.Ok);
|
||||
Assert.Equal("FAILED", result.Items[0].Status);
|
||||
Assert.Contains("Preview MOV not found", result.Items[0].ErrorMessage!);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task AnItemWithNoRecordedMovFails()
|
||||
{
|
||||
var manifest = Manifest(Item("SHOT_001", "v004", null));
|
||||
|
||||
var result = await NewStage().RunAsync(new ClaimedJob { Id = "job1" }, manifest, "machine1",
|
||||
CancellationToken.None, CancellationToken.None);
|
||||
|
||||
Assert.False(result.Ok);
|
||||
Assert.Contains("No preview MOV", result.Items[0].ErrorMessage!);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task HashesEveryFileWhenTheConfigDemandsIt()
|
||||
{
|
||||
var manifest = Manifest(Item("SHOT_001", "v004", WriteMov("SHOT_001", "v004")));
|
||||
manifest.VerifyMode = "always-hash";
|
||||
|
||||
var result = await NewStage().RunAsync(new ClaimedJob { Id = "job1" }, manifest, "machine1",
|
||||
CancellationToken.None, CancellationToken.None);
|
||||
|
||||
Assert.True(result.Ok);
|
||||
// A MOV has no validation-time digest of its own, so the one recorded
|
||||
// here is the one this build computed.
|
||||
Assert.False(string.IsNullOrWhiteSpace(result.Items[0].Checksum));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task OneBadShotFailsThePackageAndTheRestStillReport()
|
||||
{
|
||||
var manifest = Manifest(
|
||||
Item("SHOT_001", "v004", WriteMov("SHOT_001", "v004")),
|
||||
Item("SHOT_002", "v002", Path.Combine(_renderDir, "absent.mov")));
|
||||
|
||||
var result = await NewStage().RunAsync(new ClaimedJob { Id = "job1" }, manifest, "machine1",
|
||||
CancellationToken.None, CancellationToken.None);
|
||||
|
||||
Assert.False(result.Ok);
|
||||
Assert.Equal("VERIFIED", result.Items[0].Status);
|
||||
Assert.Equal("FAILED", result.Items[1].Status);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,10 @@ namespace VFXReviewWorker;
|
||||
/// hard-links (or copies) each shot's EXRs and delivery MOV into it, verifies
|
||||
/// what it wrote, and leaves a manifest + CSV report beside the shots.
|
||||
///
|
||||
/// A MOV_REVIEW package (§11.6) runs the same path for a different shape: one
|
||||
/// flat folder, one preview MOV per shot, and nothing written into it but the
|
||||
/// MOVs themselves — it is shared with a producer, not filed as a delivery.
|
||||
///
|
||||
/// Hard links make an 18-shot EXR package near-instant and cost no extra disk.
|
||||
/// They are safe here because rendered versions are immutable by pipeline
|
||||
/// design — a new version is a new directory, nothing ever rewrites an EXR in
|
||||
@@ -38,9 +42,10 @@ public sealed class DeliveryStage
|
||||
var manifestFiles = new List<object>();
|
||||
var alwaysCopy = string.Equals(manifest.CopyMode, "always-copy", StringComparison.OrdinalIgnoreCase);
|
||||
var alwaysHash = string.Equals(manifest.VerifyMode, "always-hash", StringComparison.OrdinalIgnoreCase);
|
||||
var isReview = string.Equals(manifest.Kind, "MOV_REVIEW", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
_log.LogInformation("Building delivery package {Name} ({Count} shots) at {Dir}",
|
||||
manifest.PackageName, manifest.Items.Count, packageDir);
|
||||
_log.LogInformation("Building {What} {Name} ({Count} shots) at {Dir}",
|
||||
isReview ? "MOV review" : "delivery package", manifest.PackageName, manifest.Items.Count, packageDir);
|
||||
Directory.CreateDirectory(packageDir);
|
||||
|
||||
for (var i = 0; i < manifest.Items.Count; i++)
|
||||
@@ -51,7 +56,9 @@ public sealed class DeliveryStage
|
||||
await _api.ProgressAsync(job.Id, machineId, (double)i / manifest.Items.Count, i, manifest.Items.Count, null,
|
||||
$"Packaging {item.ShotCode} {item.VersionString} ({i + 1}/{manifest.Items.Count})", shutdown);
|
||||
|
||||
var result = BuildItem(item, mapper, alwaysCopy, alwaysHash, manifestFiles);
|
||||
var result = isReview
|
||||
? BuildReviewItem(item, mapper, alwaysCopy, alwaysHash, manifestFiles)
|
||||
: BuildItem(item, mapper, alwaysCopy, alwaysHash, manifestFiles);
|
||||
results.Add(result);
|
||||
if (result.Status == "FAILED")
|
||||
{
|
||||
@@ -63,15 +70,22 @@ public sealed class DeliveryStage
|
||||
|
||||
// The report is the client-facing document, so it is written even for a
|
||||
// partial build — it is the fastest way to see what did and did not land.
|
||||
//
|
||||
// A review folder gets neither: it is opened by a producer who wants the
|
||||
// MOVs and nothing else. The manifest still travels back to the server,
|
||||
// so the record of what was shared is kept without cluttering the share.
|
||||
string? reportPath = null;
|
||||
try
|
||||
if (!isReview)
|
||||
{
|
||||
reportPath = WriteReport(manifest, results, mapper);
|
||||
WriteManifestJson(manifest, results, manifestFiles, packageDir);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.LogWarning(ex, "Could not write delivery report/manifest for {Name}", manifest.PackageName);
|
||||
try
|
||||
{
|
||||
reportPath = WriteReport(manifest, results, mapper);
|
||||
WriteManifestJson(manifest, results, manifestFiles, packageDir);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.LogWarning(ex, "Could not write delivery report/manifest for {Name}", manifest.PackageName);
|
||||
}
|
||||
}
|
||||
|
||||
return new DeliveryResult(ok, results, packageDir, reportPath, manifestFiles);
|
||||
@@ -234,6 +248,108 @@ public sealed class DeliveryStage
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// One shot of a MOV review package: place its preview MOV straight into
|
||||
/// the (flat) review folder under the client-facing name.
|
||||
///
|
||||
/// A missing MOV is fatal here, unlike in an EXR delivery where the MOV is
|
||||
/// a viewing copy beside the real deliverable — in a review it *is* the
|
||||
/// deliverable, and a review folder quietly one shot short is worse than
|
||||
/// one that says so.
|
||||
/// </summary>
|
||||
private DeliveryItemResult BuildReviewItem(
|
||||
DeliveryManifestItem item, PathMapper mapper, bool alwaysCopy, bool alwaysHash, List<object> manifestFiles)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(item.DeliveryMovPath))
|
||||
{
|
||||
return DeliveryItemResult.Failed(item, "No preview MOV is recorded for this version");
|
||||
}
|
||||
|
||||
var movSrc = mapper.Map(item.DeliveryMovPath!);
|
||||
if (!File.Exists(movSrc))
|
||||
{
|
||||
return DeliveryItemResult.Failed(item, $"Preview MOV not found: {movSrc}");
|
||||
}
|
||||
|
||||
// ShotDir is the package folder itself for a review — the MOVs sit
|
||||
// beside each other so a producer can scrub through them in order.
|
||||
var reviewDir = mapper.Map(item.ShotDir);
|
||||
Directory.CreateDirectory(reviewDir);
|
||||
|
||||
var name = string.IsNullOrWhiteSpace(item.DeliveredBaseName)
|
||||
? Path.GetFileName(movSrc)
|
||||
: item.DeliveredBaseName + Path.GetExtension(movSrc);
|
||||
var dest = Path.Combine(reviewDir, name);
|
||||
|
||||
if (Place(movSrc, dest, alwaysCopy, out var copied) is string error)
|
||||
{
|
||||
return DeliveryItemResult.Failed(item, error);
|
||||
}
|
||||
|
||||
var sourceLength = new FileInfo(movSrc).Length;
|
||||
var destLength = new FileInfo(dest).Length;
|
||||
|
||||
// There is no validation-time digest for a MOV to check against, so
|
||||
// a copy is proved against the source it came from: length always
|
||||
// (it catches the truncation a full disk causes, for free), and the
|
||||
// full hash when the config asks for it. A hard link is the source.
|
||||
string? digest = null;
|
||||
if (copied)
|
||||
{
|
||||
if (destLength != sourceLength)
|
||||
{
|
||||
return DeliveryItemResult.Failed(item,
|
||||
$"Copied MOV is {destLength} bytes but the source is {sourceLength} — the copy is incomplete");
|
||||
}
|
||||
if (alwaysHash)
|
||||
{
|
||||
digest = XxHash64.HashFile(dest);
|
||||
var sourceDigest = XxHash64.HashFile(movSrc);
|
||||
if (!string.Equals(digest, sourceDigest, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return DeliveryItemResult.Failed(item,
|
||||
$"Copied MOV does not match its source: expected {sourceDigest}, got {digest}");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (alwaysHash)
|
||||
{
|
||||
digest = XxHash64.HashFile(dest);
|
||||
}
|
||||
|
||||
manifestFiles.Add(new
|
||||
{
|
||||
shotCode = item.ShotCode,
|
||||
relativePath = name,
|
||||
bytes = destLength,
|
||||
exportId = item.ExportId,
|
||||
});
|
||||
|
||||
return new DeliveryItemResult
|
||||
{
|
||||
ItemId = item.ItemId,
|
||||
ShotCode = item.ShotCode,
|
||||
VersionString = item.VersionString,
|
||||
Status = "VERIFIED",
|
||||
// No EXR sequence is involved, so there is no shot folder to record.
|
||||
ExrPath = null,
|
||||
MovPath = dest,
|
||||
FileCount = 1,
|
||||
TotalBytes = destLength,
|
||||
Checksum = digest,
|
||||
LinkMode = copied ? "copy" : "hardlink",
|
||||
FrameStart = item.FrameStart,
|
||||
FrameEnd = item.FrameEnd,
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return DeliveryItemResult.Failed(item, $"{ex.GetType().Name}: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hard-link when possible, copy when not. Returns null on success or the
|
||||
/// error message. `copied` reports which happened, so the package records
|
||||
|
||||
@@ -100,6 +100,12 @@ public sealed class BlenderManifest
|
||||
public sealed class DeliveryManifest
|
||||
{
|
||||
public string Stage { get; set; } = "DELIVERY";
|
||||
/// <summary>
|
||||
/// "EXR_DELIVERY" builds the per-shot folders of EXRs + MOVs; "MOV_REVIEW"
|
||||
/// builds a flat folder of preview MOVs for a formal review (§11.6). One
|
||||
/// job type and one claim path either way — only what lands on disk differs.
|
||||
/// </summary>
|
||||
public string Kind { get; set; } = "EXR_DELIVERY";
|
||||
public string PackageId { get; set; } = "";
|
||||
public string PackageName { get; set; } = "";
|
||||
public int PackageNumber { get; set; }
|
||||
@@ -138,6 +144,13 @@ public sealed class DeliveryManifestItem
|
||||
public string DeliveredBaseName { get; set; } = "";
|
||||
/// <summary>When this export's validation ran — lets a linked package detect a source changed since QC.</summary>
|
||||
public DateTimeOffset? ValidatedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// True on a MOV_REVIEW item: there is no EXR sequence, so SourceDir,
|
||||
/// OutputPattern, FileCount and Checksum are empty and DeliveryMovPath is
|
||||
/// the whole deliverable.
|
||||
/// </summary>
|
||||
public bool IsMovOnly => string.IsNullOrWhiteSpace(SourceDir);
|
||||
}
|
||||
|
||||
/// <summary>PREVIEW_ONLY manifest (server-built, RenderPipeline2 §9).</summary>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
every change that gets published. publish.ps1 appends the git SHA via
|
||||
SourceRevisionId, giving "1.1.0+feb1c7b".
|
||||
-->
|
||||
<Version>1.5.2</Version>
|
||||
<Version>1.6.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user