fix(copies): close the owner review 6 second verification findings
Upload again now deletes the gone pair row once the new sequence is linked, so the pair stops reading "deleted on server" or "kept here". A linked upload the server refuses into its sequence (403 for an account without Edit that does not own it) falls back to ordinary uploads instead of failing; an Integrate that would add photos to such a sequence is blocked in its plan (NoAddRight). Automatic photo transfers pause on a metered connection whatever the option says. Integrate trashes server photos only against the manifest version that checked the winner, and a merge is blocked while the other sequence holds a damaged photo nothing else holds (DamagedPhotos), so nothing unverified reaches the trash. The plan and the confirmations now say what really happens: replaced versions are no longer counted as kept, a merge lists the kept sequence's replaced photos, plan lines use the text colour, an integrated pair that left photos out says new photos move by hand, and a merging pair reads "merging" with its progress. The Compare dialog gets per-side tooltips, class sizes for both sides, policy-aware class tooltips, column headings and readable file names; the sync table shows "deleted there" with Review and warns on skipped rows; the Edit picker names the server, the Library card shows the match status second, a deleted server sequence is named instead of "0 photos", and the match tooltips stop calling a sequence a copy. The capture scenes use the server name, the link names and consistent sample sizes. Refs #73 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b34b6b6fe0
commit
9657c1711d
44 files changed
+802
-128
No files matched your search
@@ -353,11 +353,13 @@ public sealed class CopyEngineTests(TestContext context)
|
||||
];
|
||||
using var engine = new CopyEngine(f.Sync, f.Archive.Service, new IntegratePlanner(f.Sync, sides, f.Archive.Service.Projects),
|
||||
new SequenceMerger(f.Db, f.Archive.Service, sides), new CopyReviewBuilder(f.Db, f.Archive.Service.Projects, sides), _ => Context,
|
||||
workspaceProjects: _ => Task.FromResult(projects));
|
||||
serverNames: key => key == f.Server ? "Studio NAS" : null, workspaceProjects: _ => Task.FromResult(projects));
|
||||
|
||||
var twin = (await engine.TwinsAsync(f.Ct)).Single();
|
||||
|
||||
Assert.Equal((pair.Id, linked.Id, "Grade", linkedRemote.Id, "Grade NAS"), (twin.CopyId, twin.LocalId, twin.LocalProject, twin.RemoteId, twin.ServerProject));
|
||||
Assert.Equal(f.Server, twin.Server);
|
||||
// The Edit picker shows the server by its name, never by its key.
|
||||
Assert.Equal("Studio NAS", twin.ServerName);
|
||||
}
|
||||
}
|
||||
@@ -199,6 +199,35 @@ public abstract class FoundCopyStoreTests(TestContext context) : RepositoryTest(
|
||||
Assert.Count(4, await store.ListAsync(Ct));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task UploadAgainDeletesTheGoneRowLinkedOrKeptHere()
|
||||
{
|
||||
var (db, _, s) = await SetupAsync(2);
|
||||
var store = new FoundCopyStore(db);
|
||||
foreach (var (sequence, keptHere) in new[] { (s[0], false), (s[1], true) })
|
||||
{
|
||||
var (gone, fresh) = (Guid.CreateVersion7(), Guid.CreateVersion7());
|
||||
var linked = await store.EnsureLinkedAsync(Nas, gone, sequence.Id, Ct);
|
||||
// A refresh's 404 forgets the link (hit 1); the recheck counts the second.
|
||||
await store.MarkRemoteGoneAsync(Nas, gone, sequence.Id, Guid.NewGuid(), TestData.Now, Ct);
|
||||
await store.MarkRemoteGoneAsync(Nas, gone, sequence.Id, Guid.NewGuid(), TestData.Now.AddHours(1), Ct);
|
||||
if (keptHere) Assert.True(await store.SetStateAsync(linked.Id, null, CopyState.KeptApart, Answer(), Ct));
|
||||
Assert.True((await store.GetAsync(linked.Id, Ct))!.RemoteGone);
|
||||
|
||||
// Upload again: the first original creates a new server sequence and the link points at it.
|
||||
var uploaded = await store.EnsureLinkedAsync(Nas, fresh, sequence.Id, Ct);
|
||||
|
||||
Assert.Null(await store.GetAsync(linked.Id, Ct));
|
||||
var left = await store.ListByLocalAsync(sequence.Id, Ct);
|
||||
Assert.Equal((uploaded.Id, CopyState.Linked, (Guid?)fresh, 0), (left.Single().Id, left.Single().State, left.Single().RemoteId, left.Single().RemoteGoneHits));
|
||||
// Upload all local no longer reads it as deleted on the server.
|
||||
var entry = new SyncEntry(sequence, null, SyncStatus.LocalOnly);
|
||||
var (upload, skipped) = UploadAllRule.Select([entry], left, new HashSet<Guid>(), new HashSet<Guid>());
|
||||
Assert.Empty(skipped);
|
||||
Assert.Count(1, upload);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task A404CountsOncePerRefreshAndDeletesTheCandidatesOfThatRemote()
|
||||
{
|
||||
|
||||
@@ -221,6 +221,14 @@ public sealed class IntegrateTests(TestContext context)
|
||||
plan = await planner.PlanAsync(f.Remote, pair, choices, PlanContext(canUpload: false, canFetch: false), f.Ct);
|
||||
Assert.Contains(CopyBlock.NoUploadRight, plan.Blocks);
|
||||
Assert.Contains(CopyBlock.NoFetchRight, plan.Blocks);
|
||||
// Photos sent into a server sequence the account neither owns nor may edit: the server would refuse them (403).
|
||||
var readUpload = PlanContext(canDelete: false) with { CanEdit = false, UserId = Guid.NewGuid() };
|
||||
Assert.Contains(CopyBlock.NoAddRight, (await planner.PlanAsync(f.Remote, pair, choices, readUpload, f.Ct)).Blocks);
|
||||
Assert.Equal(Loc.L("Errors.Copies.NoAddRight"), IntegratePlanner.BlockText(plan, CopyBlock.NoAddRight, "Comet", "NAS"));
|
||||
remote.OwnerUserId = readUpload.UserId;
|
||||
Assert.DoesNotContain(CopyBlock.NoAddRight, (await planner.PlanAsync(f.Remote, pair, choices, readUpload, f.Ct)).Blocks);
|
||||
Assert.DoesNotContain(CopyBlock.NoAddRight, (await planner.PlanAsync(f.Remote, pair, choices, PlanContext(canDelete: false), f.Ct)).Blocks);
|
||||
remote.OwnerUserId = null;
|
||||
|
||||
// A detail without a side.
|
||||
plan = await planner.PlanAsync(f.Remote, pair, choices with { Details = new Dictionary<string, CopySide>() }, PlanContext(), f.Ct);
|
||||
@@ -433,6 +441,26 @@ public sealed class IntegrateTests(TestContext context)
|
||||
Assert.DoesNotContain(Sha(5, 30_250), await LocalHashesAsync(f, local.Id));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AServerSequenceChangedAfterTheWinnerCheckKeepsItsLoser()
|
||||
{
|
||||
await using var f = await FixtureAsync(context);
|
||||
var (engine, _) = Engine(f);
|
||||
await using var _ = engine;
|
||||
await engine.StartAsync(f.Ct);
|
||||
var (local, remote, pair) = await ScenarioAsync(f);
|
||||
var plan = await Planner(f).PlanAsync(f.Remote, pair, await ChoicesAsync(f, local.Id, remote.Id, CopyPhotoPolicy.ThisPcWins), PlanContext(), f.Ct);
|
||||
// Another client changes the server sequence after the job read the manifest that showed the winner in place.
|
||||
f.Remote.OnceBeforeDelete = () => remote.FramesVersion++;
|
||||
|
||||
var job = await CopyJobs.EnqueueIntegrateAsync(engine, f.Sync.Copies, plan, local.DisplayTitle, f.Ct);
|
||||
var failed = await f.Archive.WaitForAsync(job.Id, JobState.Failed);
|
||||
|
||||
Assert.Equal(Loc.Plural("Errors.Copies.Kept", 1), failed.Error);
|
||||
Assert.Empty(f.Remote.Trashed);
|
||||
Assert.Contains(Sha(5, 30_250), RemoteHashes(remote));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AServerRefusalKeepsItsLoserAndTheRestIsDone()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user