feat: owner review 2 phase 5b: the server as a project home (#17)
CI / Build and test (push) Successful in 9m58s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
Release / Build, test and publish (push) Successful in 14m8s
CI / PostgreSQL 16 integration (push) Successful in 8m55s
CI / PostgreSQL 17 integration (push) Successful in 8m50s
CI / Docker image (push) Successful in 57s
Release / Server image (push) Successful in 1m22s
CI / Build and test (push) Successful in 9m58s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
Release / Build, test and publish (push) Successful in 14m8s
CI / PostgreSQL 16 integration (push) Successful in 8m55s
CI / PostgreSQL 17 integration (push) Successful in 8m50s
CI / Docker image (push) Successful in 57s
Release / Server image (push) Successful in 1m22s
A Chronos Server keeps its sequences' projects, as a PC's archive does: Main and named projects with versions under /api/v1/sequences/{id}/projects, the projects capability and the projectChanged event. The desktop opens a server's sequences in the workspace (proxies downloaded, hash-checked, resumable) with Save version, Sync, conflicts, History, Restore and the project actions against the server. Renders can be of a project version. The admin panel lists a sequence's projects and versions. Strings in all 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 #17.
This commit is contained in:
1 parent
255e149087
commit
81c303f484
325 files changed
+11477
-516
No files matched your search
@@ -51,6 +51,61 @@ public sealed class SyncAgentTests(TestContext context)
|
||||
Assert.Same(first, agent.Snapshot);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task ProjectChangesAreToldAndALostStreamSaysSomeWereMissed()
|
||||
{
|
||||
// Owner review 2, R8, phase 5b: the server's projectChanged reaches the workspace through the agent.
|
||||
await using var f = await SyncFixture.CreateAsync(context);
|
||||
f.Remote.Add("Harbour", f.NewPhotos(1));
|
||||
f.Remote.FailingEvents = 1;
|
||||
var told = new List<ProjectChangedEvent?>();
|
||||
var missed = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
var changed = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
await using var agent = new SyncAgent(f.Sync, f.Remote, () => new SyncPolicy(), null, EventsOnly);
|
||||
agent.ProjectChanged += e =>
|
||||
{
|
||||
lock (told) told.Add(e);
|
||||
(e is null ? missed : changed).TrySetResult();
|
||||
// What a listener throws never ends the event loop.
|
||||
throw new InvalidOperationException("a listener that fails");
|
||||
};
|
||||
agent.Start();
|
||||
|
||||
// The stream was lost once: the comparison after it says changes may have been missed.
|
||||
await SignalAsync(missed.Task, "the missed changes told");
|
||||
var change = new ProjectChangedEvent(Guid.CreateVersion7(), Guid.CreateVersion7(), ProjectChanges.Pushed, 3, Guid.CreateVersion7());
|
||||
f.Remote.Publish(change);
|
||||
await SignalAsync(changed.Task, "the project change told");
|
||||
lock (told) Assert.Equal(change, told.Single(e => e is not null));
|
||||
Assert.Equal(1, agent.Snapshot!.ServerSequences);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task MissedChangesAreToldOnlyOnceTheStreamIsOpenAgain()
|
||||
{
|
||||
// A change said between "changes may have been missed" and the stream's return would be lost for good: the signal
|
||||
// comes from a comparison that started once the stream was open again, so every later change reaches the workspace.
|
||||
await using var f = await SyncFixture.CreateAsync(context);
|
||||
f.Remote.Add("Harbour", f.NewPhotos(1));
|
||||
(f.Remote.FailingEvents, f.Remote.DropWhileClosed, f.Remote.ReconnectDelay) = (1, true, TimeSpan.FromMilliseconds(800));
|
||||
var subscribedWhenMissed = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
var changed = new TaskCompletionSource<ProjectChangedEvent>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
await using var agent = new SyncAgent(f.Sync, f.Remote, () => new SyncPolicy(), null, EventsOnly);
|
||||
agent.ProjectChanged += e =>
|
||||
{
|
||||
if (e is null) subscribedWhenMissed.TrySetResult(f.Remote.Subscribed);
|
||||
else changed.TrySetResult(e);
|
||||
};
|
||||
agent.Start();
|
||||
|
||||
await SignalAsync(subscribedWhenMissed.Task, "the missed changes told");
|
||||
Assert.True(await subscribedWhenMissed.Task, "the stream was open again when the missed changes were told");
|
||||
var change = new ProjectChangedEvent(Guid.CreateVersion7(), Guid.CreateVersion7(), ProjectChanges.Pushed, 2, Guid.CreateVersion7());
|
||||
f.Remote.Publish(change);
|
||||
await SignalAsync(changed.Task, "the change said after the signal told");
|
||||
Assert.Equal(change, await changed.Task);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task FailedComparisonsAreRetriedWithBackoff()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user