fix(editor): server jobs, stale proxies and read-only accounts in the remote editor

- A server sequence whose cached frames are no longer the server's (a load, a 409
  merge or a frames change event finds other frame ids) turns read-only and says
  why; opening it, or a sequence without cached proxies, queues the proxy
  download and opens it when done. Signed out reads "Connect to the server".
- Server jobs show queued, running (with a bar), paused and analysing glyphs in
  the header with Cancel; a failed or cancelled one raises a toast with Retry.
  Progress alone no longer refreshes the whole editor.
- The server job list is read by state and kind to its last page; "Add to queue"
  sets the job's priority; the event listener survives any failure and always
  releases its frames and connection.
- An account that may render but not edit picks the preset to render without
  changing the project; preset cards and their batch boxes say why they wait.
- Export tab of a server sequence: no local encoder, notices or folder; no Jobs
  history link. Sync at 12 px beside a folder that keeps 96 px and trims.
- Restore's Undo puts back the project from before the restore, only while that
  restore is the editor's last change.
- Export "Sync" of a render that ends while the session is down is queued for the
  saved session's server; skips are logged; sync follows the engine before it
  starts.
- Capture: sequence-remote-export, -running and -readonly, and
  sequence-export-copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-05 22:15:34 +00:00
1 parent 2813184b85
commit 757695f037
27 files changed
+932 -173

No files matched your search

