feat(validation): try the comp's other delivered plates before failing timecode

When the timing plate disagrees with the render, the worker now checks the
manifest's other plates[] that sit under a plate search root (or beside the
timing plate's footage folder). A match is a PASS naming that element; no
match still FAILs against the timing plate, listing the alternates tried.
Pre-renders are excluded because they agree with the render by construction.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
twotalesanimation
2026-09-18 04:21:53 +02:00
parent 2dee1bf6fc
commit 400cf3f6ea
3 changed files with 170 additions and 18 deletions
@@ -109,6 +109,74 @@ public class ValidationStageTests : IDisposable
Assert.Contains("8-frame handle", tc.Message);
}
/// <summary>Writes a one-frame plate into a footage-style element folder.</summary>
private string WritePlate(string element, string timecode, int fps = 24)
{
var plate = Path.Combine(_dir, "footage", $"UNG_107_051_010_{element}_TT_v001", $"UNG_107_051_010_{element}_TT_v001.01001.exr");
Directory.CreateDirectory(Path.GetDirectoryName(plate)!);
File.Move(ExrFixture.Write(timecode, 3840, 2160, new[] { ("B", 1), ("G", 1), ("R", 1) }, fps, 4), plate);
return plate;
}
private static ManifestSource Source(string timingPlate, params string[] plates) => new()
{
TimingPlate = new PlateRef { Path = timingPlate, FrameStart = 1001 },
Plates = plates.Select(p => new PlateRef { Path = p, FrameStart = 1001 }).ToList(),
HandleFrames = 8,
};
[Fact]
public void AnotherDeliveredPlatePassesWhenTheTimingPlateDoesNot()
{
// The comp was anchored to FG01, but the panel named BG01 (longest) as
// the timing plate — the two carry unrelated camera timecodes.
WriteSequence(105, "09:12:00:00");
var bg = WritePlate("BG01", "14:26:31:08");
var fg = WritePlate("FG01", "09:12:00:00");
var manifest = Manifest(_dir, null, 1001);
manifest.Source = Source(bg, bg, fg);
var tc = Check(NewStage().Run(manifest, _dir, new ServerConfig()), "timecode_plate_match");
Assert.Equal("PASS", tc.Status);
Assert.Contains("UNG_107_051_010_FG01_TT_v001.01001.exr", tc.Message);
Assert.Contains("BG01", tc.Message);
}
[Fact]
public void NoMatchingPlateStillFailsAgainstTheTimingPlate()
{
WriteSequence(105, "14:26:31:16");
var bg = WritePlate("BG01", "14:26:31:08");
var fg = WritePlate("FG01", "09:12:00:00");
var manifest = Manifest(_dir, null, 1001);
manifest.Source = Source(bg, bg, fg);
var tc = Check(NewStage().Run(manifest, _dir, new ServerConfig()), "timecode_plate_match");
Assert.Equal("FAIL", tc.Status);
Assert.Equal("14:26:31:08", tc.Expected);
Assert.Contains("8-frame handle", tc.Message);
Assert.Contains("1 other delivered plate", tc.Message);
}
[Fact]
public void APreRenderIsNeverUsedAsTheFallbackPlate()
{
// plates[] is every file in the comp. A pre-render was rendered from
// this comp, so it agrees with the render whether or not either is right.
WriteSequence(105, "14:26:31:16");
var bg = WritePlate("BG01", "14:26:31:08");
var preRender = Path.Combine(_dir, "renders", "prerender", "UNG_107_051_010_PRERENDER_01001.exr");
Directory.CreateDirectory(Path.GetDirectoryName(preRender)!);
File.Move(ExrFixture.Write("14:26:31:16", 3840, 2160, new[] { ("B", 1), ("G", 1), ("R", 1) }, 24, 4), preRender);
var manifest = Manifest(_dir, null, 1001);
manifest.Source = Source(bg, bg, preRender);
Assert.Equal("FAIL", Check(NewStage().Run(manifest, _dir, new ServerConfig()), "timecode_plate_match").Status);
}
[Fact]
public void APlateAtADifferentRateFailsPlateFps()
{