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
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:
1 parent
efa87f68ce
commit
9b24cf74fc
370 files changed
+29237
-287
No files matched your search
@@ -1,3 +1,4 @@
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Testing;
|
||||
|
||||
@@ -37,12 +38,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()
|
||||
{
|
||||
@@ -51,6 +108,23 @@ public sealed class ProjectBundleTests(TestContext context)
|
||||
Assert.Throws<InvalidDataException>(() => ProjectBundle.Load(path));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AFileNoReadCouldTakeBackIsRefusedBeforeItIsWritten()
|
||||
{
|
||||
var folder = context.CreateTempDirectory("bundle");
|
||||
var path = Path.Combine(folder, "huge.chronos");
|
||||
var sample = Sample();
|
||||
var huge = sample with { Sequence = sample.Sequence with { Title = new string('x', ProjectBundle.MaxBytes) } };
|
||||
var refused = Assert.Throws<ProjectTooLargeException>(() => huge.Save(path));
|
||||
Assert.Equal(Loc.L("Errors.Project.TooLarge", ProjectBundle.MaxBytes >> 20), refused.Message);
|
||||
Assert.False(File.Exists(path));
|
||||
Assert.Empty(Directory.GetFiles(folder));
|
||||
|
||||
// Within the limit, the file is written and read back.
|
||||
sample.Save(path);
|
||||
Assert.Equal(sample.Sequence.Title, ProjectBundle.Load(path).Sequence.Title);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FramePositionsApplyOnlyToTheFramesTheyWereSavedFor()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user