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:
Claude committed 2026-10-03 11:27:49 +00:00
1 parent 90321a7e53
commit 453fb63687
10 files changed
+700 -20

No files matched your search

@@ -33,9 +33,10 @@ internal sealed class ArchiveFixture : IAsyncDisposable
public ArchivePaths Paths => new(Archive.RootPath);
public CancellationToken Ct => _context.Cancellation;
public static async Task<ArchiveFixture> CreateAsync(TestContext context, string? root = null)
/// <param name="database">The index to use (a PostgreSQL schema); a temporary SQLite file when null.</param>
public static async Task<ArchiveFixture> CreateAsync(TestContext context, string? root = null, DatabaseOptions? database = null)
{
var db = await TitanoDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(context.CreateTempDirectory("db"), "titano.db")), context.Cancellation);
var db = await TitanoDatabase.OpenAsync(database ?? DatabaseOptions.Sqlite(Path.Combine(context.CreateTempDirectory("db"), "titano.db")), context.Cancellation);
var service = new ArchiveService(db, new ArchiveServiceOptions { Owner = "test", LeaseWait = TimeSpan.FromSeconds(20) });
var archive = await service.AdoptAsync(root ?? context.CreateTempDirectory("archive"), "Main", context.Cancellation);
return new ArchiveFixture(context, db, service, archive);