fix(copies): close the sixth verification round of owner review 6

A merge that finds the other changed drops its journal so the retry plans
again. Unlink and Keep apart name the local side and leave a link that now
joins another sequence alone; Link only and the Integrate job refuse to
touch a link or a pair another integration holds. A sweep of 404s asks the
server once. To trash... trashes from the kept sequence after a swap and
every trash re-checks for new last copies. The Compare dialog and Settings
choices fit in every language, Details segments say which value they take,
twins need their sibling at the other home, and a linked row keeps three
buttons. Captures updated for the dialog and Settings scenes.

Refs #73

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-17 21:58:58 +01:00
1 parent bf7701d279
commit 38764972ad
77 files changed
+965 -123

No files matched your search

@@ -687,6 +687,47 @@ public abstract class SequenceMergerTests(TestContext context) : DatabaseTest(co
}
}
[Test]
public async Task AFrameRemovedFromTheOtherAfterAStoppedTrashMakesTheNextRetryPlanAgain()
{
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 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"), (3, 20_000, "IMG_0003.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, new FoundCopyStore(fx.Db), plan, keep.DisplayTitle, Ct);
await fx.WaitForAsync(job.Id, JobState.Failed);
Assert.True(File.Exists(MergeJournal.PathFor(fx.Paths, job.Id)), "an unsent workspace keeps the journal");
// A frame of the other goes to the trash while the merge waits: its frames version never goes back.
var gone = (await fx.Db.Frames.ListBySequenceAsync(drop.Id)).First(f => f.Sha256 == Sha(3, 20_000));
var trash = await fx.Service.FrameTrash.PlanDeleteAsync(drop.Id, [gone.Id], null, fx.Ct, job.Id);
await fx.Service.FrameTrash.DeleteAsync(trash, null, null, fx.Ct, job.Id);
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");
// The next Retry plans again and asks for a new comparison instead of the same error.
await engine.ResumeAsync(job.Id, Ct);
failed = await fx.WaitForAsync(job.Id, JobState.Failed);
Assert.Equal(Chronos.Core.Localization.Loc.L("Errors.Copies.StalePlan"), failed.Error);
Assert.NotNull(await fx.Db.Sequences.GetAsync(drop.Id));
}
[Test]
public async Task APhotoSettledThroughAThirdSequenceThatIsGoneByTheTrashKeepsTheOther()
{