fix(sync): keep project positions on their photos when settings cross copies
Settings synced between a PC and its server sequence were stored as they
came, in the other copy's frame order. When the inserted photos arrived
later (a download, an upload), the index moved those already-correct
positions a second time, so exclusions, the hero and camera keyframes
landed on other photos (V-21, CD-2).
- Settings are translated by photo (SHA-256, else size and capture time)
to the frames of the copy they go to: the server's before they are
compared or applied here, this PC's to the server's frames as its
manifest lists them before a push (SyncPositions).
- A position on a photo the receiving copy lacks waits in project.json as
a pending frame and takes its place when the photo arrives, on an
insertion or an append in step with the index; the Library's hero
frame follows. A hero chosen meanwhile wins, and advice does not fill
a hero while one waits. Old projects without the member are unchanged.
- Pushes send expectedFramesVersion; PATCH /api/v1/sequences/{id} answers
409 frames_conflict when the frames changed since, and the next
comparison translates again.
- A pulled payload equal to the local copy is settled without the
archive: an offline or read-only archive no longer fails the
comparison (V-10).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
25 files changed
+1091
-51
No files matched your search
@@ -85,6 +85,26 @@ internal sealed class SyncClient : IAsyncDisposable
|
||||
return edited.Sequence!;
|
||||
}
|
||||
|
||||
/// <summary>One more photo imported into a local sequence, captured at <paramref name="captured"/> (before others: it is inserted).</summary>
|
||||
public async Task<IngestResult> AddPhotoAsync(Guid sequenceId, byte[] photo, DateTime captured)
|
||||
{
|
||||
var staging = Path.Combine(Archive.RootPath, ".titano", "staging", "test");
|
||||
Directory.CreateDirectory(staging);
|
||||
var path = Path.Combine(staging, $"{Guid.NewGuid():N}.part");
|
||||
await File.WriteAllBytesAsync(path, photo, Ct);
|
||||
return await Archives.Ingest.CommitAsync(new IngestRequest(Archive.Id, sequenceId, null, null, path, $"IMG_{captured:HHmmss}.JPG", photo.Length, Sha(photo),
|
||||
captured, null), Ct);
|
||||
}
|
||||
|
||||
/// <summary>An edit on this PC, as the editor makes it (project file and index, settings version + 1).</summary>
|
||||
public async Task<Sequence> EditSettingsAsync(Guid sequenceId, string settingsJson)
|
||||
{
|
||||
var sequence = (await Db.Sequences.GetAsync(sequenceId, Ct))!;
|
||||
await File.WriteAllTextAsync(new Titano.Core.Archiving.ArchivePaths(Archive.RootPath).Sequence(sequence.Folder).ProjectPath, settingsJson, Ct);
|
||||
return (await Db.Sequences.EditAsync(sequenceId, new Titano.Data.Repositories.SequenceEdit { SettingsJson = settingsJson }, sequence.SettingsVersion, Ct))
|
||||
.Sequence!;
|
||||
}
|
||||
|
||||
/// <summary>A render of <paramref name="sequence"/> made on this PC: its file in the sequence's exports and its row.</summary>
|
||||
public async Task<Render> RenderAsync(Sequence sequence, string fileName, byte[] bytes)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user