fix(convert): close the last edges round 3's checkers found in the trash and the copy check

- A frame flagged corrupt, like one whose file is missing, is one no verify can
  hash (a verify does not hash a file whose size differs from its record): a
  replaced entry of its sequence is kept with "restore it", never with an
  advice to verify that would never settle it.
- Erasing a deleted sequence leaves no record that its conversions went with
  it while the sequence also lives (this index has it, or a folder's sidecar
  names it: a folder copied back, a second deletion of the same id), so a
  later emptying whose walk misses that folder keeps the originals.
- A copy another conversion made since this one was confirmed supersedes it
  only once that conversion is done; while it is not (it failed while filing
  the copy), a retry is left as it was with a reason (new string
  Archive.Convert.CopyUnfinished, en and it), neither making a second copy
  nor calling the sequence done with.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-03 10:02:18 +01:00
1 parent 5012c3bbd2
commit 74ccde7210
7 files changed
+75 -11

No files matched your search

@@ -1666,8 +1666,14 @@ public sealed class ConvertTests(TestContext context)
var b = await QueuedAsync(fx, again, DateTimeOffset.UtcNow.AddMinutes(-5));
var made = (await RunHereAsync(fx, again, b.Id, confirmed: b.Created)).Sequences.Single();
Assert.Equal(ConvertOutcome.Created, made.Outcome);
await fx.Db.Jobs.SetStateAsync(b.Id, JobState.Done, null, fx.Ct);
var sequences = (await fx.Db.Sequences.ListLocationsAsync(fx.Archive.Id, fx.Ct)).Count;
// While job B has not finished (it failed after filing its copy), Retry on A waits for it: no second copy, not done with.
await fx.Db.Jobs.SetStateAsync(b.Id, JobState.Failed, "kept", fx.Ct);
var waiting = (await RunHereAsync(fx, plan, a.Id, confirmed: a.Created)).Sequences.Single();
Assert.Equal((ConvertOutcome.Blocked, Loc.L("Archive.Convert.CopyUnfinished")), (waiting.Outcome, waiting.Error));
Assert.Null(await fx.Db.Sequences.FindBySessionKeyAsync(fx.Archive.Id, MassConverter.SessionKey(a.Id, id)));
Assert.Equal(sequences, (await fx.Db.Sequences.ListLocationsAsync(fx.Archive.Id, fx.Ct)).Count);
await fx.Db.Jobs.SetStateAsync(b.Id, JobState.Done, null, fx.Ct);
// Retry on A: done with the sequence, no second copy.
var lines = new List<string>();