feat(server): route renders by settings format and adapted size; gate older servers

Owner review 1, phase 4 (P5). A render job now carries the output size its
settings give (RenderSize, proportions win) and the settings format it needs,
resolved on the server before the job is split, so only nodes that read that
format and whose encoder takes the frame claim it, and a job no online node
can read no longer waits for one. Nodes and the server announce the format
they read; settings of a newer Chronos fail saying so.

Encoder size limits are read as long edge x short edge: Media Foundation's
software H.264 encoder, announced as 4096x2304, accepts portrait 2160x3840
(probed on this PC), so EncoderSelector and the provider take either
orientation and cap a portrait frame against the turned limit.

On the desktop, Sync and Send-and-render are disabled with the
NeedsNewerServer tooltip while the server reads an older format than the
working settings need.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-04 19:48:23 +01:00
1 parent e4364c4f25
commit fca6c8dfea
27 files changed
+663 -47

No files matched your search

@@ -498,6 +498,42 @@ public sealed class ProjectTests(TestContext context)
Assert.Contains(ServerCapabilities.Projects, (await client.GetInfoAsync(context.Cancellation)).Capabilities);
}
/// <summary>
/// Owner review 1, phase 4: the server announces the settings format it reads, and takes the versions of the formats it
/// reads (1, and 2 with a turn or a look), refusing a newer one with 422 <c>newer_format</c>, nothing stored.
/// </summary>
[Test]
public async Task TheServerTakesTheSettingsFormatsItAnnounces()
{
await using var server = await TestServer.StartAsync(context, services: ArchiveModule.Register);
using (var anonymous = new ChronosClient(server.HttpBase, new CertificatePinning([]), "tests"))
Assert.Equal(ProjectSettings.CurrentVersion, (await anonymous.GetInfoAsync(context.Cancellation)).SettingsFormat);
Assert.Equal(2, ProjectSettings.CurrentVersion);
var (http, _, token) = await server.UserAsync("alberto", "editor");
using var alberto = Client(server, token);
var sid = await SequenceAsync(server, token, 2);
var main = (await alberto.ListProjectsAsync(sid)).Single(p => p.IsMain);
var head = await alberto.GetProjectHeadAsync(sid, main.Id);
var home = ProjectWire.ToHomeFrames(await alberto.GetProjectFramesAsync(sid));
var plain = Version(head, new ProjectSettings { Exposure = new ExposureSettings { ExposureOffsetEv = 0.3 } }, home);
Assert.Equal(1, plain.SettingsFormat);
var v2 = Assert.NotNull((await alberto.PushProjectVersionAsync(sid, main.Id, plain)).Version);
var turned = Version(v2, new ProjectSettings { Camera = new CameraSettings { Rotate = 90, Mirror = true }, Look = new LookSettings { Filter = "sepia" } }, home);
Assert.Equal(2, turned.SettingsFormat);
var v3 = Assert.NotNull((await alberto.PushProjectVersionAsync(sid, main.Id, turned)).Version);
Assert.Equal(2, ProjectContent.FormatOf(v3.SettingsJson));
var mirrored = ProjectSettings.FromJson(Assert.NotNull((await server.Database.Sequences.GetAsync(sid))!.SettingsJson));
Assert.Equal((90, true, "sepia"), (mirrored.Camera.Rotate, mirrored.Camera.Mirror, mirrored.Look?.Filter), "Main's head is the sequence's settings");
const string future = """{"version":3,"camera":{"rotate":90}}""";
var newer = Version(v3, new ProjectSettings(), home) with { SettingsJson = future, ContentHash = ProjectContent.Hash(future), SettingsFormat = 3 };
using (var raw = await http.PostAsJsonAsync($"/api/v1/sequences/{sid}/projects/{main.Id}/versions", newer, ProtocolJson.Default.ProjectVersionDto))
await raw.ExpectErrorAsync(HttpStatusCode.UnprocessableEntity, ProjectErrors.NewerFormat);
Assert.Equal(3, (await alberto.GetProjectAsync(sid, main.Id)).HeadNumber);
}
[Test]
public async Task TheFramesOfAHomeAreOfOneFramesVersionWithTheAliasesOfItsConversions()
{