feat: phase 5 groundwork (playback format 3, videos contracts, migration 0010, strings)
Lays down every contract the later parcels of owner review 1 phase 5 build on, so they compile against shared types without touching each other's files. - Settings format 3: export.playback (direction, loops, fades, hold), omitted at its default and member by member; RequiredFormat is 3 only while used. - OutputProgram public API with a forward-only body; still-frame job parameters (StillFrame, StillPhoto) routed to format-3 nodes only. - Render.Sha256/Kind, RenderCopy, RenderKind; JobKind.VideoCopy = 24. - Migration 0010 (sqlite, postgres): renders.sha256/kind, ix_renders_created, render_copies without a foreign key. - Videos protocol DTOs, client calls, ServerCapabilities.Videos (declared, not announced yet), ServerSettingsDto.VideosPath. - IVideoLibrary with a NotImplemented stub registered on the server; TrashKind.Videos, VideoTrashNames, VideoErrors. - en and it strings for the whole phase, five icons, decisions 1-22 and the open-question defaults; tests that used format 3 as "newer" now use 4. Refs #21 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
86aa07c1d7
commit
d472dfdec1
67 files changed
+2233
-244
No files matched your search
@@ -13,6 +13,7 @@ public sealed class JobWireTests
|
||||
[Case(JobKind.WorkspaceRender, 21, "workspace-render")]
|
||||
[Case(JobKind.WorkspaceSend, 22, "workspace-send")]
|
||||
[Case(JobKind.WorkspaceMove, 23, "workspace-move")]
|
||||
[Case(JobKind.VideoCopy, 24, "video-copy")]
|
||||
public void TheWorkspaceJobsKeepTheirValueAndName(JobKind kind, int value, string name)
|
||||
{
|
||||
Assert.Equal(value, (int)kind);
|
||||
|
||||
@@ -11,6 +11,7 @@ public abstract class MigrationTests(TestContext context) : RepositoryTest(conte
|
||||
[
|
||||
"archives", "sequences", "frames", "renders", "jobs", "media_cards", "import_history", "users", "tokens",
|
||||
"render_nodes", "settings", "tags", "sequence_tags", "audit_log", "uploads", "schedules", "frame_removals", "projects", "project_versions",
|
||||
"render_copies",
|
||||
];
|
||||
|
||||
[Test]
|
||||
@@ -103,6 +104,41 @@ public abstract class MigrationTests(TestContext context) : RepositoryTest(conte
|
||||
Assert.Null(await chronos.Projects.GetVersionAsync(version.Id, Ct));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task RendersKeepTheirHashAndKindAndCopiesOutliveThem()
|
||||
{
|
||||
var chronos = await OpenChronosAsync();
|
||||
var archive = TestData.Archive("Main");
|
||||
await chronos.Archives.UpsertAsync(archive, Ct);
|
||||
var sequence = TestData.Sequence(archive.Id);
|
||||
await chronos.Sequences.UpsertAsync(sequence, Ct);
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
var render = new Render { Id = Guid.CreateVersion7(), SequenceId = sequence.Id, PresetName = "PNG", OutputPath = "x/exports/a.png", Created = now };
|
||||
await chronos.Renders.InsertAsync(render, Ct);
|
||||
|
||||
await using var session = await chronos.Database.OpenAsync(Ct);
|
||||
// Rows recorded before migration 0010 have neither: null, told apart by the codec.
|
||||
Assert.Equal(1L, await session.ScalarAsync<long>("SELECT count(*) FROM renders WHERE sha256 IS NULL AND kind IS NULL", [], Ct));
|
||||
var hash = new string('a', 64);
|
||||
await session.ExecuteAsync("UPDATE renders SET sha256 = $1, kind = $2 WHERE id = $3", [hash, "still", render.Id], Ct);
|
||||
Assert.Equal(hash, await session.ScalarAsync<string>("SELECT sha256 FROM renders WHERE id = $1", [render.Id], Ct));
|
||||
Assert.Equal("still", await session.ScalarAsync<string>("SELECT kind FROM renders WHERE id = $1", [render.Id], Ct));
|
||||
|
||||
// A copy names its render without a foreign key: it is kept when the render goes, and may name one never stored here.
|
||||
foreach (var renderId in new[] { render.Id, Guid.CreateVersion7() })
|
||||
{
|
||||
await session.ExecuteAsync(
|
||||
"INSERT INTO render_copies (id, render_id, path, sha256, bytes, copied_at, copied_by) VALUES ($1, $2, $3, $4, $5, $6, $7)",
|
||||
[Guid.CreateVersion7(), renderId, $"C:/Videos/{renderId:N}.png", hash, 1234L, now, "admin"], Ct);
|
||||
}
|
||||
await chronos.Renders.DeleteAsync(render.Id, Ct);
|
||||
Assert.Equal(2L, await session.ScalarAsync<long>("SELECT count(*) FROM render_copies", [], Ct));
|
||||
Assert.Equal(1234L, await session.ScalarAsync<long>("SELECT bytes FROM render_copies WHERE render_id = $1", [render.Id], Ct));
|
||||
// Bytes default to 0 and the hash and author may be null.
|
||||
await session.ExecuteAsync("INSERT INTO render_copies (id, render_id, path, copied_at) VALUES ($1, $2, $3, $4)", [Guid.CreateVersion7(), render.Id, "C:/Videos/b", now], Ct);
|
||||
Assert.Equal(0L, await session.ScalarAsync<long>("SELECT bytes FROM render_copies WHERE path = $1", ["C:/Videos/b"], Ct));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AppliesOnlyPendingMigrations()
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ public sealed class ProjectStoreTests(TestContext context)
|
||||
[Test]
|
||||
public void SettingsOfANewerChronosAreRefusedSayingSo()
|
||||
{
|
||||
var refused = Assert.Throws<InvalidDataException>(() => ProjectStore.Parse("""{"version":3,"camera":{"rotate":90}}"""));
|
||||
var refused = Assert.Throws<InvalidDataException>(() => ProjectStore.Parse("""{"version":4,"camera":{"rotate":90}}"""));
|
||||
Assert.Equal(Loc.L("Errors.Render.NewerSettings"), refused.Message);
|
||||
Assert.Equal(90, ProjectStore.Parse("""{"version":2,"camera":{"rotate":90}}""").Camera.Rotate);
|
||||
// Text that is not a project keeps its own reason.
|
||||
|
||||
@@ -687,11 +687,11 @@ public sealed class RenderJobTests(TestContext context)
|
||||
|
||||
var parameters = ProcessingJobs.ReadRender(ProcessingJobs.Render(sequence, Mjpeg, 96, 64).ParametersJson).Parameters with
|
||||
{
|
||||
SettingsJson = """{"version":3,"camera":{"rotate":90},"grade":{"lut":"teal"}}""",
|
||||
SettingsJson = """{"version":4,"camera":{"rotate":90},"grade":{"lut":"teal"}}""",
|
||||
};
|
||||
var request = new Chronos.Data.Archiving.Jobs.ArchiveJobRequest(JobKind.Render, [sequence.Id], "newer",
|
||||
System.Text.Json.JsonSerializer.Serialize(parameters, Chronos.Protocol.ProtocolJson.Default.RenderJobParameters), JobPriority.User);
|
||||
Assert.Equal(3, ProcessingJobs.ReadRender(ProcessingJobs.Render(sequence, Mjpeg, 96, 64,
|
||||
Assert.Equal(4, ProcessingJobs.ReadRender(ProcessingJobs.Render(sequence, Mjpeg, 96, 64,
|
||||
ProjectSettings.FromJson(parameters.SettingsJson, allowNewer: true)).ParametersJson).Parameters.RequiredSettingsFormat, "routed to none older");
|
||||
var failed = await fx.WaitForAsync((await fx.EnqueueAsync(request)).Id, JobState.Failed);
|
||||
Assert.Equal(Loc.L("Errors.Render.NewerSettings"), failed.Error);
|
||||
|
||||
@@ -110,11 +110,11 @@ public sealed class ProjectMergeTests
|
||||
public void AFormatThreeSideIsNeverMerged()
|
||||
{
|
||||
var basis = new ProjectSettings { Camera = new CameraSettings { Rotate = 90 } };
|
||||
var newer = ProjectSettings.FromJson("""{ "version": 3, "camera": { "rotate": 180 }, "look": { "filter": "film" } }""", allowNewer: true);
|
||||
var newer = ProjectSettings.FromJson("""{ "version": 4, "camera": { "rotate": 180 }, "look": { "filter": "film" } }""", allowNewer: true);
|
||||
var mine = basis with { Look = new LookSettings { Filter = "warm" } };
|
||||
Assert.Throws<NewerSettingsException>(() => ProjectMerge.MergeWithConflicts(basis, mine, newer));
|
||||
Assert.Throws<NewerSettingsException>(() => ProjectMerge.MergeWithConflicts(basis, newer, mine));
|
||||
Assert.Equal(3, ProjectMerge.MergeWithConflicts(basis, basis, newer).Merged.Version);
|
||||
Assert.Equal(4, ProjectMerge.MergeWithConflicts(basis, basis, newer).Merged.Version);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -165,7 +165,7 @@ public sealed class ProjectMergeTests
|
||||
public void SettingsOfANewerChronosAreNeverMergedWithThisOnes()
|
||||
{
|
||||
var basis = new ProjectSettings { Exposure = new ExposureSettings { ExposureOffsetEv = 0.1 } };
|
||||
var newer = ProjectSettings.FromJson("""{ "version": 3, "exposure": { "exposureOffsetEv": 0.5 }, "grade": { "look": "film" } }""", allowNewer: true);
|
||||
var newer = ProjectSettings.FromJson("""{ "version": 4, "exposure": { "exposureOffsetEv": 0.5 }, "grade": { "look": "film" } }""", allowNewer: true);
|
||||
var mine = basis with { Stack = new StackSettings { Mode = StackSetting.Median } };
|
||||
|
||||
// Both changed: refused, whichever side the newer one is, in a replay too.
|
||||
|
||||
@@ -327,7 +327,7 @@ public abstract class ProjectRecoveryTests(TestContext context) : DatabaseTest(c
|
||||
var folder = fx.Paths.Sequence(sequence.Folder);
|
||||
|
||||
// A newer Chronos on another PC sharing the archive pushes version 2 in its settings format, and mirrors it.
|
||||
var settings = """{ "version": 3, "exposure": { "exposureOffsetEv": 0.5 }, "futureThing": true }""";
|
||||
var settings = """{ "version": 4, "exposure": { "exposureOffsetEv": 0.5 }, "futureThing": true }""";
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
var future = new ProjectVersion
|
||||
{
|
||||
@@ -339,7 +339,7 @@ public abstract class ProjectRecoveryTests(TestContext context) : DatabaseTest(c
|
||||
ClientName = "newer",
|
||||
SettingsJson = settings,
|
||||
ContentHash = ProjectContent.Hash(settings),
|
||||
SettingsFormat = 3,
|
||||
SettingsFormat = 4,
|
||||
FramesVersion = head.FramesVersion,
|
||||
CreatedAt = now,
|
||||
StoredAt = now,
|
||||
|
||||
@@ -254,7 +254,7 @@ public sealed class SyncRulesTests
|
||||
var turned = new ProjectSettings { Camera = new CameraSettings { Rotate = 90 } }.ToJson();
|
||||
Assert.Contains("\"version\": 2", turned);
|
||||
Assert.SequenceEqual(["camera.rotate"], SyncRules.Differences(turned, plain).Select(d => d.Path));
|
||||
Assert.Contains(SyncRules.Differences("""{"version":3,"camera":{"rotate":90}}""", turned, max: 5), d => d.Path == "version");
|
||||
Assert.Contains(SyncRules.Differences("""{"version":4,"camera":{"rotate":90}}""", turned, max: 5), d => d.Path == "version");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -455,7 +455,7 @@ public abstract class WorkspaceTests(TestContext context) : DatabaseTest(context
|
||||
var (_, sync) = fx.Workspace();
|
||||
var project = await fx.CheckoutAsync(sync);
|
||||
var bundle = project.ReadBundle();
|
||||
File.WriteAllText(project.BundlePath, bundle.ToJson().Replace("\"version\": 1", "\"version\": 3", StringComparison.Ordinal));
|
||||
File.WriteAllText(project.BundlePath, bundle.ToJson().Replace("\"version\": 1", "\"version\": 4", StringComparison.Ordinal));
|
||||
|
||||
var session = await sync.OpenAsync(project.ProjectId, fx.Ct);
|
||||
Assert.True(session.IsReadOnly);
|
||||
|
||||
Reference in new issue
Block a user