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

+59 -14
View File
@@ -37,9 +37,10 @@ public static class ProjectNames
}
/// <summary>
/// "Open in workspace" (owner review 2, R8), asked when a sequence has no project in the workspace yet: which project of
/// its home (Main, made from the sequence's settings as they are, or another) or a new one with its name, and the media
/// to copy (proxies; the originals come in phase 5c). Open queues the copy; the sequence opens once it is done.
/// "Open in workspace" (owner review 2, R8), asked when a sequence has no project in the workspace yet, and by the project
/// menu's Open project: which project of its home (Main, made from the sequence's settings as they are, or another) or a
/// new one with its name, and the media to copy (proxies; the originals come in phase 5c). Open queues the copy; the
/// sequence opens once it is done.
/// </summary>
public sealed class OpenInWorkspaceDialogViewModel : ArchiveDialogViewModel
{
@@ -47,14 +48,17 @@ public sealed class OpenInWorkspaceDialogViewModel : ArchiveDialogViewModel
private ProjectOption? _selected;
private bool _isNew;
public OpenInWorkspaceDialogViewModel(string sequenceTitle, IReadOnlyList<SequenceProject> projects, Action<ArchiveDialogViewModel> close)
/// <param name="taken">The names a new project cannot take (default: those of <paramref name="projects"/>).</param>
public OpenInWorkspaceDialogViewModel(string sequenceTitle, IReadOnlyList<SequenceProject> projects, Action<ArchiveDialogViewModel> close,
IReadOnlyList<string>? taken = null)
: base(close)
{
SequenceTitle = sequenceTitle;
Projects = [.. projects.OrderByDescending(p => p.IsMain).Select(p => new ProjectOption(p))];
_selected = Projects.FirstOrDefault();
_isNew = Projects.Count == 0;
NewName = new EditableField(string.Empty, n => ProjectNames.Validate(n, projects.Select(p => p.Name)), _ => { }, () => Loc.L("Tooltips.Editor.OpenWorkspace.Name"));
var names = taken ?? [.. projects.Select(p => p.Name)];
NewName = new EditableField(string.Empty, n => ProjectNames.Validate(n, names), _ => { }, () => Loc.L("Tooltips.Editor.OpenWorkspace.Name"));
NewName.PropertyChanged += (_, _) => Refresh();
OpenCommand = new RelayCommand(Open, () => CanOpen);
}
@@ -436,20 +440,24 @@ public sealed class ConflictDialogViewModel : ArchiveDialogViewModel
/// <summary>
/// "Remove local copy": the plan (files and size of the copy; versions not sent and changes not saved), then Remove
/// (only when everything is at the library), Send first (sends, then removes), or Discard changes (removes; the unsent
/// work is kept aside in the workspace's trash).
/// (only when everything is at the library), Send first (sends, then removes), or Discard changes (removes once the
/// user typed the project's name; the unsent work is kept aside in the workspace's trash). A project the library no
/// longer has (<see cref="WorkspaceRemovalPlan.Gone"/>) can only be discarded that way.
/// </summary>
public sealed class RemoveCopyDialogViewModel : ArchiveDialogViewModel
{
private readonly Func<bool, Task> _remove;
private readonly Func<Task> _sendFirst;
private readonly Func<bool> _confirmDiscard;
public RemoveCopyDialogViewModel(WorkspaceRemovalPlan plan, Func<bool, Task> remove, Func<Task> sendFirst, Action<ArchiveDialogViewModel> close)
/// <param name="confirmDiscard">The typed confirmation Discard changes asks first (<see cref="ConfirmDiscard"/>); true when the user confirmed.</param>
public RemoveCopyDialogViewModel(WorkspaceRemovalPlan plan, Func<bool, Task> remove, Func<Task> sendFirst, Func<bool> confirmDiscard, Action<ArchiveDialogViewModel> close)
: base(close)
{
Plan = plan;
_remove = remove;
_sendFirst = sendFirst;
_confirmDiscard = confirmDiscard;
Facts =
[
new DialogFact(Loc.L("Editor.RemoveCopy.Files"), Formatting.Count(plan.Files)),
@@ -457,9 +465,9 @@ public sealed class RemoveCopyDialogViewModel : ArchiveDialogViewModel
new DialogFact(Loc.L("Editor.RemoveCopy.Unsent"), Formatting.Count(plan.Unsent)),
new DialogFact(Loc.L("Editor.RemoveCopy.Changed"), Loc.L(plan.Modified ? "Editor.RemoveCopy.Yes" : "Editor.RemoveCopy.No")),
];
RemoveCommand = new AsyncRelayCommand(() => RunAsync(() => _remove(false)), () => !IsBusy && plan.IsSafe && !plan.Offline);
SendFirstCommand = new AsyncRelayCommand(() => RunAsync(_sendFirst), () => !IsBusy && !plan.IsSafe && !plan.Conflict && !plan.Offline);
DiscardCommand = new AsyncRelayCommand(() => RunAsync(() => _remove(true)), () => !IsBusy && !plan.IsSafe);
RemoveCommand = new AsyncRelayCommand(() => RunAsync(() => _remove(false)), () => !IsBusy && plan.IsSafe && !plan.Offline && !plan.Gone);
SendFirstCommand = new AsyncRelayCommand(() => RunAsync(_sendFirst), () => !IsBusy && !plan.IsSafe && !plan.Conflict && !plan.Offline && !plan.Gone);
DiscardCommand = new AsyncRelayCommand(DiscardAsync, () => !IsBusy && HasUnsent);
}
public WorkspaceRemovalPlan Plan { get; }
@@ -468,7 +476,8 @@ public sealed class RemoveCopyDialogViewModel : ArchiveDialogViewModel
public IReadOnlyList<DialogFact> Facts { get; }
public bool HasUnsent => !Plan.IsSafe;
/// <summary>Something would not be at the library after the removal (or the library no longer has the project): Discard changes shows.</summary>
public bool HasUnsent => !Plan.IsSafe || Plan.Gone;
public ICommand RemoveCommand { get; }
@@ -476,12 +485,48 @@ public sealed class RemoveCopyDialogViewModel : ArchiveDialogViewModel
public ICommand DiscardCommand { get; }
public string RemoveToolTip => Plan.IsSafe ? Plan.Offline ? Loc.L("Errors.Workspace.Offline") : Loc.L("Tooltips.Editor.RemoveCopy.Remove") : Loc.L("Errors.Workspace.Unsent");
public string RemoveToolTip => Plan.Gone ? Loc.L("Errors.Workspace.ProjectGone")
: !Plan.IsSafe ? Loc.L("Errors.Workspace.Unsent")
: Plan.Offline ? Loc.L("Errors.Workspace.Offline")
: Loc.L("Tooltips.Editor.RemoveCopy.Remove");
public string SendFirstToolTip => Plan.Conflict ? Loc.L("Errors.Workspace.Conflict") : Plan.Offline ? Loc.L("Errors.Workspace.Offline") : Loc.L("Tooltips.Editor.RemoveCopy.SendFirst");
public string SendFirstToolTip => Plan.Gone ? Loc.L("Errors.Workspace.ProjectGone")
: Plan.Conflict ? Loc.L("Errors.Workspace.Conflict")
: Plan.Offline ? Loc.L("Errors.Workspace.Offline")
: Loc.L("Tooltips.Editor.RemoveCopy.SendFirst");
public string DiscardToolTip => Loc.L("Tooltips.Editor.RemoveCopy.Discard");
/// <summary>
/// The typed confirmation of Discard changes (the plan's cross-cutting rule for what Chronos cannot bring back): the
/// project's name, as shown, typed before Discard enables.
/// </summary>
public static ConfirmRequest DiscardRequest(string projectName) => new()
{
Heading = Loc.L("Editor.RemoveCopy.DiscardTitle", projectName),
Message = Loc.L("Editor.RemoveCopy.DiscardMessage"),
SafeText = Loc.L("Editor.Project.Keep"),
SafeToolTip = Loc.L("Tooltips.Editor.RemoveCopy.Keep"),
ActionText = Loc.L("Editor.RemoveCopy.Discard"),
ActionToolTip = Loc.L("Tooltips.Editor.RemoveCopy.Discard"),
IsDestructive = true,
TypedConfirmation = projectName,
TypedPrompt = Loc.L("Editor.RemoveCopy.TypeName"),
};
/// <summary>Asks <see cref="DiscardRequest"/> through <paramref name="ui"/>: true when the user typed the name and confirmed.</summary>
public static bool ConfirmDiscard(IWorkspaceUi ui, string projectName)
{
ArgumentNullException.ThrowIfNull(ui);
return ui.Confirm(DiscardRequest(projectName));
}
private async Task DiscardAsync()
{
if (!_confirmDiscard()) return;
await RunAsync(() => _remove(true));
}
private async Task RunAsync(Func<Task> action)
{
ClearError();