fix(workspace): a deleted project asks nothing, prunes and copies clean up only after what ended well
Owner review 2, phase 5a (R8), fix round 4. A project the library no longer has now reads as Gone with no conflict to answer. The conflict stays recorded in sync.json, so Save both on a deleted project says Gone once and offers its copy. It no longer reopens the conflict dialog. Keep mine and Take the library's first check that the home still has the project. Neither is merged onto the last version a deleted project had, so the working state and the unsent versions stay as they were. Old files in versions/.replaced are pruned only after a push that ended well, never after one that stopped at a conflict. A file an earlier build set aside kept the time its version was written. It now counts as set aside no earlier than when this build first knew the folder (versions/.replaced.since), so an upgrade does not prune it by an old mtime. The Merge mark goes on the replayed version whose own change met a setting the conflict listed. A version that only rides along with a working-state conflict stays a commit. A first copy cancelled while paused or failed, which no handler runs, now has its partial media removed under the project's lease, as a running one does (ICancelledJobHandler). The space estimate counts a proxy held under its <id>-<sha16>.jpg name. The frames stamp carries a weighted SQL checksum of the hashes, so a hash replaced in place (a Verify) makes the workspace read the frames again. Desktop: a removal that cannot move a file puts back what it moved, so the copy stays whole and listed, and the failure is said. The Removed toast names a damaged copy as it is known, never by its folder id. One copy that cannot be listed no longer hides the others. A Main this Chronos cannot read (newer or damaged) is refused at once with the reason, and a damaged one offers Remove local copy. Save version is off on a Gone project, and Send/Delete there say the project was deleted in the library. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c5ed31bced
commit
279ebf437f
14 files changed
+729
-57
No files matched your search
@@ -176,6 +176,45 @@ public sealed class WorkspaceMenuTests(TestContext context)
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task SaveBothOfAProjectDeletedInTheLibrarySaysItIsGoneOnceAndOffersTheCopy()
|
||||
{
|
||||
await using var bed = await WorkspaceTestBed.CreateAsync(context);
|
||||
var here = bed.Host();
|
||||
var there = bed.Host(name: "other-pc");
|
||||
var sideId = await bed.CheckoutAsync(here, newName: "Side");
|
||||
await bed.CheckoutAsync(there, sideId);
|
||||
var (sourceA, sessionA) = await bed.OpenAsync(there, sideId);
|
||||
var (sourceB, sessionB) = await bed.OpenAsync(here, sideId);
|
||||
var (uiA, uiB) = (new RecordingUi(), new RecordingUi());
|
||||
await using (sessionA)
|
||||
await using (sessionB)
|
||||
using (var a = new ProjectMenuViewModel(there, sourceA, sessionA, uiA))
|
||||
using (var b = new ProjectMenuViewModel(here, sourceB, sessionB, uiB))
|
||||
{
|
||||
sessionA.Edit(p => Exposure(p, 0.1));
|
||||
await a.SaveVersionAsync(null);
|
||||
sessionB.Edit(p => Exposure(p, 0.7));
|
||||
await b.SyncAsync();
|
||||
uiB.CloseDialog(Assert.NotNull(uiB.Open as ConflictDialogViewModel));
|
||||
// Another PC deletes the project in the library while the choice is made here.
|
||||
await bed.Archives.Projects.DeleteAsync(sideId, bed.Ct);
|
||||
var before = uiB.Toasts.Count;
|
||||
|
||||
await b.ResolveAsync(ConflictChoice.SaveBoth);
|
||||
Assert.Equal(WorkspaceState.Gone, b.Status!.State);
|
||||
Assert.Null(b.Status.Conflict, "nothing is left to answer");
|
||||
Assert.Null(uiB.Open, "the conflict is not asked again");
|
||||
var said = uiB.Toasts.Skip(before).ToList();
|
||||
Assert.Count(1, said.Where(t => t.Message == Loc.L("Errors.Workspace.DeletedAtHome")).ToList());
|
||||
var copy = Assert.Contains(said, t => t.Action is not null);
|
||||
Assert.Equal(b.Name, copy.Message, "the copy Save both made is offered");
|
||||
Assert.False(b.SaveVersionCommand.CanExecute(null), "nothing can be sent to it");
|
||||
Assert.Equal(0.7, sessionB.Project.Exposure.ExposureOffsetEv, "the work stays in the editor");
|
||||
Assert.Equal(0.7, here.Store.Find(sideId)!.ReadBundle().Project.Exposure.ExposureOffsetEv);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task OpenProjectOffersTheLibrarysOtherProjects()
|
||||
{
|
||||
@@ -256,6 +295,10 @@ public sealed class WorkspaceMenuTests(TestContext context)
|
||||
var gone = new WorkspaceStatus(WorkspaceState.Gone, false, 0, 0, true, false, false, null, basis, null);
|
||||
var edited = new WorkspaceStatus(WorkspaceState.Modified, true, 0, 0, false, false, false, null, basis, null);
|
||||
Assert.Equal(WorkspaceState.Gone, ProjectMenuViewModel.WithLocal(gone, edited).State);
|
||||
// A conflict recorded here asks nothing of a project the library no longer has.
|
||||
var recorded = new WorkspaceConflict(Guid.NewGuid(), 3, basis.VersionId, [], [], DateTimeOffset.UtcNow);
|
||||
var stillGone = ProjectMenuViewModel.WithLocal(gone, edited with { State = WorkspaceState.Conflict, Conflict = recorded });
|
||||
Assert.Equal((WorkspaceState.Gone, (WorkspaceConflict?)null), (stillGone.State, stillGone.Conflict));
|
||||
var behind = gone with { State = WorkspaceState.Behind, Behind = 2, Offline = false };
|
||||
Assert.Equal((WorkspaceState.Behind, 2), (ProjectMenuViewModel.WithLocal(behind, edited).State, ProjectMenuViewModel.WithLocal(behind, edited).Behind));
|
||||
Assert.Equal(WorkspaceState.Modified, ProjectMenuViewModel.WithLocal(behind, edited with { Base = basis with { VersionId = Guid.NewGuid() } }).State,
|
||||
|
||||
Reference in new issue
Block a user