feat: owner review 2 phase 5a: workspace and projects with a local home (#14)
CI / Build and test (push) Successful in 9m43s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 27s
CI / PostgreSQL 16 integration (push) Failing after 8m41s
CI / PostgreSQL 17 integration (push) Successful in 12m37s
CI / Docker image (push) Successful in 56s
Release / Build, test and publish (push) Successful in 14m59s
Release / Server image (push) Successful in 1m51s

Edit opens a sequence as a project of a workspace folder outside the library. Projects have linear version histories kept as sidecars in .chronos/projects/, Main mirrors the sequence's settings, and sync merges setting by setting. Migration 0009, JobKind.WorkspaceCopy = 20, Settings › Workspace, and 241 new strings in 38 languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #14.
This commit is contained in:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-11-04 09:22:08 +01:00
1 parent efa87f68ce
commit 9b24cf74fc
370 files changed
+29237 -287

No files matched your search

@@ -64,6 +64,64 @@ public sealed class RenderJobTests(TestContext context)
Assert.Equal(3, (await fx.Db.Sequences.GetAsync(sequence.Id, fx.Ct))!.RenderedCount);
}
[Test]
public async Task AProjectVersionRendersWithItsPositionsPlacedOnTheFramesAndIsRecordedWithIt()
{
await using var fx = await ProcessingFixture.CreateAsync(context);
var sequence = await fx.AddAsync(Scene());
var frames = await fx.Db.Frames.ListBySequenceAsync(sequence.Id, cancellationToken: fx.Ct);
var photos = new FramePhotos(frames.Select(f => (f.Index, new FramePhoto(f.Sha256, f.Size, f.CapturedAt))));
var projects = fx.Archive.Service.Projects;
var vertical = await projects.CreateAsync(sequence.Id, "Vertical", cancellationToken: fx.Ct);
var head = await projects.HeadAsync(vertical.Id, fx.Ct);
// The version holds its positions parked by photo (the adopted frames are not hashed: size and capture time name them).
var settings = new ProjectSettings { ExcludedFrames = [3, 5], Timing = new TimingSettings { Mode = new Auto<TimingMode>().WithManual(TimingMode.Constant) } };
var portable = ProjectContent.ToPortable(settings, photos);
Assert.Empty(ProjectSettings.FromJson(portable).ExcludedFrames);
var draft = head with
{
Id = Guid.CreateVersion7(),
ParentId = head.Id,
Number = 2,
Kind = ProjectVersionKind.Commit,
SettingsJson = portable,
ContentHash = ProjectContent.Hash(portable),
StoredAt = null,
};
var version = (await projects.PushAsync(vertical.Id, draft, fx.Ct)).Version!;
await fx.StartEngineAsync();
var requests = ProcessingJobs.RenderVersion(sequence, version, Mjpeg with { Preset = new Auto<string>().WithManual("png-sequence") }, 96, 64);
var job = await fx.EnqueueAsync(requests.Single());
await fx.Archive.WaitForAsync(job.Id, JobState.Done, (int)TestTiming.Budget(60));
Assert.Equal(Frames - 2, Directory.GetFiles(Path.Combine(fx.Folder(sequence).Exports, "clip-PNG")).Length);
var render = (await fx.Db.Renders.ListBySequenceAsync(sequence.Id, fx.Ct)).Single();
Assert.Equal((vertical.Id, version.Id), (render.ProjectId, render.ProjectVersionId));
Assert.SequenceEqual([3, 5], ProjectSettings.FromJson(render.SettingsJson!).ExcludedFrames);
// A render of another project leaves the sequence's own settings alone.
Assert.Empty(ProjectSettings.FromJson((await fx.Db.Sequences.GetAsync(sequence.Id, fx.Ct))!.SettingsJson ?? "{}").ExcludedFrames);
// A job naming the version without its settings renders them too.
var named = Chronos.Protocol.ProtocolJson.Default.RenderJobParameters;
var parameters = System.Text.Json.JsonSerializer.Deserialize(requests[0].ParametersJson!, named)! with { SettingsJson = null };
var second = await fx.EnqueueAsync(requests[0] with { ParametersJson = System.Text.Json.JsonSerializer.Serialize(parameters, named) });
await fx.Archive.WaitForAsync(second.Id, JobState.Done, (int)TestTiming.Budget(60));
Assert.True((await fx.Db.Renders.ListBySequenceAsync(sequence.Id, fx.Ct)).All(r => r.ProjectVersionId == version.Id));
// A version the index does not hold (saved on a PC, sent later under another id), or one whose settings the job does
// not embed: the render records the project alone, never a version it did not render.
var embedded = System.Text.Json.JsonSerializer.Deserialize(requests[0].ParametersJson!, named)!;
var other = ProjectContent.ToPortable(settings with { ExcludedFrames = [3] }, photos);
foreach (var wrong in new[] { embedded with { ProjectVersionId = Guid.CreateVersion7() }, embedded with { SettingsJson = other } })
{
var refused = await fx.EnqueueAsync(requests[0] with { ParametersJson = System.Text.Json.JsonSerializer.Serialize(wrong, named) });
await fx.Archive.WaitForAsync(refused.Id, JobState.Done, (int)TestTiming.Budget(60));
var recorded = (await fx.Db.Renders.GetAsync(Chronos.Data.Processing.Jobs.RenderJobHandler.RenderId(refused.Id, 0), fx.Ct))!;
Assert.Equal<(Guid?, Guid?)>((vertical.Id, null), (recorded.ProjectId, recorded.ProjectVersionId));
}
}
[Test]
public async Task FramesThisHostCannotDecodeRenderFromTheirProxies()
{