feat: single setup, mass-pass progress, per-server homes, Desktop shares its library (owner review 5, v1.1.0) (#68)
CI / Build and test (push) Successful in 11m36s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 12s
Release / Build, test and publish (push) Successful in 14m56s
CI / PostgreSQL 16 integration (push) Successful in 10m11s
CI / PostgreSQL 17 integration (push) Successful in 10m15s
CI / Docker image (push) Successful in 45s
Release / Server image (push) Successful in 4m55s

Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #68.
This commit is contained in:
Alby96 authored and Alby96 committed 2026-11-15 18:11:43 +01:00
1 parent 988068ee8e
commit 20d64af4a4
793 files changed
+23882 -2096

No files matched your search

@@ -233,6 +233,32 @@ public sealed class ServerWorkspaceTests(TestContext context)
Assert.Null(a.Store.Find(main.Id)!.ReadMedia());
}
[Test]
public async Task ACopyQueuedUnderTheAddressRunsOnAProjectReKeyedToTheServersId()
{
await using var server = await TestServer.StartAsync(context, services: ArchiveModule.Register);
var (_, _, token) = await server.UserAsync("alberto", "editor");
var sid = await SequenceAsync(server, token, 2);
var id = Guid.CreateVersion7();
var idKey = ServerIdentity.IdKey(id);
ServerIdentity? identity = null;
await using var a = await WorkspaceClient.StartAsync(context, server, token, "PC-A", sameServer: (x, y) => identity!.Same(x, y));
identity = ServerIdentity.None.With(id, a.Server);
// The project's home names the server by its id (re-keyed at sign-in, owner review 5); the job still names the address.
var home = new ServerProjectHome(a.Client, sid, "Test server", server: idKey);
var main = (await home.ListAsync(context.Cancellation)).Single();
var project = await a.Sync.CheckoutAsync(home, main.Id, cancellationToken: context.Cancellation);
Assert.Equal(idKey, project.ReadBundle().Workspace!.Home.Server);
var job = await a.EnqueueAsync(WorkspaceJobs.CopyFromServer(sid, Title, a.Server, a.Store.Root, main.Id));
await a.WaitAsync(job.Id, JobState.Done);
Assert.Equal(2, Assert.NotNull(project.ReadMedia()).Frames.Count);
// Another server is still another home.
var other = await a.EnqueueAsync(WorkspaceJobs.CopyFromServer(sid, Title, "https://elsewhere:8443", a.Store.Root, main.Id));
Assert.Equal(Loc.L("Errors.Workspace.OtherHome"), (await a.WaitAsync(other.Id, JobState.Failed)).Error);
}
[Test]
public async Task TheOriginalsAreDownloadedCheckedAndKeptBesideTheProxies()
{
@@ -560,7 +586,7 @@ public sealed class ServerWorkspaceTests(TestContext context)
public bool Connected { get; set; } = true;
public static async Task<WorkspaceClient> StartAsync(TestContext context, TestServer server, string token, string name, HttpMessageHandler? handler = null,
Func<bool>? hold = null)
Func<bool>? hold = null, Func<string?, string?, bool>? sameServer = null)
{
var db = await ChronosDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(context.CreateTempDirectory(name + "-db"), "chronos.db")), context.Cancellation);
var archives = new ArchiveService(db, new ArchiveServiceOptions { Owner = name });
@@ -568,7 +594,8 @@ public sealed class ServerWorkspaceTests(TestContext context)
var archive = await archives.CreateAsync(context.CreateTempDirectory(name + "-archive"), "Local", cancellationToken: context.Cancellation);
var client = new ChronosClient(server.HttpBase, new CertificatePinning([]), name, handler) { Token = token };
WorkspaceClient? created = null;
var options = hold is null ? WorkspaceJobOptions.For(archives) : WorkspaceJobOptions.For(archives) with { HoldTransfers = hold };
var options = WorkspaceJobOptions.For(archives) with { SameServer = sameServer };
if (hold is not null) options = options with { HoldTransfers = hold };
var engine = new JobEngine(db, WorkspaceJobs.CreateHandlers(db, archives, new Connector(client, () => created?.Connected ?? true), options),
new JobEngineOptions { Workers = 1, WorkerId = name, PollInterval = TimeSpan.FromMilliseconds(50), CheckpointInterval = TimeSpan.FromMilliseconds(50) });
await engine.StartAsync(context.Cancellation);