fix(workspace): settle only the conflict shown, keep what a choice replaces, desktop gaps of phase 5a

Review 2, phase 5a, fix round 1 (desktop and the engine side of Resolve and Restore).

- Resolve applies Keep mine / Take the library's only to the conflict the dialog listed:
  when the head or what differs moved since, the new conflict is recorded and asked again;
  Sync re-works a pending conflict instead of re-showing a stale list. Take the library's
  first saves uncommitted changes as a version, and the editor takes it as one undo step
  (toast Undo, Ctrl+Z) that brings back only the settings both changed.
- Restore saves unsaved changes as a version also while a conflict waits; a restore that
  changed nothing, or was undone, no longer marks the next version as a Restore.
- The editor's saves and merges of a workspace project merge positions photo by photo
  (portable form) and ask where both sides changed a setting, never deciding for ours.
- Read-only after a pull is signalled, and no save that can never be stored is left behind.
- The chip is read again after edits; a background conflict waits for the open dialog;
  Send first and Delete show the conflict they met; Discard changes needs the typed name.
- Open project... reaches the library's other projects (Save both's sibling, also from
  its toast); copies whose project or sequence is gone read Not in library and can be
  removed from the picker's Workspace rows; a delete whose local copy stays says so.
- A workspace folder inside a library is refused before anything is written.
- Conflict and Compare lines name heroes, exclusions and keyframes; History shows the PC
  name alone, never the program's prefixes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-03 10:22:17 +01:00
1 parent 50e28fd63d
commit 8027d84f7e
28 files changed
+1321 -134

No files matched your search

+31 -7
View File
@@ -8,6 +8,7 @@ using Chronos.App.Infrastructure;
using Chronos.App.Jobs;
using Chronos.App.Server;
using Chronos.App.Shell;
using Chronos.App.Workspace;
using Chronos.Core.Advice;
using Chronos.Core.Analysis;
using Chronos.Core.Diagnostics;
@@ -480,7 +481,7 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
/// <summary>Why the controls that change the project are disabled; null while they are not.</summary>
public string? LockedToolTip => IsOutdated ? Loc.L("Tooltips.Editor.Outdated", ServerName)
: IsReadOnly ? Loc.L("Tooltips.Editor.ReadOnly")
: IsReadOnly ? Loc.L(Session.Source is WorkspaceSequenceSource ? "Errors.Workspace.ReadOnly" : "Tooltips.Editor.ReadOnly")
: IsBusy ? Loc.L("Tooltips.Editor.Busy")
: null;
@@ -1053,17 +1054,33 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
});
/// <summary>
/// A save met settings someone changed to other values on the server (BRIEF §14.5 "explicit conflict prompt"): the
/// dialog lists them; Keep mine overwrites the server's, Take server (the safe default, also on Esc) shows theirs as
/// one undoable step. Saving waits until then.
/// A save met settings someone changed to other values on the server (BRIEF §14.5 "explicit conflict prompt"), or, for
/// a workspace project, that a sync took from the library while the edit waited (owner review 2, R8): the dialog lists
/// them; Keep mine overwrites the other side's, Take server or the library's (the safe default, also on Esc) shows theirs
/// as one undoable step. Saving waits until then.
/// </summary>
private void OnConflictFound(ProjectConflictException conflict) => _dispatcher.BeginInvoke(() =>
{
if (_disposed || Session.Conflict is null) return;
var keepMine = Shell.Services.Dialogs.Confirm(ConflictRequest(conflict, Title, ServerName ?? string.Empty));
var request = Session.Source is WorkspaceSequenceSource ? LibraryConflictRequest(conflict, Title) : ConflictRequest(conflict, Title, ServerName ?? string.Empty);
var keepMine = Shell.Services.Dialogs.Confirm(request);
if (!_disposed) Session.ResolveConflict(keepMine);
});
/// <summary>The conflict prompt of a workspace project: what differs (the editor's value, then the library's) and what each choice keeps.</summary>
internal static ConfirmRequest LibraryConflictRequest(ProjectConflictException conflict, string title) => new()
{
Heading = Loc.L("Editor.Workspace.Conflict.Title"),
Message = Loc.L("Editor.Workspace.Edited.Message", title),
Detail = string.Join(Environment.NewLine, WorkspaceText.ConflictLines(conflict.Differences, 10)),
DetailToolTip = Loc.L("Tooltips.Editor.Workspace.Differences"),
SafeText = Loc.L("Editor.Workspace.Conflict.TakeHome"),
SafeToolTip = Loc.L("Tooltips.Editor.Workspace.TakeHomeUndo"),
ActionText = Loc.L("Server.Sync.Action.KeepMine"),
ActionToolTip = Loc.L("Tooltips.Editor.Workspace.KeepMine"),
IsDestructive = true,
};
/// <summary>The conflict prompt: what differs (the editor's value, then the server's) and what each choice replaces.</summary>
internal static ConfirmRequest ConflictRequest(ProjectConflictException conflict, string title, string server) => new()
{
@@ -1160,8 +1177,9 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
}
/// <summary>
/// The frames of the server sequence changed while it is open (any thread): everything that changes the project is
/// disabled and says why, and a toast offers to fetch the proxies again.
/// The frames of the server sequence changed while it is open, or a workspace project's sync took a newer Chronos's
/// settings (any thread): everything that changes the project is disabled and says why, and a toast says so (for a
/// server sequence, offering to fetch the proxies again).
/// </summary>
private void OnReadOnlyChanged() => _dispatcher.BeginInvoke(() =>
{
@@ -1173,6 +1191,12 @@ public sealed class EditorViewModel : LocalizedViewModel, IAsyncDisposable
OnPropertyChanged(nameof(RenderChoiceToolTip));
OnRenderStateChanged();
OnBusyChanged();
// A workspace project a sync turned read-only (a newer Chronos saved it): said once, the controls say why too.
if (IsReadOnly && Session.Source is WorkspaceSequenceSource)
{
Shell.ShowToast(new Toast { Title = Loc.L("Editor.Workspace.ReadOnly"), Message = Loc.L("Errors.Workspace.ReadOnly") });
return;
}
if (!IsOutdated) return;
var (id, title) = (Session.Content.Sequence.Id, Title);
Shell.ShowToast(new Toast