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:
Alby96andClaude Opus 5.5 committed 2026-11-04 16:23:54 +01:00
1 parent 6daf5fa056
commit 09fcff4eb2
13 files changed
+210 -226

No files matched your search

@@ -3,6 +3,7 @@ using System.IO;
using Chronos.App.Archiving;
using Chronos.App.Infrastructure;
using Chronos.App.Jobs;
using Chronos.App.Settings;
using Chronos.App.Workspace;
using Chronos.Core.Localization;
using Chronos.Core.Model;
@@ -112,36 +113,25 @@ public sealed class WorkspaceCleanupHostTests(TestContext context)
var plan = await host.PlanTrashAsync();
Assert.Equal((2, 2L * "kept aside a".Length), (plan.Items.Count, plan.Bytes));
var closed = 0;
WorkspaceTrashResult? emptied = null;
var dialog = new WorkspaceTrashDialogViewModel(plan, p => host.EmptyTrashAsync(p), r => emptied = r, _ => closed++);
Assert.Equal(2, dialog.Rows.Count);
Assert.Equal("2", dialog.Confirmation);
Assert.False(dialog.EraseCommand.CanExecute(null), "nothing typed");
dialog.Typed = "3";
Assert.False(dialog.CanErase, "the wrong number");
dialog.Typed = " 2 ";
Assert.True(dialog.CanErase && dialog.EraseCommand.CanExecute(null), "the number of entries");
// The Empty… confirmation lists both entries and asks for their number typed.
var request = Assert.NotNull(WorkspaceSettingsRows.TrashRequest(plan));
Assert.Equal("2", request.TypedConfirmation);
Assert.True(request.IsDestructive, "erasing for good is destructive");
// An entry added since the plan: refused, nothing erased, the dialog stays open with why.
// An entry added since the plan: refused, nothing erased.
var late = Directory.CreateDirectory(Path.Combine(folder, Guid.CreateVersion7().ToString("N") + "-" + DateTime.UtcNow.Ticks)).FullName;
File.WriteAllText(Path.Combine(late, "late.txt"), "late");
dialog.EraseCommand.Execute(null);
await WorkspaceTestBed.UntilAsync(() => dialog.ErrorText is { Length: > 0 }, "the emptying is refused");
Assert.Equal(0, closed);
var refused = await Assert.ThrowsAsync<WorkspaceException>(() => host.EmptyTrashAsync(plan));
Assert.Equal(Loc.L("Errors.Workspace.TrashChanged"), refused.Message);
Assert.Equal(3, (await host.PlanTrashAsync()).Items.Count);
// As planned again: erased for good, the dialog closed.
// As planned again: erased for good.
plan = await host.PlanTrashAsync();
dialog = new WorkspaceTrashDialogViewModel(plan, p => host.EmptyTrashAsync(p), r => emptied = r, _ => closed++) { Typed = "3" };
dialog.EraseCommand.Execute(null);
await WorkspaceTestBed.UntilAsync(() => closed == 1, "the dialog closes");
Assert.True(emptied is { Items: 3 }, "three entries erased");
var emptied = await host.EmptyTrashAsync(plan);
Assert.Equal(3, emptied.Items);
Assert.True((await host.PlanTrashAsync()).IsEmpty, "the trash is empty");
// An empty trash offers nothing to erase.
var none = new WorkspaceTrashDialogViewModel(await host.PlanTrashAsync(), p => host.EmptyTrashAsync(p), null, _ => { }) { Typed = "0" };
Assert.False(none.CanErase);
Assert.Equal(Loc.L("Tooltips.Settings.Workspace.EmptyTrash.Disabled"), none.EraseToolTip);
Assert.Null(WorkspaceSettingsRows.TrashRequest(await host.PlanTrashAsync()));
}
}