feat: owner review 2 phase 5a: workspace and projects with a local home (#14)
CI / Build and test (push) Successful in 9m43s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 27s
CI / PostgreSQL 16 integration (push) Failing after 8m41s
CI / PostgreSQL 17 integration (push) Successful in 12m37s
CI / Docker image (push) Successful in 56s
Release / Build, test and publish (push) Successful in 14m59s
Release / Server image (push) Successful in 1m51s

Edit opens a sequence as a project of a workspace folder outside the library. Projects have linear version histories kept as sidecars in .chronos/projects/, Main mirrors the sequence's settings, and sync merges setting by setting. Migration 0009, JobKind.WorkspaceCopy = 20, Settings › Workspace, and 241 new strings in 38 languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #14.
This commit is contained in:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-11-04 09:22:08 +01:00
1 parent efa87f68ce
commit 9b24cf74fc
370 files changed
+29237 -287

No files matched your search

+97 -8
View File
@@ -44,10 +44,20 @@ public enum StackSetting
}
/// <summary>A control point of the time-remap curve: output fraction → source fraction (both 0..1).</summary>
public sealed record CurvePoint(double X, double Y);
public sealed record CurvePoint(double X, double Y)
{
/// <summary>Members this Chronos does not know (written by a newer one): kept as they are, so they survive a round trip.</summary>
[JsonExtensionData]
public Dictionary<string, JsonElement>? Extra { get; set; }
}
/// <summary>Virtual-camera keyframe in normalised coordinates.</summary>
public sealed record CameraKey(int Frame, double CenterX, double CenterY, double Zoom, double Rotation, string Easing = "EaseInOut");
public sealed record CameraKey(int Frame, double CenterX, double CenterY, double Zoom, double Rotation, string Easing = "EaseInOut")
{
/// <summary>Members this Chronos does not know (written by a newer one): kept as they are, so they survive a round trip.</summary>
[JsonExtensionData]
public Dictionary<string, JsonElement>? Extra { get; set; }
}
/// <summary>
/// The frame positions of a project that name a photo this copy of the sequence does not hold: settings taken from a
@@ -78,6 +88,10 @@ public sealed record PendingFrame
[JsonIgnore]
public FramePhoto Photo => new(Sha256, Size, CapturedAt);
/// <summary>Members this Chronos does not know (written by a newer one): kept as they are, so they survive a round trip.</summary>
[JsonExtensionData]
public Dictionary<string, JsonElement>? Extra { get; set; }
}
public sealed record TimingSettings
@@ -91,6 +105,10 @@ public sealed record TimingSettings
public double? FitToSeconds { get; init; }
public IReadOnlyList<CurvePoint> RemapCurve { get; init; } = [new(0, 0), new(1, 1)];
/// <summary>Members this Chronos does not know (written by a newer one): kept as they are, so they survive a round trip.</summary>
[JsonExtensionData]
public Dictionary<string, JsonElement>? Extra { get; set; }
}
public sealed record ExposureSettings
@@ -119,6 +137,10 @@ public sealed record ExposureSettings
/// <remarks>Written even when null: a missing value reads back as the default knee, which would turn "off" on.</remarks>
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public double? HighlightKnee { get; init; } = 0.9;
/// <summary>Members this Chronos does not know (written by a newer one): kept as they are, so they survive a round trip.</summary>
[JsonExtensionData]
public Dictionary<string, JsonElement>? Extra { get; set; }
}
public sealed record MotionSettings
@@ -134,6 +156,10 @@ public sealed record MotionSettings
/// <summary>Path smoothing in frames (Gaussian sigma).</summary>
public Auto<double> StabilizeSmoothing { get; init; } = new();
/// <summary>Members this Chronos does not know (written by a newer one): kept as they are, so they survive a round trip.</summary>
[JsonExtensionData]
public Dictionary<string, JsonElement>? Extra { get; set; }
}
public sealed record CameraSettings
@@ -147,6 +173,10 @@ public sealed record CameraSettings
public double OffsetX { get; init; }
public double OffsetY { get; init; }
public IReadOnlyList<CameraKey> Keyframes { get; init; } = [];
/// <summary>Members this Chronos does not know (written by a newer one): kept as they are, so they survive a round trip.</summary>
[JsonExtensionData]
public Dictionary<string, JsonElement>? Extra { get; set; }
}
public sealed record StackSettings
@@ -155,6 +185,10 @@ public sealed record StackSettings
/// <summary>Window (median/mean) or trail length (star trails) in frames.</summary>
public int Length { get; init; } = 9;
/// <summary>Members this Chronos does not know (written by a newer one): kept as they are, so they survive a round trip.</summary>
[JsonExtensionData]
public Dictionary<string, JsonElement>? Extra { get; set; }
}
/// <summary>Values of an export; null fields take the preset's value (BRIEF §11.4: editing any value makes it "Custom").</summary>
@@ -173,6 +207,10 @@ public sealed record ExportOverrides
public int? Quality { get; init; }
public string? RateControl { get; init; }
public string? Encoder { get; init; }
/// <summary>Members this Chronos does not know (written by a newer one): kept as they are, so they survive a round trip.</summary>
[JsonExtensionData]
public Dictionary<string, JsonElement>? Extra { get; set; }
}
public sealed record ExportSettings
@@ -196,6 +234,10 @@ public sealed record ExportSettings
/// unless chosen, as renders travel on request (BRIEF §14.5).
/// </summary>
public bool SyncToServer { get; init; }
/// <summary>Members this Chronos does not know (written by a newer one): kept as they are, so they survive a round trip.</summary>
[JsonExtensionData]
public Dictionary<string, JsonElement>? Extra { get; set; }
}
/// <summary>
@@ -236,6 +278,20 @@ public sealed record ProjectSettings
[JsonIgnore]
public bool HeroPending => PendingFrames?.Any(p => p.Hero) == true;
/// <summary>
/// Members this Chronos does not know (settings a newer Chronos added, such as filters): kept as they are, so a project
/// read and written again loses nothing (owner review 2, R8).
/// </summary>
[JsonExtensionData]
public Dictionary<string, JsonElement>? Extra { get; set; }
/// <summary>
/// Written by a newer Chronos (<see cref="Version"/> above <see cref="CurrentVersion"/>), read with
/// <see cref="FromJson(string, bool)"/> allowing it: shown, never edited, as its known values may mean something else there.
/// </summary>
[JsonIgnore]
public bool IsNewerFormat => Version > CurrentVersion;
public string ToJson() => JsonSerializer.Serialize(this, ProjectJson.Default.ProjectSettings);
/// <summary>
@@ -245,7 +301,15 @@ public sealed record ProjectSettings
/// </summary>
/// <exception cref="JsonException">The text is not a JSON object, or repeats a member.</exception>
/// <exception cref="InvalidDataException">The project was written by a newer Chronos.</exception>
public static ProjectSettings FromJson(string json)
public static ProjectSettings FromJson(string json) => FromJson(json, allowNewer: false);
/// <summary>
/// <see cref="FromJson(string)"/>, reading a project of a newer Chronos too when <paramref name="allowNewer"/>: its
/// known values, its unknown members in <see cref="Extra"/>, and <see cref="IsNewerFormat"/> set (open it read-only).
/// </summary>
/// <exception cref="JsonException">The text is not a JSON object, repeats a member, or a known member has another type.</exception>
/// <exception cref="InvalidDataException">The project was written by a newer Chronos and <paramref name="allowNewer"/> is false.</exception>
public static ProjectSettings FromJson(string json, bool allowNewer)
{
var options = new JsonNodeOptions { PropertyNameCaseInsensitive = true };
var merged = JsonNode.Parse(new ProjectSettings().ToJson(), options)!.AsObject();
@@ -266,7 +330,7 @@ public sealed record ProjectSettings
throw new JsonException("A project must be a JSON object.");
}
var settings = JsonSerializer.Deserialize(merged, ProjectJson.Default.ProjectSettings) ?? new ProjectSettings();
if (settings.Version > CurrentVersion)
if (settings.IsNewerFormat && !allowNewer)
throw new InvalidDataException($"project.json version {settings.Version} is newer than this Chronos ({CurrentVersion}).");
return settings;
}
@@ -510,14 +574,21 @@ public sealed record ProjectSettings
return changed;
}
/// <summary>Gives the pending frames whose photo <paramref name="to"/> holds their positions back.</summary>
/// <summary>
/// Gives the pending frames whose photo <paramref name="to"/> holds their positions back. An entry with members this
/// Chronos does not know (a newer one's values of the photo) stays, without its positions: those members are not this
/// Chronos's to drop, and the next portable form parks the positions in it again.
/// </summary>
private static bool PlacePending(JsonObject project, FramePhotos to, List<Parked> pending)
{
var changed = false;
foreach (var parked in pending)
{
if (to.IndexOf(parked.Photo, parked.Occurrence) is not { } at) continue;
parked.Placed = changed = true;
var kept = HasUnknownMembers(parked.Entry);
if (kept && !HoldsPosition(parked.Entry)) continue;
parked.Placed = !kept;
changed = true;
if (Flag(parked.Entry, "excluded"))
{
if (project["excludedFrames"] is not JsonArray positions) project["excludedFrames"] = positions = new JsonArray();
@@ -538,6 +609,12 @@ public sealed record ProjectSettings
keyframes.Add(copy);
}
}
if (kept)
{
parked.Entry["excluded"] = false;
parked.Entry["hero"] = false;
parked.Entry["keyframes"] = new JsonArray();
}
}
if (project["heroFrame"] is null) return changed;
// A hero is chosen: none waits any more, and an entry left with nothing to place goes.
@@ -597,8 +674,20 @@ public sealed record ProjectSettings
private static bool Flag(JsonObject entry, string name) => entry[name] is JsonValue value && value.TryGetValue<bool>(out var set) && set;
/// <summary>A pending entry still has a position to give its photo.</summary>
private static bool Waits(JsonObject entry) => Flag(entry, "excluded") || Flag(entry, "hero") || entry["keyframes"] is JsonArray { Count: > 0 };
/// <summary>The members of a pending entry this Chronos knows: its photo, which copy of it, and the positions on it.</summary>
internal static readonly HashSet<string> PendingMembers = new(StringComparer.OrdinalIgnoreCase)
{
"sha256", "size", "capturedAt", "occurrence", "excluded", "hero", "keyframes",
};
/// <summary>A pending entry has a position to give its photo.</summary>
private static bool HoldsPosition(JsonObject entry) => Flag(entry, "excluded") || Flag(entry, "hero") || entry["keyframes"] is JsonArray { Count: > 0 };
/// <summary>A pending entry holds members this Chronos does not know (written by a newer one).</summary>
private static bool HasUnknownMembers(JsonObject entry) => entry.Any(p => !PendingMembers.Contains(p.Key));
/// <summary>A pending entry still holds something: a position to give its photo, or members that are not this Chronos's to drop.</summary>
private static bool Waits(JsonObject entry) => HoldsPosition(entry) || HasUnknownMembers(entry);
private static bool IsPosition(JsonNode? node, out int position)
{