feat(projects): workspace projects with linear versions, the local archive as their home
Owner review 2, phase 5a (R8): editing moves out of the library into a workspace on a fast disk, and a sequence gets several projects, each with a linear version history pushed and pulled like git. - Core: ProjectSettings keeps members a newer Chronos wrote (Extra) and reads a newer settings format read-only; ProjectContent is the portable form of a version (every frame position parked by photo, canonical text, SHA-256 content hash); ProjectBundle format 2 adds the workspace section, and a file without it is still written as format 1. JobKind.WorkspaceCopy = 20 (19 kept for Convert). - Data: migration 0009 (projects, project_versions, the render's project columns); ProjectService on ArchiveService.Projects keeps projects as sidecars first (.chronos/projects/<id>/), then the index, under the sequence lease: create, rename, delete into the projects' trash, history, push with fast-forward, idempotent repeat, divergence and hash checks. Main is made from the sequence's settings and mirrored both ways, so every older code path keeps working; outside writes become "external" versions, a mirror a crash cut short is completed or merged. Full scans and rebuilds take the projects back from their sidecars. - ProjectMerge moves from the App to Data/Projects, merges pending frames photo by photo and replays unpushed commits on a moved head. - Workspaces: WorkspaceStore, WorkspaceSync (checkout, save, commit, push, pull with replay and merge, conflicts settled by keep mine / take server / save both, restore, status) and the WorkspaceCopy job (proxies copied hash-verified and resumable; originals refused until phase 5c). - Renders of a project version place its positions on the frames and record the project and version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit c4c1802884e403db8759ed0501f770a67a047f20)
This commit is contained in:
1 parent
e3cbe30b29
commit
03d32f18d3
51 files changed
+4917
-108
No files matched your search
@@ -37,12 +37,68 @@ public sealed class ProjectBundleTests(TestContext context)
|
||||
// The archive's own meta files are JSON too, but not project files.
|
||||
Assert.Throws<InvalidDataException>(() => ProjectBundle.Parse("""{ "schemaVersion": 1, "id": "0192a4c1-7b3e-7cc0-8a51-2f9d0e6b1a01" }"""));
|
||||
var json = Sample().ToJson();
|
||||
Assert.Throws<InvalidDataException>(() => ProjectBundle.Parse(json.Replace("\"formatVersion\": 1", "\"formatVersion\": 2", StringComparison.Ordinal)));
|
||||
Assert.Throws<InvalidDataException>(() => ProjectBundle.Parse(json.Replace("\"formatVersion\": 1", "\"formatVersion\": 3", StringComparison.Ordinal)));
|
||||
Assert.Throws<InvalidDataException>(() => ProjectBundle.Parse(json.Replace(SequenceId.ToString(), "not-a-guid", StringComparison.Ordinal)));
|
||||
Assert.Throws<InvalidDataException>(() => ProjectBundle.Parse(json.Replace("\"version\": 1", "\"version\": 99", StringComparison.Ordinal)));
|
||||
Assert.Throws<InvalidDataException>(() => ProjectBundle.Parse(json.Replace("\"folder\"", "\"place\"", StringComparison.Ordinal)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AWorkspaceProjectFileRoundTripsItsWorkspaceSection()
|
||||
{
|
||||
var basis = new BundleBase(Guid.Parse("0192a4c1-7b3e-7cc0-8a51-2f9d0e6b1a10"), 7, new string('a', 64));
|
||||
var workspace = new BundleWorkspace(Guid.Parse("0192a4c1-7b3e-7cc0-8a51-2f9d0e6b1a11"), "Vertical social", false,
|
||||
new BundleHome(BundleHome.ArchiveKind, SequenceId, ArchiveId), basis, new BundleMedia(BundleMedia.Proxies, 12));
|
||||
var bundle = Sample() with { Workspace = workspace };
|
||||
var path = Path.Combine(context.CreateTempDirectory("bundle"), "project.chronos");
|
||||
bundle.Save(path);
|
||||
|
||||
var json = File.ReadAllText(path);
|
||||
Assert.Contains("\"formatVersion\": 2", json);
|
||||
Assert.Contains("\"kind\": \"archive\"", json);
|
||||
var back = ProjectBundle.Load(path);
|
||||
Assert.Equal(workspace, back.Workspace);
|
||||
Assert.Equal(bundle.Project.ToJson(), back.Project.ToJson());
|
||||
Assert.False(back.IsReadOnly);
|
||||
|
||||
// A server home names its server; a project not pulled yet has no base.
|
||||
var remote = workspace with { Home = new BundleHome(BundleHome.ServerKind, SequenceId, Server: "https://nas:8443"), Base = null, IsMain = true };
|
||||
Assert.Equal(remote, ProjectBundle.Parse((bundle with { Workspace = remote }).ToJson()).Workspace);
|
||||
Assert.Throws<InvalidDataException>(() => ProjectBundle.Parse(json.Replace("\"kind\": \"archive\"", "\"kind\": \"cloud\"", StringComparison.Ordinal)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AFileOfTheFirstFormatStillOpens()
|
||||
{
|
||||
const string v1 = """
|
||||
{ "format": "chronos-project", "formatVersion": 1, "saved": "2026-10-12T09:30:00+00:00",
|
||||
"archive": { "id": "0192a4c1-7b3e-7cc0-8a51-2f9d0e6b1a01", "name": "Main archive" },
|
||||
"sequence": { "id": "0192a4c1-7b3e-7cc0-8a51-2f9d0e6b1a02", "folder": "2026/Harbour", "frames": 10 },
|
||||
"project": { "excludedFrames": [4] },
|
||||
"workspace": { "projectId": "0192a4c1-7b3e-7cc0-8a51-2f9d0e6b1a11" } }
|
||||
""";
|
||||
var bundle = ProjectBundle.Parse(v1);
|
||||
Assert.SequenceEqual([4], bundle.Project.ExcludedFrames);
|
||||
// A format 1 file has no workspace section, whatever it holds.
|
||||
Assert.Null(bundle.Workspace);
|
||||
Assert.Contains("\"formatVersion\": 1", bundle.ToJson());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ANewerProjectOpensReadOnlyInAWorkspaceFileOnly()
|
||||
{
|
||||
var workspace = new BundleWorkspace(Guid.CreateVersion7(), "Main", true, new BundleHome(BundleHome.ArchiveKind, SequenceId, ArchiveId), null,
|
||||
new BundleMedia(BundleMedia.Proxies, 0));
|
||||
var json = (Sample() with { Workspace = workspace }).ToJson().Replace("\"version\": 1", "\"version\": 2", StringComparison.Ordinal);
|
||||
var bundle = ProjectBundle.Parse(json);
|
||||
Assert.True(bundle.IsReadOnly);
|
||||
Assert.True(bundle.Project.IsNewerFormat);
|
||||
Assert.Equal(0.8, bundle.Project.Exposure.DeflickerStrength.Resolve(1.0));
|
||||
|
||||
var plain = Sample().ToJson().Replace("\"version\": 1", "\"version\": 2", StringComparison.Ordinal);
|
||||
Assert.Throws<InvalidDataException>(() => ProjectBundle.Parse(plain));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AFileTooLargeToBeAProjectIsNotRead()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user