fix(copies): close the tenth verification round of owner review 6
- A merge verify that finds a hashed photo the plan did not copy (held by a third sequence when planned) held by nothing now drops its journal and fails as a stale plan, so the retry plans again and lists the photo as a last copy instead of failing with "did not match after copying" forever. - A comparison settles no details of a pair being integrated, and the Integrate's Details stage refuses a line decided as the server's whose server value is now this PC's own, so a background push or pull no longer reverses the user's line-by-line choice (owner Q4). - A 404 for a server sequence no local copy is linked to deletes only its Candidate pairs; a Kept apart answer counts the hit as a linked pair does (two 404s GoneRecheck apart), so a moment's 404 neither re-asks nor auto-links a pair the user kept separate (owner Q1). Upload all local sends the local sequence once the deletion is confirmed. - Download originals into a local copy the server key names and that is paired with the server sequence links it first and fills it as a linked copy: its tombstones hold and its details are compared, not overwritten. - An upload of a sequence with a Candidate pair goes under a key of the job, and one that joins a server sequence this PC already knows compares its details instead of sending them all over the server's. Refs #73 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c1c02d8ef7
commit
e002c583d6
12 files changed
+383
-34
No files matched your search
@@ -1093,6 +1093,43 @@ public abstract class SequenceMergerTests(TestContext context) : DatabaseTest(co
|
||||
Assert.Contains(again.LastCopies, l => l.Key == Sha(5, 30_250));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task APhotoHeldByAThirdSequenceThatIsGoneByTheVerifyMakesTheRetryPlanAgain()
|
||||
{
|
||||
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.Verify) 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);
|
||||
|
||||
// A last copy the plan did not list, not a failed copy: the journal goes and nothing goes to the trash.
|
||||
Assert.Equal(Chronos.Core.Localization.Loc.L("Errors.Copies.StalePlan"), failed.Error);
|
||||
Assert.Contains(Sha(5, 30_250), await HashesAsync(fx, drop.Id));
|
||||
Assert.False(File.Exists(MergeJournal.PathFor(fx.Paths, job.Id)), "the next run plans again");
|
||||
|
||||
// The Retry asks for a new comparison instead of the same verify error, and the new plan lists the photo.
|
||||
handler.BeforeStage = null;
|
||||
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));
|
||||
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