fix(app): viewers open server sequences with proxies, the editor follows the sign-in

An account without Edit is offered Open with proxies on a server that keeps
projects and checks nothing out, since it could never push. The editor of a
server's workspace project connects with the sign-in in use at each call, so a
project opened signed out renders once signed in; SyncHost tells every session
start and stop so workspace projects read their state again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-04 12:54:46 +01:00
1 parent cdd29f8e84
commit 48d8158fd7
8 files changed
+165 -24

No files matched your search

@@ -2,6 +2,7 @@ using System.Globalization;
using System.Text.Json;
using Chronos.App.Editor;
using Chronos.App.Infrastructure;
using Chronos.App.Tests.Editor;
using Chronos.App.Workspace;
using Chronos.Core.Imaging.Decoders;
using Chronos.Core.Localization;
@@ -143,7 +144,10 @@ public sealed class ServerHomeTests(TestContext context)
var told = new List<WorkspaceHomeChange>();
host.HomeChanged += told.Add;
var source = new WorkspaceSequenceSource(host.Sync, projectId, bed.Db, DecoderFactory.CreateClient(null), bed.Engine, new WorkspaceServerHome(null));
// Opened signed out; the sign-in made later is the one the source connects with.
FakeRemoteSequenceApi? signedIn = null;
var source = new WorkspaceSequenceSource(host.Sync, projectId, bed.Db, DecoderFactory.CreateClient(null), bed.Engine,
new WorkspaceServerHome(() => signedIn, () => signedIn));
var content = await source.LoadAsync(bed.Ct);
var session = new EditorSession(source, content, [], TimeSpan.FromMilliseconds(20));
var ui = new RecordingUi();
@@ -160,6 +164,19 @@ public sealed class ServerHomeTests(TestContext context)
Assert.Empty(await source.ListJobsAsync(bed.Ct));
var refused = await Assert.ThrowsAsync<EditorException>(() => source.SubmitAsync(session.RenderRequests(session.Project.Export)[0], bed.Ct));
Assert.Equal(Loc.L("Editor.Error.SignedOut"), refused.Message);
// Signed in since: the render goes to the server on that sign-in's connection; signed in anew, on the new one's.
var first = new FakeRemoteSequenceApi(await bed.RowAsync(), []);
signedIn = first;
await source.SubmitAsync(session.RenderRequests(session.Project.Export)[0], bed.Ct);
Assert.Equal(1, first.Posted.Count);
var second = new FakeRemoteSequenceApi(await bed.RowAsync(), []);
signedIn = second;
await source.SubmitAsync(session.RenderRequests(session.Project.Export)[0], bed.Ct);
Assert.Equal((1, 1), (first.Posted.Count, second.Posted.Count));
var until = DateTime.UtcNow + TimeSpan.FromSeconds(TestTiming.Budget(10));
while (!first.Disposed && DateTime.UtcNow < until) await Task.Delay(20, bed.Ct);
Assert.True(first.Disposed, "the old sign-in's connection closes");
signedIn = null;
// In step with the server: the render names the version it holds, whose settings the server renders.
Assert.True(await menu.ReadyToRenderAsync(), "nothing to send");