fix(workspace): finish or keep every choice, copy and sync a cut or a deleted project leaves
- A take of the library's values cut past its commit point settles its conflict (replay journal marks Settles); a later stale choice finds nothing to settle, and one cut before it keeps the conflict so the next choice is applied. - A local version that changes nothing once replayed on the head is not sent nor written as a Merge; its file stays in versions/.replaced. - Save both journals its intent (name, base, time) before the home is asked, so a cut after the copy was made reuses that copy on retry. - A project deleted at the home reads as Gone from pull, push, resolve and save both, logged once, without retry loops; versions and working state stay. - Save both keeps the restore recorded in sync.json. - The copy job writes a photo's new bytes under a name of its own while the editor's media still name the old file, switching at the commit; a cancelled first copy removes its own half media under the lease (VM hook removed). - Status reads the version files once, re-reads the home's frames only when its stamp moved, reports damage only when confirmed under the lease, and waits once for a busy lease before calling the media outdated. - versions/.replaced is pruned after a sync that ended well (30 days, newest 20 kept, never a file a journal names). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
488b588ad9
commit
5eeb64b680
14 files changed
+1183
-216
No files matched your search
@@ -83,6 +83,19 @@ internal sealed class WorkspaceFixture : IAsyncDisposable
|
||||
return await Archive.WaitForAsync(job.Id, expected, (int)TestTiming.Budget(60));
|
||||
}
|
||||
|
||||
/// <summary>Queues a workspace copy job and returns at once, while it runs.</summary>
|
||||
public async Task<Job> StartCopyAsync(WorkspaceStore store, Guid projectId)
|
||||
{
|
||||
var engine = await EngineAsync();
|
||||
return await engine.EnqueueAsync(WorkspaceJobs.Copy(Sequence, store.Root, projectId), cancellationToken: Ct);
|
||||
}
|
||||
|
||||
/// <summary>Cancels a job, as the user does from the jobs list.</summary>
|
||||
public async Task CancelAsync(Guid jobId) => await (await EngineAsync()).CancelAsync(jobId, Ct);
|
||||
|
||||
/// <summary>Pauses a job, as the user does from the jobs list.</summary>
|
||||
public async Task PauseAsync(Guid jobId) => await (await EngineAsync()).PauseAsync(jobId, Ct);
|
||||
|
||||
private async Task<JobEngine> EngineAsync()
|
||||
{
|
||||
if (_engine is not null) return _engine;
|
||||
@@ -151,6 +164,39 @@ internal sealed class CuttingHome(IProjectHome home) : IProjectHome
|
||||
public Task<HomeFrames> FramesAsync(CancellationToken cancellationToken) => home.FramesAsync(cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>A home that counts its reads of the frames, its stamp of them passed through.</summary>
|
||||
internal sealed class CountingHome(IProjectHome home) : IProjectHome
|
||||
{
|
||||
public int FramesReads { get; private set; }
|
||||
|
||||
public Task<HomeFrames> FramesAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
FramesReads++;
|
||||
return home.FramesAsync(cancellationToken);
|
||||
}
|
||||
|
||||
public Task<string?> FramesStampAsync(CancellationToken cancellationToken) => home.FramesStampAsync(cancellationToken);
|
||||
|
||||
public Task<HomeSequence> SequenceAsync(CancellationToken cancellationToken) => home.SequenceAsync(cancellationToken);
|
||||
public Task<IReadOnlyList<SequenceProject>> ListAsync(CancellationToken cancellationToken) => home.ListAsync(cancellationToken);
|
||||
|
||||
public Task<SequenceProject> CreateAsync(string name, Guid? fromVersionId, string? author, CancellationToken cancellationToken) =>
|
||||
home.CreateAsync(name, fromVersionId, author, cancellationToken);
|
||||
|
||||
public Task<ProjectVersion> HeadAsync(Guid projectId, CancellationToken cancellationToken) => home.HeadAsync(projectId, cancellationToken);
|
||||
|
||||
public Task<ProjectVersion?> GetVersionAsync(Guid projectId, Guid versionId, CancellationToken cancellationToken) =>
|
||||
home.GetVersionAsync(projectId, versionId, cancellationToken);
|
||||
|
||||
public Task<IReadOnlyList<ProjectVersion>> VersionsAfterAsync(Guid projectId, int afterNumber, int limit, CancellationToken cancellationToken) =>
|
||||
home.VersionsAfterAsync(projectId, afterNumber, limit, cancellationToken);
|
||||
|
||||
public Task<IReadOnlyList<ProjectVersion>> HistoryAsync(Guid projectId, int? beforeNumber, int limit, CancellationToken cancellationToken) =>
|
||||
home.HistoryAsync(projectId, beforeNumber, limit, cancellationToken);
|
||||
|
||||
public Task<PushResult> PushAsync(Guid projectId, ProjectVersion version, CancellationToken cancellationToken) => home.PushAsync(projectId, version, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>A home that cannot be reached, standing for a server out of reach or an archive offline.</summary>
|
||||
internal sealed class UnreachableHome(IProjectHome home) : IProjectHome
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user