fix(workspace): every cut of a sync is recoverable, renders name only versions the home holds

A push now moves the base before its local file reads as sent; a replay
journals itself in sync.json, writes the replayed versions, then the base
(the commit point), and only then sets the old ones aside and adopts the
local commits the home already held; a conflict met past such commits moves
the base onto them first. A save-both journals its copy and the ids it sends
under, so a retry completes the same copy instead of making another. The
next push, pull or resolve finishes or undoes whatever a cut left, so no
version is orphaned and no false conflict appears.

The editor reads the working state and the media index under the project
lease; workspace.json is written whole and moved into place (an empty one is
made again); project files may hold 64 MiB and one that would be larger is
refused before it is written, so large projects check out. The workspace copy
checks the drive's free space before and during the copy, keeps the folder in
its checkpoint and stores a reset when a pass starts again, and runs at High
level in the priority queue. Renders record a version only when the index
holds it with the settings rendered; an unsent version renders as the project.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-03 10:19:56 +01:00
1 parent 50e28fd63d
commit 833d7cf8e9
18 files changed
+950 -92

No files matched your search

@@ -53,6 +53,7 @@ internal sealed class RenderJobHandler(ChronosDatabase db, ProcessingOptions opt
var aliases = embedded is not null ? await Projects.HomePhotos.AliasesAsync(db, sequence.Id, cancellation).ConfigureAwait(false) : [];
var project = (embedded is not null ? ProjectStore.Parse(Placed(embedded, frames, aliases)) : ProjectStore.Read(sequence, folder)) with { Export = export };
var settingsJson = project.ToJson();
var (projectId, projectVersionId) = await ProvenanceAsync(parameters, sequence, cancellation).ConfigureAwait(false);
using var names = new OutputNames();
var all = Targets(export, parameters.PresetName);
@@ -90,8 +91,8 @@ internal sealed class RenderJobHandler(ChronosDatabase db, ProcessingOptions opt
{
Id = RenderId(context.Job.Id, index),
OutputPath = Stored(paths, result.OutputPath),
ProjectId = parameters.ProjectId,
ProjectVersionId = parameters.ProjectVersionId,
ProjectId = projectId,
ProjectVersionId = projectVersionId,
};
await db.Renders.InsertAsync(entity, CancellationToken.None).ConfigureAwait(false);
done.Add(index);
@@ -137,6 +138,27 @@ internal sealed class RenderJobHandler(ChronosDatabase db, ProcessingOptions opt
: throw new InvalidOperationException(Loc.L("Errors.Render.ProjectVersion"));
}
/// <summary>
/// The project and the version a render records (owner review 2, R8: a render never names a version whose settings it
/// did not use, nor one the index does not hold): the project when it is one of the sequence's; the version when the index
/// holds it, for that project of the sequence, with the content hash of the settings the job embeds. A job naming a
/// version the home never received (one saved on a PC and sent later under another id) records the project alone.
/// </summary>
private async Task<(Guid? Project, Guid? Version)> ProvenanceAsync(Protocol.RenderJobParameters parameters, Sequence sequence, CancellationToken cancellationToken)
{
Guid? project = parameters.ProjectId is { } id && await db.Projects.GetAsync(id, cancellationToken).ConfigureAwait(false) is { } owner
&& owner.SequenceId == sequence.Id
? id
: null;
if (parameters.ProjectVersionId is not { } versionId
|| await db.Projects.GetVersionAsync(versionId, cancellationToken).ConfigureAwait(false) is not { } version
|| (project is { } named && version.ProjectId != named)
|| await db.Projects.GetAsync(version.ProjectId, cancellationToken).ConfigureAwait(false) is not { } of || of.SequenceId != sequence.Id
|| (parameters.SettingsJson is { } embedded && !ProjectContent.Verifies(embedded, version.ContentHash)))
return (project, null);
return (version.ProjectId, versionId);
}
/// <summary>
/// Settings whose positions wait for their photos (a project version's portable form, settings synced from another copy)
/// with them placed on the frames rendered, a photo parked on an encoding a conversion replaced since found through