fix(upload): repairs charge no quota and another sequence's copy no longer blocks them
A re-upload that repairs a missing or damaged frame is now reported as IngestResult.Repaired and adds nothing to the uploader's used bytes; the quota checks at start and completion skip uploads whose target sequence already holds the content. The start shortcut and crash recovery share one rule (UploadRules.StandIn): an intact copy stands for the upload, the target sequence's own copy first, except when the target holds the content only in damaged copies, which the upload's bytes then repair. A sequence adopted at the archive root that holds frames is never given a new folder when its root sidecar is missing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
8 files changed
+150
-39
No files matched your search
@@ -136,11 +136,12 @@ public sealed class ArchiveIngest : IArchiveIngest
|
||||
|
||||
/// <summary>
|
||||
/// A sequence created without photos (<c>POST /api/v1/sequences</c>, BRIEF §14.3) has no folder until its first frame.
|
||||
/// An empty folder otherwise means the archive root itself, adopted in place, whose sidecar names the sequence.
|
||||
/// An empty folder otherwise means the archive root itself, adopted in place, whose sidecar names the sequence; one
|
||||
/// that holds frames is never moved elsewhere, even while its root sidecar is missing.
|
||||
/// </summary>
|
||||
internal static bool AwaitsFolder(Sequence sequence, ArchivePaths paths)
|
||||
{
|
||||
if (sequence.Folder.Length > 0) return false;
|
||||
if (sequence.Folder.Length > 0 || sequence.FrameCount > 0) return false;
|
||||
var root = paths.Sequence(string.Empty);
|
||||
if (!File.Exists(root.ManifestPath)) return true;
|
||||
try
|
||||
@@ -363,7 +364,7 @@ public sealed class ArchiveIngest : IArchiveIngest
|
||||
foreach (var (p, frame) in accepted.Where(a => byId.ContainsKey(a.Frame.Id)))
|
||||
p.Completion.TrySetResult(Result(sequenceId, sequence, byId[frame.Id], false));
|
||||
foreach (var (p, frame) in repairs.Where(r => repaired.Contains(r.Frame.Id)))
|
||||
p.Completion.TrySetResult(Result(sequenceId, sequence, byId[frame.Id], false));
|
||||
p.Completion.TrySetResult(Result(sequenceId, sequence, byId[frame.Id], false) with { Repaired = true });
|
||||
var unrepaired = repairs.Select(r => r.Frame.Id).Where(id => !repaired.Contains(id)).ToHashSet();
|
||||
foreach (var (p, frameId) in duplicates)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user