Merge branch 'review2-p5a-fix3-desktop' into review2-p5a-int3
Conflict in WorkspaceFallbackTests: keeps desktop's new newer-copy test and drops ACancelledFirstCopyLeavesNoHalfMedia, which the sync branch removed along with WorkspaceHost.RemovePartialMediaAsync (the cancelled first copy's clean-up now runs in the copy job, tested in Data). ReplayAsync auto-merged with both intents: desktop's working-state conflicts and silent paths, and sync's skip of no-change versions, Settles journal flag and PruneReplaced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
c5ed31bced
21 files changed
+696
-54
No files matched your search
@@ -153,6 +153,66 @@ public abstract class WorkspaceConflictTests(TestContext context) : DatabaseTest
|
||||
Assert.Equal(1.0, (await two.OpenAsync(id, fx.Ct)).Working.Exposure.ExposureOffsetEv, "the value listed as this side's is kept");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AWorkingStateBackAtTheBaseValueIsListedAndKeptAsItIs()
|
||||
{
|
||||
var fx = await FixtureAsync();
|
||||
var (_, one) = fx.Workspace("one");
|
||||
var (_, two) = fx.Workspace("two");
|
||||
var id = (await fx.CheckoutAsync(one)).ProjectId;
|
||||
await fx.CheckoutAsync(two, id);
|
||||
var basis = (await two.OpenAsync(id, fx.Ct)).Working.Exposure.ExposureOffsetEv;
|
||||
await EditAsync(one, id, s => Offset(s, 0.5), fx.Ct);
|
||||
await one.CommitAsync(id, cancellationToken: fx.Ct);
|
||||
await one.PushAsync(id, fx.Home, fx.Ct);
|
||||
// This side saved 0.8 as a version, then went back to the base value without saving.
|
||||
await EditAsync(two, id, s => Offset(s, 0.8), fx.Ct);
|
||||
await two.CommitAsync(id, "warmer", cancellationToken: fx.Ct);
|
||||
await EditAsync(two, id, s => Offset(s, basis), fx.Ct);
|
||||
|
||||
var shown = Assert.NotNull((await two.PullAsync(id, fx.Home, fx.Ct)).Status.Conflict);
|
||||
var difference = shown.Differences.Single();
|
||||
Assert.Equal(("exposure.exposureOffsetEv", basis, 0.5), (difference.Path, Number(difference.Mine) ?? 0, Number(difference.Theirs)),
|
||||
"this side's value is the working state's, not the version's 0.8");
|
||||
|
||||
var settled = await two.ResolveAsync(id, fx.Home, ConflictChoice.KeepMine, shown: shown, cancellationToken: fx.Ct);
|
||||
Assert.Null(settled.Status.Conflict, "one answer settles what was shown");
|
||||
Assert.Equal(basis, (await two.OpenAsync(id, fx.Ct)).Working.Exposure.ExposureOffsetEv, "the value listed as this side's is the one kept");
|
||||
Assert.True(settled.Status.Modified, "the saved version keeps its own value; the working state's is not saved yet");
|
||||
Assert.Equal("warmer", two.Unpushed(id).Single().Note);
|
||||
await two.CommitAsync(id, cancellationToken: fx.Ct);
|
||||
await two.PushAsync(id, fx.Home, fx.Ct);
|
||||
Assert.Equal(basis, ProjectSettings.FromJson((await fx.Home.HeadAsync(id, fx.Ct)).SettingsJson).Exposure.ExposureOffsetEv, "the library ends with the value kept");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AWorkingStateHoldingTheLibrarysValueIsNoConflictAndItsVersionAgrees()
|
||||
{
|
||||
var fx = await FixtureAsync();
|
||||
var (_, one) = fx.Workspace("one");
|
||||
var (_, two) = fx.Workspace("two");
|
||||
var id = (await fx.CheckoutAsync(one)).ProjectId;
|
||||
await fx.CheckoutAsync(two, id);
|
||||
await EditAsync(one, id, s => Offset(s, 0.5), fx.Ct);
|
||||
await one.CommitAsync(id, cancellationToken: fx.Ct);
|
||||
await one.PushAsync(id, fx.Home, fx.Ct);
|
||||
// This side saved 0.8 and a stack as a version, then set the offset to the library's own 0.5 without saving.
|
||||
await EditAsync(two, id, s => Stack(Offset(s, 0.8), StackSetting.Mean), fx.Ct);
|
||||
await two.CommitAsync(id, "local", cancellationToken: fx.Ct);
|
||||
await EditAsync(two, id, s => Offset(s, 0.5), fx.Ct);
|
||||
|
||||
var pulled = await two.PullAsync(id, fx.Home, fx.Ct);
|
||||
Assert.Null(pulled.Status.Conflict, "nothing to choose: the working state holds the library's value");
|
||||
var working = (await two.OpenAsync(id, fx.Ct)).Working;
|
||||
Assert.Equal((0.5, StackSetting.Mean), (working.Exposure.ExposureOffsetEv, working.Stack.Mode), "the working state is unchanged");
|
||||
var replayed = ProjectSettings.FromJson(two.Unpushed(id).Single().SettingsJson);
|
||||
Assert.Equal((0.5, StackSetting.Mean), (replayed.Exposure.ExposureOffsetEv, replayed.Stack.Mode), "the replayed version agrees with the working state");
|
||||
Assert.True(pulled.Status is { State: WorkspaceState.Ahead, Modified: false }, "nothing left unsaved");
|
||||
await two.PushAsync(id, fx.Home, fx.Ct);
|
||||
var head = ProjectSettings.FromJson((await fx.Home.HeadAsync(id, fx.Ct)).SettingsJson);
|
||||
Assert.Equal((0.5, StackSetting.Mean), (head.Exposure.ExposureOffsetEv, head.Stack.Mode));
|
||||
}
|
||||
|
||||
private static double? Number(string? json) => json is null ? null : double.Parse(json, System.Globalization.CultureInfo.InvariantCulture);
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in new issue
Block a user