feat(project): settle phase 4 contracts: conditional settings format, transforms, look, output size

Groundwork for owner review 1, phase 4, so the parallel packages build on
fixed contracts and strings.

- Settings: camera rotate/mirror/flip/straighten and a look, declared after
  the existing members and omitted at default. ToJson writes the lowest
  format that renders the same (2 only while a transform or look is used),
  so projects without them keep byte-identical text and hash; an old-build
  simulation test proves the order survives an older build's round trip.
- RenderSize and RenderRules: proportions win over a fixed preset box, and
  the routing format a job needs.
- FrameOrientation, CropFrame, OrientationEdit, LookFilter (identity) and
  FrameFinish (look, then knee) wired into the render pipeline and preview;
  RenderGeometry gains view-frame members equivalent to today.
- Protocol trailing members for node, job and server formats; SyncText keys;
  EditPath counts transforms and the look as hand values.
- New en/it strings and tooltips, five icons, test fixtures moved to v3 as
  the first unread format, and the 18 DECISIONS rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-04 19:10:12 +01:00
1 parent 4ad29977b9
commit e4364c4f25
43 files changed
+1544 -178

No files matched your search

@@ -21,6 +21,55 @@ public sealed class ProjectMergeTests
private static PendingFrame Waiting(FramePhoto photo, bool excluded = false, bool hero = false) =>
new() { Sha256 = photo.Sha256, Size = photo.Size, CapturedAt = photo.CapturedAt, Excluded = excluded, Hero = hero };
[Test]
public void ATurnOnOneSideAndALookOnTheOtherMergeIntoFormatTwo()
{
var basis = new ProjectSettings { Exposure = new ExposureSettings { ExposureOffsetEv = 0.2 } };
var ours = basis with { Camera = basis.Camera with { Rotate = 90, Straighten = 1.5 } };
var theirs = basis with { Look = new LookSettings { Filter = "sepia", Strength = 0.6 } };
var result = ProjectMerge.MergeWithConflicts(basis, ours, theirs);
Assert.False(result.HasConflicts);
Assert.Equal((90, 1.5), (result.Merged.Camera.Rotate, result.Merged.Camera.Straighten));
Assert.Equal("sepia", result.Merged.Look?.Filter);
Assert.Equal(2, result.Merged.Version);
Assert.Contains("\"version\": 2", result.Merged.ToJson());
// One side takes the turn away while the other keeps the look: the format the members need, not the one taken.
var undone = ProjectMerge.MergeWithConflicts(result.Merged, result.Merged with { Camera = basis.Camera }, result.Merged with { Look = null }).Merged;
Assert.Equal(1, ProjectContent.FormatOf(undone.ToJson()));
Assert.Equal(basis.ToJson(), undone.ToJson());
}
[Test]
public void BothSidesCroppingGiveOneCropConflict()
{
var basis = new ProjectSettings { Camera = new CameraSettings { Aspect = new Auto<string>().WithManual("9:16") } };
var ours = basis with { Camera = basis.Camera with { Crop = [0.1, 0, 0.3, 0.9] } };
var theirs = basis with { Camera = basis.Camera with { Crop = [0.5, 0.05, 0.2, 0.6], Mirror = true } };
var result = ProjectMerge.MergeWithConflicts(basis, ours, theirs);
// The box is one value: never the x of one side and the width of the other.
Assert.SequenceEqual(["camera.crop"], result.Conflicts.Select(c => c.Path));
Assert.SequenceEqual([0.1, 0, 0.3, 0.9], Assert.NotNull(result.Merged.Camera.Crop));
Assert.True(result.Merged.Camera.Mirror);
Assert.SequenceEqual([0.5, 0.05, 0.2, 0.6], Assert.NotNull(
ProjectMerge.MergeWithConflicts(basis, ours, theirs, new HashSet<string> { "camera.crop" }).Merged.Camera.Crop));
}
[Test]
public void AFormatThreeSideIsNeverMerged()
{
var basis = new ProjectSettings { Camera = new CameraSettings { Rotate = 90 } };
var newer = ProjectSettings.FromJson("""{ "version": 3, "camera": { "rotate": 180 }, "look": { "filter": "film" } }""", allowNewer: true);
var mine = basis with { Look = new LookSettings { Filter = "warm" } };
Assert.Throws<NewerSettingsException>(() => ProjectMerge.MergeWithConflicts(basis, mine, newer));
Assert.Throws<NewerSettingsException>(() => ProjectMerge.MergeWithConflicts(basis, newer, mine));
Assert.Equal(3, ProjectMerge.MergeWithConflicts(basis, basis, newer).Merged.Version);
}
[Test]
public void EntriesOfOnePhotoMergeAsOneWithThePositionsOfBoth()
{
@@ -69,7 +118,7 @@ public sealed class ProjectMergeTests
public void SettingsOfANewerChronosAreNeverMergedWithThisOnes()
{
var basis = new ProjectSettings { Exposure = new ExposureSettings { ExposureOffsetEv = 0.1 } };
var newer = ProjectSettings.FromJson("""{ "version": 2, "exposure": { "exposureOffsetEv": 0.5 }, "grade": { "look": "film" } }""", allowNewer: true);
var newer = ProjectSettings.FromJson("""{ "version": 3, "exposure": { "exposureOffsetEv": 0.5 }, "grade": { "look": "film" } }""", allowNewer: true);
var mine = basis with { Stack = new StackSettings { Mode = StackSetting.Median } };
// Both changed: refused, whichever side the newer one is, in a replay too.