fix(copies): close the third verification round and add the match baselines
Integrate trashes a server photo only for the sequence's owner or an admin, a Details stage stops instead of overwriting a server change the user had kept this PC's value against, a merge retried after a stop plans again when work reached the other sequence, detection keeps pairs answered while it ran, and a sync row whose match the server deleted offers Keep here, Upload again and To trash. The Integrate and merge logs say in the UI language why a version was kept. The edit-picker-twins capture scene showed no Twin chip, since a capture has no workspace: it now lists sample workspace projects of the sample matches. The screenshot baselines gain the 38 Matches screens and take the Matches chip, the three Settings > Server rows, the longer priority list and 1.2.0. Refs #73 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3e6110d329
commit
3c99badcfe
96 files changed
+910
-147
No files matched your search
@@ -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<Sequence, Task>[] 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()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user