fix(data): trash moves finish whatever is cancelled, archive-wide jobs hold their sequences
Once a folder has moved into the trash (or back), its index step runs to the end with no cancellation and a failed step moves the folder back, so trash and index never disagree. Running or paused archive-wide jobs (scan, rebuild, import, maintenance, a verify of everything) block a delete of every sequence of their archive; a verify of named sequences blocks those. A row whose folder is gone is refused (FolderMissing) instead of losing its settings. Delete revalidates the plan cheaply (index row, jobs, sidecar id from its head) instead of measuring every folder again; the dry run reports progress. A restored folder without a sidecar gets the record's title, tags, rating and notes and drops a hero frame it no longer has. EditSequenceInfoAsync changes one field from the current sidecar values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
4 files changed
+475
-135
No files matched your search
@@ -177,4 +177,22 @@ public sealed class ArchiveIndexTests(TestContext context)
|
||||
Assert.SequenceEqual(["Night"], (await fx.Db.Sequences.GetAsync(comet.Id))!.Tags);
|
||||
Assert.Equal(0, (await fx.ScanAsync()).Indexed);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AnEditOfOneFieldKeepsWhatChangedSinceTheRowWasRead()
|
||||
{
|
||||
await using var fx = await CreateAsync(context);
|
||||
Populate(fx.Paths);
|
||||
await fx.ScanAsync();
|
||||
var comet = (await fx.Db.Sequences.ListLocationsAsync(fx.Archive.Id)).Single(l => l.Folder == "Trips/Comet");
|
||||
var stale = (await fx.Db.Sequences.GetAsync(comet.Id))!;
|
||||
var edited = await fx.Service.SetSequenceInfoAsync(comet.Id, "Comet 2026", ["night"], 2, "Tripod", fx.Ct);
|
||||
|
||||
var rated = await fx.Service.EditSequenceInfoAsync(stale.Id, info => info with { Rating = 5 }, fx.Ct);
|
||||
|
||||
Assert.Equal(("Comet 2026", "night", 5, "Tripod"), (rated.Title, rated.Tags.Single(), rated.Rating, rated.Notes));
|
||||
Assert.Equal(edited.SettingsVersion + 1, rated.SettingsVersion);
|
||||
var manifest = ManifestStore.ReadSequence(fx.Paths.Sequence(comet.Folder).ManifestPath);
|
||||
Assert.Equal(("Comet 2026", "night", 5, "Tripod"), (manifest.Title, manifest.Tags.Single(), manifest.Rating, manifest.Notes));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user