fix(copies): close the fourth verification round of owner review 6
The fourth verification round of the matches work found 18 defects in the merge, Integrate and Matches surfaces. This commit fixes them: - An Integrate job now carries the planning account's id, so its re-plan decides ownership the way the dialog did. - A merge skips only a project the kept sequence holds a real copy of (name, offset head and history content) and re-points its renders to that copy. - A merge runs its trash checks before the Links stage and records an undo, so an abandoned merge gives the other sequence back its link, session keys and pairs. - The metered hold adopts automatic transfers that were paused before a restart. - Apply in the Compare dialog re-plans when the plan is pending or stale. - The Library's Two versions... lists the second versions a Union merge leaves, each with Drop... (dry run, confirmation, verified partner). A merge job's Open shows that list. - The merge's typed confirmation is the invariant count, and the prompt names it in all 38 languages. - Italian text uses Principale and Gemello. The Main project is named through WorkspaceText in the Projects part and in the twin tooltip. - The session keys tooltip is split into two keys, and To trash... and Delete on server... say why they are disabled. - The capture restores the editor account before the Matches scenes. - Upload again follows SyncHost.CanSendSync (Upload with Edit). - Matches rows trim archive names in the middle on a rebalanced grid; the Projects part rows trim, with the full text in the tooltip. - The sample project targets use ProjectTransplant.FreeName. DECISIONS, CHANGELOG, STATUS 8.7, the request doc and the 16 changed capture baselines are updated. Refs #73 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No files matched your search
@@ -141,7 +141,8 @@ public sealed class CopyScreenSmokeTests
|
||||
var request = merge.MergeRequest(plan);
|
||||
Assert.True(request.IsDestructive);
|
||||
var dropped = list.Pairs.Single(p => p.Here.Title == CopyScenes.Alps) is var alps && plan.KeepId == alps.Copy.LocalId ? alps.There : alps.Here;
|
||||
Assert.Equal(dropped.Photos.ToString(Loc.Culture), request.TypedConfirmation);
|
||||
Assert.Equal(dropped.Photos.ToString(System.Globalization.CultureInfo.InvariantCulture), request.TypedConfirmation);
|
||||
Assert.Contains(request.TypedConfirmation!, request.TypedPrompt!);
|
||||
await app.ExpectAsync<ServerView>("server-copies-merge");
|
||||
|
||||
// Choose on "choose the sequence to keep" takes the keyboard to the first Kept radio of the Plan part.
|
||||
@@ -215,6 +216,16 @@ public sealed class CopyScreenSmokeTests
|
||||
item = Assert.Contains(shell.Library.Items, i => i.HasMatch && i.Title == CopyScenes.Alps);
|
||||
Assert.NotNull(item.MatchStatus);
|
||||
await app.ExpectAsync<LibraryView>("library-copies", waitForThumbnails: true);
|
||||
|
||||
// Two versions… lists the photos the sequence keeps in two versions (a Union merge's), here none, and says so.
|
||||
Assert.True(shell.Library.VersionsItemCommand.CanExecute(item));
|
||||
await shell.Library.ShowVersionsAsync(item.Id);
|
||||
var versions = Assert.NotNull(shell.Library.Dialog as VersionsDialogViewModel);
|
||||
Assert.True(versions.IsEmpty && !versions.HasRows);
|
||||
Assert.Contains(CopyScenes.Alps, versions.Heading);
|
||||
versions.CloseCommand.Execute(null);
|
||||
Assert.Null(shell.Library.Dialog);
|
||||
|
||||
shell.Library.CompareItemCommand.Execute(item);
|
||||
Assert.Equal(SectionKey.Server, shell.Current.Key);
|
||||
Assert.True(shell.Server.Sync.IsMatches);
|
||||
|
||||
@@ -408,6 +408,52 @@ public sealed class CopyTextTests
|
||||
Assert.Equal(0, CopyDialogViewModel.KeptVersions(steps, PhotoAction.FetchVersion, PhotoAction.TrashHere));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheMergesTypedConfirmationIsTheCountWithoutSeparatorsAndThePromptNamesIt()
|
||||
{
|
||||
// 1,204 photos: what to type has no group separator in any language ("1.204" in Italian), and the prompt says it.
|
||||
foreach (var culture in new[] { "en", "it", "de", "hu" })
|
||||
{
|
||||
Loc.SetCulture(CultureInfo.GetCultureInfo(culture));
|
||||
try
|
||||
{
|
||||
Assert.Equal("1204", CopyDialogViewModel.MergeTyped(1_204));
|
||||
var prompt = CopyDialogViewModel.MergeTypedPrompt(1_204, "Alps 2026");
|
||||
Assert.Contains("1204", prompt);
|
||||
Assert.Contains("Alps 2026", prompt);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheSessionKeysTooltipNamesTheKeysThatStayOnlyWhenThereAreAny()
|
||||
{
|
||||
Assert.Equal(Loc.L("Tooltips.Server.Copies.Plan.SessionKeys"), CopyDialogViewModel.SessionKeysToolTip([]));
|
||||
var kept = CopyDialogViewModel.SessionKeysToolTip(["card:A1", "folder:B2"]);
|
||||
Assert.False(kept.Contains("{0}", StringComparison.Ordinal), "no placeholder is left in the text");
|
||||
Assert.Contains("card:A1", kept);
|
||||
Assert.Contains("folder:B2", kept);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AMatchRowTrimsALongArchiveNameInItsMiddleAndItsTooltipSaysItWhole()
|
||||
{
|
||||
Assert.Equal("Main archive", CopyText.MiddleTrim("Main archive", CopyText.RowNameLength));
|
||||
var name = "ChronosArchive-Photos-2026-Studio NAS backup";
|
||||
var trimmed = CopyText.MiddleTrim(name, CopyText.RowNameLength);
|
||||
Assert.LessOrEqual(trimmed.Length, CopyText.RowNameLength);
|
||||
Assert.True(trimmed.StartsWith("ChronosArch", StringComparison.Ordinal) && trimmed.EndsWith("NAS backup", StringComparison.Ordinal), trimmed);
|
||||
Assert.Contains("…", trimmed);
|
||||
|
||||
var facts = Facts("Lighthouse", name, 1_204);
|
||||
Assert.Contains(trimmed, CopyText.Where(facts, isServer: false, maxName: CopyText.RowNameLength));
|
||||
Assert.Contains(name, CopyText.Where(facts, isServer: false));
|
||||
}
|
||||
|
||||
private static (StatusKind, string) Head((StatusKind Kind, string Text, string ToolTip) state) => (state.Kind, state.Text);
|
||||
|
||||
private static FoundCopy Copy(CopyState state, CopyKind kind = CopyKind.LocalServer, int deletedThere = 0, bool gone = false) => new()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.IO;
|
||||
using Chronos.App.Server;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data.Archiving.Jobs;
|
||||
@@ -74,6 +75,45 @@ public sealed class UploadHoldTests
|
||||
Assert.True(UploadHold.HeldNow(Of(JobKind.UploadCommit, $$"""{"server":"{{Server}}","automatic":true}"""), metered: true, optionOn: false));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AnAutomaticTransferPausedBeforeARestartResumesOnceTheConnectionIsNotMetered()
|
||||
{
|
||||
var folder = Path.Combine(Path.GetTempPath(), "chronos-hold-" + Guid.NewGuid().ToString("N"));
|
||||
Directory.CreateDirectory(folder);
|
||||
try
|
||||
{
|
||||
await using var db = await Chronos.Data.ChronosDatabase.OpenAsync(Chronos.Data.DatabaseOptions.Sqlite(Path.Combine(folder, "index.db")));
|
||||
var automatic = Of(JobKind.Download, $$"""{"server":"{{Server}}","mode":"Originals","automatic":true}""");
|
||||
var manual = Of(JobKind.Download, $$"""{"server":"{{Server}}","mode":"Originals"}""");
|
||||
foreach (var job in new[] { automatic, manual })
|
||||
{
|
||||
await db.Jobs.EnqueueAsync(job);
|
||||
await db.Jobs.SetStateAsync(job.Id, JobState.Paused, null);
|
||||
}
|
||||
await using var engine = new Chronos.Data.Jobs.JobEngine(db, [], new Chronos.Data.Jobs.JobEngineOptions { Workers = 1, WorkerId = "test" });
|
||||
// A new hold after a restart: it paused the automatic one before, and its record of that is gone.
|
||||
using var hold = new UploadHold(() => db, () => false, () => false);
|
||||
hold.Attach(engine);
|
||||
await hold.ApplyAsync();
|
||||
|
||||
Assert.Equal(JobState.Queued, (await db.Jobs.GetAsync(automatic.Id))!.State);
|
||||
// A transfer the user started and paused stays paused: its pause may be the user's.
|
||||
Assert.Equal(JobState.Paused, (await db.Jobs.GetAsync(manual.Id))!.State);
|
||||
Assert.True(UploadHold.Adopts(automatic with { State = JobState.Paused }));
|
||||
Assert.False(UploadHold.Adopts(manual with { State = JobState.Paused }));
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
Directory.Delete(folder, recursive: true);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TransfersWithThisPcsLibraryAndOtherJobsAreNot()
|
||||
{
|
||||
|
||||
@@ -855,6 +855,107 @@ public abstract class SequenceMergerTests(TestContext context) : DatabaseTest(co
|
||||
Assert.Null(await fx.Db.Sequences.GetAsync(drop.Id));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AMergeAbandonedAtTheTrashGivesTheOtherBackItsLinkAndSessionKeys()
|
||||
{
|
||||
var fx = await FixtureAsync();
|
||||
var s = await ScenarioAsync(fx, 0);
|
||||
var merger = Merger(fx);
|
||||
var (engine, handler) = Engine(fx, merger, new FakeProjects(), new FakeWorkspace());
|
||||
await engine.StartAsync(Ct);
|
||||
// Details saved into the other after the links stage: the trash abandons the merge.
|
||||
handler.BeforeStage = stage => stage == MergeStage.Trash ? fx.Db.Sequences.SetTagsAsync(s.Drop.Id, ["edited"], Ct) : Task.CompletedTask;
|
||||
var plan = await merger.PlanAsync(s.Copy.Id, s.Keep.Id, s.Drop.Id, s.Choices, NoContext, Ct);
|
||||
var job = await merger.EnqueueAsync(engine, new FoundCopyStore(fx.Db), plan, s.Keep.DisplayTitle, Ct);
|
||||
var failed = await fx.WaitForAsync(job.Id, JobState.Failed);
|
||||
|
||||
Assert.Equal(Chronos.Core.Localization.Loc.L("Errors.Copies.Changed", s.Drop.DisplayTitle), failed.Error);
|
||||
var drop = Assert.NotNull(await fx.Db.Sequences.GetAsync(s.Drop.Id));
|
||||
var keep = (await fx.Db.Sequences.GetAsync(s.Keep.Id))!;
|
||||
Assert.Equal(s.Drop.Id, (await new SyncLinkStore(fx.Db).ListAsync(Nas, Ct)).Single().LocalId);
|
||||
Assert.Equal(s.Drop.Id, await fx.Db.Sequences.FindBySessionKeyAsync(fx.Archive.Id, "drop-0", Ct));
|
||||
Assert.Contains("drop-0", ManifestStore.ReadSequence(fx.Paths.Sequence(drop.Folder).ManifestPath).SessionKeys);
|
||||
Assert.DoesNotContain("drop-0", ManifestStore.ReadSequence(fx.Paths.Sequence(keep.Folder).ManifestPath).SessionKeys);
|
||||
Assert.False(File.Exists(MergeJournal.PathFor(fx.Paths, job.Id)), "the next run plans again");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AProjectOfTheOtherWithTheHeadOfAnUnrelatedKeptProjectIsCopiedWithItsRenders()
|
||||
{
|
||||
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")]);
|
||||
// Two untouched projects made from equal Mains: equal heads, unrelated projects.
|
||||
var instagram = await fx.Service.Projects.CreateAsync(keep.Id, "Instagram", cancellationToken: fx.Ct);
|
||||
var export = await fx.Service.Projects.CreateAsync(drop.Id, "4K export", cancellationToken: fx.Ct);
|
||||
Assert.Equal((await fx.Service.Projects.HeadAsync(instagram.Id, Ct)).ContentHash, (await fx.Service.Projects.HeadAsync(export.Id, Ct)).ContentHash);
|
||||
var render = await RenderOfAsync(fx, drop, export);
|
||||
var copy = await PairAsync(fx, keep.Id, drop.Id);
|
||||
var merger = Merger(fx);
|
||||
var handler = (MergeJobHandler)SequenceMerger.CreateHandler(fx.Db, merger, fx.Service, new Chronos.Data.Projects.ProjectTransplant(), new FakeWorkspace());
|
||||
var engine = Own(new JobEngine(fx.Db, [.. fx.Service.CreateJobHandlers(), handler],
|
||||
new JobEngineOptions { Workers = 1, WorkerId = "test", PollInterval = TimeSpan.FromMilliseconds(50), CheckpointInterval = TimeSpan.FromMilliseconds(50) }));
|
||||
await engine.StartAsync(Ct);
|
||||
|
||||
var plan = await merger.PlanAsync(copy.Id, keep.Id, drop.Id, await ChoicesAsync(fx, keep.Id, drop.Id, CopyPhotoPolicy.Union), NoContext, Ct);
|
||||
Assert.SequenceEqual([("4K export", "4K export")], plan.Projects.Select(p => (p.SourceName, p.TargetName)));
|
||||
var job = await merger.EnqueueAsync(engine, new FoundCopyStore(fx.Db), plan, keep.DisplayTitle, Ct);
|
||||
await fx.WaitForAsync(job.Id, JobState.Done);
|
||||
|
||||
var copied = (await fx.Db.Projects.ListBySequenceAsync(keep.Id, includeDeleted: false, Ct)).Single(p => p.Name == "4K export");
|
||||
var moved = (await fx.Db.Renders.GetAsync(render.Id))!;
|
||||
Assert.Equal((keep.Id, (Guid?)copied.Id, copied.HeadVersionId), (moved.SequenceId, moved.ProjectId, moved.ProjectVersionId));
|
||||
Assert.Null(await fx.Db.Sequences.GetAsync(drop.Id));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AProjectTheKeptOneHoldsACopyOfIsNotCopiedAgainAndItsRendersNameTheCopy()
|
||||
{
|
||||
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")]);
|
||||
var cut = await fx.Service.Projects.CreateAsync(drop.Id, "Night cut", cancellationToken: fx.Ct);
|
||||
var render = await RenderOfAsync(fx, drop, cut);
|
||||
// An earlier run of the merge copied it before it stopped.
|
||||
var held = await new Chronos.Data.Projects.ProjectTransplant().CopyAsync(new Chronos.Data.Projects.ArchiveProjectHome(fx.Db, fx.Service.Projects, drop.Id), cut,
|
||||
new Chronos.Data.Projects.ArchiveProjectHome(fx.Db, fx.Service.Projects, keep.Id), "Night cut", null, _ => ValueTask.CompletedTask, Ct);
|
||||
var copy = await PairAsync(fx, keep.Id, drop.Id);
|
||||
var merger = Merger(fx);
|
||||
var (engine, _) = 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.Union), NoContext, Ct);
|
||||
Assert.Empty(plan.Projects);
|
||||
var job = await merger.EnqueueAsync(engine, new FoundCopyStore(fx.Db), plan, keep.DisplayTitle, Ct);
|
||||
await fx.WaitForAsync(job.Id, JobState.Done);
|
||||
|
||||
var moved = (await fx.Db.Renders.GetAsync(render.Id))!;
|
||||
var head = (await fx.Db.Projects.GetAsync(held.Id, Ct))!.HeadVersionId;
|
||||
Assert.Equal((keep.Id, (Guid?)held.Id, head), (moved.SequenceId, moved.ProjectId, moved.ProjectVersionId));
|
||||
}
|
||||
|
||||
/// <summary>A render of <paramref name="project"/>'s head, its file outside the sequence's folder.</summary>
|
||||
private static async Task<Render> RenderOfAsync(ArchiveFixture fx, Sequence sequence, SequenceProject project)
|
||||
{
|
||||
var bytes = RandomNumberGenerator.GetBytes(2048);
|
||||
var file = Path.Combine(fx.Paths.Root, $"{project.Id:N}.mp4");
|
||||
await File.WriteAllBytesAsync(file, bytes, fx.Ct);
|
||||
var render = new Render
|
||||
{
|
||||
Id = Guid.CreateVersion7(),
|
||||
SequenceId = sequence.Id,
|
||||
PresetName = "1080p",
|
||||
OutputPath = file,
|
||||
Bytes = bytes.Length,
|
||||
Sha256 = Sha(bytes),
|
||||
Created = DateTimeOffset.UtcNow,
|
||||
ProjectId = project.Id,
|
||||
ProjectVersionId = project.HeadVersionId,
|
||||
};
|
||||
await fx.Db.Renders.InsertAsync(render, fx.Ct);
|
||||
return render;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AJobWhosePlanMovedSinceTheDialogRefusesAndChangesNothing()
|
||||
{
|
||||
|
||||
@@ -294,6 +294,32 @@ public sealed class CopyEngineTests(TestContext context)
|
||||
Assert.True((await f.Db.Frames.ListBySequenceAsync(local.Id, cancellationToken: f.Ct)).Any(fr => fr.Sha256 == Sha(a)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task DropOwnVersionTrashesOneVersionOfALocalSequenceAndIsRefusedOnceTheOtherIsGone()
|
||||
{
|
||||
// Two versions a Union merge left in one sequence, its pair gone (owner Q3): listed, and each can be dropped.
|
||||
await using var f = await FixtureAsync(context);
|
||||
var (local, _, a, b) = await VersionsAsync(f);
|
||||
using var engine = Engine(f);
|
||||
var photo = (await engine.VersionsAsync(local.Id, f.Ct)).Single();
|
||||
var (frameA, frameB) = photo.FirstSha256 == Sha(a) ? (photo.FirstFrameId, photo.SecondFrameId) : (photo.SecondFrameId, photo.FirstFrameId);
|
||||
Assert.True(photo.CapturedAt is not null && photo.FirstSize > 0 && photo.SecondSize > 0);
|
||||
|
||||
var dropA = await engine.PlanDropOwnVersionAsync(local.Id, frameA, f.Ct);
|
||||
Assert.Equal((1, frameB, Sha(b)), (dropA.Plan.Frames.Count, dropA.PartnerFrameId, dropA.PartnerSha256));
|
||||
Assert.Equal(Sha(a), dropA.LastCopies.Single().Key);
|
||||
var dropB = await engine.PlanDropOwnVersionAsync(local.Id, frameB, f.Ct);
|
||||
|
||||
Assert.Equal(1, await engine.DropOwnVersionAsync(dropB, f.Ct));
|
||||
var left = await f.Db.Frames.ListBySequenceAsync(local.Id, cancellationToken: f.Ct);
|
||||
Assert.True(left.Any(fr => fr.Sha256 == Sha(a)) && !left.Any(fr => fr.Sha256 == Sha(b)));
|
||||
Assert.Empty(await engine.VersionsAsync(local.Id, f.Ct));
|
||||
|
||||
// The other version is gone now: dropping this one too would lose the photo, so nothing moves.
|
||||
await Assert.ThrowsAsync<StaleCopyPlanException>(() => engine.DropOwnVersionAsync(dropA, f.Ct));
|
||||
Assert.True((await f.Db.Frames.ListBySequenceAsync(local.Id, cancellationToken: f.Ct)).Any(fr => fr.Sha256 == Sha(a)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A pair holding one photo in two versions (a Union keep-both): two files of one sub-second capture time, on both sides,
|
||||
/// besides one plain photo.
|
||||
|
||||
@@ -294,6 +294,60 @@ public sealed class IntegrateTests(TestContext context)
|
||||
Assert.True((await builder.BuildAsync(pair, f.Remote, owner, f.Ct)).Can.DeleteThere);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TheJobOfAnOwnerWhoIsNotAnAdminPlansWhatTheDialogPlanned()
|
||||
{
|
||||
await using var f = await FixtureAsync(context);
|
||||
var (engine, _) = Engine(f);
|
||||
await using var _ = engine;
|
||||
await engine.StartAsync(f.Ct);
|
||||
var local = await LocalAsync(f, "Comet", [(1, 0, "IMG_0001.JPG"), (4, 30_250, "IMG_0004.JPG")]);
|
||||
var names = await NamesAsync(f, local.Id);
|
||||
var remote = Remote(f, "Comet", [(1, 0, names[0]), (5, 30_250, names[1])]);
|
||||
remote.OwnerUserId = Guid.NewGuid();
|
||||
var pair = await PairAsync(f, local.Id, remote.Id);
|
||||
// An Editor who owns the server sequence: the Delete right, not the admin role.
|
||||
var owner = PlanContext() with { OwnsOrAdmin = false, UserId = remote.OwnerUserId };
|
||||
var plan = await Planner(f).PlanAsync(f.Remote, pair, await ChoicesAsync(f, local.Id, remote.Id, CopyPhotoPolicy.ThisPcWins), owner, f.Ct);
|
||||
Assert.Contains(plan.Photos, p => p.Action == PhotoAction.TrashThere);
|
||||
// The context the job plans with gives the same plan.
|
||||
var queued = IntegrateJobContext.From(owner);
|
||||
Assert.Equal(owner.UserId, queued.ToPlanContext().UserId);
|
||||
Assert.Equal(plan.Fingerprint, (await Planner(f).PlanAsync(f.Remote, pair, plan.Choices, queued.ToPlanContext(), f.Ct)).Fingerprint);
|
||||
|
||||
var job = await CopyJobs.EnqueueIntegrateAsync(engine, f.Sync.Copies, plan, local.DisplayTitle, f.Ct);
|
||||
await f.Archive.WaitForAsync(job.Id, JobState.Done);
|
||||
|
||||
Assert.Equal(Sha(5, 30_250), f.Remote.Trashed.Single().Frame.Sha256);
|
||||
Assert.True(RemoteHashes(remote).SetEquals([Sha(1, 0), Sha(4, 30_250)]));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TheJobOfAnOwnerWithoutTheEditRightSendsWhatTheDialogAllowed()
|
||||
{
|
||||
await using var f = await FixtureAsync(context);
|
||||
var (engine, _) = Engine(f);
|
||||
await using var _ = engine;
|
||||
await engine.StartAsync(f.Ct);
|
||||
var local = await LocalAsync(f, "Comet", [(1, 0, "IMG_0001.JPG"), (2, 10_000, "IMG_0002.JPG")]);
|
||||
var names = await NamesAsync(f, local.Id);
|
||||
var remote = Remote(f, "Comet", [(1, 0, names[0])]);
|
||||
remote.OwnerUserId = Guid.NewGuid();
|
||||
var pair = await PairAsync(f, local.Id, remote.Id);
|
||||
// Upload but not Edit: photos may go into a sequence the account owns.
|
||||
var owner = PlanContext(canDelete: false) with { CanEdit = false, UserId = remote.OwnerUserId };
|
||||
var choices = await ChoicesAsync(f, local.Id, remote.Id, CopyPhotoPolicy.Union);
|
||||
var plan = await Planner(f).PlanAsync(f.Remote, pair, choices, owner, f.Ct);
|
||||
Assert.Contains(plan.Photos, p => p.Action is PhotoAction.Send or PhotoAction.SendVersion);
|
||||
Assert.DoesNotContain(CopyBlock.NoAddRight, plan.Blocks);
|
||||
Assert.Equal(plan.Fingerprint, (await Planner(f).PlanAsync(f.Remote, pair, choices, IntegrateJobContext.From(owner).ToPlanContext(), f.Ct)).Fingerprint);
|
||||
|
||||
var job = await CopyJobs.EnqueueIntegrateAsync(engine, f.Sync.Copies, plan, local.DisplayTitle, f.Ct);
|
||||
await f.Archive.WaitForAsync(job.Id, JobState.Done);
|
||||
|
||||
Assert.True(RemoteHashes(remote).SetEquals([Sha(1, 0), Sha(2, 10_000)]));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task WithoutTheDeleteRightTheServersVersionStaysOutOfItsMainAndTheRestRuns()
|
||||
{
|
||||
|
||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 77 KiB |