+90 -26
View File
@@ -10,6 +10,7 @@ using Titano.Core.Model;
using Titano.Core.Project;
using Titano.Core.Video;
using Titano.Data.Processing;
using Titano.Ui.Controls;
using Titano.Ui.Mvvm;
namespace Titano.App.Editor;
@@ -31,9 +32,12 @@ public sealed class PresetCard(ExportTab owner, ExportChoice choice) : Observabl
/// <summary>Sequence presets apply full settings; export presets only choose the output.</summary>
public bool IsSequencePreset => Choice.Sequence is not null;
public string ToolTip => Choice.Reason is { } reason
/// <summary>What choosing the card does, or why it cannot be chosen now (a job runs, the project cannot change).</summary>
public string ToolTip => owner.Editor.LockedToolTip ?? (Choice.Reason is { } reason
? Loc.L(IsSequencePreset ? "Tooltips.Editor.Export.ApplyPreset" : "Tooltips.Editor.Export.Recommended", reason)
: Loc.L("Tooltips.Editor.Export.Preset", Name);
: Loc.L("Tooltips.Editor.Export.Preset", Name));
public string BatchToolTip => owner.Editor.LockedToolTip ?? Loc.L("Tooltips.Editor.Export.InBatch");
/// <summary>"MP4 · HEVC Main10 · 3840×2160 · 24 fps".</summary>
public string? Format { get => _format; private set => Set(ref _format, value); }
@@ -57,6 +61,7 @@ public sealed class PresetCard(ExportTab owner, ExportChoice choice) : Observabl
public ICommand SelectCommand => owner.SelectCommand;
/// <remarks>A server sequence renders on the server: this PC's encoders neither name nor rule out the encoding.</remarks>
public void Update(ExportPlan? plan)
{
if (plan is null)
@@ -65,12 +70,20 @@ public sealed class PresetCard(ExportTab owner, ExportChoice choice) : Observabl
return;
}
var settings = plan.Setup.Encoder.Settings;
var remote = owner.Editor.IsRemote;
Format = EditorText.Format(plan.Export, settings.Width, settings.Height);
Encoding = EditorText.Encoding(plan.Export, settings.BitRate, plan.Setup.Encoder.Capability?.Name);
Estimate = plan.Setup.Encoder.IsReady ? EditorText.Estimate(plan.Estimate) : Loc.L("Editor.Export.Unavailable");
Encoding = EditorText.Encoding(plan.Export, settings.BitRate, remote ? null : plan.Setup.Encoder.Capability?.Name);
Estimate = remote || plan.Setup.Encoder.IsReady ? EditorText.Estimate(plan.Estimate) : Loc.L("Editor.Export.Unavailable");
}
public void RefreshBatch() => OnPropertyChanged(nameof(IsInBatch));
/// <summary>A job of the sequence started or ended, or the project became read-only: the tooltips say why the card waits.</summary>
public void RefreshLocked()
{
OnPropertyChanged(nameof(ToolTip));
OnPropertyChanged(nameof(BatchToolTip));
}
}
/// <summary>A codec choice of the Output panel with the profile and depth it implies.</summary>
@@ -154,11 +167,14 @@ public sealed class ExportTab : EditorTab
public string AddToQueueToolTip => Editor.RenderBlockedReason ?? Loc.L("Tooltips.Editor.Export.AddToQueue");
public string BatchToolTip => Editor.RenderBlockedReason ?? (Batch.Count == 0 ? Loc.L("Tooltips.Editor.Export.BatchEmpty")
: Editor.IsRemote ? Loc.L("Tooltips.Editor.Export.BatchServer", Editor.RemoteText ?? string.Empty)
: Editor.IsRemote ? Loc.L("Tooltips.Editor.Export.BatchServer", Editor.ServerName)
: Loc.L("Tooltips.Editor.Export.Batch"));
public bool HasHistory => Editor.Session.Content.Renders.Count > 0;
/// <summary>The "history" link opens this PC's Jobs screen, which does not list a server's jobs.</summary>
public bool CanOpenHistory => !Editor.IsRemote;
/// <summary>The newest render is a file on this PC (a server's renders stay on the server).</summary>
public bool CanReveal => Editor.Session.Content.Renders is [{ OutputPath.Length: > 0 }, ..];
@@ -208,7 +224,7 @@ public sealed class ExportTab : EditorTab
}
}
/// <summary>"Restore · 03/10/2026 14:22".</summary>
/// <summary>"Restore settings · 03/10/2026 14:22".</summary>
public string RestoreText => Loc.L("Editor.Export.Restore", SelectedCopy?.Label ?? string.Empty);
public string RestoreToolTip => Editor.LockedToolTip ?? Loc.L("Tooltips.Editor.Export.Restore", SelectedCopy?.Label ?? string.Empty);
@@ -296,6 +312,11 @@ public sealed class ExportTab : EditorTab
public IReadOnlyList<Choice> Encoders { get => _encoders; private set => Set(ref _encoders, value); }
/// <summary>The encoder is this PC's choice only for its own renders; the server or its render node picks its own.</summary>
public bool CanChooseEncoder => !Editor.IsRemote;
public string EncoderToolTip => Editor.IsRemote ? Loc.L("Tooltips.Editor.Export.EncoderServer", Editor.ServerName) : Loc.L("Tooltips.Editor.Export.Encoder");
public Choice? SelectedEncoder
{
get => Encoders.FirstOrDefault(e => Equals(e.Value, Export.Overrides.Encoder ?? string.Empty));
@@ -305,10 +326,12 @@ public sealed class ExportTab : EditorTab
}
}
/// <summary>"hardware", "software" (the word, not a colour, carries the state).</summary>
public string? EncoderKind => Editor.Plan?.Setup.Encoder.Capability is { } c ? Loc.L(c.Hardware ? "Editor.Export.Hardware" : "Editor.Export.Software") : null;
/// <summary>"hardware", "software" for this PC's encoder (the word, not a colour, carries the state).</summary>
public string? EncoderKind => !Editor.IsRemote && Editor.Plan?.Setup.Encoder.Capability is { } c
? Loc.L(c.Hardware ? "Editor.Export.Hardware" : "Editor.Export.Software")
: null;
public bool IsHardware => Editor.Plan?.Setup.Encoder.Capability?.Hardware == true;
public bool IsHardware => !Editor.IsRemote && Editor.Plan?.Setup.Encoder.Capability?.Hardware == true;
public IReadOnlyList<Choice> Depths { get => _depths; private set => Set(ref _depths, value); }
@@ -332,9 +355,10 @@ public sealed class ExportTab : EditorTab
public IReadOnlyList<SaveChoice> SaveChoices { get => _saveChoices; private set => Set(ref _saveChoices, value); }
/// <summary>The project's folder; a server sequence always renders into its exports folder on the server.</summary>
public SaveChoice? SelectedSave
{
get => SaveChoices.FirstOrDefault(c => !c.Browse && c.Folder == Export.Folder);
get => SaveChoices.FirstOrDefault(c => !c.Browse && c.Folder == (CanChooseFolder ? Export.Folder : null));
set
{
if (_refreshing || value is null) return;
@@ -353,10 +377,11 @@ public sealed class ExportTab : EditorTab
? Loc.L("Tooltips.Editor.Export.FolderServer")
: Loc.L("Tooltips.Editor.Export.Folder", Export.Folder ?? Editor.Session.Content.ExportsFolder ?? string.Empty);
public string? EstimatedSize => Editor.Plan is { Setup.Encoder.IsReady: true } plan ? Formatting.Bytes(plan.Estimate.Bytes) : null;
public string? EstimatedSize => Estimated is { } plan ? Formatting.Bytes(plan.Estimate.Bytes) : null;
public string? EstimatedTime => Editor.Plan is { Setup.Encoder.IsReady: true } plan
? Loc.L("Editor.Export.About", Formatting.Duration(plan.Estimate.Time)) + (plan.Setup.Encoder.Capability is { } c ? " · " + c.Name : string.Empty)
/// <summary>"about 5 min · NVENC"; without this PC's encoder for a server sequence.</summary>
public string? EstimatedTime => Estimated is { } plan
? Loc.L("Editor.Export.About", Formatting.Duration(plan.Estimate.Time)) + (!Editor.IsRemote && plan.Setup.Encoder.Capability is { } c ? " · " + c.Name : string.Empty)
: null;
public string? ResultName => Editor.Plan?.FileName;
@@ -378,6 +403,9 @@ public sealed class ExportTab : EditorTab
private ResolvedExport Resolved => Editor.Plan?.Export ?? ExportResolver.Resolve(Export);
/// <summary>The plan when its estimates mean something: this PC can encode it, or the server renders it.</summary>
private ExportPlan? Estimated => Editor.Plan is { } plan && (Editor.IsRemote || plan.Setup.Encoder.IsReady) ? plan : null;
public bool IsInBatch(string presetId) => Export.Batch.Contains(presetId, StringComparer.OrdinalIgnoreCase);
public void SetInBatch(string presetId, bool value)
@@ -393,8 +421,8 @@ public sealed class ExportTab : EditorTab
try
{
UpdateLists();
SaveChoices = Export.Folder is { } folder
? [new SaveChoice(null), new SaveChoice(folder), new SaveChoice(null, Browse: true)]
SaveChoices = !CanChooseFolder ? [new SaveChoice(null)]
: Export.Folder is { } folder ? [new SaveChoice(null), new SaveChoice(folder), new SaveChoice(null, Browse: true)]
: [new SaveChoice(null), new SaveChoice(null, Browse: true)];
if (!NameTemplate.IsDirty) NameTemplate.Load(Export.NameTemplate);
OnAllPropertiesChanged();
@@ -403,11 +431,8 @@ public sealed class ExportTab : EditorTab
{
_refreshing = false;
}
foreach (var card in Cards)
{
card.IsSelected = card.Choice.Sequence is null && string.Equals(card.Choice.ExportPresetId, Resolved.PresetId, StringComparison.OrdinalIgnoreCase);
card.RefreshBatch();
}
SelectCards();
foreach (var card in Cards) card.RefreshBatch();
_ = EstimateCardsAsync();
}
@@ -420,15 +445,21 @@ public sealed class ExportTab : EditorTab
if (!Width.IsDirty) Width.Load(settings?.Width.ToString(CultureInfo.InvariantCulture) ?? string.Empty);
if (!Height.IsDirty) Height.Load(settings?.Height.ToString(CultureInfo.InvariantCulture) ?? string.Empty);
UpdateLists();
Notices = Editor.Plan is { } plan
? [.. plan.Setup.Warnings.Select(w => Loc.L(w.Key, [.. w.Args])).Concat(plan.Export.Warnings.Select(k => Loc.L(k))).Distinct()]
: [];
Notices = Editor.Plan is { } plan ? PlanNotices(plan) : [];
OnAllPropertiesChanged();
}
finally
{
_refreshing = false;
}
// The plan follows the preset a read-only session chose to render.
SelectCards();
}
public override void OnBusyChanged()
{
base.OnBusyChanged();
foreach (var card in Cards) card.RefreshLocked();
}
public override void OnContentChanged()
@@ -479,6 +510,24 @@ public sealed class ExportTab : EditorTab
private void LoadCards() => Cards = [.. ExportPlanner.Choices(Editor.Session.Presets, Editor.Session.Advice).Select(c => new PresetCard(this, c))];
/// <summary>The card of the export preset the plan renders.</summary>
private void SelectCards()
{
foreach (var card in Cards)
card.IsSelected = card.Choice.Sequence is null && string.Equals(card.Choice.ExportPresetId, Resolved.PresetId, StringComparison.OrdinalIgnoreCase);
}
/// <summary>
/// What the plan changed or cannot do, localised; for a server sequence without this PC's encoder notices (the server
/// or its render node picks the encoder).
/// </summary>
private IReadOnlyList<string> PlanNotices(ExportPlan plan)
{
var encoder = Editor.IsRemote ? plan.Setup.Encoder.Notices.Select(n => n.Key).ToHashSet(StringComparer.Ordinal) : [];
return [.. plan.Setup.Warnings.Where(w => !encoder.Contains(w.Key)).Select(w => Loc.L(w.Key, [.. w.Args]))
.Concat(plan.Export.Warnings.Select(k => Loc.L(k))).Distinct()];
}
/// <summary>Estimates every card off the UI thread for the project as it is now (latest request wins).</summary>
private async Task EstimateCardsAsync()
{
@@ -507,13 +556,18 @@ public sealed class ExportTab : EditorTab
for (var i = 0; i < cards.Count; i++) cards[i].Update(plans[i]);
}
/// <summary>Makes the chosen copy the project as one undo step; the toast offers Undo.</summary>
/// <summary>
/// Makes the chosen copy the project as one undo step. The toast's Undo brings back the project as it was before, as
/// a new step, while the restore is still the last change of this editor (a later edit would otherwise be undone).
/// </summary>
private async Task RestoreAsync()
{
if (SelectedCopy is not { } copy) return;
var session = Editor.Session;
var before = session.Project;
try
{
if (!await Editor.Session.RestoreAsync(copy))
if (!await session.RestoreAsync(copy))
{
Editor.Shell.Notify(Loc.L("Editor.Copy.Same"), copy.Label);
return;
@@ -524,7 +578,17 @@ public sealed class ExportTab : EditorTab
Editor.Shell.ReportError(ex);
return;
}
Editor.Shell.Notify(Loc.L("Editor.Copy.Restored"), copy.Label, Loc.L("Editor.Copy.Undo"), Loc.L("Tooltips.Editor.Copy.Undo"), () => Editor.Session.Undo());
var restored = session.Project;
var editor = Editor;
bool Undoable() => ReferenceEquals(editor.Shell.Sequence.Editor, editor) && ReferenceEquals(session.Project, restored);
editor.Shell.ShowToast(new Toast
{
Title = Loc.L("Editor.Copy.Restored"),
Message = copy.Label,
ActionText = Loc.L("Editor.Copy.Undo"),
ActionToolTip = Loc.L("Tooltips.Editor.Copy.Undo"),
ActionCommand = new RelayCommand(() => session.Edit(_ => before), Undoable),
});
}
private void OpenHistory()