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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user