feat(data): delete sequences into the archive's trash and restore them
SequenceTrash plans (files, bytes, trash folder, blocked reasons) and moves
each sequence folder whole into .titano/trash/<id> under its leases, next to a
record of its index row and renders, then drops the index rows; restore moves
it back (to a free folder when the old one is taken) and indexes it again from
its sidecar with the same ids. The server's DELETE /sequences/{id} now uses it
and refuses a sequence a job is working on (409 sequence_busy).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
10 files changed
+700
-20
No files matched your search
@@ -149,6 +149,30 @@ public sealed class SequenceTests(TestContext context)
|
||||
await gone.ExpectErrorAsync(HttpStatusCode.NotFound, "not_found");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task ASequenceAJobWorksOnIsNotDeleted()
|
||||
{
|
||||
await using var server = await TestServer.StartAsync(context);
|
||||
var (editor, _, _) = await server.UserAsync("alberto", "editor");
|
||||
var frame = await Uploads.UploadAsync(editor, Uploads.Photo(3000, 35));
|
||||
var sequence = (await server.Database.Sequences.GetAsync(frame.SequenceId))!;
|
||||
await server.Database.Jobs.EnqueueAsync(new Titano.Core.Model.Job
|
||||
{
|
||||
Id = Guid.CreateVersion7(),
|
||||
Kind = Titano.Core.Model.JobKind.Render,
|
||||
TargetIds = [sequence.Id],
|
||||
State = Titano.Core.Model.JobState.Running,
|
||||
NodeId = "node#0",
|
||||
Created = DateTimeOffset.UtcNow,
|
||||
Started = DateTimeOffset.UtcNow,
|
||||
});
|
||||
|
||||
using (var plan = await editor.DeleteAsync($"/api/v1/sequences/{sequence.Id}?dryRun=true")) await plan.ExpectErrorAsync(HttpStatusCode.Conflict, "sequence_busy");
|
||||
using (var deleted = await editor.DeleteAsync($"/api/v1/sequences/{sequence.Id}")) await deleted.ExpectErrorAsync(HttpStatusCode.Conflict, "sequence_busy");
|
||||
Assert.True(Directory.Exists(Path.Combine(server.Options.ArchivePath, sequence.Folder)));
|
||||
Assert.NotNull(await server.Database.Sequences.GetAsync(sequence.Id));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task FramesAndStatsArePaged()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user