feat: owner review 2 phase 4b: mass conversion after import (#13)
CI / Build and test (push) Failing after 3m1s
CI / PostgreSQL 16 integration (push) Skipped
CI / PostgreSQL 17 integration (push) Skipped
CI / Docker image (push) Skipped
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 10s
Release / Build, test and publish (push) Successful in 15m31s
Release / Server image (push) Successful in 1m13s

Convert photos already in the archive to JPEG, TIFF-16 or Linear DNG, from the panel's Library and the desktop's Archive and Library. Each run asks Replace (same frames, originals to the trash, recoverable) or New sequence. A dry run lists what converts, what is skipped and why, size before and after, and free space; the job converts exactly the confirmed photos, resumes, and commits all or nothing per sequence. A conversion never changes what Chronos reads from a photo. Replaced originals are erased only on the archive's own word that their conversion is gone. Desktop TIFFs that WIC showed black or as noise now go to the managed reader; the Edit picker no longer spins a core.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #13.
This commit is contained in:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-11-03 10:41:50 +01:00
1 parent 7e4a3b481d
commit efa87f68ce
354 files changed
+24530 -843

No files matched your search

@@ -439,21 +439,33 @@ public abstract class FrameTrashTests(TestContext context) : DatabaseTest(contex
var (sequence, frames) = await UploadedAsync(fx, 2);
var replacement = frames[1];
var good = WriteReplaced(fx, sequence, "20261027100000", replacement.Sha256!);
var bad = WriteReplaced(fx, sequence, "20261027110000", new string('a', 64));
// A replacement no frame of the sequence holds any more, and whose deletion the sidecar records (its conversion deleted
// and erased): the dry run says so, and the emptying confirmed with it erases the originals (owner review 2, R7).
var deleted = new string('a', 64);
var gone = WriteReplaced(fx, sequence, "20261027110000", deleted);
var sidecar = fx.Paths.Sequence(sequence.Folder).ManifestPath;
var manifest = ManifestStore.ReadSequence(sidecar);
ManifestStore.WriteSequence(sidecar, manifest with
{
Removed = [.. (manifest.Removed ?? []), new RemovedPhoto { Sha256 = deleted, Reason = RemovalReason.Deleted, At = DateTimeOffset.UtcNow }],
});
// One that nothing in the archive says was deleted stays: the sidecar holds no frame of it and no tombstone of it, as a
// sidecar rebuilt from the photos shows a conversion it never knew.
var untraced = WriteReplaced(fx, sequence, "20261027113000", new string('b', 64));
var engine = await fx.StartEngineAsync();
var listed = await fx.Service.ListTrashAsync(fx.Archive.Id, fx.Ct);
Assert.True(listed.All(e => e.Kind == TrashKind.Replaced));
var plan = await fx.Service.PlanEmptyTrashAsync(fx.Archive.Id, null, fx.Ct);
Assert.True(plan.Entries.Single(e => e.Name == FrameTrash.EntryPrefix + gone).ConversionDeleted);
Assert.False(plan.Entries.Single(e => e.Name == FrameTrash.EntryPrefix + good).ConversionDeleted);
Assert.False(plan.Entries.Single(e => e.Name == FrameTrash.EntryPrefix + untraced).ConversionDeleted, "the archive does not say it was deleted");
var job = await engine.EnqueueAsync(ArchiveJobs.EmptyTrash(fx.Archive, plan), cancellationToken: fx.Ct);
var failed = await fx.WaitForAsync(job.Id, JobState.Failed);
var kept = await fx.WaitForAsync(job.Id, JobState.Failed);
Assert.Contains(Chronos.Core.Localization.Loc.L("Archive.Log.TrashKeptUnknown", sequence.DisplayTitle), kept.LogTail);
Assert.Equal(FrameTrash.EntryPrefix + untraced, (await fx.Service.ListTrashAsync(fx.Archive.Id, fx.Ct)).Single().Name, "the others are erased");
Assert.Equal(Chronos.Core.Localization.Loc.Plural("Archive.Error.TrashKept", 1), failed.Error);
var left = Assert.Contains(await fx.Service.ListTrashAsync(fx.Archive.Id, fx.Ct), e => e.Name == FrameTrash.EntryPrefix + bad);
Assert.Equal(TrashKind.Replaced, left.Kind);
Assert.DoesNotContain(FrameTrash.EntryPrefix + good, (await fx.Service.ListTrashAsync(fx.Archive.Id, fx.Ct)).Select(e => e.Name));
// A replacement whose file no longer hashes to it keeps its originals too.
// A replacement whose file no longer hashes to it keeps its originals.
var other = WriteReplaced(fx, sequence, "20261027120000", replacement.Sha256!);
var file = fx.Paths.FromRelative(replacement.RelativePath);
var bytes = File.ReadAllBytes(file);