fix(workspace): finish or keep every choice, copy and sync a cut or a deleted project leaves

- A take of the library's values cut past its commit point settles its conflict
  (replay journal marks Settles); a later stale choice finds nothing to settle,
  and one cut before it keeps the conflict so the next choice is applied.
- A local version that changes nothing once replayed on the head is not sent
  nor written as a Merge; its file stays in versions/.replaced.
- Save both journals its intent (name, base, time) before the home is asked,
  so a cut after the copy was made reuses that copy on retry.
- A project deleted at the home reads as Gone from pull, push, resolve and
  save both, logged once, without retry loops; versions and working state stay.
- Save both keeps the restore recorded in sync.json.
- The copy job writes a photo's new bytes under a name of its own while the
  editor's media still name the old file, switching at the commit; a cancelled
  first copy removes its own half media under the lease (VM hook removed).
- Status reads the version files once, re-reads the home's frames only when
  its stamp moved, reports damage only when confirmed under the lease, and
  waits once for a busy lease before calling the media outdated.
- versions/.replaced is pruned after a sync that ended well (30 days, newest
  20 kept, never a file a journal names).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-03 13:06:19 +01:00
1 parent 488b588ad9
commit 5eeb64b680
14 files changed
+1183 -216

No files matched your search

+1 -17
View File
@@ -703,6 +703,7 @@ public sealed class SequenceViewModel : SectionViewModel
{
if (!ReferenceEquals(fetch, _fetch) || job.Id != fetch.JobId || job.State is not (JobState.Done or JobState.Failed or JobState.Cancelled)) return;
StopFetch();
// A first copy of a project's media the user cancelled removes what it wrote itself, once it has stopped (the job).
switch (job.State)
{
// Opened only when it is still the sequence asked for; otherwise the next visit opens it (from the cache, from the workspace).
@@ -714,23 +715,6 @@ public sealed class SequenceViewModel : SectionViewModel
Shell.Notify(Loc.L(fetch.ProjectId is null ? "Editor.Proxies.Failed" : "Editor.Workspace.CopyFailed"), job.Error ?? fetch.Title, Loc.L("Shell.Nav.Jobs"),
Loc.L("Tooltips.Nav.Jobs"), () => Shell.Navigate(SectionKey.Jobs), isError: true);
break;
// The user cancelled the first copy of a project's media: the photos it wrote go (a failed one keeps them for its retry).
case JobState.Cancelled when fetch.ProjectId is { } cancelled:
_ = RemovePartialMediaAsync(cancelled);
break;
}
}
private async Task RemovePartialMediaAsync(Guid projectId)
{
try
{
await Shell.Services.Workspace.RemovePartialMediaAsync(projectId);
}
catch (Exception ex) when (ex is not OutOfMemoryException)
{
// Copies the library can make again: they wait for the next copy, which checks each.
Log.Warning("workspace", $"The media of a cancelled copy of project {projectId} could not be removed", ex);
}
}