merge: sync and project position fixes (V-9, V-10, V-21, V-29, CD-2)

Merge branch fix2/sync-positions into the verification branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-12 17:10:58 +00:00
commit 51acc7f91b
32 files changed
+1843 -153

No files matched your search

@@ -485,6 +485,51 @@ public sealed class ArchiveIngestTests(TestContext context)
Assert.True(JsonNode.DeepEquals(JsonNode.Parse(row.SettingsJson!), JsonNode.Parse(File.ReadAllText(folder.ProjectPath))), "project.json mirrors the index");
}
[Test]
public async Task PositionsWaitingForTheirPhotosTakeTheirPlaceWhenTheyArrive()
{
await using var fx = await CreateAsync(context);
var results = new List<IngestResult>();
for (var i = 0; i < 3; i++) results.Add(await fx.Service.Ingest.CommitAsync(Request(fx, fx.Stage(Start.AddMinutes(1 + i), 30 + i)), fx.Ct));
var sequenceId = results[0].SequenceId;
var folder = fx.Paths.Sequence((await fx.Db.Sequences.GetAsync(sequenceId))!.Folder);
// Settings synced from a copy that also holds an earlier and a later photo: what names them waits for them.
var early = fx.Stage(Start, 40);
var late = fx.Stage(Start.AddMinutes(9), 41);
var project = new ProjectSettings
{
ExcludedFrames = [1],
Camera = new CameraSettings { Keyframes = [new CameraKey(0, 0.5, 0.5, 1, 0)] },
PendingFrames =
[
new PendingFrame { Sha256 = early.Sha256, Size = early.Size, Excluded = true },
new PendingFrame { Sha256 = late.Sha256, Size = late.Size, Hero = true, Keyframes = [new CameraKey(0, 0.3, 0.6, 2, 0)] },
],
}.ToJson();
AtomicFile.WriteAllText(folder.ProjectPath, project);
var version = (await fx.Db.Sequences.EditAsync(sequenceId, new SequenceEdit { SettingsJson = project }, null, fx.Ct)).Sequence!.SettingsVersion;
// The later photo is appended in step with the index; the earlier one is inserted before every other.
var appended = await fx.Service.Ingest.CommitAsync(Request(fx, late), fx.Ct);
var halfway = ProjectSettings.FromJson((await fx.Db.Sequences.GetAsync(sequenceId))!.SettingsJson!);
Assert.Equal(3, halfway.HeroFrame);
Assert.Count(1, halfway.PendingFrames!);
Assert.Equal(early.Sha256, halfway.PendingFrames![0].Sha256);
var inserted = await fx.Service.Ingest.CommitAsync(Request(fx, early), fx.Ct);
var row = (await fx.Db.Sequences.GetAsync(sequenceId))!;
var frames = await fx.Db.Frames.ListBySequenceAsync(sequenceId);
var placed = ProjectSettings.FromJson(row.SettingsJson!);
Assert.SequenceEqual([inserted.FrameId, results[1].FrameId], placed.ExcludedFrames.Select(i => frames[i].Id));
Assert.Equal(appended.FrameId, frames[placed.HeroFrame!.Value].Id);
Assert.SequenceEqual([results[0].FrameId, appended.FrameId], placed.Camera.Keyframes.Select(k => frames[k.Frame].Id));
Assert.Equal(0.3, placed.Camera.Keyframes[1].CenterX);
Assert.Null(placed.PendingFrames);
Assert.Equal(appended.FrameId, row.HeroFrameId);
Assert.Equal(version, row.SettingsVersion);
Assert.True(JsonNode.DeepEquals(JsonNode.Parse(row.SettingsJson!), JsonNode.Parse(File.ReadAllText(folder.ProjectPath))), "project.json mirrors the index");
}
[Test]
public async Task PhotosAFolderScanFindsMoveTheProjectPositionsButUnknownMembersStay()
{