fix(workspace): close the phase 5c review findings
Originals are now judged by their bytes, never by the media index: a removal or clean-up hashes every file under media/originals and deletes it only when the home holds that SHA-256; every other file, named or not, goes to the workspace trash. Trash entries are filled under a staging name that Empty never lists. A ledger can only name files inside exports/. Jobs follow the workspace: a copy, render or send resolves the folder that holds its project now (a moved workspace, a retry after a move) and waits while a move has not switched yet. A clean-up failure after the switch is a warning that keeps the journal for a later resume; entries that changed since they were copied are kept, and a same-volume rename refused across volumes falls back to copy and verify. Sends map a replayed version by content hash, or go with the project only, and note an old server that drops provenance. The media index (format 2) and project file (format 3) refuse older readers while they hold originals. Metered connections also hold sync downloads and server copies. The editor gains Send again, the Settings page can resume a stopped move, the disabled tooltips say why, and unused strings are pruned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
09fcff4eb2
commit
2654683a12
125 files changed
+1618
-401
No files matched your search
@@ -80,10 +80,20 @@ public sealed partial class WorkspaceHost
|
||||
/// </summary>
|
||||
public event Action? MoveEnded;
|
||||
|
||||
/// <summary>A move job followed here waits, runs or is paused (no disk is read).</summary>
|
||||
public bool IsMoveQueued
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_gate) return _moveJob != Guid.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A move stopped before it ended: the folder in use holds its journal and no move job waits, runs or is paused. Null
|
||||
/// when there is none (a move under way is no move to take up). A move job waiting at start is followed from now on,
|
||||
/// so the workspace waits for it (<see cref="IsMoving"/>).
|
||||
/// A move stopped before it ended: the folder in use holds its journal and no move job waits, runs or is paused; or a
|
||||
/// move switched to the folder in use and left part of the folder it came from (its journal there names what is left
|
||||
/// to clear). Null when there is none (a move under way is no move to take up). A move job waiting at start is followed
|
||||
/// from now on, so the workspace waits for it (<see cref="IsMoving"/>).
|
||||
/// </summary>
|
||||
public Task<WorkspaceMoveJournal?> UnfinishedMoveAsync(CancellationToken cancellationToken = default) => Task.Run(async () =>
|
||||
{
|
||||
@@ -96,7 +106,20 @@ public sealed partial class WorkspaceHost
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return WorkspaceMover.HasJournal(Root) ? WorkspaceMover.ReadJournal(Root) : null;
|
||||
if (WorkspaceMover.HasJournal(Root)) return WorkspaceMover.ReadJournal(Root);
|
||||
// The folder in use is a move's target: the folder it left may hold what could not be cleared after the switch.
|
||||
var root = Path.TrimEndingDirectorySeparator(Path.GetFullPath(Root));
|
||||
foreach (var state in new[] { JobState.Done, JobState.Failed, JobState.Cancelled })
|
||||
{
|
||||
foreach (var job in (await db.Jobs.ListAsync(state, JobKind.WorkspaceMove, 5, cancellationToken: cancellationToken).ConfigureAwait(false)).Items)
|
||||
{
|
||||
if (WorkspaceJobs.MoveParameters(job) is not { From.Length: > 0 } moved || !WorkspaceMover.HasJournal(moved.From)) continue;
|
||||
if (WorkspaceMover.ReadJournal(moved.From) is { Stage: WorkspaceMoveStage.Switched } left
|
||||
&& string.Equals(Path.TrimEndingDirectorySeparator(Path.GetFullPath(left.To)), root, StringComparison.OrdinalIgnoreCase))
|
||||
return left;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}, cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user