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
@@ -47,14 +47,14 @@ public abstract class WorkspaceSendTests(TestContext context) : DatabaseTest(con
|
||||
}
|
||||
|
||||
/// <summary>An output in the project's exports with its ledger entry, as a local render leaves them.</summary>
|
||||
private static WorkspaceRenderEntry Render(WorkspaceProject project, Guid? versionId, string name, int seed)
|
||||
private static WorkspaceRenderEntry Render(WorkspaceProject project, Guid? versionId, string name, int seed, string? settingsHash = null)
|
||||
{
|
||||
Directory.CreateDirectory(project.ExportsDirectory);
|
||||
var bytes = new byte[150_000 + seed];
|
||||
new Random(seed).NextBytes(bytes);
|
||||
File.WriteAllBytes(Path.Combine(project.ExportsDirectory, name), bytes);
|
||||
var entry = new WorkspaceRenderEntry(Guid.CreateVersion7(), Guid.CreateVersion7(), name, Convert.ToHexStringLower(SHA256.HashData(bytes)), bytes.Length,
|
||||
"1080p H.264", "h264", 1920, 1080, 24, 2.5, project.ProjectId, versionId, null, Rendered);
|
||||
"1080p H.264", "h264", 1920, 1080, 24, 2.5, project.ProjectId, versionId, settingsHash, Rendered);
|
||||
project.WriteRenders(project.ReadRenders().With(entry));
|
||||
return entry;
|
||||
}
|
||||
@@ -221,12 +221,53 @@ public abstract class WorkspaceSendTests(TestContext context) : DatabaseTest(con
|
||||
var foreign = (await fx.Home.HeadAsync(other.Id, fx.Ct)).Id;
|
||||
var entry = Render(project, foreign, "Foreign.mp4", 7);
|
||||
|
||||
var job = await SendAsync(fx, engine, store, project.ProjectId, JobState.Done);
|
||||
|
||||
// The project's home holds no such version of this project: the render goes with its project alone.
|
||||
Assert.Contains(Loc.L("Archive.Log.WorkspaceVersionNotHome", project.ReadBundle().Workspace!.Name), job.LogTail!);
|
||||
var row = Assert.NotNull(await fx.Db.Renders.GetAsync(entry.RenderId, fx.Ct));
|
||||
Assert.Equal(((Guid?)project.ProjectId, (Guid?)null), (row.ProjectId, row.ProjectVersionId));
|
||||
Assert.True(project.ReadRenders().Find(entry.RenderId)!.IsSent);
|
||||
Assert.Null(project.ReadRenders().Find(entry.RenderId)!.ProjectVersionId);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AVersionTheHomeHoldsByAnotherIdIsFiledByThatId()
|
||||
{
|
||||
var fx = await FixtureAsync();
|
||||
var engine = await EngineAsync(fx);
|
||||
var (store, _, project) = await CheckoutAsync(fx);
|
||||
// A version a push replayed on a home that moved on: the home holds its content under another id.
|
||||
var head = await fx.Home.HeadAsync(project.ProjectId, fx.Ct);
|
||||
var entry = Render(project, Guid.CreateVersion7(), "Replayed.mp4", 11, head.ContentHash);
|
||||
|
||||
var job = await SendAsync(fx, engine, store, project.ProjectId, JobState.Done);
|
||||
|
||||
Assert.Contains(Loc.L("Archive.Log.WorkspaceVersionReplayed", project.ReadBundle().Workspace!.Name, head.Number), job.LogTail!);
|
||||
var row = Assert.NotNull(await fx.Db.Renders.GetAsync(entry.RenderId, fx.Ct));
|
||||
Assert.Equal(((Guid?)project.ProjectId, (Guid?)head.Id), (row.ProjectId, row.ProjectVersionId));
|
||||
// The ledger names the home's id from now on.
|
||||
var sent = Assert.NotNull(project.ReadRenders().Find(entry.RenderId));
|
||||
Assert.Equal(((Guid?)head.Id, true), (sent.ProjectVersionId, sent.IsSent));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task ALedgerNamingAFileOutsideTheExportsIsRefused()
|
||||
{
|
||||
var fx = await FixtureAsync();
|
||||
var engine = await EngineAsync(fx);
|
||||
var (store, _, project) = await CheckoutAsync(fx);
|
||||
// A ledger edited by hand (or a newer Chronos's) naming the working state: never read, never sent.
|
||||
var entry = Render(project, null, "Outside.mp4", 12) with { File = Path.Combine("..", WorkspaceProject.BundleFile) };
|
||||
project.WriteRenders(project.ReadRenders().Without(entry.RenderId).With(entry));
|
||||
|
||||
var failed = await SendAsync(fx, engine, store, project.ProjectId, JobState.Failed);
|
||||
|
||||
Assert.Equal(Loc.L("Errors.Workspace.SendVersion"), failed.Error);
|
||||
Assert.Equal(Loc.L("Errors.Workspace.SendFailed", 1, 1), failed.Error);
|
||||
Assert.Null(await fx.Db.Renders.GetAsync(entry.RenderId, fx.Ct));
|
||||
// Not the render's fault: it waits, unsent, for the next send.
|
||||
Assert.Equal(WorkspaceRenderEntry.Pending, project.ReadRenders().Find(entry.RenderId)!.State);
|
||||
Assert.Equal((WorkspaceRenderEntry.Failed, Loc.L("Errors.Workspace.SendMissing", WorkspaceProject.BundleFile)),
|
||||
(project.ReadRenders().Find(entry.RenderId)!.State, project.ReadRenders().Find(entry.RenderId)!.Error));
|
||||
Assert.FileExists(project.BundlePath);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in new issue
Block a user