fix(copies): close the owner review 6 verification findings

A merge could still trash photos it never verified, resume against a
pair the user had answered meanwhile, and take different unhashed
photos for copies; the dialog and the lists worded several facts
wrongly or lost them on refresh.

- Merge: a retry resumes only while the pair is still the job's;
  Verify requires the other archive online and its folder in place,
  stops on an unreadable photo, files a differing unhashed photo as a
  second version and must cover every frame before Trash; the plan
  hashes unmatched unhashed photos first, lists "Deleted in the other"
  and names the relinked servers; second versions stay discoverable
  (CopySides.VersionsAsync).
- Integrate: a retry after a failure before the journal runs again.
- Sync: a sequence back after a 404 stays Linked while its link holds;
  a local cull no longer asks for attention.
- Block lines of both planners name the right sequence, archive,
  server and space through one formatter.
- Compare dialog: one Details row per setting with worded values,
  Projects headings, Choose focuses the kept-sequence radios, the
  photo selection reaches rows outside the viewport, the Replace
  confirmation lists the losers per side, plan lines read as queued.
- Matches and Library: counts first and grouped, integrating shown as
  a share, local matches name the other archive, the Library keeps its
  match and "deleted on server" statuses across a refresh.

Refs #73

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-17 15:02:39 +01:00
1 parent d10577b175
commit b34b6b6fe0
41 files changed
+1046 -193

No files matched your search

@@ -185,6 +185,68 @@ public sealed class CopyTextTests
Assert.Equal(SyncText.State(entry with { Transfer = upload }), SyncText.State(entry with { Transfer = upload }, candidate));
}
[Test]
public void TheOwnerReview6TextsFitTheirPlaces()
{
// Integrating: the share in the cell, "x of y" in the tooltip.
var (_, text, tip) = CopyText.State(Copy(CopyState.Integrating), progress: (1_234, 2_400));
Assert.Equal(Loc.L("Server.Copies.State.Integrating", "51"), text);
Assert.Contains(Loc.L("Server.Copies.State.Progress", "1,234", "2,400"), tip);
Assert.Equal(Loc.L("Server.Copies.State.Integrating", "0"), CopyText.State(Copy(CopyState.Integrating)).Text);
// The count comes first, so a trimmed cell keeps what tells two pairs apart.
Assert.True(CopyText.Where(Facts("Lighthouse", "Main archive", 1_204), isServer: false).StartsWith("1,204", StringComparison.Ordinal));
// The frame positions read as the setting they are, with the count of photos they place.
Assert.Equal(Loc.L("Server.Copies.Detail.Positions"), SyncText.DetailLabel(CopyPayload.PendingFramesPath));
Assert.Equal(Loc.Plural("Shell.Status.Photos", 2), SyncText.DetailValue(CopyPayload.PendingFramesPath, "{\"a\":{},\"b\":{}}"));
Assert.Equal("Lighthouse", SyncText.DetailValue("sequence.title", "Lighthouse"));
Assert.Equal("41", SyncText.DetailValue("exposure.deflickerWindow.manual", "41"));
Assert.Equal(Loc.L("Server.Copies.Detail.Changed"), SyncText.DetailValue("exposure.curve", "{\"points\":[[0,0],[1,1]]}"));
// The members of one setting are one row and one choice.
Assert.Equal(SyncText.DetailSetting("exposure.deflickerWindow.isAuto"), SyncText.DetailSetting("exposure.deflickerWindow.manual"));
var row = new CopyDetailRow([new DetailLine("exposure.deflickerWindow.isAuto", "true", "false"), new DetailLine("exposure.deflickerWindow.manual", "41", "33")],
isMerge: false, () => { });
Assert.SequenceEqual(["exposure.deflickerWindow.isAuto", "exposure.deflickerWindow.manual"], row.Paths);
Assert.Equal(string.Join(Loc.Separator, Loc.L("Server.Setting.Auto"), "41"), row.HereText);
// A match between this PC's archives names the other archive, not the server.
var local = new SyncMark(Copy(CopyState.Candidate, CopyKind.LocalLocal), null, "Studio NAS", OtherWhere: "Old archive");
Assert.Equal(Loc.L("Tooltips.Library.Status.CopyFoundLocal", "Old archive"), SyncText.State(Entry(SyncStatus.LocalOnly, link: null), local).ToolTip);
// The Library card of a sequence whose server copy was deleted says so.
var gone = View(Copy(CopyState.Linked, gone: true), "Lighthouse");
var status = CopyListViewModel.LibraryStatus(gone, Local.Id);
Assert.Equal(Loc.L("Library.Status.RemoteGone"), status.Text);
// A plan line is what will happen (queued), a warning leads.
Assert.Equal(StatusKind.Queued, new CopyPlanLine("Receives 2 photos").Kind);
Assert.Equal(StatusKind.Warning, new CopyPlanLine("Only copy", IsWarning: true).Kind);
}
[Test]
public void TheReplaceConfirmationListsEachSidesLosersUnderItsHeading()
{
var trashed = new List<PhotoStep>
{
new("a", PhotoAction.TrashHere, Guid.NewGuid(), "IMG_0001.JPG", 10, "a"),
new("b", PhotoAction.TrashHere, Guid.NewGuid(), "IMG_0002.JPG", 10, "b"),
new("c", PhotoAction.TrashThere, Guid.NewGuid(), "IMG_0003.JPG", 10, "c"),
};
var lasts = new List<LastCopy> { new("b", CopySide.ThisPc, "IMG_0002.JPG", 10) };
var lines = CopyDialogViewModel.ReplaceLines(lasts, trashed, "Studio NAS").Split(Environment.NewLine);
Assert.SequenceEqual(
[
Loc.L("Server.Copies.Plan.OnThisPc"),
" " + Loc.L("Server.Copies.Confirm.LastCopy", "IMG_0002.JPG"),
" IMG_0001.JPG",
Loc.L("Server.Copies.Plan.OnServer", "Studio NAS"),
" IMG_0003.JPG",
], lines);
}
private static (StatusKind, string) Head((StatusKind Kind, string Text, string ToolTip) state) => (state.Kind, state.Text);
private static FoundCopy Copy(CopyState state, CopyKind kind = CopyKind.LocalServer, int deletedThere = 0, bool gone = false) => new()