fix(copies): close the owner review 6 verification findings
A merge could still trash photos it never verified, resume against a pair the user had answered meanwhile, and take different unhashed photos for copies; the dialog and the lists worded several facts wrongly or lost them on refresh. - Merge: a retry resumes only while the pair is still the job's; Verify requires the other archive online and its folder in place, stops on an unreadable photo, files a differing unhashed photo as a second version and must cover every frame before Trash; the plan hashes unmatched unhashed photos first, lists "Deleted in the other" and names the relinked servers; second versions stay discoverable (CopySides.VersionsAsync). - Integrate: a retry after a failure before the journal runs again. - Sync: a sequence back after a 404 stays Linked while its link holds; a local cull no longer asks for attention. - Block lines of both planners name the right sequence, archive, server and space through one formatter. - Compare dialog: one Details row per setting with worded values, Projects headings, Choose focuses the kept-sequence radios, the photo selection reaches rows outside the viewport, the Replace confirmation lists the losers per side, plan lines read as queued. - Matches and Library: counts first and grouped, integrating shown as a share, local matches name the other archive, the Library keeps its match and "deleted on server" statuses across a refresh. Refs #73 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d10577b175
commit
b34b6b6fe0
41 files changed
+1046
-193
No files matched your search
@@ -5,6 +5,9 @@ using Chronos.Protocol;
|
||||
|
||||
namespace Chronos.Data.Copies;
|
||||
|
||||
/// <summary>One photo a sequence keeps in two versions: each version's frame, file name and SHA-256.</summary>
|
||||
public sealed record PhotoVersions(Guid FirstFrameId, string FirstFileName, string FirstSha256, Guid SecondFrameId, string SecondFileName, string SecondSha256);
|
||||
|
||||
/// <summary>
|
||||
/// The two sides of a comparison as <see cref="CopyComparer"/> reads them (owner review 6, #73; design §4.2): a local
|
||||
/// sequence's frames and tombstones, a server sequence's manifest with its frames' capture times, and the last-copy check
|
||||
@@ -48,6 +51,27 @@ public sealed class CopySides(ChronosDatabase db)
|
||||
manifest.Removed ?? []);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The photos one sequence keeps in two versions (owner Q3, design §4.1 Versions): a sub-second capture instant holding
|
||||
/// exactly two usable, hashed frames of different content, as a Union merge or Integrate leaves them. Read from the
|
||||
/// frames themselves, so they stay listed after the pair that made them is gone; each pair once, in index order.
|
||||
/// </summary>
|
||||
public async Task<IReadOnlyList<PhotoVersions>> VersionsAsync(Guid sequenceId, CancellationToken ct)
|
||||
{
|
||||
var frames = await Processing.SequenceFrames.ListAsync(_db, sequenceId, ct).ConfigureAwait(false);
|
||||
var result = new List<PhotoVersions>();
|
||||
foreach (var group in frames.Where(f => (f.Flags & UnusableFlags) == 0 && f.Sha256 is { Length: > 0 } && f.CapturedAt is not null)
|
||||
.GroupBy(f => CopyComparer.Millisecond(f.CapturedAt!.Value)))
|
||||
{
|
||||
if (group.Key % 1000 == 0) continue;
|
||||
var versions = group.DistinctBy(f => f.Sha256!.ToLowerInvariant(), StringComparer.Ordinal).OrderBy(f => f.Index).ToList();
|
||||
if (versions.Count != 2 || group.Count() != 2) continue;
|
||||
result.Add(new PhotoVersions(versions[0].Id, versions[0].FileName, versions[0].Sha256!.ToLowerInvariant(),
|
||||
versions[1].Id, versions[1].FileName, versions[1].Sha256!.ToLowerInvariant()));
|
||||
}
|
||||
return [.. result.OrderBy(v => frames.First(f => f.Id == v.FirstFrameId).Index)];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The raw SHA-256 (lower-case) of <paramref name="sha256"/> that a usable frame (not Missing or Corrupt) of any sequence
|
||||
/// of this index other than <paramref name="except"/> holds: what is not the last copy of its photo. Batched.
|
||||
|
||||
Reference in new issue
Block a user