feat: work board, no usage data, archive folder tree, deploy guide (owner review 4 + owner review 1 phase 6) (#62)
CI / Build and test (push) Successful in 10m37s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 9s
Release / Build, test and publish (push) Successful in 16m19s
CI / PostgreSQL 16 integration (push) Successful in 10m19s
CI / PostgreSQL 17 integration (push) Successful in 11m27s
CI / Docker image (push) Successful in 57s
Release / Server image (push) Successful in 1m34s

Owner review 4 and owner review 1 phase 6.

- Work board in Videos (desktop and admin panel): Published and Workspace lanes (#29).
- Anonymous usage counts removed: Chronos sends nothing about its use (#30).
- The archive's whole folder tree is created inside any archive root, on the server and the desktop (#31).
- Video cards start with the preset; sizes keep number and unit together (#28).
- Deploy guide docs/deploy (Docker, Unraid, desktop), BRIEF §24, original documentation in docs/reference/original (#22).

Closes #22 #28 #29 #30 #31

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 #62.
This commit is contained in:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-11-06 18:46:22 +01:00
1 parent 728ffa35cb
commit 0075065884
304 files changed
+6892 -325

No files matched your search

@@ -0,0 +1,64 @@
using Chronos.Core.Archiving;
using Chronos.Data.Archiving;
using Chronos.Testing;
namespace Chronos.Data.Tests.Archiving;
/// <summary>Every archive the service creates, adopts or opens holds its whole layout (BRIEF §7, owner request 2026-11-06).</summary>
[Category("archive")]
public sealed class ArchiveStructureServiceTests(TestContext context)
{
[Test]
public async Task ANewArchiveGetsItsWholeLayout()
{
await using var db = await ChronosDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(context.CreateTempDirectory("db"), "chronos.db")), context.Cancellation);
var service = new ArchiveService(db);
var root = Path.Combine(context.CreateTempDirectory("new"), "Chronos", "Archive");
var archive = await service.AdoptAsync(root, "Fresh", context.Cancellation);
var paths = new ArchivePaths(archive.RootPath);
Assert.FileExists(paths.ManifestPath);
Assert.Empty(ArchiveStructure.Missing(paths));
Assert.True(Directory.Exists(paths.TrashPhotosDirectory) && Directory.Exists(paths.TrashVideosDirectory));
}
[Test]
public async Task OpeningAnArchiveMakesTheFoldersItLacksAndTouchesNothingElse()
{
await using var fx = await ArchiveFixture.CreateAsync(context);
var paths = fx.Paths;
var kept = Path.Combine(paths.StagingDirectory, "copy.tmp");
File.WriteAllText(kept, "staged");
var manifest = File.ReadAllBytes(paths.ManifestPath);
// An archive an older Chronos or a copy left without its trash, journal and locks.
Directory.Delete(paths.TrashDirectory, recursive: true);
Directory.Delete(paths.JournalDirectory);
Directory.Delete(paths.LocksDirectory, recursive: true);
await fx.Service.OpenAsync(paths.Root, fx.Ct);
Assert.Empty(ArchiveStructure.Missing(paths));
Assert.Equal("staged", File.ReadAllText(kept));
Assert.BytesEqual(manifest, File.ReadAllBytes(paths.ManifestPath));
}
[Test]
public async Task AnArchiveThatCannotBeLaidOutIsNotCreated()
{
await using var db = await ChronosDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(context.CreateTempDirectory("db"), "chronos.db")), context.Cancellation);
var service = new ArchiveService(db);
var root = context.CreateTempDirectory("blocked");
// A file where the archive's metadata folder belongs: it stays, and the archive is refused with the reason.
var meta = new ArchivePaths(root).MetaDirectory;
File.WriteAllText(meta, "not a folder");
var error = await Assert.ThrowsAsync<ArchiveStructureException>(() => service.CreateAsync(root, "Blocked", cancellationToken: context.Cancellation));
Assert.Equal(ArchiveStructureProblem.Failed, error.Report.Problem);
Assert.Equal(meta, error.Report.Folder);
Assert.Equal(error.Report.Message, error.Message);
Assert.Equal("not a folder", File.ReadAllText(meta));
Assert.Empty(await db.Archives.ListAsync(context.Cancellation));
}
}
@@ -105,7 +105,7 @@ public abstract class FrameTrashTests(TestContext context) : DatabaseTest(contex
Assert.SequenceEqual([frames[1].Id, frames[3].Id], plan.Frames.Select(f => f.Id));
Assert.Equal(frames[1].Size + frames[3].Size, plan.Bytes);
Assert.Equal(before, await Photos.DumpIndexAsync(fx.Db, fx.Archive.Id));
Assert.False(Directory.Exists(FrameTrash.Directory(fx.Paths)), "a dry run moves nothing");
Assert.False(Directory.EnumerateFileSystemEntries(FrameTrash.Directory(fx.Paths)).Any(), "a dry run moves nothing");
foreach (var frame in frames) Assert.FileExists(fx.Paths.FromRelative(frame.RelativePath));
}
@@ -26,6 +26,11 @@ public abstract class SequenceTrashTests(TestContext context) : DatabaseTest(con
return sequences;
}
/// <summary>What the trash holds besides its photos and videos areas, which every archive has (empty here).</summary>
private static IEnumerable<string> TrashContents(ArchivePaths paths) =>
Directory.EnumerateFileSystemEntries(paths.TrashDirectory, "*", SearchOption.AllDirectories)
.Where(e => e != paths.TrashPhotosDirectory && e != paths.TrashVideosDirectory);
private static (int Files, long Bytes) OnDisk(string folder)
{
var files = new DirectoryInfo(folder).EnumerateFiles("*", SearchOption.AllDirectories).ToList();
@@ -109,7 +114,7 @@ public abstract class SequenceTrashTests(TestContext context) : DatabaseTest(con
Assert.Equal(6, plan.Frames);
Assert.Equal(before, await Photos.DumpIndexAsync(fx.Db, fx.Archive.Id));
Assert.True(Directory.Exists(folder), "a dry run moves nothing");
Assert.False(Directory.Exists(SequenceTrash.TrashDirectory(fx.Paths)));
Assert.Empty(TrashContents(fx.Paths));
}
[Test]
@@ -166,7 +171,7 @@ public abstract class SequenceTrashTests(TestContext context) : DatabaseTest(con
Assert.Equal(before, await Photos.DumpIndexAsync(fx.Db, fx.Archive.Id));
Assert.Equal(render.OutputPath, (await fx.Db.Renders.ListBySequenceAsync(victim.Id)).Single().OutputPath);
Assert.Empty(await fx.Service.ListTrashAsync(fx.Archive.Id, fx.Ct));
Assert.Empty(Directory.EnumerateFileSystemEntries(SequenceTrash.TrashDirectory(fx.Paths)));
Assert.Empty(TrashContents(fx.Paths));
Assert.Equal(0, (await fx.ScanAsync()).Indexed);
// Deleted again: the trash takes it again under the same name.
@@ -360,7 +365,7 @@ public abstract class SequenceTrashTests(TestContext context) : DatabaseTest(con
Assert.True(Directory.Exists(folder), "the folder is back where it was");
Assert.Equal(before, await Photos.DumpIndexAsync(fx.Db, fx.Archive.Id));
Assert.Empty(Directory.EnumerateFileSystemEntries(SequenceTrash.TrashDirectory(fx.Paths)));
Assert.Empty(TrashContents(fx.Paths));
await HealSequencesAsync(fx, "DELETE");
Assert.Count(1, await fx.Service.DeleteAsync(await fx.Service.PlanDeleteAsync([victim.Id], null, fx.Ct), null, null, fx.Ct));
}