diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 5c2263d2..31700569 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -128,6 +128,24 @@ match. A 1.1 server works as before, without Integrate; a 1.2 server adds the ph
- The Edit picker's twin tooltip names the server, not its key; the Library card shows the match status second; a
match whose server sequence was deleted names the server instead of "0 photos"; the match tooltips no longer call a
sequence a "copy".
+ - Integrate trashes a server photo only for the server sequence's owner or an admin; for anyone else the server's
+ losing version stays, out of the server's Main, and the plan says it needs the Delete right. Compare offers Delete on
+ server on the same terms.
+ - A server title, tags, rating or notes change made while an Integrate runs stops its Details stage where the user kept
+ this PC's value, instead of being overwritten.
+ - A merge retried after a stop plans again when work reached the other sequence since (settings, a project, a render)
+ or when a third sequence no longer holds a photo it was counted on for; a photo flagged missing whose file is back
+ blocks the merge plan.
+ - Detection no longer removes a pair answered while it ran.
+ - The Integrate and merge logs say in the UI language why a losing version was kept, and name the files and projects
+ they replaced or copied; an unreachable server's projects are named by the server's name.
+ - Upload all local names where a suspected match lies (another server, or another archive of this PC); a skipped
+ busy sequence says a job is integrating or merging it.
+ - A sync row whose match the server deleted offers Keep here, Upload again and To trash….
+ - Compare dialog: the parts' tooltips say what each shows; the photo list has column headings; the Projects headings
+ name the lists they head; a merge reads Kept and Other from the start; the Projects part shows where each project
+ goes as soon as it opens. Matches: the This side and Other side columns take the room the actions leave.
+ - The Edit picker's Twin chip sits right after the project name.
## [1.1.1] — 2026-11-16
diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md
index 81c74f96..70fe6b8f 100644
--- a/docs/DECISIONS.md
+++ b/docs/DECISIONS.md
@@ -965,5 +965,12 @@ One line per decision: date · decision · alternative · reason.
| 2026-11-17 | The Compare photo list keeps each row's selection from the list's SelectionChanged (`ListSelection.SyncsRows`), not only from the realised rows' IsSelected binding (#73) | Turn virtualisation off | A long class list must stay virtualised; Ctrl+A must reach the hidden rows |
| 2026-11-17 | Automatic photo transfers (an integrated pair's new photos) are held on a metered connection whatever the "pause on metered" option says; manual transfers follow the option (#73) | Follow the option for every transfer | Owner Q6: new photos move by themselves "with a metered pause"; the option still governs what the user starts |
| 2026-11-17 | A linked upload whose IntoTarget the server refuses (403 forbidden) falls back for the rest of the job to ordinary uploads the server files by SHA-256; an Integrate that would send photos into a server sequence the account neither owns nor may edit is blocked in its plan (`CopyBlock.NoAddRight`) (#73) | Fail the upload; ask the server for a new right | A Read+Upload account keeps uploading as before 1.2; an Integrate cannot fall back without leaving its plan, so it stops before anything moves |
-| 2026-11-17 | A merge is blocked (`CopyBlock.DamagedPhotos`) when the other sequence holds a Corrupt-flagged photo whose current file content nothing in the kept sequence or elsewhere in this PC's index holds; one held elsewhere goes to the trash as before (#73) | List the damaged photos in the plan and trash them | The simplest safe option: nothing unverified goes to the trash, and Verify/repair already exist |
-| 2026-11-17 | The Plan's "Server uses ours" line still counts every version sent, replaced or kept beside (#73) | Count it as the Versions line does | The line says which side's file the server ends up with, true in both cases |
+| 2026-11-17 | A merge is blocked (`CopyBlock.DamagedPhotos`) when the other sequence holds a Corrupt- or Missing-flagged photo (one whose file is back counts too: the merge would not copy it) whose current file content nothing in the kept sequence or elsewhere in this PC's index holds; one held elsewhere goes to the trash as before (#73) | List the damaged photos in the plan and trash them | The simplest safe option: nothing unverified goes to the trash, and Verify/repair already exist |
+| 2026-11-17 | The Plan's "Server uses ours" line counts only the versions whose server version goes to its trash or out of its Main (`IntegratePlan.ServerUsesOurs`); a losing server version that stays for want of the right to delete it is listed as "stays: needs the Delete right" (`StaysForDelete`) and kept out of the server's Main by the payload (#73; replaces the earlier row that counted every version sent) | Count every version sent | A version sent but not used by the server's Main would be reported as used |
+| 2026-11-17 | Who may trash photos of a server sequence is decided per sequence: the admin role (`CopyPlanContext.OwnsOrAdmin`, from the role or the ManageUsers permission only an admin holds) or the account that owns that sequence (its `OwnerUserId`), each with the Delete right; Integrate plans and Compare's Delete on server follow it (#73; replaces approximating ownership with the Delete right) | Approximate ownership with the Delete or Edit right | The server's DeleteFramesAsync allows the owner or an admin only: an Editor's plan would fail at the dry run with a 403 |
+| 2026-11-17 | An Integrate's Details stage absorbs a server change made since the plan only on lines the plan did not have, or where the user took the server's value; a change to a title, tags, rating or notes line where the user kept this PC's value stops the stage (`Errors.Copies.DetailsChanged`) and overwrites neither side (#73) | Absorb every server change since the plan | Absorbing would silently overwrite the server's new value with this PC's on a line the user decided before that value existed |
+| 2026-11-17 | A merge retried after a stop re-checks before the trash that nothing reached the other sequence since its plan: its settings version, a project not planned (or moved on to another head) whose head the kept sequence does not hold, a render not moved whose file the kept one does not hold, and the photos a third sequence held at the verify; any of these drops the journal and asks for a new plan (`Errors.Copies.Changed`); the plan skips the other's projects whose head the kept sequence already holds (#73) | Trust the journal written before the stop | Work sent home into the other after the stop would go to the trash with it, never copied |
+| 2026-11-17 | Detection removes a stale pair only while it is still an unanswered Candidate (`FoundCopyStore.DeleteCandidateAsync`): an answer given while detection ran stays (#73) | Delete by id | A Keep apart or a Link given during a detection pass was erased |
+| 2026-11-17 | The merge dialog plans once on opening to learn the sequence kept by default, so its photos read Kept and Other from the start; with no default (both equal) they read the two archives' names until one is kept (#73) | Read Kept for the pair's first until a plan runs | The wrong sequence was called "Kept" until the Plan part was opened |
+| 2026-11-17 | A sync row whose match the server deleted offers the Matches row's Keep here, Upload again and To trash… (Upload again only once kept here), as new `SyncAction` values appended to the enum (#73) | Offer them on the Matches list only | Design §6.3 puts them on the local row; the row read "deleted on server" with no action |
+| 2026-11-17 | The capture's edit-picker-twins scene lists two sample workspace projects (the integrated pair's Main, a Vertical of a pair still to answer) through `SequencePickerViewModel.ShowSampleWorkspaceAsync`, since a capture has no workspace (`WorkspaceHost.IsEnabled`); the Twin chip is marked by the picker's own twin lookup (#73) | Enable the workspace in a capture | The capture's sample library has no engine to copy media; without it the scene showed no Workspace group and no chip |
diff --git a/i18n/en/Archive.resx b/i18n/en/Archive.resx
index 3fdae8e6..ac2797a1 100644
--- a/i18n/en/Archive.resx
+++ b/i18n/en/Archive.resx
@@ -457,6 +457,16 @@
Videos{0}: sent into the linked sequencelong: job log line{0}: received into this PC's sequencelong: job log line
+ {0}: older version kept, {1}long: job log line; {1} is one of Archive.Log.KeptReason.*
+ Project {0} not copied: {1}long: job log line
+ a job is working on itlong: completes Archive.Log.CopyKept
+ the photos changed meanwhilelong: completes Archive.Log.CopyKept
+ the version that replaces it is not in placelong: completes Archive.Log.CopyKept
+ the version that replaces it is not in place on the serverlong: completes Archive.Log.CopyKept
+ the archive is offline or read-onlylong: completes Archive.Log.CopyKept
+ the server refused it ({0})long: completes Archive.Log.CopyKept; {0} is the server's reason
+ the photo cannot be read nowlong: completes Archive.Log.CopyKept
+ the sequence would be left emptylong: completes Archive.Log.CopyKept{0}: older version to the trashlong: job log lineProject {0} copied as {1}long: job log line{0}: copied and verifiedlong: job log line
diff --git a/i18n/en/Errors.resx b/i18n/en/Errors.resx
index 175d266a..1b924978 100644
--- a/i18n/en/Errors.resx
+++ b/i18n/en/Errors.resx
@@ -146,6 +146,7 @@
{0} photos stayed as they were; the job log says why.{0} project was not copied; the job log says why.{0} projects were not copied; the job log says why.
+ The projects of {0} cannot be reached now.{0} needs {1} free; free some space and try again.A job is working on one of these sequences; try again when it ends.Send or discard the workspace changes of {0} first.
diff --git a/i18n/en/Tooltips.resx b/i18n/en/Tooltips.resx
index 3d31b2bf..c8b1d455 100644
--- a/i18n/en/Tooltips.resx
+++ b/i18n/en/Tooltips.resx
@@ -1150,16 +1150,21 @@
This sequence may also be on {0}. Compare to decide.Upload all local left this out: {0}.Photos did not move by themselves: {0}.
- it may be the same as a sequence on the server
+ it may be the same as a sequence on {0}{0} the server's name
+ it may be the same as a sequence in {0}{0} the other archive's nameyou kept it apart from a matchit came from a serverthe server deleted its sequence
- it is being integrated
+ a job is integrating or merging itUpload the sequences only here; {0} is left out (its row says why).Upload the sequences only here; {0} are left out (each row says why).Look for matches of these sequences on {0} and on this PC now.Look for matches among this PC's archives now.See which photos, details and projects differ between the two sequences.
+ The photos each sequence has, and which version each side keeps.
+ The title, tags, rating, notes and settings that differ, line by line.
+ The editing projects of each sequence, and where they go.
+ What each side receives and loses before anything runs.Complete both sequences, settle the differences once, then keep them in sync.Merge the two into the kept sequence; the other goes to the trash after verification.Keep both as separate sequences and stop asking. Upload all local leaves this one out.
diff --git a/i18n/it/Archive.it.resx b/i18n/it/Archive.it.resx
index 1a2da1ef..fadc3e65 100644
--- a/i18n/it/Archive.it.resx
+++ b/i18n/it/Archive.it.resx
@@ -449,6 +449,16 @@
Video{0}: inviata nella sequenza collegata{0}: ricevuta nella sequenza di questo PC
+ {0}: versione precedente mantenuta, {1}
+ Progetto {0} non copiato: {1}
+ un'attività ci sta lavorando
+ le foto sono cambiate nel frattempo
+ la versione che la sostituisce non è al suo posto
+ la versione che la sostituisce non è al suo posto sul server
+ l'archivio non è raggiungibile o è di sola lettura
+ il server l'ha rifiutato ({0})
+ la foto non si può leggere ora
+ la sequenza resterebbe vuota{0}: versione precedente nel cestinoProgetto {0} copiato come {1}{0}: copiata e verificata
diff --git a/i18n/it/Errors.it.resx b/i18n/it/Errors.it.resx
index 276b816f..5425cb6f 100644
--- a/i18n/it/Errors.it.resx
+++ b/i18n/it/Errors.it.resx
@@ -146,6 +146,7 @@
{0} foto sono rimaste com'erano; il registro del lavoro dice perché.{0} progetto non è stato copiato; il registro dice perché.{0} progetti non sono stati copiati; il registro dice perché.
+ I progetti di {0} non sono raggiungibili ora.{0} ha bisogno di {1} liberi; libera spazio e riprova.Un lavoro sta usando una di queste sequenze; riprova quando finisce.Prima invia o scarta le modifiche di lavoro di {0}.
diff --git a/i18n/it/Tooltips.it.resx b/i18n/it/Tooltips.it.resx
index c9eb90d1..387d9525 100644
--- a/i18n/it/Tooltips.it.resx
+++ b/i18n/it/Tooltips.it.resx
@@ -1148,16 +1148,21 @@
Questa sequenza potrebbe essere anche su {0}. Confronta per decidere.Carica le locali l'ha saltata: {0}.Le foto non sono passate da sole: {0}.
- potrebbe essere la stessa di una sequenza sul server
+ potrebbe essere la stessa di una sequenza su {0}
+ potrebbe essere la stessa di una sequenza in {0}l'hai tenuta separata da una corrispondenzaviene da un serveril server ha eliminato la sua sequenza
- è in integrazione
+ un'attività la sta integrando o unendoCarica le sequenze presenti solo qui; {0} viene saltata (la sua riga dice perché).Carica le sequenze presenti solo qui; {0} vengono saltate (ogni riga dice perché).Cerca ora corrispondenze di queste sequenze su {0} e su questo PC.Cerca ora corrispondenze tra gli archivi di questo PC.Mostra quali foto, dettagli e progetti differiscono tra le due sequenze.
+ Le foto di ciascuna sequenza e quale versione tiene ogni lato.
+ Titolo, tag, valutazione, note e impostazioni che differiscono, riga per riga.
+ I progetti di modifica di ciascuna sequenza e dove vanno.
+ Cosa riceve e cosa perde ogni lato prima che parta qualcosa.Completa entrambe le sequenze, risolvi una volta le differenze, poi tienile sincronizzate.Unisce le due nella sequenza tenuta; l'altra va nel cestino dopo la verifica.Tiene le due sequenze separate e non chiede più. Carica le locali la salta.
diff --git a/src/Chronos.App/DesignTime/SampleCopies.cs b/src/Chronos.App/DesignTime/SampleCopies.cs
index 409cebce..0f2e478b 100644
--- a/src/Chronos.App/DesignTime/SampleCopies.cs
+++ b/src/Chronos.App/DesignTime/SampleCopies.cs
@@ -32,6 +32,12 @@ internal sealed class SampleCopyEngine : ICopyEngine
public IReadOnlyList Pairs => _pairs;
+ ///
+ /// More twins, read when asked (edit-picker-twins): the workspace's projects of this PC taken as a linked pair's, so the
+ /// picker shows its Twin chip whichever sample project the workspace holds then.
+ ///
+ public Func>>? MoreTwins { get; set; }
+
public void Add(SampleCopy pair) => _pairs.Add(pair);
/// Raises as a detection run would (the matches-found toast).
@@ -75,7 +81,11 @@ internal sealed class SampleCopyEngine : ICopyEngine
steps, lasts, leftOut, null, null, null, choices.Details.Count, projects,
steps.Where(s => s.Action is PhotoAction.Fetch or PhotoAction.FetchVersion).Sum(s => s.Bytes),
steps.Where(s => s.Action is PhotoAction.Send or PhotoAction.SendVersion).Sum(s => s.Bytes),
- 1_240_000_000_000, 2_900_000_000_000, blocks, 1, 1, 1, 1, "sample"));
+ 1_240_000_000_000, 2_900_000_000_000, blocks, 1, 1, 1, 1, "sample")
+ {
+ // The sample signs in with every right: each version this PC sends replaces the server's, which goes to its trash.
+ ServerUsesOurs = steps.Count(s => s.Action == PhotoAction.SendVersion),
+ });
}
public async Task EnqueueIntegrateAsync(JobEngine engine, IntegratePlan plan, CancellationToken ct)
@@ -99,11 +109,11 @@ internal sealed class SampleCopyEngine : ICopyEngine
.Select(p => new ProjectStep(keepsHere ? CopySide.Other : CopySide.ThisPc, p.Id, p.Name, p.Name + " (2)", p.Versions, p.HeadId)).ToList();
return Task.FromResult(new MergePlan(copyId, keep ?? Guid.Empty, keepsHere ? pair.Copy.OtherId ?? Guid.Empty : pair.Copy.LocalId, choices, steps, [],
[new RenderStep(Guid.CreateVersion7(), "Alps 2025 4K.mp4", 640_000_000, null)], null, choices.Details.Count, projects,
- ["card:CANON-EOS-R5:2025-07-14"], [], [pair.Copy.Server ?? "nas"], new DeletePlan([], []), drop.Bytes / 20, 1_240_000_000_000, blocks,
+ ["card:CANON-EOS-R5:2025-07-14"], [], [.. drop.Servers], new DeletePlan([], []), drop.Bytes / 20, 1_240_000_000_000, blocks,
1, 1, 1, 1, "sample")
{
- // The link that moves is shown by the server's name, as SequenceMerger names it.
- LinkNames = [drop.Servers.FirstOrDefault() ?? pair.Copy.Server ?? "nas"],
+ // Only the dropped sequence's own links move, shown by their servers' names as SequenceMerger names them.
+ LinkNames = [.. drop.Servers],
});
}
@@ -154,10 +164,13 @@ internal sealed class SampleCopyEngine : ICopyEngine
public Task KeepHereAsync(Guid copyId, CancellationToken ct) => Change(copyId, c => c with { State = CopyState.KeptApart, PreviousState = c.State });
- public Task> TwinsAsync(CancellationToken ct) => Task.FromResult>(
- [.. _pairs.Where(p => p.Copy is { Kind: CopyKind.LocalServer, State: CopyState.Integrated or CopyState.Linked })
+ public async Task> TwinsAsync(CancellationToken ct)
+ {
+ IReadOnlyList more = MoreTwins is { } read ? await read() : [];
+ return [.. _pairs.Where(p => p.Copy is { Kind: CopyKind.LocalServer, State: CopyState.Integrated or CopyState.Linked })
.Select(p => new CopyTwin(p.Copy.Id, p.Copy.LocalId, p.Here.Where, "Main", p.Copy.Server ?? string.Empty, p.Copy.RemoteId ?? Guid.Empty, "Vertical",
- p.There.Where))]);
+ p.There.Where)), .. more];
+ }
///
/// The photo steps of the choices: photos only on one side travel to the other (unless Choose each leaves them out);
diff --git a/src/Chronos.App/DesignTime/SampleData.cs b/src/Chronos.App/DesignTime/SampleData.cs
index f2483d12..f065a451 100644
--- a/src/Chronos.App/DesignTime/SampleData.cs
+++ b/src/Chronos.App/DesignTime/SampleData.cs
@@ -301,6 +301,10 @@ public sealed class SampleData
const string ServerName = "Studio NAS";
var start = new DateTime(2026, 8, 13, 21, 0, 0);
+ // Each card draws a picture of its own: a few generated frames on disk, as FillAsync writes them (library-copies).
+ string[][] palettes = [["#1B2A4A", "#E07B39", "#F6C778"], ["#050914", "#1D2B53", "#C9D6FF"], ["#3A4F5C", "#9FB7C4", "#E9EEF1"],
+ ["#24476B", "#7FA7C9", "#F2F5F7"], ["#2F4A2A", "#7BA05B", "#D9E8C4"]];
+ var painted = 0;
async Task SequenceAsync(string title, Guid archive, int frames, DateTime first, string camera)
{
var sequence = new Sequence
@@ -320,6 +324,8 @@ public sealed class SampleData
UpdatedAt = Now,
};
await db.Sequences.UpsertAsync(sequence);
+ var folderRoot = archive == originals.Id ? root : main.RootPath;
+ await db.Frames.BulkInsertAsync(WriteFrames(folderRoot, sequence, palettes[painted++ % palettes.Length], raw: false));
return sequence;
}
@@ -394,6 +400,11 @@ public sealed class SampleData
SampleCopies.Facts(garden, main.Name, 480), SampleCopies.Facts(garden, ServerName, 0), photos, [], Projects(other: false)));
engine.NextFind = new CopyFindResult([engine.Pairs[0].Copy, engine.Pairs[3].Copy], [], []);
+ // Edit's picker (edit-picker-twins): this PC's workspace projects read as a linked pair's, with a project on the server.
+ var workspace = _services.Workspace;
+ engine.MoreTwins = async () => !workspace.IsAvailable ? []
+ : [.. (await workspace.ListAsync()).Where(e => !e.IsServerHome).Take(1)
+ .Select(e => new CopyTwin(Guid.Empty, e.SequenceId, main.Name, e.Name, server, Guid.Empty, "Main", ServerName))];
_services.Sync.Copies = engine;
return engine;
}
diff --git a/src/Chronos.App/Infrastructure/AppServices.cs b/src/Chronos.App/Infrastructure/AppServices.cs
index b305783a..f7ba5e8f 100644
--- a/src/Chronos.App/Infrastructure/AppServices.cs
+++ b/src/Chronos.App/Infrastructure/AppServices.cs
@@ -253,9 +253,9 @@ public sealed class AppServices : IAsyncDisposable
}
///
- /// What the planners know of this PC and the signed-in account. The account's rights stand for its rights over the
- /// server's sequence: the server enforces ownership itself, so OwnsOrAdmin reads Delete or an admin right; the account's
- /// id lets the Integrate planner see the sequences it owns (sending into one it neither owns nor may edit is refused).
+ /// What the planners know of this PC and the signed-in account. OwnsOrAdmin is the admin role only (Manage users, which
+ /// only Admin holds): the server deletes frames of a sequence for its owner or an admin only, so ownership is decided per
+ /// sequence from its owner and the account's id (sending into one it neither owns nor may edit is refused as well).
///
private CopyPlanContext CopyContext(ISyncRemote? remote)
{
@@ -265,7 +265,7 @@ public sealed class AppServices : IAsyncDisposable
bool Has(Permissions p) => (permissions & (long)p) != 0;
var originals = Settings.KnownServers.Select(k => k.OriginalsArchiveId).OfType().ToHashSet();
return new CopyPlanContext(System.Environment.MachineName, remote is null ? null : Server.ServerName, rights.CanUpload, rights.CanFetchOriginals,
- rights.CanEdit, Has(Permissions.Delete), Has(Permissions.Delete) || Has(Permissions.ManageArchive) || Has(Permissions.ManageUsers),
+ rights.CanEdit, Has(Permissions.Delete), string.Equals(user?.Role, "Admin", StringComparison.OrdinalIgnoreCase) || Has(Permissions.ManageUsers),
remote is not null && Sync.HasProjects, user is { QuotaBytes: > 0 } ? Math.Max(0, user.QuotaBytes - user.UsedBytes) : null, new HashSet(),
originals)
{
diff --git a/src/Chronos.App/Sections/SequencePickerView.xaml b/src/Chronos.App/Sections/SequencePickerView.xaml
index 9f0063cc..16acbdab 100644
--- a/src/Chronos.App/Sections/SequencePickerView.xaml
+++ b/src/Chronos.App/Sections/SequencePickerView.xaml
@@ -103,8 +103,9 @@
lib:ThumbnailLoading.Width="64" DataContext="{Binding Sequence}">
-
-
+
+
diff --git a/src/Chronos.App/Sections/SequencePickerViewModel.cs b/src/Chronos.App/Sections/SequencePickerViewModel.cs
index a3e74fd4..7a94ae3b 100644
--- a/src/Chronos.App/Sections/SequencePickerViewModel.cs
+++ b/src/Chronos.App/Sections/SequencePickerViewModel.cs
@@ -9,6 +9,7 @@ using Chronos.Core.Diagnostics;
using Chronos.Core.Model;
using Chronos.Data;
using Chronos.Data.Repositories;
+using Chronos.Data.Workspaces;
using Chronos.Ui.Mvvm;
namespace Chronos.App.Sections;
@@ -326,6 +327,28 @@ public sealed class SequencePickerViewModel : LocalizedViewModel
_workspaceStates = ReadStatesAsync(items, generation);
}
+ ///
+ /// Lists as the Workspace group, each , then marks their twins. Design
+ /// time only: a capture has no workspace (), so its edit-picker-twins scene lists
+ /// sample projects of the sample matches.
+ ///
+ internal async Task ShowSampleWorkspaceAsync(IReadOnlyList entries, WorkspaceStatus status)
+ {
+ if (Shell.Services.Database is not { } db) return;
+ var items = new List();
+ foreach (var entry in entries)
+ {
+ var row = await db.Sequences.GetAsync(entry.SequenceId);
+ items.Add(new WorkspaceProjectItem(entry, row is null ? null : new SequenceItem(row, Shell.Services.Thumbnails)) { Status = status });
+ }
+ WorkspaceItems.Clear();
+ foreach (var item in items) WorkspaceItems.Add(item);
+ SelectedProject = WorkspaceItems.FirstOrDefault();
+ OnPropertyChanged(nameof(HasWorkspaceItems));
+ RaiseStates();
+ await MarkTwinsAsync(items);
+ }
+
///
/// Marks the projects whose time-lapse (a linked or integrated match) has a workspace project at the other home too
/// (owner review 6, #73): a muted Twin chip, "Also at {home}: {project}".
diff --git a/src/Chronos.App/Sections/ServerView.xaml b/src/Chronos.App/Sections/ServerView.xaml
index 7f2cd0f1..a914444a 100644
--- a/src/Chronos.App/Sections/ServerView.xaml
+++ b/src/Chronos.App/Sections/ServerView.xaml
@@ -311,24 +311,34 @@
keeps its 10 px scroll-bar gutter and the header the same on its right, so the columns line up with or without scrolling. -->
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -399,10 +409,10 @@
+
+
-
-
-
+
diff --git a/src/Chronos.App/Server/Copies/CopyDialogViewModel.cs b/src/Chronos.App/Server/Copies/CopyDialogViewModel.cs
index cea7934e..6712417f 100644
--- a/src/Chronos.App/Server/Copies/CopyDialogViewModel.cs
+++ b/src/Chronos.App/Server/Copies/CopyDialogViewModel.cs
@@ -225,6 +225,19 @@ public sealed class CopyDialogViewModel : ArchiveDialogViewModel
/// A merge keeping the pair's other sequence: the review compares the pair's first with it, so its two columns swap.
private bool Swapped => IsMerge && _keepId is { } keep && keep == Copy.OtherId;
+ /// A merge with no kept sequence yet: the photo sides read as the two archives' names, not as Kept and Other.
+ private (string Here, string There)? Places => IsMerge && _keepId is null ? (Here.Where, There.Where) : null;
+
+ /// The class rows follow the kept sequence (or the places while none is kept).
+ private void OrientClasses()
+ {
+ foreach (var row in _classes)
+ {
+ row.Swapped = Swapped;
+ row.Places = Places;
+ }
+ }
+
// ---- Projects ----
/// 0 Copy across, 1 Leave them (a merge always copies: its other home goes to the trash).
@@ -267,6 +280,15 @@ public sealed class CopyDialogViewModel : ArchiveDialogViewModel
public string ThereHeading => IsMerge ? DroppedFacts?.Where ?? There.Where : Loc.L("Server.Copies.Plan.OnServer", ServerName);
+ ///
+ /// The Projects part's first list: this PC's, or the pair's first sequence's. The lists stay where the review put them
+ /// whichever sequence is kept, so their headings name the place, not the role.
+ ///
+ public string ProjectsHereHeading => IsMerge ? Here.Where : Loc.L("Server.Copies.Plan.OnThisPc");
+
+ /// The Projects part's second list: the server's, or the pair's other sequence's.
+ public string ProjectsThereHeading => IsMerge ? There.Where : Loc.L("Server.Copies.Plan.OnServer", ServerName);
+
public bool IsPlanning
{
get => _isPlanning;
@@ -312,12 +334,24 @@ public sealed class CopyDialogViewModel : ArchiveDialogViewModel
{
_review = await _engine.CompareAsync(Copy.Id, Copy.Kind == CopyKind.LocalServer ? _shell.Services.Sync.Remote : null, CancellationToken.None);
if (IsClosed) return;
+ if (IsMerge && _keepId is null)
+ {
+ // The sequence the merge keeps by default is known before the first plan: the photos read Kept and Other
+ // from the start (both sides equal in every way: they name the archives until the user keeps one).
+ var merge = await _engine.PlanMergeAsync(Copy.Id, null, MergeChoices(), CancellationToken.None);
+ if (IsClosed) return;
+ if (!merge.Blocks.Contains(CopyBlock.KeptUnchosen) && merge.KeepId != Guid.Empty)
+ {
+ _keepId = merge.KeepId;
+ _merge = merge;
+ }
+ }
Build(_review);
if ((_plan?.Projects ?? _merge?.Projects) is { } steps) SetProjectTargets(steps);
IsLoaded = true;
if (_integrate && _part == CopyDialogPart.Plan && Unchosen > 0) _part = CopyDialogPart.Details;
OnAllPropertiesChanged();
- if (_part == CopyDialogPart.Plan) SchedulePlan(TimeSpan.Zero);
+ if (_part is CopyDialogPart.Plan or CopyDialogPart.Projects) SchedulePlan(TimeSpan.Zero);
}
catch (Exception ex) when (Expected(ex))
{
@@ -353,7 +387,7 @@ public sealed class CopyDialogViewModel : ArchiveDialogViewModel
private void Build(CopyReview review)
{
- Classes = [.. review.Photos.Totals.Where(t => t.Count > 0).Select(t => new CopyClassRow(t, _policy.Value, IsMerge) { Swapped = Swapped })];
+ Classes = [.. review.Photos.Totals.Where(t => t.Count > 0).Select(t => new CopyClassRow(t, _policy.Value, IsMerge) { Swapped = Swapped, Places = Places })];
_class = _classes.FirstOrDefault(c => c.Class == _startClass)
?? _classes.FirstOrDefault(c => c.Class is not (PhotoClass.Same or PhotoClass.Converted))
?? _classes.FirstOrDefault();
@@ -377,10 +411,11 @@ public sealed class CopyDialogViewModel : ArchiveDialogViewModel
foreach (var row in _details) row.SetQuietly(chosen.GetValueOrDefault(row.Path, -1));
}
- /// The kept sequence changed sides: the columns follow it.
- private void Reorient(bool wasSwapped)
+ /// The kept sequence changed sides (or was first chosen): the columns and the photo sides follow it.
+ private void Reorient(bool wasSwapped, bool wasKnown)
{
- if (wasSwapped == Swapped || _review is not { } review) return;
+ OrientClasses();
+ if ((wasSwapped == Swapped && wasKnown == _keepId.HasValue) || _review is not { } review) return;
BuildDetails(review);
BuildPhotos();
}
@@ -396,7 +431,7 @@ public sealed class CopyDialogViewModel : ArchiveDialogViewModel
: [.. review.Photos.Of(cls.Value).Select(p => new CopyPhotoRow(p, IsMerge,
choosing && !IsMerge && cls is PhotoClass.OnlyHere or PhotoClass.OnlyThere,
choosing && cls == PhotoClass.Differs, choices, _perPhoto.TryGetValue(p.Key, out var c) ? c : null, () => OnPhotoChanged(p.Key), drop,
- Swapped))];
+ Swapped, Places))];
foreach (var row in _photos) row.PropertyChanged += (_, e) =>
{
if (e.PropertyName != nameof(CopyPhotoRow.IsSelected)) return;
@@ -441,10 +476,10 @@ public sealed class CopyDialogViewModel : ArchiveDialogViewModel
private void Keep(CopyKeepOption option)
{
var wasSwapped = Swapped;
+ var wasKnown = _keepId.HasValue;
_keepId = option.SequenceId;
foreach (var other in _keep.Where(o => !ReferenceEquals(o, option))) other.SetQuietly(false);
- foreach (var row in _classes) row.Swapped = Swapped;
- Reorient(wasSwapped);
+ Reorient(wasSwapped, wasKnown);
RaiseHeadings();
Changed();
}
@@ -524,8 +559,7 @@ public sealed class CopyDialogViewModel : ArchiveDialogViewModel
var wasSwapped = Swapped;
_keepId = merge.KeepId;
foreach (var option in _keep) option.SetQuietly(option.SequenceId == _keepId);
- foreach (var row in _classes) row.Swapped = Swapped;
- Reorient(wasSwapped);
+ Reorient(wasSwapped, wasKnown: false);
}
}
else if (_shell.Services.Sync.Remote is { } remote && string.Equals(_shell.Services.Sync.Server, Copy.Server, StringComparison.OrdinalIgnoreCase))
@@ -583,8 +617,11 @@ public sealed class CopyDialogViewModel : ArchiveDialogViewModel
Trash(plan.Photos, PhotoAction.TrashThere, there);
Photos(plan.Photos, PhotoAction.Fetch, PhotoAction.FetchVersion, PhotoAction.TrashHere, "Server.Copies.Plan.Receives", here);
Photos(plan.Photos, PhotoAction.Send, PhotoAction.SendVersion, PhotoAction.TrashThere, "Server.Copies.Plan.Receives", there);
- var versions = plan.Photos.Count(p => p.Action == PhotoAction.SendVersion);
+ // Only the versions whose server version is trashed there or excluded from its Main (both kept, or one that stays
+ // for want of the Delete right): a server version that could not be excluded stays in use.
+ var versions = plan.ServerUsesOurs;
if (versions > 0) there.Add(new(Loc.Plural("Server.Copies.Plan.ServerUsesOurs", versions, ServerName), Loc.L("Tooltips.Server.Copies.Plan.ServerUsesOurs")));
+ if (plan.StaysForDelete > 0) there.Add(new(Loc.Plural("Server.Copies.Plan.NeedsDelete", plan.StaysForDelete), IsWarning: true));
// A detail changes on the side that does not keep its own value: this PC takes the server's, the server this PC's.
var toHere = _details.Where(d => d.Chosen == CopySide.Other).SelectMany(d => d.Paths).Distinct(StringComparer.Ordinal).Count();
var toThere = _details.Where(d => d.Chosen == CopySide.ThisPc).SelectMany(d => d.Paths).Distinct(StringComparer.Ordinal).Count();
diff --git a/src/Chronos.App/Server/Copies/CopyDialogs.xaml b/src/Chronos.App/Server/Copies/CopyDialogs.xaml
index 8bf47d7b..a82d026a 100644
--- a/src/Chronos.App/Server/Copies/CopyDialogs.xaml
+++ b/src/Chronos.App/Server/Copies/CopyDialogs.xaml
@@ -63,10 +63,10 @@
-
-
-
-
+
+
+
+
@@ -130,40 +130,58 @@
ToolTip="{l:Loc Tooltips.Server.Copies.DeleteOnServer}" ToolTipService.ShowOnDisabled="True"
Visibility="{Binding CanDeleteThere, Converter={StaticResource CopyBoolToVisibility}}" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -243,9 +261,9 @@
-
-
-
+
+
+
diff --git a/src/Chronos.App/Server/Copies/CopyListViewModel.cs b/src/Chronos.App/Server/Copies/CopyListViewModel.cs
index f45a0df3..73d73f9c 100644
--- a/src/Chronos.App/Server/Copies/CopyListViewModel.cs
+++ b/src/Chronos.App/Server/Copies/CopyListViewModel.cs
@@ -28,6 +28,7 @@ public sealed class CopyListViewModel : ObservableObject, IDisposable
private readonly SemaphoreSlim _reloading = new(1, 1);
private readonly Dictionary _deletedThere = [];
private IReadOnlyList _pairs = [];
+ private IReadOnlyList _all = [];
private ICopyEngine? _engine;
private string _search = string.Empty;
private int _reloadQueued;
@@ -149,6 +150,20 @@ public sealed class CopyListViewModel : ObservableObject, IDisposable
return pair.Copy.Kind == CopyKind.LocalLocal && pair.Copy.OtherId == sequenceId ? pair.Here.Where : pair.There.Where;
}
+ ///
+ /// Where the unanswered match of lies, of any server or archive (Upload all local's
+ /// "may be the same as a sequence on …"): the server's name, or the other archive (Local); null when none is known.
+ ///
+ public SkippedMatch? CandidateWhere(Guid sequenceId)
+ {
+ var pair = _all.FirstOrDefault(p => p.Copy is { State: CopyState.Candidate, RemoteGone: false } copy
+ && (copy.LocalId == sequenceId || copy.OtherId == sequenceId));
+ if (pair is null) return null;
+ var local = pair.Copy.Kind == CopyKind.LocalLocal;
+ var other = local && pair.Copy.OtherId == sequenceId ? pair.Here : pair.There;
+ return new SkippedMatch(other.Where, local);
+ }
+
/// Reads the pairs again; requests made while a pass runs share the next one.
public async Task ReloadAsync()
{
@@ -160,6 +175,7 @@ public sealed class CopyListViewModel : ObservableObject, IDisposable
{
var server = Host.Server;
var all = Engine is { } engine ? await engine.ListAsync(CancellationToken.None) : [];
+ _all = all;
AllPairs = Engine is { } stored ? await stored.ListAllPairsAsync(CancellationToken.None) : [];
_pairs = [.. CopyText.Sorted(all.Where(p => p.Copy.Kind == CopyKind.LocalLocal
|| string.Equals(p.Copy.Server, server, StringComparison.OrdinalIgnoreCase)))];
@@ -327,6 +343,16 @@ public sealed class CopyListViewModel : ObservableObject, IDisposable
ShowList?.Invoke(null);
}
+ ///
+ /// A button of the sync table's row for a sequence in a pair (Keep here, Upload again, To trash… of a match the server
+ /// deleted): runs as the Matches row's own, then the list reloads.
+ ///
+ internal async Task ActOnAsync(Guid sequenceId, CopyAction action)
+ {
+ if (_pairs.FirstOrDefault(p => p.Copy.Id == PairOf(sequenceId)?.Id) is not { } pair) return;
+ await ActAsync(Rows.FirstOrDefault(r => r.Id == pair.Copy.Id) ?? new CopyRow(pair, Rights, ActAsync), action);
+ }
+
private async Task ActAsync(CopyRow row, CopyAction action)
{
if (Engine is not { } engine) return;
diff --git a/src/Chronos.App/Server/Copies/CopyPhotoRow.cs b/src/Chronos.App/Server/Copies/CopyPhotoRow.cs
index 95f9b27e..710b5dcd 100644
--- a/src/Chronos.App/Server/Copies/CopyPhotoRow.cs
+++ b/src/Chronos.App/Server/Copies/CopyPhotoRow.cs
@@ -17,6 +17,7 @@ public sealed class CopyClassRow(PhotoClassTotal total, CopyPhotoPolicy policy =
{
private CopyPhotoPolicy _policy = policy;
private bool _swapped;
+ private (string Here, string There)? _places;
public PhotoClass Class { get; } = total.Class;
public StatusKind Kind => CopyText.ClassKind(Class);
@@ -61,6 +62,22 @@ public sealed class CopyClassRow(PhotoClassTotal total, CopyPhotoPolicy policy =
}
}
+ ///
+ /// A merge whose kept sequence is not chosen yet: the sides read as the two archives' names ("Main archive"), not as
+ /// Kept and Other; null once one is kept.
+ ///
+ public (string Here, string There)? Places
+ {
+ get => _places;
+ set
+ {
+ if (_places == value) return;
+ _places = value;
+ OnPropertyChanged();
+ OnPropertyChanged(nameof(BytesToolTip));
+ }
+ }
+
public string ToolTip => CopyText.ClassToolTip(Oriented, _policy, isMerge);
public int Count => total.Count;
@@ -74,8 +91,9 @@ public sealed class CopyClassRow(PhotoClassTotal total, CopyPhotoPolicy policy =
_ => Class,
};
- private string Side(bool here) => Loc.L(isMerge ? (here != _swapped ? "Server.Copies.Detail.Kept" : "Server.Copies.Detail.Other")
- : here ? "Server.Copies.Detail.ThisPc" : "Server.Copies.Detail.Server");
+ private string Side(bool here) => isMerge && _places is { } places ? here ? places.Here : places.There
+ : Loc.L(isMerge ? (here != _swapped ? "Server.Copies.Detail.Kept" : "Server.Copies.Detail.Other")
+ : here ? "Server.Copies.Detail.ThisPc" : "Server.Copies.Detail.Server");
}
///
@@ -86,17 +104,20 @@ public sealed class CopyPhotoRow : ObservableObject, ISelectableRow
{
private readonly Action _changed;
private readonly bool _swapped;
+ private readonly (string Here, string There)? _places;
private bool _bring;
private bool _isSelected;
private SettingsOption? _choice;
/// A merge keeping the pair's other sequence: the photo's second side is the kept one.
+ /// A merge with no kept sequence yet: the two archives' names its sides read as (not Kept and Other).
public CopyPhotoRow(ComparedPhoto photo, bool isMerge, bool canBring, bool canChoose, IReadOnlyList> choices,
- PhotoChoice? current, Action changed, Func? drop, bool swapped = false)
+ PhotoChoice? current, Action changed, Func? drop, bool swapped = false, (string Here, string There)? places = null)
{
Photo = photo;
IsMerge = isMerge;
_swapped = isMerge && swapped;
+ _places = isMerge ? places : null;
CanBring = canBring;
CanChoose = canChoose;
Choices = choices;
@@ -177,6 +198,7 @@ public sealed class CopyPhotoRow : ObservableObject, ISelectableRow
OnPropertyChanged(nameof(ChoiceAccessibleName));
}
- private string Side(bool here) => Loc.L(IsMerge ? (here != _swapped ? "Server.Copies.Detail.Kept" : "Server.Copies.Detail.Other")
- : here ? "Server.Copies.Detail.ThisPc" : "Server.Copies.Detail.Server");
+ private string Side(bool here) => _places is { } places ? here ? places.Here : places.There
+ : Loc.L(IsMerge ? (here != _swapped ? "Server.Copies.Detail.Kept" : "Server.Copies.Detail.Other")
+ : here ? "Server.Copies.Detail.ThisPc" : "Server.Copies.Detail.Server");
}
diff --git a/src/Chronos.App/Server/Copies/CopyScenes.cs b/src/Chronos.App/Server/Copies/CopyScenes.cs
index fee68393..48339f77 100644
--- a/src/Chronos.App/Server/Copies/CopyScenes.cs
+++ b/src/Chronos.App/Server/Copies/CopyScenes.cs
@@ -1,7 +1,10 @@
+using Chronos.App.DesignTime;
using Chronos.App.Infrastructure;
using Chronos.App.Shell;
+using Chronos.App.Workspace;
using Chronos.Data.Copies;
using Chronos.Data.Sync;
+using Chronos.Data.Workspaces;
namespace Chronos.App.Server.Copies;
@@ -17,7 +20,7 @@ public static class CopyScenes
[
"server-copies", "server-copies-toast", "server-copies-photos", "server-copies-choose", "server-copies-versions",
"server-copies-review", "server-copies-details", "server-copies-projects", "server-copies-plan", "server-copies-blocked",
- "server-copies-merge", "server-sync-copyfound", "server-copies-gone",
+ "server-copies-merge", "server-sync-copyfound", "server-copies-gone", "edit-picker-twins",
];
/// The Lighthouse pair (a match found on the server).
@@ -29,6 +32,11 @@ public static class CopyScenes
/// Shows ; returns the dialog it opened, if any.
public static async Task ShowAsync(ShellViewModel shell, string view)
{
+ if (view == "edit-picker-twins")
+ {
+ await ShowPickerTwinsAsync(shell);
+ return null;
+ }
var server = shell.Server;
var sync = server.Sync;
var list = sync.Copies;
@@ -80,7 +88,8 @@ public static class CopyScenes
dialog.Part = CopyDialogPart.Plan;
break;
}
- if (dialog.IsPlan) await dialog.PlanNowAsync();
+ // The Projects part shows where each project goes: the plan names the targets, as it does in the app.
+ if (dialog.IsPlan || dialog.IsProjects) await dialog.PlanNowAsync();
return dialog;
}
@@ -107,9 +116,41 @@ public static class CopyScenes
return request;
}
+ ///
+ /// Edit's picker (design §8.7): a workspace project whose time-lapse has a project at the other home too carries the
+ /// muted Twin chip, marked once the picker has listed the workspace.
+ ///
+ private static async Task ShowPickerTwinsAsync(ShellViewModel shell)
+ {
+ shell.Navigate(SectionKey.Edit);
+ var section = shell.Sequence;
+ if (section.ChangeSequenceCommand.CanExecute(null)) section.ChangeSequenceCommand.Execute(null);
+ await section.Picker.ReloadAsync();
+ await section.Picker.WorkspaceLoadedAsync();
+ if (!shell.Services.Workspace.IsAvailable && shell.Services.Sync.Copies is SampleCopyEngine sample)
+ {
+ // A capture has no workspace: a project of the integrated pair, whose server has one too, and one of a pair
+ // still to answer, which has no twin.
+ var saved = SampleData.Now;
+ IReadOnlyList entries =
+ [
+ .. sample.Pairs.Where(p => p.Copy is { Kind: CopyKind.LocalServer, State: CopyState.Integrated }).Take(1)
+ .Select(p => SampleEntry(p, "Main", saved)),
+ .. sample.Pairs.Where(p => p.Copy.Kind == CopyKind.LocalServer && p.Here.Title == Lighthouse).Take(1)
+ .Select(p => SampleEntry(p, "Vertical", saved.AddHours(-2))),
+ ];
+ await section.Picker.ShowSampleWorkspaceAsync(entries, new WorkspaceStatus(WorkspaceState.InSync, false, 0, 0, false, false, false, null, null, null));
+ }
+ for (var i = 0; i < 200 && !section.Picker.WorkspaceItems.Any(p => p.HasTwin); i++) await Task.Delay(25);
+ }
+
+ private static WorkspaceEntry SampleEntry(SampleCopy pair, string name, DateTimeOffset saved) =>
+ new(Guid.CreateVersion7(), pair.Copy.LocalId, name, name == "Main", WorkspaceHost.ArchiveHome(pair.Copy.LocalId), pair.Here.Title, HasMedia: true, saved);
+
/// Back to the sync table with no dialog and no search.
public static void Reset(ShellViewModel shell)
{
+ if (shell.Sequence.CancelPickCommand.CanExecute(null)) shell.Sequence.CancelPickCommand.Execute(null);
if (shell.Server.Dialog is { } open) shell.Server.CloseDialog(open);
shell.Server.Sync.ShowFilter(SyncFilter.All, string.Empty);
}
diff --git a/src/Chronos.App/Server/SyncRow.cs b/src/Chronos.App/Server/SyncRow.cs
index 195314b0..d09b6fbc 100644
--- a/src/Chronos.App/Server/SyncRow.cs
+++ b/src/Chronos.App/Server/SyncRow.cs
@@ -22,7 +22,8 @@ public sealed class SyncRowAction : ObservableObject
}
public SyncAction Action { get; }
- public string Text => Action is SyncAction.Compare or SyncAction.Review ? Loc.L("Server.Copies.Action." + Action) : Loc.L("Server.Sync.Action." + Action);
+ public string Text => Action is SyncAction.Compare or SyncAction.Review or SyncAction.KeepHere or SyncAction.UploadAgain or SyncAction.ToTrash
+ ? Loc.L("Server.Copies.Action." + Action) : Loc.L("Server.Sync.Action." + Action);
public ICommand Command => _command;
public string ToolTip
@@ -128,7 +129,7 @@ public sealed class SyncRow : ObservableObject
foreach (var action in _actions)
{
action.Relabel();
- action.ToolTip = SyncText.ToolTip(_entry, action.Action, _rights);
+ action.ToolTip = SyncText.ToolTip(_entry, action.Action, _rights, _mark);
}
RaiseTexts();
}
@@ -144,7 +145,7 @@ public sealed class SyncRow : ObservableObject
}
foreach (var action in _actions)
{
- action.ToolTip = SyncText.ToolTip(_entry, action.Action, rights);
+ action.ToolTip = SyncText.ToolTip(_entry, action.Action, rights, _mark);
action.IsEnabled = SyncText.IsEnabled(action.Action, rights);
action.Sequence = Title;
}
diff --git a/src/Chronos.App/Server/SyncTableViewModel.cs b/src/Chronos.App/Server/SyncTableViewModel.cs
index 06efdb8c..02d102bd 100644
--- a/src/Chronos.App/Server/SyncTableViewModel.cs
+++ b/src/Chronos.App/Server/SyncTableViewModel.cs
@@ -341,7 +341,7 @@ public sealed class SyncTableViewModel : ObservableObject, IDisposable
private SyncMark Mark(SyncEntry entry) => entry.Local is { } local
? new SyncMark(Copies.PairOf(local.Id), _skipped.TryGetValue(local.Id, out var why) ? why : null, _shell.Services.Server.Flow.Info?.Name,
Host.PhotoFailures.TryGetValue(local.Id, out var failure) && failure.Count >= SyncAgent.NotSentAfter ? failure : null,
- Copies.OtherWhere(local.Id))
+ Copies.OtherWhere(local.Id), why == UploadSkip.SuspectedCopy ? Copies.CandidateWhere(local.Id) : null)
: new SyncMark(Copies.PairOf(entry.Id), null, _shell.Services.Server.Flow.Info?.Name, OtherWhere: Copies.OtherWhere(entry.Id));
/// The rule of Upload all local (design §6.4): what it sends, and what it leaves out and why.
@@ -438,6 +438,16 @@ public sealed class SyncTableViewModel : ObservableObject, IDisposable
case SyncAction.Review:
Copies.Compare(entry.Local?.Id ?? entry.Id, PhotoClass.DeletedThere);
return;
+ // A match the server deleted: the Matches row's Keep here, Upload again and To trash… (design §6.3).
+ case SyncAction.KeepHere:
+ await Copies.ActOnAsync(entry.Local?.Id ?? entry.Id, CopyAction.KeepHere);
+ return;
+ case SyncAction.UploadAgain:
+ await Copies.ActOnAsync(entry.Local?.Id ?? entry.Id, CopyAction.UploadAgain);
+ return;
+ case SyncAction.ToTrash:
+ await Copies.ActOnAsync(entry.Local?.Id ?? entry.Id, CopyAction.ToTrash);
+ return;
case SyncAction.Upload:
await service.EnqueueUploadAsync(engine, server, entry.Local!);
break;
diff --git a/src/Chronos.App/Server/SyncText.cs b/src/Chronos.App/Server/SyncText.cs
index 9d6d118e..bb92f557 100644
--- a/src/Chronos.App/Server/SyncText.cs
+++ b/src/Chronos.App/Server/SyncText.cs
@@ -49,6 +49,15 @@ public enum SyncAction
/// Open Compare on the photos the match deleted (design §6.2: "deleted there · n" with Review).
Review,
+
+ /// The server deleted the match: keep this PC's sequence and stop asking (design §6.3).
+ KeepHere,
+
+ /// The server deleted the match: send this PC's sequence as a new one (design §6.3).
+ UploadAgain,
+
+ /// The server deleted the match: move this PC's sequence to the archive trash, after a plan (design §6.3).
+ ToTrash,
}
///
@@ -56,13 +65,17 @@ public enum SyncAction
/// local left it out, and the automatic photo transfers of an integrated pair that failed too often in a row.
///
/// Where the pair's other sequence lies ("Old archive"): the tooltip of a match between this PC's archives.
+/// Where the unanswered match that made Upload all local leave it out lies (any server, or another archive).
public readonly record struct SyncMark(Data.Copies.FoundCopy? Copy, Data.Copies.UploadSkip? Skipped, string? ServerName = null,
- AutoPhotoFailure? NotSent = null, string? OtherWhere = null)
+ AutoPhotoFailure? NotSent = null, string? OtherWhere = null, SkippedMatch? SkippedMatch = null)
{
/// The row's sequence is in a pair nobody answered yet.
public bool IsCandidate => Copy is { State: Data.Copies.CopyState.Candidate, RemoteGone: false };
}
+/// Where an unanswered match lies: a server's name, or () another archive of this PC.
+public sealed record SkippedMatch(string Where, bool Local);
+
/// What the signed-in account may do (server permission bits), and whether its server keeps projects.
/// Send originals, settings and renders (upload and edit rights).
/// Download originals (editors and render nodes).
@@ -213,10 +226,22 @@ public static class SyncText
? Loc.L("Tooltips.Library.Status.CopyFoundLocal", mark.OtherWhere ?? string.Empty)
: Loc.L("Tooltips.Server.Sync.State.CopyFound", mark.ServerName ?? mark.Copy.Server ?? string.Empty));
if (mark.Skipped is { } why && entry.Status == SyncStatus.LocalOnly)
- return (StatusKind.Warning, Loc.L("Server.Sync.State.Skipped"), Loc.L("Tooltips.Server.Sync.State.Skipped", Loc.L("Tooltips.Server.Sync.Skip." + why)));
+ return (StatusKind.Warning, Loc.L("Server.Sync.State.Skipped"), Loc.L("Tooltips.Server.Sync.State.Skipped", SkipReason(why, mark)));
return State(entry);
}
+ ///
+ /// Why Upload all local left a sequence out; a suspected match names where it lies (a server by its name, or another
+ /// archive of this PC), which may be another server than the signed-in one.
+ ///
+ internal static string SkipReason(Data.Copies.UploadSkip why, SyncMark mark) => why switch
+ {
+ Data.Copies.UploadSkip.SuspectedCopy when mark.SkippedMatch is { Local: true } local => Loc.L("Tooltips.Server.Sync.Skip.SuspectedCopyLocal", local.Where),
+ Data.Copies.UploadSkip.SuspectedCopy => Loc.L("Tooltips.Server.Sync.Skip.SuspectedCopy",
+ mark.SkippedMatch?.Where ?? mark.ServerName ?? Loc.L("Server.Label.Server")),
+ _ => Loc.L("Tooltips.Server.Sync.Skip." + why),
+ };
+
///
/// The row's buttons with its match (design §8.1): a sequence in an unanswered pair offers Compare… first, then its usual
/// buttons; a linked one offers Compare… last, and Review… after it when the match deleted photos.
@@ -224,7 +249,10 @@ public static class SyncText
public static IReadOnlyList Actions(SyncEntry entry, SyncRights rights, SyncMark mark)
{
var actions = Actions(entry, rights);
- if (entry.Transfer is not null || mark.Copy is null || mark.Copy.RemoteGone) return actions;
+ if (entry.Transfer is not null || mark.Copy is null) return actions;
+ // The server deleted the match (design §6.3): the local row offers what the Matches row does; kept here, Upload again.
+ if (mark.Copy.RemoteGone)
+ return mark.Copy.State == Data.Copies.CopyState.KeptApart ? [SyncAction.UploadAgain] : [SyncAction.KeepHere, SyncAction.UploadAgain, SyncAction.ToTrash];
if (mark.IsCandidate) return [SyncAction.Compare, .. actions];
if (DeletedThere(mark) > 0) return [.. actions, SyncAction.Compare, SyncAction.Review];
return entry.Link is not null ? [.. actions, SyncAction.Compare] : actions;
@@ -420,11 +448,19 @@ public static class SyncText
_ => 0,
};
- /// Whether a row button can be pressed: all can, but Open in workspace on a server that keeps no projects.
- public static bool IsEnabled(SyncAction action, SyncRights rights) => action != SyncAction.OpenInWorkspace || rights.KeepsProjects;
+ ///
+ /// Whether a row button can be pressed: all can, but Open in workspace on a server that keeps no projects and Upload
+ /// again without the upload right.
+ ///
+ public static bool IsEnabled(SyncAction action, SyncRights rights) => action switch
+ {
+ SyncAction.OpenInWorkspace => rights.KeepsProjects,
+ SyncAction.UploadAgain => rights.CanUpload,
+ _ => true,
+ };
/// The tooltip of a row button: what it does and, for transfers, what it moves; why not, for one disabled.
- public static string ToolTip(SyncEntry entry, SyncAction action, SyncRights rights = default) => action switch
+ public static string ToolTip(SyncEntry entry, SyncAction action, SyncRights rights = default, SyncMark mark = default) => action switch
{
SyncAction.Upload or SyncAction.DownloadOriginals => Loc.L("Tooltips.Server.Sync." + action, Formatting.Bytes(Size(entry, action))),
SyncAction.GetExports => Loc.Plural("Tooltips.Server.Sync.GetExports", entry.Link!.ExportsToGet, Formatting.Bytes(Size(entry, action))),
@@ -432,6 +468,10 @@ public static class SyncText
SyncAction.OpenInWorkspace when !rights.KeepsProjects => Loc.L("Tooltips.Server.Sync.OpenInWorkspace.NoProjects"),
SyncAction.Compare => Loc.L("Tooltips.Server.Copies.Compare"),
SyncAction.Review => Loc.L("Tooltips.Server.Copies.Review"),
+ SyncAction.KeepHere => Loc.L("Tooltips.Server.Copies.KeepHere"),
+ SyncAction.UploadAgain when !rights.CanUpload => Loc.L("Tooltips.Server.Sync.UploadAll.NoRight"),
+ SyncAction.UploadAgain => Loc.L("Tooltips.Server.Copies.UploadAgain", mark.ServerName ?? mark.Copy?.Server ?? Loc.L("Server.Label.Server")),
+ SyncAction.ToTrash => Loc.L("Tooltips.Server.Copies.ToTrashSequence"),
_ => Loc.L("Tooltips.Server.Sync." + action),
};
diff --git a/src/Chronos.App/Shell/ScreenCapture.cs b/src/Chronos.App/Shell/ScreenCapture.cs
index 43d2e4e9..4d638147 100644
--- a/src/Chronos.App/Shell/ScreenCapture.cs
+++ b/src/Chronos.App/Shell/ScreenCapture.cs
@@ -310,7 +310,8 @@ public static class ScreenCapture
{
DismissToasts(window);
await CopyScenes.ShowAsync(shell, view);
- written += await SaveAsync(window, directory, view, theme);
+ // Edit's picker with its Twin chip draws the sequences' thumbnails.
+ written += await SaveAsync(window, directory, view, theme, waitForThumbnails: view.StartsWith("edit-", StringComparison.Ordinal) ? shell : null);
}
CopyScenes.Reset(shell);
if (await CopyScenes.ReplaceRequestAsync(shell) is { } replace)
diff --git a/src/Chronos.Data/Archiving/Jobs/MergeJobHandler.cs b/src/Chronos.Data/Archiving/Jobs/MergeJobHandler.cs
index 6a12fe9b..fd5f0104 100644
--- a/src/Chronos.Data/Archiving/Jobs/MergeJobHandler.cs
+++ b/src/Chronos.Data/Archiving/Jobs/MergeJobHandler.cs
@@ -152,6 +152,7 @@ internal sealed class MergeJobHandler(ChronosDatabase db, SequenceMerger merger,
Stage = MergeStage.Copy,
KeepSettingsVersion = plan.KeepSettingsVersion,
DropFramesVersion = plan.DropFramesVersion,
+ DropSettingsVersion = plan.DropSettingsVersion,
KeepStatus = (int)keepRow.Status,
Copies = [.. plan.Photos.Where(p => p.Action is PhotoAction.Fetch or PhotoAction.FetchVersion && p.FrameId is not null)
.Select(p => new MergeCopy(p.Key, p.Action, p.FrameId!.Value, p.FileName, p.Bytes, p.Sha256))],
@@ -485,6 +486,9 @@ internal sealed class MergeJobHandler(ChronosDatabase db, SequenceMerger merger,
var lost = failed.Where(f => !others.Contains(f.Sha256)).Select(f => f.Sha256).Distinct(StringComparer.Ordinal).Count();
if (lost > 0) throw new InvalidOperationException(Loc.Plural("Errors.Copies.VerifyFailed", lost));
journal.Settled.AddRange(failed.Select(f => f.FrameId));
+ // Held by a third sequence now: asked again before the trash, which that sequence may not wait for.
+ foreach (var sha in failed.Select(f => f.Sha256).Distinct(StringComparer.Ordinal))
+ if (!journal.SettledElsewhere.Contains(sha)) journal.SettledElsewhere.Add(sha);
}
journal.VerifiedDropFramesVersion = drop.FramesVersion;
Save();
@@ -522,7 +526,7 @@ internal sealed class MergeJobHandler(ChronosDatabase db, SequenceMerger merger,
}
if (!await WinnerInPlaceAsync(replace.WinnerSha256).ConfigureAwait(false))
{
- Keep(replace, "the version that replaces it is not in place");
+ Keep(replace, Loc.L("Archive.Log.KeptReason.NotInPlace"));
continue;
}
try
@@ -530,16 +534,17 @@ internal sealed class MergeJobHandler(ChronosDatabase db, SequenceMerger merger,
var plan = await owner.Archives.FrameTrash.PlanDeleteAsync(journal.KeepId, [replace.KeepFrameId], null, _ct, journal.JobId).ConfigureAwait(false);
if (!plan.CanDelete)
{
- Keep(replace, string.Join(", ", plan.Blocked));
+ Keep(replace, CopyLog.Reasons(plan.Blocked));
continue;
}
await owner.Archives.FrameTrash.DeleteAsync(plan, null, null, _ct, journal.JobId).ConfigureAwait(false);
journal.Replaced.Add(replace.Key);
Save();
+ context.Log(Loc.L("Archive.Log.CopyReplaced", replace.FileName));
}
catch (Exception ex) when (ex is StaleDeletePlanException or IOException or UnauthorizedAccessException)
{
- Keep(replace, ex.Message);
+ Keep(replace, CopyLog.Reason(ex));
}
}
}
@@ -548,7 +553,7 @@ internal sealed class MergeJobHandler(ChronosDatabase db, SequenceMerger merger,
{
journal.KeptLosers.Add(replace.Key);
Save();
- context.Log($"{replace.FileName}: {why}");
+ context.Log(Loc.L("Archive.Log.CopyKept", replace.FileName, why));
}
/// Whether a usable frame of the kept sequence holds , hashed again.
@@ -608,11 +613,12 @@ internal sealed class MergeJobHandler(ChronosDatabase db, SequenceMerger merger,
await RenamesRendersAsync(step.SourceProjectId, copied.Id).ConfigureAwait(false);
journal.ProjectsDone.Add(step.SourceProjectId);
Save();
+ context.Log(Loc.L("Archive.Log.CopyProject", step.SourceName, step.TargetName));
}
catch (Exception ex) when (ex is not OperationCanceledException)
{
failed++;
- context.Log($"{step.SourceName}: {ex.Message}");
+ context.Log(Loc.L("Archive.Log.CopyProjectKept", step.SourceName, ex.Message));
}
}
if (failed > 0) throw new InvalidOperationException(Loc.Plural("Errors.Copies.ProjectsKept", failed));
@@ -689,6 +695,12 @@ internal sealed class MergeJobHandler(ChronosDatabase db, SequenceMerger merger,
await context.ReportAsync(Done(), Total, new JobDetail(JobStep.Trash, _dropTitle)).ConfigureAwait(false);
if (await owner.Workspace.HasUnsentAsync(journal.DropId, _ct).ConfigureAwait(false))
throw new InvalidOperationException(Loc.L("Errors.Copies.Unsent", _dropTitle));
+ if (await WorkSinceThePlanAsync(drop).ConfigureAwait(false))
+ {
+ // Work saved into the other since the plan (sent home, rendered) never reached the kept one: planned again.
+ ForgetJournal();
+ throw Changed(_dropTitle);
+ }
var expected = journal.VerifiedDropFramesVersion ?? throw Changed(_dropTitle);
if (drop.FramesVersion != expected) throw Changed(_dropTitle);
EnsureDropReadable(drop);
@@ -711,9 +723,37 @@ internal sealed class MergeJobHandler(ChronosDatabase db, SequenceMerger merger,
context.Log(Loc.L("Archive.Log.MergeTrashed", _dropTitle));
}
+ ///
+ /// Whether the other holds work the plan did not see and nothing copied: details or Main settings saved since (its
+ /// settings version moved), a project made or a version added since (missing from the plan, or another head than the
+ /// one it copied), or a render the kept sequence does not hold.
+ ///
+ private async Task WorkSinceThePlanAsync(Sequence drop)
+ {
+ if (journal.DropSettingsVersion is { } settings && drop.SettingsVersion != settings) return true;
+ var planned = journal.Projects.ToDictionary(p => p.SourceProjectId);
+ HashSet? keepHeads = null;
+ foreach (var project in await _db.Projects.ListBySequenceAsync(journal.DropId, includeDeleted: false, _ct).ConfigureAwait(false))
+ {
+ if (project.IsMain) continue;
+ if (planned.TryGetValue(project.Id, out var step) && (project.HeadVersionId ?? Guid.Empty) == step.SourceHeadId) continue;
+ // Not planned (or moved on since) is fine only when the kept sequence holds that head already, as the plan saw it.
+ keepHeads ??= await owner.Merger.HeadHashesAsync(
+ await _db.Projects.ListBySequenceAsync(journal.KeepId, includeDeleted: false, _ct).ConfigureAwait(false), _ct).ConfigureAwait(false);
+ if (!await owner.Merger.HeldAlreadyAsync(project, keepHeads, _ct).ConfigureAwait(false)) return true;
+ }
+ var renders = await _db.Renders.ListBySequenceAsync(journal.DropId, _ct).ConfigureAwait(false);
+ if (renders.Count == 0) return false;
+ // A render the plan left because the kept sequence holds the same file stays with the other, as planned.
+ var keepHashes = (await _db.Renders.ListBySequenceAsync(journal.KeepId, _ct).ConfigureAwait(false)).Select(r => r.Sha256).OfType()
+ .ToHashSet(StringComparer.OrdinalIgnoreCase);
+ return renders.Any(r => !journal.RendersMoved.Contains(r.Id) && (r.Sha256 is null || !keepHashes.Contains(r.Sha256)));
+ }
+
///
/// Every usable photo of the other was verified (held by the kept sequence, or a last copy the plan listed, or held by
- /// a third sequence), and every photo the verify found in the kept sequence is still there and usable (read under its lease).
+ /// a third sequence that still holds it now), and every photo the verify found in the kept sequence is still there and
+ /// usable (read under its lease).
///
private async Task EnsureVerifiedHeldAsync()
{
@@ -723,6 +763,18 @@ internal sealed class MergeJobHandler(ChronosDatabase db, SequenceMerger merger,
if (dropFrames.Any(f => (f.Flags & CopySides.UnusableFlags) == 0 && !journal.Verified.ContainsKey(f.Id) && !journal.Settled.Contains(f.Id)))
throw Changed(_dropTitle);
+ // The photos a third sequence held at the verify: one it no longer holds would leave only with the other, never
+ // listed as a last copy. Planned again, the plan lists it.
+ if (journal.SettledElsewhere.Count > 0)
+ {
+ var still = await new CopySides(_db).HeldElsewhereAsync(journal.SettledElsewhere, [journal.DropId, journal.KeepId], _ct).ConfigureAwait(false);
+ if (journal.SettledElsewhere.Any(sha => !still.Contains(sha)))
+ {
+ ForgetJournal();
+ throw Changed(_dropTitle);
+ }
+ }
+
var frames = await ProcessingFrames.ListAsync(_db, journal.KeepId, _ct).ConfigureAwait(false);
var byId = frames.Where(f => (f.Flags & CopySides.UnusableFlags) == 0).ToDictionary(f => f.Id);
var hashes = byId.Values.Select(f => f.Sha256).OfType().Select(s => s.ToLowerInvariant()).ToHashSet(StringComparer.Ordinal);
diff --git a/src/Chronos.Data/Archiving/MergeJournal.cs b/src/Chronos.Data/Archiving/MergeJournal.cs
index b1931b3e..be967462 100644
--- a/src/Chronos.Data/Archiving/MergeJournal.cs
+++ b/src/Chronos.Data/Archiving/MergeJournal.cs
@@ -55,6 +55,12 @@ internal sealed class MergeJournal
/// The dropped sequence's frames version the plan read (checked before each photo and at the verify).
public int DropFramesVersion { get; set; }
+ ///
+ /// The dropped sequence's settings version the plan read: the trash refuses another (work sent home to the other since
+ /// the plan, its Main settings or details, would go to the trash unmerged). Null in a journal written before it was kept.
+ ///
+ public int? DropSettingsVersion { get; set; }
+
/// The kept sequence's statuses before the merge (what its follow-ups make again).
public int KeepStatus { get; set; }
@@ -90,6 +96,13 @@ internal sealed class MergeJournal
/// Drop frames the verify found nothing of to lose: last copies the plan listed, or photos a third sequence holds.
public List Settled { get; set; } = [];
+ ///
+ /// Raw SHA-256 of the drop photos the verify settled because a third sequence held them: asked again under the kept
+ /// sequence's lease before the trash (that sequence may have gone since). Those settled through the
+ /// user confirmed as last copies and are not asked again.
+ ///
+ public List SettledElsewhere { get; set; } = [];
+
/// The dropped sequence's frames version the verify read: the trash refuses another.
public int? VerifiedDropFramesVersion { get; set; }
diff --git a/src/Chronos.Data/Archiving/SequenceMerger.cs b/src/Chronos.Data/Archiving/SequenceMerger.cs
index 09e147c1..870be2c9 100644
--- a/src/Chronos.Data/Archiving/SequenceMerger.cs
+++ b/src/Chronos.Data/Archiving/SequenceMerger.cs
@@ -144,7 +144,7 @@ public sealed class SequenceMerger(ChronosDatabase db, ArchiveService archives,
var losers = steps.Where(s => s.Action == PhotoAction.TrashHere).Select(s => s.FrameId!.Value).ToHashSet();
var keepHolds = here.Photos.Where(p => !p.Unusable && p.Sha256 is { Length: > 0 } && !losers.Contains(p.FrameId))
.Select(p => p.Sha256!.ToLowerInvariant()).ToHashSet(StringComparer.Ordinal);
- // Photos of the other a verify flagged Corrupt (changed since import, or damaged) whose file is still there: the
+ // Photos of the other a verify flagged Corrupt (changed since import, or damaged) or Missing whose file is there: the
// comparison leaves them out, so nothing would copy or hash-verify them before their folder goes to the trash. One
// whose content now nothing else holds (an edited photo's only copy) blocks the merge until it is resolved.
if (online && await DamagedAsync(drop, dropPaths, keepHolds, ct).ConfigureAwait(false)) blocks.Add(CopyBlock.DamagedPhotos);
@@ -281,14 +281,15 @@ public sealed class SequenceMerger(ChronosDatabase db, ArchiveService archives,
}
///
- /// Whether the other sequence holds a frame flagged Corrupt (not Missing) whose file is still there and whose content,
- /// hashed now (in memory), neither the kept sequence () nor any other sequence of this
- /// index holds; an unreadable such file counts too.
+ /// Whether the other sequence holds a frame flagged unusable (Corrupt, or Missing by an earlier verify although its file
+ /// is back) whose file is there and whose content, hashed now (in memory), neither the kept sequence
+ /// () nor any other sequence of this index holds; an unreadable such file counts too. The
+ /// comparison leaves such frames out, so nothing else would copy or list them before their folder goes to the trash.
///
private async Task DamagedAsync(Guid drop, ArchivePaths dropPaths, IReadOnlySet keepHolds, CancellationToken ct)
{
var flagged = (await _db.Frames.ListBySequenceAsync(drop, cancellationToken: ct).ConfigureAwait(false))
- .Where(f => (f.Flags & FrameFlags.Corrupt) != 0 && (f.Flags & FrameFlags.Missing) == 0).ToList();
+ .Where(f => (f.Flags & CopySides.UnusableFlags) != 0).ToList();
var hashes = new List();
foreach (var frame in flagged)
{
@@ -441,15 +442,20 @@ public sealed class SequenceMerger(ChronosDatabase db, ArchiveService archives,
return false;
}
- /// The drop's non-Main projects, each with the name it gets at the kept sequence's home.
+ ///
+ /// The drop's non-Main projects, each with the name it gets at the kept sequence's home; one whose head the kept
+ /// sequence's projects hold already (by content: a merge planned again after an earlier run copied it) is not copied again.
+ ///
private async Task> ProjectStepsAsync(Guid keep, Guid drop, string dropArchiveName, CancellationToken ct)
{
- var taken = (await _db.Projects.ListBySequenceAsync(keep, includeDeleted: false, ct).ConfigureAwait(false)).Select(p => p.Name)
- .ToHashSet(StringComparer.OrdinalIgnoreCase);
+ var keepProjects = await _db.Projects.ListBySequenceAsync(keep, includeDeleted: false, ct).ConfigureAwait(false);
+ var taken = keepProjects.Select(p => p.Name).ToHashSet(StringComparer.OrdinalIgnoreCase);
+ var keepHeads = await HeadHashesAsync(keepProjects, ct).ConfigureAwait(false);
var steps = new List();
foreach (var project in (await _db.Projects.ListBySequenceAsync(drop, includeDeleted: false, ct).ConfigureAwait(false))
.Where(p => !p.IsMain).OrderBy(p => p.CreatedAt).ThenBy(p => p.Id))
{
+ if (await HeldAlreadyAsync(project, keepHeads, ct).ConfigureAwait(false)) continue;
var name = FreeName(project.Name, dropArchiveName, taken);
taken.Add(name);
steps.Add(new ProjectStep(CopySide.Other, project.Id, project.Name, name, project.HeadNumber, project.HeadVersionId ?? Guid.Empty));
@@ -457,6 +463,33 @@ public sealed class SequenceMerger(ChronosDatabase db, ArchiveService archives,
return steps;
}
+ /// The content hashes of the heads of (Main and versionless ones left out; an unreadable head too).
+ internal async Task> HeadHashesAsync(IEnumerable projects, CancellationToken ct)
+ {
+ var hashes = new HashSet(StringComparer.OrdinalIgnoreCase);
+ foreach (var project in projects.Where(p => !p.IsMain && p.HeadVersionId is not null))
+ {
+ if (await HeadHashAsync(project.Id, ct).ConfigureAwait(false) is { } hash) hashes.Add(hash);
+ }
+ return hashes;
+ }
+
+ /// Whether the head of is one of (by content).
+ internal async Task HeldAlreadyAsync(SequenceProject project, IReadOnlySet heads, CancellationToken ct) =>
+ heads.Count > 0 && project.HeadVersionId is not null && await HeadHashAsync(project.Id, ct).ConfigureAwait(false) is { } head && heads.Contains(head);
+
+ private async Task HeadHashAsync(Guid projectId, CancellationToken ct)
+ {
+ try
+ {
+ return (await _archives.Projects.HeadAsync(projectId, ct).ConfigureAwait(false)).ContentHash;
+ }
+ catch (Exception ex) when (ex is ProjectException or IOException or UnauthorizedAccessException)
+ {
+ return null;
+ }
+ }
+
/// The name itself when free, else "<name> (<archive>)", then " (2)"…, each within .
internal static string FreeName(string name, string archiveName, IReadOnlySet taken)
{
diff --git a/src/Chronos.Data/Copies/CopyFinder.cs b/src/Chronos.Data/Copies/CopyFinder.cs
index 22b5758f..eee3ed8c 100644
--- a/src/Chronos.Data/Copies/CopyFinder.cs
+++ b/src/Chronos.Data/Copies/CopyFinder.cs
@@ -349,8 +349,9 @@ public sealed class CopyFinder(ChronosDatabase db, FoundCopyStore store, CopySid
evidence = Strongest(evidence, score);
if (!CopyRules.IsCopy(evidence, score))
{
- if (existing is { State: CopyState.Candidate }) await _store.DeleteAsync(existing.Id, ct).ConfigureAwait(false);
- return existing is { State: CopyState.Candidate } ? null : existing;
+ // Only while it is still a Candidate: an answer given since it was read (Keep apart, Link) stays, as answered.
+ if (existing is not { State: CopyState.Candidate }) return existing;
+ return await _store.DeleteCandidateAsync(existing.Id, ct).ConfigureAwait(false) ? null : await _store.GetAsync(existing.Id, ct).ConfigureAwait(false);
}
var row = await _store.UpsertFoundAsync(new FoundCopy
@@ -478,7 +479,7 @@ public sealed class CopyFinder(ChronosDatabase db, FoundCopyStore store, CopySid
// Asked local pairs that share nothing any more (photos deleted, a sequence reidentified) are no longer asked.
foreach (var stale in all.Where(c => c is { Kind: CopyKind.LocalLocal, State: CopyState.Candidate } && !candidates.ContainsKey((c.LocalId, c.OtherId!.Value))
&& !held.Contains(c.LocalId) && !held.Contains(c.OtherId!.Value)))
- await _store.DeleteAsync(stale.Id, ct).ConfigureAwait(false);
+ await _store.DeleteCandidateAsync(stale.Id, ct).ConfigureAwait(false);
var now = DateTimeOffset.UtcNow;
foreach (var id in touched)
@@ -513,7 +514,7 @@ public sealed class CopyFinder(ChronosDatabase db, FoundCopyStore store, CopySid
evidence = Strongest(evidence, score);
if (!CopyRules.IsCopy(evidence, score))
{
- if (existing is { State: CopyState.Candidate }) await _store.DeleteAsync(existing.Id, ct).ConfigureAwait(false);
+ if (existing is { State: CopyState.Candidate }) await _store.DeleteCandidateAsync(existing.Id, ct).ConfigureAwait(false);
return;
}
var row = await _store.UpsertFoundAsync(new FoundCopy
diff --git a/src/Chronos.Data/Copies/CopyLog.cs b/src/Chronos.Data/Copies/CopyLog.cs
new file mode 100644
index 00000000..a106c7e9
--- /dev/null
+++ b/src/Chronos.Data/Copies/CopyLog.cs
@@ -0,0 +1,28 @@
+using Chronos.Core.Localization;
+using Chronos.Data.Archiving;
+using Chronos.Protocol.Client;
+
+namespace Chronos.Data.Copies;
+
+/// The reasons the Integrate and merge logs give for a losing version they kept, in the UI language.
+internal static class CopyLog
+{
+ /// Why the archive's dry run refused to trash it: one phrase per block ("a job is working on it").
+ public static string Reasons(IEnumerable blocks) =>
+ string.Join(", ", blocks.Distinct().Select(b => Loc.L("Archive.Log.KeptReason." + b)));
+
+ ///
+ /// Why a trash step failed: the photos changed meanwhile (a stale dry run), the server's refusal with its reason, or the
+ /// system's message (an I/O error, already in the system's language).
+ ///
+ public static string Reason(Exception ex)
+ {
+ ArgumentNullException.ThrowIfNull(ex);
+ return ex switch
+ {
+ StaleDeletePlanException => Loc.L("Archive.Log.KeptReason.FramesChanged"),
+ ChronosApiException => Loc.L("Archive.Log.KeptReason.Refused", ex.Message),
+ _ => ex.Message,
+ };
+ }
+}
diff --git a/src/Chronos.Data/Copies/CopyPlans.cs b/src/Chronos.Data/Copies/CopyPlans.cs
index 1c41764b..329aa803 100644
--- a/src/Chronos.Data/Copies/CopyPlans.cs
+++ b/src/Chronos.Data/Copies/CopyPlans.cs
@@ -86,6 +86,15 @@ public sealed record IntegratePlan(Guid CopyId, string Server, Guid LocalId, Gui
/// The context the plan was made with (rights, names): the job plans again with it ().
public CopyPlanContext? Context { get; init; }
+
+ ///
+ /// Photos whose server version stays for want of the right to trash it there (Delete, and owner or admin of the server
+ /// sequence): counted in ; the server's Main uses this PC's version of them.
+ ///
+ public int StaysForDelete { get; init; }
+
+ /// Photos whose server version the plan trashes there or excludes from the server's Main: the server uses this PC's version.
+ public int ServerUsesOurs { get; init; }
}
/// The choices of a merge of two local copies (projects are always copied across: the other's home goes to the trash).
@@ -115,7 +124,8 @@ public sealed record MergePlan(Guid CopyId, Guid KeepId, Guid DropId, MergeChoic
}
///
-/// What the planners need to know of this PC and the signed-in account: names, rights (OwnsOrAdmin: of the server sequence),
+/// What the planners need to know of this PC and the signed-in account: names, rights (OwnsOrAdmin: the account is an admin
+/// of the server, which owns every sequence there; owning one is decided per sequence from its owner and ),
/// whether the server keeps projects, the quota left, sequences with unsent workspace work, and every server's originals archive.
///
public sealed record CopyPlanContext(string PcName, string? ServerName, bool CanUpload, bool CanFetch, bool CanEdit, bool CanDelete,
diff --git a/src/Chronos.Data/Copies/CopyReviewBuilder.cs b/src/Chronos.Data/Copies/CopyReviewBuilder.cs
index df282c0f..07c7bbf2 100644
--- a/src/Chronos.Data/Copies/CopyReviewBuilder.cs
+++ b/src/Chronos.Data/Copies/CopyReviewBuilder.cs
@@ -45,6 +45,7 @@ public sealed class CopyReviewBuilder(ChronosDatabase db, ProjectService project
bool thereKeeps;
List<(Guid Id, long Bytes, string? Sha256)> thereRenders;
IReadOnlySet capabilities = new HashSet(StringComparer.Ordinal);
+ Guid? remoteOwner = null;
if (copy.Kind == CopyKind.LocalLocal)
{
var other = await SequenceAsync(copy.OtherId!.Value, ct).ConfigureAwait(false);
@@ -61,6 +62,7 @@ public sealed class CopyReviewBuilder(ChronosDatabase db, ProjectService project
throw new ArgumentException("A pair with a server sequence is reviewed over that server's session.", nameof(remote));
var remoteId = copy.RemoteId!.Value;
var dto = await remote.GetSequenceAsync(remoteId, ct).ConfigureAwait(false);
+ remoteOwner = dto.OwnerUserId;
var manifest = await remote.GetManifestAsync(remoteId, ct).ConfigureAwait(false);
var rows = await remote.ListFramesAsync(remoteId, ct).ConfigureAwait(false);
var captured = new Dictionary(rows.Count);
@@ -90,7 +92,7 @@ public sealed class CopyReviewBuilder(ChronosDatabase db, ProjectService project
var renders = Renders(hereRenders, thereRenders);
var can = copy.Kind == CopyKind.LocalLocal
? await LocalCapabilitiesAsync(copy, local, ct).ConfigureAwait(false)
- : await ServerCapabilitiesAsync(copy, local, photos, details, capabilities, context, ct).ConfigureAwait(false);
+ : await ServerCapabilitiesAsync(copy, local, photos, details, capabilities, context, remoteOwner, ct).ConfigureAwait(false);
return new CopyReview(copy, hereFacts, thereFacts, photos, details, projectsView, renders, can);
}
@@ -198,7 +200,7 @@ public sealed class CopyReviewBuilder(ChronosDatabase db, ProjectService project
/// What can be done with a local↔server pair, and why not (design §5b, §5c, §6.2).
private async Task ServerCapabilitiesAsync(FoundCopy copy, Sequence local, CopyComparisonResult photos, IReadOnlyList details,
- IReadOnlySet capabilities, CopyPlanContext context, CancellationToken ct)
+ IReadOnlySet capabilities, CopyPlanContext context, Guid? remoteOwner, CancellationToken ct)
{
var server = copy.Server!;
var remoteId = copy.RemoteId!.Value;
@@ -217,7 +219,9 @@ public sealed class CopyReviewBuilder(ChronosDatabase db, ProjectService project
if (copy.State == CopyState.Integrating || await BusyAsync([local.Id], [remoteId], ct).ConfigureAwait(false)) blocks.Add(CopyBlock.Busy);
if (await OfflineAsync(local, ct).ConfigureAwait(false)) blocks.Add(CopyBlock.ArchiveOffline);
var linkOnly = !linkTaken && !linked && copy.State is CopyState.Candidate or CopyState.KeptApart && !copy.RemoteGone;
- return new CopyCapabilities(blocks.Count == 0 && !copy.RemoteGone, linkOnly, context.CanDelete && context.OwnsOrAdmin && !copy.RemoteGone, blocks);
+ // The server deletes frames of a sequence for its owner or an admin only (DeleteFramesAsync), whatever the account's Delete right.
+ var owns = context.OwnsOrAdmin || (context.UserId is { } me && remoteOwner == me);
+ return new CopyCapabilities(blocks.Count == 0 && !copy.RemoteGone, linkOnly, context.CanDelete && owns && !copy.RemoteGone, blocks);
}
/// What can be done with two local copies: merge them, unless a job works on either, both are linked to one server, or an archive is offline.
diff --git a/src/Chronos.Data/Copies/FoundCopyStore.cs b/src/Chronos.Data/Copies/FoundCopyStore.cs
index 57e345e7..e137395f 100644
--- a/src/Chronos.Data/Copies/FoundCopyStore.cs
+++ b/src/Chronos.Data/Copies/FoundCopyStore.cs
@@ -276,6 +276,13 @@ public sealed class FoundCopyStore(ChronosDatabase db, TimeProvider? time = null
public Task DeleteAsync(Guid id, CancellationToken ct) =>
_db.ExecuteAsync("DELETE FROM found_copies WHERE id = $1", [id], ct);
+ ///
+ /// Deletes the row only while it still reads as a : a Keep apart or Link the user gave
+ /// since detection read it stays. True when the row went.
+ ///
+ public async Task DeleteCandidateAsync(Guid id, CancellationToken ct) =>
+ await _db.ExecuteAsync($"DELETE FROM found_copies WHERE id = $1 AND {Effective} = 0", [id], ct).ConfigureAwait(false) == 1;
+
///
/// Moves the pairs and probes of to inside the caller's transaction (the one
/// moves the links in; design §2.5), after the links moved. On a clash the row
diff --git a/src/Chronos.Data/Copies/IntegrateJobHandler.cs b/src/Chronos.Data/Copies/IntegrateJobHandler.cs
index 6ce1e1c4..3f5de77b 100644
--- a/src/Chronos.Data/Copies/IntegrateJobHandler.cs
+++ b/src/Chronos.Data/Copies/IntegrateJobHandler.cs
@@ -196,7 +196,10 @@ internal sealed class IntegrateJobHandler(SyncService sync, IntegratePlanner pla
LocalPayload = plan.LocalPayload,
RemotePayload = plan.RemotePayload,
Projects = [.. plan.Projects],
+ ServerName = plan.Context?.ServerName,
};
+ foreach (var step in plan.Photos.Where(p => p.Action is PhotoAction.Send or PhotoAction.SendVersion or PhotoAction.Fetch or PhotoAction.FetchVersion))
+ journal.Names.TryAdd(step.Action == PhotoAction.FetchVersion && step.Sha256 is { Length: > 0 } sha ? sha : step.Key, step.FileName);
journal.Save(paths);
return journal;
}
@@ -252,22 +255,23 @@ internal sealed class IntegrateJobHandler(SyncService sync, IntegratePlanner pla
var send = journal.Send.Except(journal.Sent, StringComparer.Ordinal).ToList();
if (send.Count > 0)
{
- await owner._transfers.SendPhotosAsync(context, remote, journal.LocalId, journal.RemoteId, send, key => DoneAsync(journal.Sent, key))
+ await owner._transfers.SendPhotosAsync(context, remote, journal.LocalId, journal.RemoteId, send, key => DoneAsync(journal.Sent, key, "Archive.Log.CopySent"))
.ConfigureAwait(false);
}
var fetch = journal.Fetch.Except(journal.Fetched, StringComparer.Ordinal).ToList();
if (fetch.Count > 0)
{
- await owner._transfers.FetchPhotosAsync(context, remote, journal.RemoteId, journal.LocalId, fetch, key => DoneAsync(journal.Fetched, key))
- .ConfigureAwait(false);
+ await owner._transfers.FetchPhotosAsync(context, remote, journal.RemoteId, journal.LocalId, fetch,
+ key => DoneAsync(journal.Fetched, key, "Archive.Log.CopyFetched")).ConfigureAwait(false);
}
}
- private async ValueTask DoneAsync(List list, string key)
+ private async ValueTask DoneAsync(List list, string key, string logKey)
{
if (list.Contains(key, StringComparer.Ordinal)) return;
list.Add(key);
Save();
+ context.Log(Loc.L(logKey, journal.Names.GetValueOrDefault(key) ?? key));
await context.CheckpointAsync($"photos:{journal.Sent.Count + journal.Fetched.Count}", Done(), Total).ConfigureAwait(false);
}
@@ -301,7 +305,7 @@ internal sealed class IntegrateJobHandler(SyncService sync, IntegratePlanner pla
}
if (!await WinnerHereAsync(step.WinnerSha256).ConfigureAwait(false))
{
- Keep(step, "the version that replaces it is not in place");
+ Keep(step, Loc.L("Archive.Log.KeptReason.NotInPlace"));
return;
}
try
@@ -311,16 +315,17 @@ internal sealed class IntegrateJobHandler(SyncService sync, IntegratePlanner pla
.ConfigureAwait(false);
if (!plan.CanDelete)
{
- Keep(step, string.Join(", ", plan.Blocked));
+ Keep(step, CopyLog.Reasons(plan.Blocked));
return;
}
await owner.Archives.FrameTrash.DeleteAsync(plan, null, null, _ct, journal.JobId).ConfigureAwait(false);
journal.TrashedHere.Add(step.Key);
Save();
+ context.Log(Loc.L("Archive.Log.CopyReplaced", step.FileName));
}
catch (Exception ex) when (ex is StaleDeletePlanException or IOException or UnauthorizedAccessException)
{
- Keep(step, ex.Message);
+ Keep(step, CopyLog.Reason(ex));
}
}
@@ -344,7 +349,7 @@ internal sealed class IntegrateJobHandler(SyncService sync, IntegratePlanner pla
// The winner on the server, by SHA-256, in a usable frame of a fresh manifest.
if (!manifest.Frames.Any(f => (f.Flags & (long)CopySides.UnusableFlags) == 0 && string.Equals(f.Sha256, step.WinnerSha256, StringComparison.OrdinalIgnoreCase)))
{
- Keep(step, "the version that replaces it is not in place on the server");
+ Keep(step, Loc.L("Archive.Log.KeptReason.NotInPlaceServer"));
return;
}
try
@@ -355,6 +360,7 @@ internal sealed class IntegrateJobHandler(SyncService sync, IntegratePlanner pla
await remote.DeleteFramesAsync(journal.RemoteId, new FrameDeleteRequest([step.FrameId], manifest.FramesVersion, DryRun: false), _ct).ConfigureAwait(false);
journal.TrashedThere.Add(step.Key);
Save();
+ context.Log(Loc.L("Archive.Log.CopyReplaced", step.FileName));
}
catch (ChronosApiException ex) when (ex.Status == HttpStatusCode.NotFound)
{
@@ -363,7 +369,7 @@ internal sealed class IntegrateJobHandler(SyncService sync, IntegratePlanner pla
catch (Exception ex) when (ex is ChronosApiException { IsTransient: false } or NotSupportedException)
{
// Refused (the frames version moved, no right, would empty it): the photo stays.
- Keep(step, ex.Message);
+ Keep(step, CopyLog.Reason(ex));
}
}
@@ -371,7 +377,7 @@ internal sealed class IntegrateJobHandler(SyncService sync, IntegratePlanner pla
{
journal.KeptLosers.Add(step.Key);
Save();
- context.Log($"{step.FileName}: {why}");
+ context.Log(Loc.L("Archive.Log.CopyKept", step.FileName, why));
}
/// Whether a usable frame of the local copy holds , its file hashed again now.
@@ -433,7 +439,7 @@ internal sealed class IntegrateJobHandler(SyncService sync, IntegratePlanner pla
var (from, to) = step.From == CopySide.ThisPc ? ((IProjectHome?)localHome, serverHome) : (serverHome, localHome);
try
{
- if (from is null || to is null) throw new HomeUnavailableException($"The projects of {journal.Server} cannot be reached now.");
+ if (from is null || to is null) throw new HomeUnavailableException(Loc.L("Errors.Copies.ProjectsUnreachable", journal.ServerName ?? journal.Server));
if ((await from.ListAsync(_ct).ConfigureAwait(false)).FirstOrDefault(p => p.Id == step.SourceProjectId) is not { } source)
{
// Deleted at its home since the plan: nothing to copy.
@@ -449,12 +455,13 @@ internal sealed class IntegrateJobHandler(SyncService sync, IntegratePlanner pla
}, _ct).ConfigureAwait(false);
journal.ProjectsDone.Add(step.SourceProjectId);
Save();
+ context.Log(Loc.L("Archive.Log.CopyProject", step.SourceName, step.TargetName));
}
catch (Exception ex) when (ex is not OperationCanceledException)
{
journal.ProjectsFailed.Add(step.SourceProjectId);
Save();
- context.Log($"{step.SourceName}: {ex.Message}");
+ context.Log(Loc.L("Archive.Log.CopyProjectKept", step.SourceName, ex.Message));
}
}
}
diff --git a/src/Chronos.Data/Copies/IntegrateJournal.cs b/src/Chronos.Data/Copies/IntegrateJournal.cs
index 73929d39..99d9984a 100644
--- a/src/Chronos.Data/Copies/IntegrateJournal.cs
+++ b/src/Chronos.Data/Copies/IntegrateJournal.cs
@@ -36,6 +36,9 @@ internal sealed class IntegrateJournal
public string Server { get; set; } = string.Empty;
+ /// The name the server is shown by (the log names it); null: its key.
+ public string? ServerName { get; set; }
+
public Guid LocalId { get; set; }
public Guid RemoteId { get; set; }
@@ -53,6 +56,9 @@ internal sealed class IntegrateJournal
/// Photo keys of the server originals fetched (Fetch steps, and the server's key of each FetchVersion).
public List Fetch { get; set; } = [];
+ /// The file name of each key sent or fetched (the log names the photo).
+ public Dictionary Names { get; set; } = new(StringComparer.Ordinal);
+
public List Trash { get; set; } = [];
/// The one portable payload both sides get; null when the details stay as they are.
diff --git a/src/Chronos.Data/Copies/IntegratePlanner.cs b/src/Chronos.Data/Copies/IntegratePlanner.cs
index 75181460..42e606fc 100644
--- a/src/Chronos.Data/Copies/IntegratePlanner.cs
+++ b/src/Chronos.Data/Copies/IntegratePlanner.cs
@@ -93,11 +93,15 @@ public sealed class IntegratePlanner(SyncService sync, CopySides sides, ProjectS
var tombstones = SyncTombstones.FromDtos(here.Removed, there.Removed);
// Photos, by the policy (the "wins" policies decide the Different class only).
- var canTrashThere = context.CanDelete && context.OwnsOrAdmin;
+ // The server moves frames of a sequence to its trash for the sequence's owner or an admin only (DeleteFramesAsync),
+ // whatever the account's Delete right; sending into it needs that or the Edit right (UploadService).
+ var owns = context.OwnsOrAdmin || (context.UserId is { } me && dto.OwnerUserId == me);
+ var canTrashThere = context.CanDelete && owns;
var steps = new List();
var excluded = new List();
var leftOut = 0;
var dropped = new HashSet(StringComparer.Ordinal);
+ var trashedThere = 0;
foreach (var photo in comparison.Photos)
{
switch (photo.Class)
@@ -130,11 +134,15 @@ public sealed class IntegratePlanner(SyncService sync, CopySides sides, ProjectS
if (canTrashThere)
{
steps.Add(Step(photo.Key, PhotoAction.TrashThere, photo.There!));
+ trashedThere++;
}
else
{
+ // The server's version stays (no right to trash it there), listed "stays: needs the Delete right";
+ // its Main uses this PC's version, as when both are kept.
dropped.Add(photo.Key);
leftOut++;
+ if (photo.There!.Sha256 is { Length: > 0 } stays) excluded.Add(tombstones.Canonical(stays)!);
}
break;
case PhotoChoice.TakeThere:
@@ -161,6 +169,7 @@ public sealed class IntegratePlanner(SyncService sync, CopySides sides, ProjectS
var lines = CopyPayload.Lines(localRaw, localPhotos, remoteRaw, remotePhotos);
SyncPayload? payload = null;
var changes = 0;
+ var excludedThere = 0;
var unchosen = lines.Where(l => !choices.Details.ContainsKey(l.Path)).Select(l => l.Path).Distinct(StringComparer.Ordinal).Count();
if (unchosen > 0)
{
@@ -175,6 +184,7 @@ public sealed class IntegratePlanner(SyncService sync, CopySides sides, ProjectS
try
{
merged = CopyPayload.ExcludeVersions(merged, excluded);
+ excludedThere = excluded.Count;
}
catch (Exception ex) when (ex is JsonException or InvalidDataException)
{
@@ -200,12 +210,12 @@ public sealed class IntegratePlanner(SyncService sync, CopySides sides, ProjectS
// Rights.
if (steps.Any(s => s.Action is PhotoAction.Send or PhotoAction.SendVersion) && !context.CanUpload) blocks.Add(CopyBlock.NoUploadRight);
// Sent into the server sequence: the server allows that to its owner, an admin or an account with Edit only.
- var owns = context.OwnsOrAdmin || (context.UserId is { } me && dto.OwnerUserId == me);
if (steps.Any(s => s.Action is PhotoAction.Send or PhotoAction.SendVersion) && context.CanUpload && !owns && !context.CanEdit)
blocks.Add(CopyBlock.NoAddRight);
if (steps.Any(s => s.Action is PhotoAction.Fetch or PhotoAction.FetchVersion) && !context.CanFetch) blocks.Add(CopyBlock.NoFetchRight);
// Nothing left but versions whose loser stays for want of the Delete right: there is nothing to integrate.
- if (dropped.Count > 0 && steps.All(s => dropped.Contains(s.Key)) && payload is null && projectSteps.Count == 0) blocks.Add(CopyBlock.NoDeleteRight);
+ // (The payload making the server's Main use this PC's version of those photos does not count: it is the same choice.)
+ if (dropped.Count > 0 && steps.All(s => dropped.Contains(s.Key)) && changes == 0 && projectSteps.Count == 0) blocks.Add(CopyBlock.NoDeleteRight);
var fingerprint = CopyRules.PlanFingerprint(FingerprintLines(local, manifest, localRaw, remoteRaw, choices, steps, lastCopies, payload, localPortable,
remotePortable, projectSteps));
@@ -214,6 +224,8 @@ public sealed class IntegratePlanner(SyncService sync, CopySides sides, ProjectS
manifest.FramesVersion, manifest.SettingsVersion, fingerprint)
{
Context = context,
+ StaysForDelete = dropped.Count,
+ ServerUsesOurs = trashedThere + excludedThere,
};
bool Brought(string key) => choices.Photos != CopyPhotoPolicy.ChoosePerPhoto || choices.PerPhoto.GetValueOrDefault(key, PhotoChoice.Leave) == PhotoChoice.Bring;
diff --git a/src/Chronos.Data/Sync/SyncService.cs b/src/Chronos.Data/Sync/SyncService.cs
index 4228044c..3843db29 100644
--- a/src/Chronos.Data/Sync/SyncService.cs
+++ b/src/Chronos.Data/Sync/SyncService.cs
@@ -633,6 +633,16 @@ public sealed class SyncService
var absorbed = CopyPayload.Moved(plannedRemote, freshRemote);
if (absorbed.Count > 0 && !freshRemote.SameAs(final))
{
+ // Title, tags, rating and notes the user decided as this PC's (the plan had a line there and the final payload
+ // keeps this PC's value) are never taken over from a server edit made since: no analysis moves them, and they
+ // keep no history. The pair goes back to Linked and the sync shows the conflict. Settings paths are absorbed.
+ var metadata = absorbed.Where(p => p.StartsWith(SyncRules.MetadataPath, StringComparison.Ordinal)).ToList();
+ if (metadata.Count > 0)
+ {
+ var lined = CopyPayload.Moved(plannedLocal, plannedRemote);
+ var notLocal = CopyPayload.Moved(plannedLocal, finalPortable);
+ if (metadata.Any(p => lined.Contains(p) && !notLocal.Contains(p))) throw DetailsChanged();
+ }
final = CopyPayload.Merge(final, freshRemote, absorbed.ToDictionary(p => p, _ => CopySide.Other, StringComparer.Ordinal),
[.. absorbed.Select(p => new DetailLine(p, null, null))]);
}
diff --git a/tests/Chronos.App.Tests/Server/CopyScreenSmokeTests.cs b/tests/Chronos.App.Tests/Server/CopyScreenSmokeTests.cs
index 79c2e49e..8593bf24 100644
--- a/tests/Chronos.App.Tests/Server/CopyScreenSmokeTests.cs
+++ b/tests/Chronos.App.Tests/Server/CopyScreenSmokeTests.cs
@@ -66,6 +66,16 @@ public sealed class CopyScreenSmokeTests
var marked = table.Rows.First(r => r.Title == CopyScenes.Lighthouse);
Assert.Equal(Loc.L("Server.Sync.State.CopyFound"), marked.StateText);
Assert.Equal(SyncAction.Compare, marked.Actions[0].Action);
+
+ // A match the server deleted: the local row offers what the Matches row does (design §6.3), each with a tooltip.
+ await CopyScenes.ShowAsync(shell, "server-copies-gone");
+ var gone = table.Rows.Single(r => r.Title == "Garden 2026");
+ Assert.SequenceEqual([SyncAction.KeepHere, SyncAction.UploadAgain, SyncAction.ToTrash], gone.Actions.Select(a => a.Action));
+ foreach (var action in gone.Actions)
+ {
+ Assert.False(string.IsNullOrWhiteSpace(action.ToolTip), $"{action.Text} has a tooltip");
+ Assert.Equal(Loc.L("Server.Copies.Action." + action.Action), action.Text);
+ }
CopyScenes.Reset(shell);
});
@@ -170,6 +180,23 @@ public sealed class CopyScreenSmokeTests
CopyScenes.Reset(shell);
});
+ [Test]
+ public Task EditsPickerMarksAProjectWhoseTimeLapseHasATwin() => ScreenHost.RunAsync(async () =>
+ {
+ await using var app = await StartAsync();
+ var shell = app.Shell;
+ // A workspace project of this PC: the sample reads it as a linked pair's, with a project on the server.
+ var id = await app.Sample.FillEditorAsync();
+ shell.OpenSequence(id);
+ await shell.Sequence.OpenAsync(id);
+ Assert.Contains(CopyScenes.Views, v => v == "edit-picker-twins");
+ await CopyScenes.ShowAsync(shell, "edit-picker-twins");
+ var twin = Assert.Contains(shell.Sequence.Picker.WorkspaceItems, i => i.HasTwin);
+ Assert.False(string.IsNullOrWhiteSpace(twin.TwinToolTip), "the Twin chip says where the other project is");
+ await app.ExpectAsync("edit-picker-twins", waitForThumbnails: true);
+ CopyScenes.Reset(shell);
+ });
+
[Test]
public Task TheLibraryAndSettingsShowTheMatches() => ScreenHost.RunAsync(async () =>
{
diff --git a/tests/Chronos.App.Tests/Server/CopyTextTests.cs b/tests/Chronos.App.Tests/Server/CopyTextTests.cs
index 4c586c39..c7e08c12 100644
--- a/tests/Chronos.App.Tests/Server/CopyTextTests.cs
+++ b/tests/Chronos.App.Tests/Server/CopyTextTests.cs
@@ -191,6 +191,44 @@ public sealed class CopyTextTests
Assert.Equal(SyncText.State(entry with { Transfer = upload }), SyncText.State(entry with { Transfer = upload }, candidate));
}
+ [Test]
+ public void ASkipForASuspectedMatchNamesWhereTheMatchLies()
+ {
+ var mark = new SyncMark(null, UploadSkip.SuspectedCopy, "Studio NAS");
+ // A match on another server than the signed-in one is named by that server.
+ Assert.Equal(Loc.L("Tooltips.Server.Sync.Skip.SuspectedCopy", "Lab NAS"),
+ SyncText.SkipReason(UploadSkip.SuspectedCopy, mark with { SkippedMatch = new SkippedMatch("Lab NAS", false) }));
+ // One in another archive of this PC says "in", not "on".
+ Assert.Equal(Loc.L("Tooltips.Server.Sync.Skip.SuspectedCopyLocal", "Old archive"),
+ SyncText.SkipReason(UploadSkip.SuspectedCopy, mark with { SkippedMatch = new SkippedMatch("Old archive", true) }));
+ // Unknown: the signed-in server.
+ Assert.Equal(Loc.L("Tooltips.Server.Sync.Skip.SuspectedCopy", "Studio NAS"), SyncText.SkipReason(UploadSkip.SuspectedCopy, mark));
+ // A job on it may integrate or merge it: the words say neither alone.
+ Assert.Equal(Loc.L("Tooltips.Server.Sync.Skip.Busy"), SyncText.SkipReason(UploadSkip.Busy, mark));
+ }
+
+ [Test]
+ public void ARowWhoseMatchTheServerDeletedOffersWhatTheMatchesRowDoes()
+ {
+ var entry = Entry(SyncStatus.LocalOnly, link: null);
+ var editor = SyncRights.Of((long)RolePermissions.Default(UserRole.Editor));
+ var gone = new SyncMark(Copy(CopyState.Linked, gone: true), null, "Studio NAS");
+ Assert.SequenceEqual([SyncAction.KeepHere, SyncAction.UploadAgain, SyncAction.ToTrash], SyncText.Actions(entry, editor, gone));
+ // Kept here: only Upload again.
+ Assert.SequenceEqual([SyncAction.UploadAgain], SyncText.Actions(entry, editor, new SyncMark(Copy(CopyState.KeptApart, gone: true), null)));
+ foreach (var action in new[] { SyncAction.KeepHere, SyncAction.UploadAgain, SyncAction.ToTrash })
+ {
+ var row = new SyncRowAction(action, () => Task.CompletedTask);
+ Assert.Equal(Loc.L("Server.Copies.Action." + action), row.Text);
+ Assert.False(string.IsNullOrWhiteSpace(SyncText.ToolTip(entry, action, editor, gone)), $"{action} has a tooltip");
+ }
+ Assert.Equal(Loc.L("Tooltips.Server.Copies.UploadAgain", "Studio NAS"), SyncText.ToolTip(entry, SyncAction.UploadAgain, editor, gone));
+ // Without the upload right, Upload again is offered disabled with the reason.
+ var reader = SyncRights.Of((long)RolePermissions.Default(UserRole.Viewer));
+ Assert.False(SyncText.IsEnabled(SyncAction.UploadAgain, reader));
+ Assert.Equal(Loc.L("Tooltips.Server.Sync.UploadAll.NoRight"), SyncText.ToolTip(entry, SyncAction.UploadAgain, reader, gone));
+ }
+
[Test]
public void TheOwnerReview6TextsFitTheirPlaces()
{
diff --git a/tests/Chronos.Data.Tests/Archiving/SequenceMergerTests.cs b/tests/Chronos.Data.Tests/Archiving/SequenceMergerTests.cs
index b46afe27..746aa242 100644
--- a/tests/Chronos.Data.Tests/Archiving/SequenceMergerTests.cs
+++ b/tests/Chronos.Data.Tests/Archiving/SequenceMergerTests.cs
@@ -497,6 +497,96 @@ public abstract class SequenceMergerTests(TestContext context) : DatabaseTest(co
Assert.DoesNotContain(CopyBlock.DamagedPhotos, (await merger.PlanAsync(copy.Id, keep.Id, drop.Id, choices, NoContext, Ct)).Blocks);
}
+ [Test]
+ public async Task APhotoFlaggedMissingWhoseFileIsThereBlocksTheMerge()
+ {
+ var fx = await FixtureAsync();
+ var keep = await SequenceAsync(fx, "keep", [(1, 0, "IMG_0001.JPG")]);
+ var drop = await SequenceAsync(fx, "drop", [(1, 0, "IMG_0001.JPG"), (2, 10_000, "IMG_0002.JPG")]);
+ // Flagged Missing by an earlier verify (a drive away then), its file back now: the merge would not copy it.
+ var missing = (await fx.Db.Frames.ListBySequenceAsync(drop.Id)).First(f => f.Sha256 == Sha(2, 10_000));
+ await fx.Db.Frames.UpdateFlagsAsync([missing.Id], FrameFlags.Missing, FrameFlags.None, Ct);
+ var copy = await PairAsync(fx, keep.Id, drop.Id);
+
+ var plan = await Merger(fx).PlanAsync(copy.Id, keep.Id, drop.Id, await ChoicesAsync(fx, keep.Id, drop.Id, CopyPhotoPolicy.Union), NoContext, Ct);
+
+ Assert.Contains(CopyBlock.DamagedPhotos, plan.Blocks);
+ Assert.False(plan.CanApply);
+ }
+
+ [Test]
+ public async Task WorkSentHomeIntoTheOtherAfterAStoppedTrashAsksForANewPlan()
+ {
+ var fx = await FixtureAsync();
+ var merger = Merger(fx);
+ var workspace = new FakeWorkspace();
+ var (engine, handler) = Engine(fx, merger, new FakeProjects(), workspace);
+ await engine.StartAsync(Ct);
+ var store = new FoundCopyStore(fx.Db);
+
+ // Details sent home (a settings version), then a project made in the other (a new head), each after the stop.
+ Func[] sends =
+ [
+ drop => fx.Db.Sequences.SetTagsAsync(drop.Id, ["sent"], Ct),
+ drop => fx.Service.Projects.CreateAsync(drop.Id, "Sent cut", cancellationToken: fx.Ct),
+ ];
+ for (var i = 0; i < sends.Length; i++)
+ {
+ var keep = await SequenceAsync(fx, $"keep-{i}", [(10 * i + 1, 0, "IMG_0001.JPG")]);
+ var drop = await SequenceAsync(fx, $"drop-{i}", [(10 * i + 1, 0, "IMG_0001.JPG"), (10 * i + 2, 10_000, "IMG_0002.JPG")]);
+ var copy = await PairAsync(fx, keep.Id, drop.Id);
+ handler.BeforeStage = stage =>
+ {
+ if (stage == MergeStage.Trash) workspace.Unsent.Add(drop.Id);
+ return Task.CompletedTask;
+ };
+ var plan = await merger.PlanAsync(copy.Id, keep.Id, drop.Id, await ChoicesAsync(fx, keep.Id, drop.Id, CopyPhotoPolicy.Union), NoContext, Ct);
+ var job = await merger.EnqueueAsync(engine, store, plan, keep.DisplayTitle, Ct);
+ await fx.WaitForAsync(job.Id, JobState.Failed);
+
+ // The workspace sends its work home into the other, then Retry.
+ await sends[i](drop);
+ handler.BeforeStage = null;
+ workspace.Unsent.Clear();
+ await engine.ResumeAsync(job.Id, Ct);
+ var failed = await fx.WaitForAsync(job.Id, JobState.Failed);
+
+ Assert.Equal(Chronos.Core.Localization.Loc.L("Errors.Copies.Changed", drop.DisplayTitle), failed.Error);
+ Assert.NotNull(await fx.Db.Sequences.GetAsync(drop.Id));
+ Assert.False(File.Exists(MergeJournal.PathFor(fx.Paths, job.Id)), "the next run plans again");
+ }
+ }
+
+ [Test]
+ public async Task APhotoSettledThroughAThirdSequenceThatIsGoneByTheTrashKeepsTheOther()
+ {
+ var fx = await FixtureAsync();
+ var keep = await SequenceAsync(fx, "keep", [(1, 0, "IMG_0001.JPG"), (4, 30_250, "IMG_0004.JPG")]);
+ var drop = await SequenceAsync(fx, "drop", [(1, 0, "IMG_0001.JPG"), (5, 30_250, "IMG_0004.JPG")]);
+ // A third sequence holds the other's losing version: not a last copy when planned.
+ var third = await SequenceAsync(fx, "third", [(5, 30_250, "IMG_0004.JPG")]);
+ var copy = await PairAsync(fx, keep.Id, drop.Id);
+ var merger = Merger(fx);
+ var (engine, handler) = Engine(fx, merger, new FakeProjects(), new FakeWorkspace());
+ await engine.StartAsync(Ct);
+ var plan = await merger.PlanAsync(copy.Id, keep.Id, drop.Id, await ChoicesAsync(fx, keep.Id, drop.Id, CopyPhotoPolicy.ThisPcWins), NoContext, Ct);
+ Assert.Empty(plan.LastCopies);
+ handler.BeforeStage = async stage =>
+ {
+ if (stage == MergeStage.Trash) await fx.Db.Sequences.DeleteAsync(third.Id, Ct);
+ };
+
+ var job = await merger.EnqueueAsync(engine, new FoundCopyStore(fx.Db), plan, keep.DisplayTitle, Ct);
+ var failed = await fx.WaitForAsync(job.Id, JobState.Failed);
+
+ // Now the other holds its only copy: nothing goes to the trash, and the next plan lists it as a last copy.
+ Assert.Equal(Chronos.Core.Localization.Loc.L("Errors.Copies.Changed", drop.DisplayTitle), failed.Error);
+ Assert.Contains(Sha(5, 30_250), await HashesAsync(fx, drop.Id));
+ Assert.False(File.Exists(MergeJournal.PathFor(fx.Paths, job.Id)));
+ var again = await merger.PlanAsync(copy.Id, keep.Id, drop.Id, await ChoicesAsync(fx, keep.Id, drop.Id, CopyPhotoPolicy.ThisPcWins), NoContext, Ct);
+ Assert.Contains(again.LastCopies, l => l.Key == Sha(5, 30_250));
+ }
+
[Test]
public async Task APhotoAddedToTheOtherOrDeletedFromTheKeptOneMeanwhileKeepsTheOtherOutOfTheTrash()
{
diff --git a/tests/Chronos.Data.Tests/Copies/FoundCopyStoreTests.cs b/tests/Chronos.Data.Tests/Copies/FoundCopyStoreTests.cs
index bae68976..18bddfa9 100644
--- a/tests/Chronos.Data.Tests/Copies/FoundCopyStoreTests.cs
+++ b/tests/Chronos.Data.Tests/Copies/FoundCopyStoreTests.cs
@@ -70,6 +70,23 @@ public abstract class FoundCopyStoreTests(TestContext context) : RepositoryTest(
return job;
}
+ [Test]
+ public async Task ThePruneOfAStaleCandidateLeavesARowAnsweredMeanwhile()
+ {
+ var (db, _, s) = await SetupAsync(2);
+ var store = new FoundCopyStore(db);
+ var stale = await store.UpsertFoundAsync(Remote(s[0].Id, Guid.CreateVersion7()), Ct);
+ var answered = await store.UpsertFoundAsync(Remote(s[1].Id, Guid.CreateVersion7()), Ct);
+ // Detection read both as candidates; the user keeps one apart before the prune runs.
+ Assert.True(await store.SetStateAsync(answered.Id, CopyState.Candidate, CopyState.KeptApart, Answer(), Ct));
+
+ Assert.True(await store.DeleteCandidateAsync(stale.Id, Ct));
+ Assert.False(await store.DeleteCandidateAsync(answered.Id, Ct));
+
+ Assert.Null(await store.GetAsync(stale.Id, Ct));
+ Assert.Equal(CopyState.KeptApart, (await store.GetAsync(answered.Id, Ct))!.State);
+ }
+
[Test]
public async Task AnUpsertUpdatesScoresAndKeepsTheStateAndTheStrongerEvidence()
{
diff --git a/tests/Chronos.Data.Tests/Copies/IntegrateTests.cs b/tests/Chronos.Data.Tests/Copies/IntegrateTests.cs
index e1c22541..52dddf9d 100644
--- a/tests/Chronos.Data.Tests/Copies/IntegrateTests.cs
+++ b/tests/Chronos.Data.Tests/Copies/IntegrateTests.cs
@@ -261,6 +261,58 @@ public sealed class IntegrateTests(TestContext context)
Assert.Contains(CopyBlock.NoDeleteRight, plan.Blocks);
}
+ [Test]
+ public async Task AnEditorMayNotTrashTheVersionOfASequenceSomeoneElseOwns()
+ {
+ await using var f = await FixtureAsync(context);
+ var local = await LocalAsync(f, "Comet", [(1, 0, "IMG_0001.JPG"), (4, 30_250, "IMG_0004.JPG")]);
+ var names = await NamesAsync(f, local.Id);
+ var remote = Remote(f, "Comet", [(1, 0, names[0]), (5, 30_250, names[1])]);
+ remote.OwnerUserId = Guid.NewGuid();
+ var pair = await PairAsync(f, local.Id, remote.Id);
+ var choices = await ChoicesAsync(f, local.Id, remote.Id, CopyPhotoPolicy.ThisPcWins);
+ // An Editor: the Delete right, but not the admin role, and the server sequence is someone else's.
+ var editor = PlanContext() with { OwnsOrAdmin = false, UserId = Guid.NewGuid() };
+
+ var plan = await Planner(f).PlanAsync(f.Remote, pair, choices, editor, f.Ct);
+
+ Assert.False(plan.Photos.Any(p => p.Action == PhotoAction.TrashThere), "no trash step on the server");
+ // It stays, out of the server's Main, which uses this PC's version instead.
+ Assert.Equal((1, 1, 1), (plan.LeftOut, plan.StaysForDelete, plan.ServerUsesOurs));
+ Assert.Contains(CopyBlock.NoDeleteRight, plan.Blocks);
+ Assert.False(plan.Destructive);
+
+ // The owner may: the same plan trashes the server's version, and the server uses this PC's.
+ var owner = editor with { UserId = remote.OwnerUserId };
+ var owned = await Planner(f).PlanAsync(f.Remote, pair, choices, owner, f.Ct);
+ Assert.Contains(owned.Photos, p => p.Action == PhotoAction.TrashThere);
+ Assert.Equal((0, 1), (owned.StaysForDelete, owned.ServerUsesOurs));
+
+ // Compare offers Delete on server only where the server would allow it.
+ var builder = new CopyReviewBuilder(f.Db, f.Archive.Service.Projects, new CopySides(f.Db));
+ Assert.False((await builder.BuildAsync(pair, f.Remote, editor, f.Ct)).Can.DeleteThere);
+ Assert.True((await builder.BuildAsync(pair, f.Remote, owner, f.Ct)).Can.DeleteThere);
+ }
+
+ [Test]
+ public async Task WithoutTheDeleteRightTheServersVersionStaysOutOfItsMainAndTheRestRuns()
+ {
+ await using var f = await FixtureAsync(context);
+ var (local, remote, pair) = await ScenarioAsync(f);
+ var choices = await ChoicesAsync(f, local.Id, remote.Id, CopyPhotoPolicy.ThisPcWins);
+
+ var plan = await Planner(f).PlanAsync(f.Remote, pair, choices, PlanContext(canDelete: false), f.Ct);
+
+ // The server's losing version stays (it needs the Delete right), but its Main uses this PC's version.
+ Assert.False(plan.Photos.Any(p => p.Action == PhotoAction.TrashThere), "no trash step on the server");
+ Assert.Equal((1, 1), (plan.StaysForDelete, plan.ServerUsesOurs));
+ var pending = ProjectSettings.FromJson(SyncRules.NormalizeSettings(Assert.NotNull(plan.Payload).SettingsJson)).PendingFrames ?? [];
+ Assert.Contains(pending, p => p.Sha256 == Sha(5, 30_250) && p.Excluded);
+ // Other steps remain: the plan runs, only the delete waits.
+ Assert.DoesNotContain(CopyBlock.NoDeleteRight, plan.Blocks);
+ Assert.True(plan.CanApply);
+ }
+
[Test]
public async Task UnionBringsEveryPhotoBothWaysAndIntegratesThePair()
{
@@ -476,6 +528,11 @@ public sealed class IntegrateTests(TestContext context)
var failed = await f.Archive.WaitForAsync(job.Id, JobState.Failed);
Assert.Equal(Loc.Plural("Errors.Copies.Kept", 1), failed.Error);
+ // The log says why in the UI language: "IMG_0004.JPG: older version kept, the server refused it (…)".
+ var log = Assert.NotNull(failed.LogTail);
+ Assert.Contains(Between(Loc.L("Archive.Log.CopyKept", "\u0001", "\u0002"), '\u0001', '\u0002'), log);
+ var refused = Loc.L("Archive.Log.KeptReason.Refused", "\u0001");
+ Assert.Contains(refused[..refused.IndexOf('\u0001', StringComparison.Ordinal)], log);
Assert.Contains(Sha(5, 30_250), RemoteHashes(remote));
Assert.Contains(Sha(4, 30_250), RemoteHashes(remote));
Assert.Contains(Sha(3, 20_000), await LocalHashesAsync(f, local.Id));
@@ -536,6 +593,39 @@ public sealed class IntegrateTests(TestContext context)
Assert.Equal(CopyState.Linked, (await f.Sync.Copies.GetAsync(pair.Id, f.Ct))!.State);
}
+ [Test]
+ public async Task AServerTitleEditMeanwhileOverAPlannedLineThisPcWinsStopsTheDetails()
+ {
+ await using var f = await FixtureAsync(context);
+ var (engine, handler) = Engine(f);
+ await using var _ = engine;
+ await engine.StartAsync(f.Ct);
+ var photos = f.NewPhotos(3);
+ var local = await f.LocalAsync("Comet", photos.Take(2).ToList(), SyncFixture.Window33);
+ var remote = f.Remote.Add("Comet NAS", [photos[0], photos[2]], SyncFixture.Window33);
+ var pair = await PairAsync(f, local.Id, remote.Id);
+ // The title differs and the user keeps this PC's; someone renames the server's while the photos travel.
+ handler.BeforeStage = stage =>
+ {
+ if (stage == IntegrateStage.Photos)
+ {
+ remote.Title = "Comet (night)";
+ remote.SettingsVersion++;
+ remote.UpdatedAt = DateTimeOffset.UtcNow;
+ }
+ return Task.CompletedTask;
+ };
+ var plan = await Planner(f).PlanAsync(f.Remote, pair, await ChoicesAsync(f, local.Id, remote.Id, CopyPhotoPolicy.Union), PlanContext(), f.Ct);
+
+ var job = await CopyJobs.EnqueueIntegrateAsync(engine, f.Sync.Copies, plan, local.DisplayTitle, f.Ct);
+ var failed = await f.Archive.WaitForAsync(job.Id, JobState.Failed);
+
+ // Not absorbed over the user's choice: the Details stage stops and neither title is overwritten.
+ Assert.Equal(Loc.L("Errors.Copies.DetailsChanged"), failed.Error);
+ Assert.Equal("Comet", (await f.Db.Sequences.GetAsync(local.Id, f.Ct))!.Title);
+ Assert.Equal("Comet (night)", remote.Title);
+ }
+
[Test]
public async Task ACancelledQueuedJobSetsThePairBack()
{
@@ -744,6 +834,13 @@ public sealed class IntegrateTests(TestContext context)
}
/// Waits until no job works on (the passes an Integrate queues after its photos).
+ /// The fixed text of a localized line between two placeholders' markers.
+ private static string Between(string text, char from, char to)
+ {
+ var start = text.IndexOf(from, StringComparison.Ordinal) + 1;
+ return text[start..text.IndexOf(to, start)];
+ }
+
private static async Task WaitIdleAsync(SyncFixture f, Guid sequenceId)
{
var until = DateTime.UtcNow.AddSeconds(30);
diff --git a/tests/visual/baselines/edit-picker-twins-dark.png b/tests/visual/baselines/edit-picker-twins-dark.png
new file mode 100644
index 00000000..3b47ca80
Binary files /dev/null and b/tests/visual/baselines/edit-picker-twins-dark.png differ
diff --git a/tests/visual/baselines/edit-picker-twins-light.png b/tests/visual/baselines/edit-picker-twins-light.png
new file mode 100644
index 00000000..89691a21
Binary files /dev/null and b/tests/visual/baselines/edit-picker-twins-light.png differ
diff --git a/tests/visual/baselines/library-copies-dark.png b/tests/visual/baselines/library-copies-dark.png
new file mode 100644
index 00000000..8e5235fc
Binary files /dev/null and b/tests/visual/baselines/library-copies-dark.png differ
diff --git a/tests/visual/baselines/library-copies-light.png b/tests/visual/baselines/library-copies-light.png
new file mode 100644
index 00000000..c92dfc68
Binary files /dev/null and b/tests/visual/baselines/library-copies-light.png differ
diff --git a/tests/visual/baselines/server-conflict-dark.png b/tests/visual/baselines/server-conflict-dark.png
index 22336ede..7271e152 100644
Binary files a/tests/visual/baselines/server-conflict-dark.png and b/tests/visual/baselines/server-conflict-dark.png differ
diff --git a/tests/visual/baselines/server-conflict-light.png b/tests/visual/baselines/server-conflict-light.png
index 354f6e7a..faa32a78 100644
Binary files a/tests/visual/baselines/server-conflict-light.png and b/tests/visual/baselines/server-conflict-light.png differ
diff --git a/tests/visual/baselines/server-copies-blocked-dark.png b/tests/visual/baselines/server-copies-blocked-dark.png
new file mode 100644
index 00000000..854d2d9b
Binary files /dev/null and b/tests/visual/baselines/server-copies-blocked-dark.png differ
diff --git a/tests/visual/baselines/server-copies-blocked-light.png b/tests/visual/baselines/server-copies-blocked-light.png
new file mode 100644
index 00000000..dcbff6ee
Binary files /dev/null and b/tests/visual/baselines/server-copies-blocked-light.png differ
diff --git a/tests/visual/baselines/server-copies-choose-dark.png b/tests/visual/baselines/server-copies-choose-dark.png
new file mode 100644
index 00000000..49fadfa3
Binary files /dev/null and b/tests/visual/baselines/server-copies-choose-dark.png differ
diff --git a/tests/visual/baselines/server-copies-choose-light.png b/tests/visual/baselines/server-copies-choose-light.png
new file mode 100644
index 00000000..cfc2df0f
Binary files /dev/null and b/tests/visual/baselines/server-copies-choose-light.png differ
diff --git a/tests/visual/baselines/server-copies-confirm-dark.png b/tests/visual/baselines/server-copies-confirm-dark.png
new file mode 100644
index 00000000..54a6b617
Binary files /dev/null and b/tests/visual/baselines/server-copies-confirm-dark.png differ
diff --git a/tests/visual/baselines/server-copies-confirm-light.png b/tests/visual/baselines/server-copies-confirm-light.png
new file mode 100644
index 00000000..8c4b533c
Binary files /dev/null and b/tests/visual/baselines/server-copies-confirm-light.png differ
diff --git a/tests/visual/baselines/server-copies-dark.png b/tests/visual/baselines/server-copies-dark.png
new file mode 100644
index 00000000..a13403f4
Binary files /dev/null and b/tests/visual/baselines/server-copies-dark.png differ
diff --git a/tests/visual/baselines/server-copies-details-dark.png b/tests/visual/baselines/server-copies-details-dark.png
new file mode 100644
index 00000000..0b0f0100
Binary files /dev/null and b/tests/visual/baselines/server-copies-details-dark.png differ
diff --git a/tests/visual/baselines/server-copies-details-light.png b/tests/visual/baselines/server-copies-details-light.png
new file mode 100644
index 00000000..cb87b684
Binary files /dev/null and b/tests/visual/baselines/server-copies-details-light.png differ
diff --git a/tests/visual/baselines/server-copies-empty-dark.png b/tests/visual/baselines/server-copies-empty-dark.png
new file mode 100644
index 00000000..f4a7d8eb
Binary files /dev/null and b/tests/visual/baselines/server-copies-empty-dark.png differ
diff --git a/tests/visual/baselines/server-copies-empty-light.png b/tests/visual/baselines/server-copies-empty-light.png
new file mode 100644
index 00000000..d34d9737
Binary files /dev/null and b/tests/visual/baselines/server-copies-empty-light.png differ
diff --git a/tests/visual/baselines/server-copies-gone-dark.png b/tests/visual/baselines/server-copies-gone-dark.png
new file mode 100644
index 00000000..3f991766
Binary files /dev/null and b/tests/visual/baselines/server-copies-gone-dark.png differ
diff --git a/tests/visual/baselines/server-copies-gone-light.png b/tests/visual/baselines/server-copies-gone-light.png
new file mode 100644
index 00000000..cda6fc55
Binary files /dev/null and b/tests/visual/baselines/server-copies-gone-light.png differ
diff --git a/tests/visual/baselines/server-copies-light.png b/tests/visual/baselines/server-copies-light.png
new file mode 100644
index 00000000..338b3363
Binary files /dev/null and b/tests/visual/baselines/server-copies-light.png differ
diff --git a/tests/visual/baselines/server-copies-merge-dark.png b/tests/visual/baselines/server-copies-merge-dark.png
new file mode 100644
index 00000000..4ad294c5
Binary files /dev/null and b/tests/visual/baselines/server-copies-merge-dark.png differ
diff --git a/tests/visual/baselines/server-copies-merge-light.png b/tests/visual/baselines/server-copies-merge-light.png
new file mode 100644
index 00000000..47884608
Binary files /dev/null and b/tests/visual/baselines/server-copies-merge-light.png differ
diff --git a/tests/visual/baselines/server-copies-photos-dark.png b/tests/visual/baselines/server-copies-photos-dark.png
new file mode 100644
index 00000000..ca4ff631
Binary files /dev/null and b/tests/visual/baselines/server-copies-photos-dark.png differ
diff --git a/tests/visual/baselines/server-copies-photos-light.png b/tests/visual/baselines/server-copies-photos-light.png
new file mode 100644
index 00000000..1aeaa337
Binary files /dev/null and b/tests/visual/baselines/server-copies-photos-light.png differ
diff --git a/tests/visual/baselines/server-copies-plan-dark.png b/tests/visual/baselines/server-copies-plan-dark.png
new file mode 100644
index 00000000..bc95ed37
Binary files /dev/null and b/tests/visual/baselines/server-copies-plan-dark.png differ
diff --git a/tests/visual/baselines/server-copies-plan-light.png b/tests/visual/baselines/server-copies-plan-light.png
new file mode 100644
index 00000000..98984bcf
Binary files /dev/null and b/tests/visual/baselines/server-copies-plan-light.png differ
diff --git a/tests/visual/baselines/server-copies-projects-dark.png b/tests/visual/baselines/server-copies-projects-dark.png
new file mode 100644
index 00000000..f3521b15
Binary files /dev/null and b/tests/visual/baselines/server-copies-projects-dark.png differ
diff --git a/tests/visual/baselines/server-copies-projects-light.png b/tests/visual/baselines/server-copies-projects-light.png
new file mode 100644
index 00000000..9364bf70
Binary files /dev/null and b/tests/visual/baselines/server-copies-projects-light.png differ
diff --git a/tests/visual/baselines/server-copies-replace-confirm-dark.png b/tests/visual/baselines/server-copies-replace-confirm-dark.png
new file mode 100644
index 00000000..93d1879e
Binary files /dev/null and b/tests/visual/baselines/server-copies-replace-confirm-dark.png differ
diff --git a/tests/visual/baselines/server-copies-replace-confirm-light.png b/tests/visual/baselines/server-copies-replace-confirm-light.png
new file mode 100644
index 00000000..15895da2
Binary files /dev/null and b/tests/visual/baselines/server-copies-replace-confirm-light.png differ
diff --git a/tests/visual/baselines/server-copies-review-dark.png b/tests/visual/baselines/server-copies-review-dark.png
new file mode 100644
index 00000000..f6287f34
Binary files /dev/null and b/tests/visual/baselines/server-copies-review-dark.png differ
diff --git a/tests/visual/baselines/server-copies-review-light.png b/tests/visual/baselines/server-copies-review-light.png
new file mode 100644
index 00000000..c9bcc883
Binary files /dev/null and b/tests/visual/baselines/server-copies-review-light.png differ
diff --git a/tests/visual/baselines/server-copies-signedout-dark.png b/tests/visual/baselines/server-copies-signedout-dark.png
new file mode 100644
index 00000000..74fff342
Binary files /dev/null and b/tests/visual/baselines/server-copies-signedout-dark.png differ
diff --git a/tests/visual/baselines/server-copies-signedout-light.png b/tests/visual/baselines/server-copies-signedout-light.png
new file mode 100644
index 00000000..72d1ef05
Binary files /dev/null and b/tests/visual/baselines/server-copies-signedout-light.png differ
diff --git a/tests/visual/baselines/server-copies-toast-dark.png b/tests/visual/baselines/server-copies-toast-dark.png
new file mode 100644
index 00000000..df3cd983
Binary files /dev/null and b/tests/visual/baselines/server-copies-toast-dark.png differ
diff --git a/tests/visual/baselines/server-copies-toast-light.png b/tests/visual/baselines/server-copies-toast-light.png
new file mode 100644
index 00000000..ae114be7
Binary files /dev/null and b/tests/visual/baselines/server-copies-toast-light.png differ
diff --git a/tests/visual/baselines/server-copies-versions-dark.png b/tests/visual/baselines/server-copies-versions-dark.png
new file mode 100644
index 00000000..eff85e4b
Binary files /dev/null and b/tests/visual/baselines/server-copies-versions-dark.png differ
diff --git a/tests/visual/baselines/server-copies-versions-light.png b/tests/visual/baselines/server-copies-versions-light.png
new file mode 100644
index 00000000..ccdd268c
Binary files /dev/null and b/tests/visual/baselines/server-copies-versions-light.png differ
diff --git a/tests/visual/baselines/server-dark.png b/tests/visual/baselines/server-dark.png
index 762266d0..14cffdd2 100644
Binary files a/tests/visual/baselines/server-dark.png and b/tests/visual/baselines/server-dark.png differ
diff --git a/tests/visual/baselines/server-jobs-dark.png b/tests/visual/baselines/server-jobs-dark.png
index 0ad010b0..aa3c21e6 100644
Binary files a/tests/visual/baselines/server-jobs-dark.png and b/tests/visual/baselines/server-jobs-dark.png differ
diff --git a/tests/visual/baselines/server-jobs-light.png b/tests/visual/baselines/server-jobs-light.png
index 5a05864a..f5b966af 100644
Binary files a/tests/visual/baselines/server-jobs-light.png and b/tests/visual/baselines/server-jobs-light.png differ
diff --git a/tests/visual/baselines/server-light.png b/tests/visual/baselines/server-light.png
index 7b11203a..6db37d21 100644
Binary files a/tests/visual/baselines/server-light.png and b/tests/visual/baselines/server-light.png differ
diff --git a/tests/visual/baselines/server-share-dark.png b/tests/visual/baselines/server-share-dark.png
index 0b612bba..01b1cc06 100644
Binary files a/tests/visual/baselines/server-share-dark.png and b/tests/visual/baselines/server-share-dark.png differ
diff --git a/tests/visual/baselines/server-share-failed-dark.png b/tests/visual/baselines/server-share-failed-dark.png
index cad826fc..421843b6 100644
Binary files a/tests/visual/baselines/server-share-failed-dark.png and b/tests/visual/baselines/server-share-failed-dark.png differ
diff --git a/tests/visual/baselines/server-share-failed-light.png b/tests/visual/baselines/server-share-failed-light.png
index 31169521..8ff0e81c 100644
Binary files a/tests/visual/baselines/server-share-failed-light.png and b/tests/visual/baselines/server-share-failed-light.png differ
diff --git a/tests/visual/baselines/server-share-light.png b/tests/visual/baselines/server-share-light.png
index fdd6fbbd..c98d7482 100644
Binary files a/tests/visual/baselines/server-share-light.png and b/tests/visual/baselines/server-share-light.png differ
diff --git a/tests/visual/baselines/server-sync-copyfound-dark.png b/tests/visual/baselines/server-sync-copyfound-dark.png
new file mode 100644
index 00000000..7f977fde
Binary files /dev/null and b/tests/visual/baselines/server-sync-copyfound-dark.png differ
diff --git a/tests/visual/baselines/server-sync-copyfound-light.png b/tests/visual/baselines/server-sync-copyfound-light.png
new file mode 100644
index 00000000..76133474
Binary files /dev/null and b/tests/visual/baselines/server-sync-copyfound-light.png differ
diff --git a/tests/visual/baselines/server-sync-dark.png b/tests/visual/baselines/server-sync-dark.png
index 1c45d8e3..f511a62e 100644
Binary files a/tests/visual/baselines/server-sync-dark.png and b/tests/visual/baselines/server-sync-dark.png differ
diff --git a/tests/visual/baselines/server-sync-light.png b/tests/visual/baselines/server-sync-light.png
index 4c8307c7..657872f8 100644
Binary files a/tests/visual/baselines/server-sync-light.png and b/tests/visual/baselines/server-sync-light.png differ
diff --git a/tests/visual/baselines/settings-about-dark.png b/tests/visual/baselines/settings-about-dark.png
index 1fe6af60..8948957f 100644
Binary files a/tests/visual/baselines/settings-about-dark.png and b/tests/visual/baselines/settings-about-dark.png differ
diff --git a/tests/visual/baselines/settings-about-light.png b/tests/visual/baselines/settings-about-light.png
index 3ac4beb9..5ad094b5 100644
Binary files a/tests/visual/baselines/settings-about-light.png and b/tests/visual/baselines/settings-about-light.png differ
diff --git a/tests/visual/baselines/settings-rendering-dark.png b/tests/visual/baselines/settings-rendering-dark.png
index 91726a18..4a20c44c 100644
Binary files a/tests/visual/baselines/settings-rendering-dark.png and b/tests/visual/baselines/settings-rendering-dark.png differ
diff --git a/tests/visual/baselines/settings-rendering-light.png b/tests/visual/baselines/settings-rendering-light.png
index 795d2faf..6478b3ba 100644
Binary files a/tests/visual/baselines/settings-rendering-light.png and b/tests/visual/baselines/settings-rendering-light.png differ
diff --git a/tests/visual/baselines/settings-server-dark.png b/tests/visual/baselines/settings-server-dark.png
index 51316f2e..2c037ce3 100644
Binary files a/tests/visual/baselines/settings-server-dark.png and b/tests/visual/baselines/settings-server-dark.png differ
diff --git a/tests/visual/baselines/settings-server-light.png b/tests/visual/baselines/settings-server-light.png
index d4c0b75b..a6c68eda 100644
Binary files a/tests/visual/baselines/settings-server-light.png and b/tests/visual/baselines/settings-server-light.png differ