feat(server): settings sent alone move the hero frame with the project's hero

The sync of a local copy sends only the project; the server now maps its hero
index to the frame the Library shows, through the same helper the archive
engine's project writes use. Edits that name the hero are audited as such.

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-03 16:37:33 +00:00
1 parent a3781e26a0
commit afaa387daf
4 files changed
+76 -10

No files matched your search

@@ -73,6 +73,33 @@ public sealed class RemoteEditingTests(TestContext context)
Assert.Null(cleared.HeroFrameId);
}
[Test]
public async Task SettingsAloneMoveTheHeroFrameWithTheProjectsHero()
{
await using var server = await TestServer.StartAsync(context);
var (editor, _, token) = await server.UserAsync("alberto", "editor");
using var client = Client(server, token);
await Uploads.UploadAsync(editor, Uploads.Photo(2000, 46), "a.CR3", sessionKey: "pier");
var second = await Uploads.UploadAsync(editor, Uploads.Photo(2000, 47), "b.CR3", sessionKey: "pier");
var id = second.SequenceId;
var read = await client.GetSequenceAsync(id, context.Cancellation);
// The sync of a local copy sends the project only.
var project = new ProjectSettings { HeroFrame = second.Index };
var hero = await client.UpdateSequenceAsync(id, new UpdateSequenceRequest(null, null, null, null, project.ToJson(), read.SettingsVersion),
context.Cancellation);
Assert.Equal(second.FrameId, hero.HeroFrameId);
var exposure = project with { Exposure = project.Exposure with { ExposureOffsetEv = 0.3 } };
var kept = await client.UpdateSequenceAsync(id, new UpdateSequenceRequest(null, null, null, null, exposure.ToJson(), hero.SettingsVersion),
context.Cancellation);
Assert.Equal(second.FrameId, kept.HeroFrameId, "other changes keep the hero");
var cleared = await client.UpdateSequenceAsync(id, new UpdateSequenceRequest(null, null, null, null, (exposure with { HeroFrame = null }).ToJson(),
kept.SettingsVersion), context.Cancellation);
Assert.Null(cleared.HeroFrameId, "no hero shows the first frame");
}
[Test]
public async Task JobsPostedOnePerPresetReadBackAsTheClientsJobs()
{