fix(workspace): follow server renames, never keep a thumbnail as a proxy on resume

A pull and the server's renamed event write the home's name into the copy, so
a rename made on the server reaches the workspace. A copy from a server marks
a thumbnail taken for a missing proxy before moving it into place; a resumed
run reads the marker and fetches the proxy the server has now, instead of
recording the thumbnail as one. Tests also cover the frames stamp (frames read
only when it moves), an older server's copy refusal and a viewer's 403 push.

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:45 +01:00
1 parent 44f0d30147
commit cdd29f8e84
4 files changed
+227 -7

No files matched your search

@@ -370,10 +370,41 @@ public sealed class WorkspaceSync(WorkspaceStore store, string clientName)
return new WorkspaceSyncResult(await StatusLockedAsync(project, home, cancellationToken).ConfigureAwait(false), [], pulled);
}
if (project.ReadSync().Conflict is null) PruneReplaced(project);
await FollowNameLockedAsync(project, home, cancellationToken).ConfigureAwait(false);
return new WorkspaceSyncResult(await StatusLockedAsync(project, home, cancellationToken).ConfigureAwait(false), [], pulled);
}
}
/// <summary>
/// The project's name (and whether it is Main) as its home has them now, written to the copy here: a rename made at the
/// home reaches the workspace. True when the copy's name changed; false when it already matched, or the home could not
/// say (unreachable, or no longer listing the project): the next pull or status tells those.
/// </summary>
public async Task<bool> FollowNameAsync(Guid projectId, IProjectHome home, CancellationToken cancellationToken = default)
{
ArgumentNullException.ThrowIfNull(home);
var project = Existing(projectId);
using (await project.LockAsync(LockWait, cancellationToken).ConfigureAwait(false))
return await FollowNameLockedAsync(project, home, cancellationToken).ConfigureAwait(false);
}
private static async Task<bool> FollowNameLockedAsync(WorkspaceProject project, IProjectHome home, CancellationToken cancellationToken)
{
SequenceProject? listed;
try
{
listed = (await home.ListAsync(cancellationToken).ConfigureAwait(false)).FirstOrDefault(p => p.Id == project.ProjectId);
}
catch (Exception ex) when (ex is HomeUnavailableException or ProjectException)
{
return false;
}
var bundle = project.ReadBundle();
if (listed is null || bundle.Workspace is not { } workspace || (workspace.Name == listed.Name && workspace.IsMain == listed.IsMain)) return false;
project.WriteBundle(bundle with { Workspace = workspace with { Name = listed.Name, IsMain = listed.IsMain } });
return true;
}
/// <summary>
/// Settles the conflict a pull or push stopped at, as the user was shown it (<paramref name="shown"/>, else the one
/// recorded). <see cref="ConflictChoice.KeepMine"/> keeps this workspace's values (but for the members in