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
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:
1 parent
7e4a3b481d
commit
efa87f68ce
354 files changed
+24530
-843
No files matched your search
@@ -599,6 +599,45 @@ public sealed class LibraryTests(TestContext context)
|
||||
Assert.Equal(HttpStatusCode.NotFound, unknown.StatusCode);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TheDryRunSaysWhichReplacedOriginalsLostTheirConversion()
|
||||
{
|
||||
await using var server = await TestServer.StartAsync(context, services: ArchiveModule.Register);
|
||||
var (editor, _, _) = await server.UserAsync("alberto", "editor");
|
||||
var admin = await server.AdminAsync();
|
||||
Guid id = default;
|
||||
for (var i = 0; i < 2; i++) id = (await Uploads.UploadAsync(editor, Photo(70 + i), $"IMG_{i + 1:0000}.JPG", sessionKey: "roof")).SequenceId;
|
||||
await UntilIdleAsync(server);
|
||||
var request = new ConvertRequest([id], false, "tiff16", null, "replace", DryRun: true);
|
||||
ConvertPlanDto convert;
|
||||
using (var dry = await admin.PostAsJsonAsync("/api/v1/archive/convert", request, ProtocolJson.Default.ConvertRequest))
|
||||
convert = await dry.ReadAsync(ProtocolJson.Default.ConvertPlanDto);
|
||||
using (var applied = await admin.PostAsJsonAsync("/api/v1/archive/convert", request with { DryRun = false, Fingerprint = convert.Fingerprint },
|
||||
ProtocolJson.Default.ConvertRequest))
|
||||
await UntilJobAsync(admin, (await applied.ReadAsync(ProtocolJson.Default.JobDto)).Id, "done");
|
||||
await UntilIdleAsync(server);
|
||||
|
||||
// The converted sequence still holds the conversions: nothing to say.
|
||||
TrashEmptyPlanDto plan;
|
||||
using (var dry = await admin.PostAsJsonAsync("/api/v1/archive/trash/empty", new TrashEmptyRequest(null, true, null), ProtocolJson.Default.TrashEmptyRequest))
|
||||
plan = await dry.ReadAsync(ProtocolJson.Default.TrashEmptyPlanDto);
|
||||
Assert.Equal(("replaced", false), (plan.Entries.Single().Kind, plan.Entries.Single().ConversionDeleted));
|
||||
|
||||
// The user deletes a converted photo: its originals are the last copy of it, and the dry run says so.
|
||||
var photo = await DeletePhotoAsync(editor, id, (await server.Database.Frames.ListBySequenceAsync(id))[0].Id);
|
||||
using (var dry = await admin.PostAsJsonAsync("/api/v1/archive/trash/empty", new TrashEmptyRequest(null, true, null), ProtocolJson.Default.TrashEmptyRequest))
|
||||
plan = await dry.ReadAsync(ProtocolJson.Default.TrashEmptyPlanDto);
|
||||
Assert.True(plan.Entries.Single(e => e.Kind == "replaced").ConversionDeleted);
|
||||
Assert.False(plan.Entries.Single(e => e.Name == photo).ConversionDeleted);
|
||||
// The panel's confirmation names such entries first, each saying so, wherever the trash lists them.
|
||||
var page = await server.Client.GetStringAsync("/admin/pages/library/trash.js");
|
||||
Assert.Contains("list: [...plan.entries.filter((e) => e.conversionDeleted), ...plan.entries.filter((e) => !e.conversionDeleted)]", page);
|
||||
using (var empty = await admin.PostAsJsonAsync("/api/v1/archive/trash/empty", new TrashEmptyRequest(null, false, plan.Fingerprint),
|
||||
ProtocolJson.Default.TrashEmptyRequest))
|
||||
await UntilJobAsync(admin, (await empty.ReadAsync(ProtocolJson.Default.JobDto)).Id, "done");
|
||||
using (var list = await admin.GetAsync("/api/v1/archive/trash")) Assert.Empty((await list.ReadAsync(ProtocolJson.Default.TrashListDto)).Entries);
|
||||
}
|
||||
|
||||
/// <summary>Deletes one photo of a sequence into the trash; returns the entry's name.</summary>
|
||||
private static async Task<string> DeletePhotoAsync(HttpClient client, Guid sequenceId, Guid frameId)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user