fix(workspace): join the phase 5c packages at their seams
The local render, the send home, the clean-up, the settings page and the folder move were built apart; together they left gaps: - A local render to an image sequence writes a folder, which the send took for a missing file. The archive home now files the folder whole (checked by its listing hash, as the render recorded it) and the clean-up removes a sent folder; a server, which takes one file per render, refuses it with Errors.Workspace.SendSequence. - Rename, delete and Remove local copy are refused while the folder is being moved, so no project folder changes under the move. - Settings > Workspace shows the folder, usage, Move... and Change... again when a move ends (WorkspaceHost.MoveEnded). - Empty... uses the Settings typed confirmation; the separate trash dialog, never shown, is removed. The move plan counts unsent renders with the clean-up's helper. - Tests: the follow-up send now runs in the render tests; an end-to-end archive-home test (originals, version on render, local render, send with project and version, clean-up) and an image-sequence send test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6daf5fa056
commit
09fcff4eb2
13 files changed
+210
-226
No files matched your search
@@ -90,18 +90,22 @@ public sealed class WorkspaceRenderTests(TestContext context)
|
||||
Assert.Equal(await Chronos.Core.Archiving.ContentHash.Sha256Async(output), entry.Sha256);
|
||||
Assert.Equal(("Mjpeg", 96, 64), (entry.Codec, entry.Width, entry.Height));
|
||||
Assert.Null(entry.ProjectVersionId, "the working state the job embeds is no version this workspace holds");
|
||||
Assert.Empty(await fx.Db.Renders.ListBySequenceAsync(bed.Sequence.Id, fx.Ct));
|
||||
|
||||
// The send home follows with the new render.
|
||||
// The send home follows with the new render, and files it in the archive with its project.
|
||||
var send = (await fx.Db.Jobs.ListAsync(null, 50, null, fx.Ct)).Items.Single(j => j.Kind == JobKind.WorkspaceSend);
|
||||
var sent = Assert.NotNull(WorkspaceJobs.SendParameters(send));
|
||||
Assert.SequenceEqual([entry.RenderId], sent.RenderIds);
|
||||
Assert.Equal((bed.Project.ProjectId, bed.Store.Root), (sent.ProjectId, sent.WorkspaceRoot));
|
||||
await fx.WaitForAsync(send.Id, JobState.Done);
|
||||
var filed = Assert.NotNull(await fx.Db.Renders.GetAsync(entry.RenderId, fx.Ct));
|
||||
Assert.Equal((bed.Sequence.Id, (Guid?)bed.Project.ProjectId, (Guid?)null), (filed.SequenceId, filed.ProjectId, filed.ProjectVersionId));
|
||||
entry = Assert.NotNull(bed.Project.ReadRenders().Find(entry.RenderId));
|
||||
Assert.True(entry.IsSent, "the ledger says it went home");
|
||||
|
||||
// The same render of the archive's own sequence: the same pictures, at the same size and length.
|
||||
var archive = await bed.Engine.EnqueueAsync(ProcessingJobs.Render(bed.Sequence, Mjpeg, 96, 64), cancellationToken: fx.Ct);
|
||||
await fx.WaitForAsync(archive.Id, JobState.Done);
|
||||
var row = (await fx.Db.Renders.ListBySequenceAsync(bed.Sequence.Id, fx.Ct)).Single();
|
||||
var row = Assert.NotNull(await fx.Db.Renders.GetAsync(RenderJobHandler.RenderId(archive.Id, 0), fx.Ct));
|
||||
Assert.Equal((row.Width, row.Height, row.Fps, row.DurationSeconds), (entry.Width, entry.Height, entry.Fps, entry.DurationSeconds));
|
||||
|
||||
// Again: another name, the first output and its entry kept.
|
||||
@@ -140,6 +144,67 @@ public sealed class WorkspaceRenderTests(TestContext context)
|
||||
Assert.Equal(Loc.L("Errors.Workspace.RenderVersion"), (await fx.WaitForAsync(unknown.Id, JobState.Failed)).Error);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The whole way of a local render to an archive home: originals copied, a version saved for the render, the render on this
|
||||
/// PC, the send that pushes the version first and files the render with its project and version, then the clean-up that
|
||||
/// removes the media and the sent file of the project, now in step with its home.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public async Task ALocalRenderGoesHomeWithItsVersionAndTheCleanUpThenFreesTheProject()
|
||||
{
|
||||
await using var bed = await BedAsync();
|
||||
var fx = bed.Fx;
|
||||
var id = bed.Project.ProjectId;
|
||||
var sync = new WorkspaceSync(bed.Store, "test") { LockWait = TimeSpan.FromSeconds(TestTiming.Budget(10)) };
|
||||
var home = new ArchiveProjectHome(fx.Db, fx.Archive.Service.Projects, bed.Sequence.Id);
|
||||
Assert.True(bed.Project.ReadMedia() is { HoldsOriginals: true }, "the copy brought the originals");
|
||||
// The archive's photos hashed (a Verify), so the home can say it holds each original as it is here.
|
||||
var verify = await bed.Engine.EnqueueAsync(ArchiveJobs.Verify(fx.Archive.Archive, [bed.Sequence.Id]), cancellationToken: fx.Ct);
|
||||
await fx.WaitForAsync(verify.Id, JobState.Done);
|
||||
|
||||
// Version on render: the working state saved as a version here, not sent yet.
|
||||
var session = await sync.OpenAsync(id, fx.Ct);
|
||||
await sync.SaveAsync(id, session.Working with { ExcludedFrames = [4] }, fx.Ct);
|
||||
var version = Assert.NotNull(await sync.CommitAsync(id, "Render", cancellationToken: fx.Ct));
|
||||
Assert.Null(await home.GetVersionAsync(id, version.Id, fx.Ct), "the home does not have the version yet");
|
||||
|
||||
var json = System.Text.Json.Nodes.JsonNode.Parse(ProcessingJobs.Render(bed.Sequence, Mjpeg, 96, 64).ParametersJson!)!.AsObject();
|
||||
json.Remove("settingsJson");
|
||||
var render = await bed.Engine.EnqueueAsync(
|
||||
WorkspaceJobs.Render(bed.Sequence.Id, bed.Sequence.DisplayTitle, bed.Store.Root, id, version.Id, json.ToJsonString()), cancellationToken: fx.Ct);
|
||||
await fx.WaitForAsync(render.Id, JobState.Done);
|
||||
var entry = bed.Project.ReadRenders().Entries.Single();
|
||||
Assert.Equal((version.Id, WorkspaceRenderEntry.Pending), (entry.ProjectVersionId, entry.State));
|
||||
|
||||
// The send pushes the version, then files the render with its project and version.
|
||||
var send = (await fx.Db.Jobs.ListAsync(null, 50, null, fx.Ct)).Items.Single(j => j.Kind == JobKind.WorkspaceSend);
|
||||
send = await fx.WaitForAsync(send.Id, JobState.Done);
|
||||
Assert.Contains(Loc.L("Archive.Log.WorkspaceVersionPushed", bed.Project.ReadBundle().Workspace!.Name, version.Number), send.LogTail);
|
||||
Assert.NotNull(await home.GetVersionAsync(id, version.Id, fx.Ct));
|
||||
var row = Assert.NotNull(await fx.Db.Renders.GetAsync(entry.RenderId, fx.Ct));
|
||||
Assert.Equal((bed.Sequence.Id, (Guid?)id, (Guid?)version.Id, entry.Size), (row.SequenceId, row.ProjectId, row.ProjectVersionId, row.Bytes));
|
||||
Assert.Equal(entry.Sha256, await Chronos.Core.Archiving.ContentHash.Sha256Async(Path.Combine(fx.Archive.Paths.Root, row.OutputPath)));
|
||||
Assert.True(bed.Project.ReadRenders().Find(entry.RenderId)!.IsSent, "the ledger says it went home");
|
||||
Assert.Equal(WorkspaceState.InSync, (await sync.StatusAsync(id, home, fx.Ct)).State);
|
||||
|
||||
// The clean-up (here the size limit) frees the project: its proxies, originals and the sent render go; the originals
|
||||
// are the home's own, so none is set aside in the trash.
|
||||
var exported = bed.Project.ExportFile(entry.File);
|
||||
var report = await new WorkspaceCleaner(sync, fx.Db, _ => home) { LockWait = TimeSpan.FromSeconds(TestTiming.Budget(10)) }
|
||||
.CleanAsync(new WorkspaceCleanOptions { SizeLimitBytes = 1 }, fx.Ct);
|
||||
var cleaned = Assert.NotNull(report.Cleaned.SingleOrDefault());
|
||||
Assert.Equal((id, 0), (cleaned.ProjectId, cleaned.Trashed));
|
||||
Assert.Empty(report.Kept);
|
||||
Assert.FileMissing(exported);
|
||||
Assert.Empty(bed.Project.ReadRenders().Entries);
|
||||
Assert.False(Directory.Exists(bed.Project.OriginalsDirectory), "the originals went");
|
||||
Assert.False(Directory.Exists(bed.Project.ProxiesDirectory), "the proxies went");
|
||||
Assert.True(bed.Project.ReadMedia() is { IsCleaned: true }, "the media index says it was cleaned");
|
||||
Assert.Equal(WorkspaceState.MediaRemoved, (await sync.StatusAsync(id, home, fx.Ct)).State);
|
||||
// The home keeps the render and the version.
|
||||
Assert.FileExists(Path.Combine(fx.Archive.Paths.Root, row.OutputPath));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task WithoutTheOriginalsTheRenderIsRefusedSayingHowManyLack()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user