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

@@ -48,12 +48,16 @@ public sealed partial class AdminVideosTests(TestContext context)
var page = await server.Client.GetStringAsync("/admin/pages/videos.js");
var calls = ApiCall().Matches(page).Select(m => (Method: m.Groups[1].Value, Target: m.Groups[2].Value)).ToList();
Assert.True(calls.Count >= 4, string.Join(", ", calls));
// Reads the list, the server's videos folder and a filtered sequence's title; writes only the videos' delete and copy:
// no settings, no project, no render, no job of its own.
// Reads the list, the server's videos folder, its name (the board's lanes) and a filtered sequence's title; writes only
// the videos' delete and copy: no settings, no project, no render, no job of its own.
foreach (var (method, target) in calls)
{
Assert.True(method is "get" or "post", $"api.{method}({target}");
if (method == "get") Assert.True(target is "listQuery(" or @"""/api/v1/server/settings""" or "`/api/v1/sequences/${encodeURIComponent(id)}`", target);
if (method == "get")
{
Assert.True(target is "listQuery(" or @"""/api/v1/server/settings""" or @"""/api/v1/server/info""" or "`/api/v1/sequences/${encodeURIComponent(id)}`",
target);
}
else Assert.True(target is @"""/api/v1/videos/copy""" or @"""/api/v1/videos/delete""", target);
}
Assert.Contains("return `/api/v1/videos?${p}`;", page);
@@ -103,6 +107,39 @@ public sealed partial class AdminVideosTests(TestContext context)
Assert.Equal("missing", VideoStates.Missing);
}
[Test]
public async Task TheBoardShowsPublishedAndWorkspaceLanes()
{
await using var server = await TestServer.StartAsync(context);
var page = await server.Client.GetStringAsync("/admin/pages/videos.js");
// A third view beside cards and list, kept like them; its icon is the panel's.
Assert.Contains(@"data-view=""board"" aria-pressed=""${view === ""board""}"" data-i18n-title=""Admin.Videos.View.Board.Tip""", page);
Assert.Contains(@"return stored === ""list"" || stored === ""board"" ? stored : ""cards"";", page);
Assert.Contains(" board: `<svg", await server.Client.GetStringAsync("/admin/icons.js"));
// Two lanes, newest first whatever the order chosen: the board reads the server newest first, with Order off and
// saying why (rc.14 review: re-sorting the page read in another order left the newest out). Published counts the
// server's total; Workspace holds the renders a PC's workspace sent here (a project named, produced by a machine
// other than this server), marked Sent, counted among those read ("+" while more can be read).
Assert.Contains(@"return view === ""board"" ? ""newest"" : filters.sort;", page);
Assert.Contains(@"if (sortShown() !== ""newest"") p.set(""sort"", sortShown());", page);
Assert.Contains(@"sort.disabled = view === ""board"";", page);
Assert.Contains(@"""Admin.Videos.Sort.Board.Tip""", page);
Assert.Contains(@"return lane(""Published"", rows, false, formatNumber(total ?? rows.length))", page);
Assert.Contains(@"+ lane(""Workspace"", sent, true, `${formatNumber(sent.length)}${cursor ? ""+"" : """"}`);", page);
// A Shift range runs along the lane picked in, as its cards are shown.
Assert.Contains(@"order: (el) => view === ""board"" && el?.closest("".board-lane"")", page);
Assert.Contains("if (shift) selection.range(key, order(el));", await server.Client.GetStringAsync("/admin/pages/library/shared.js"));
// Sizes keep their number and unit together, as the desktop's (issue #28).
Assert.Contains(@"format(value)} ${units[unit]}`;", await server.Client.GetStringAsync("/admin/ui.js"));
Assert.Contains("export function boardLane(v, serverName)", page);
Assert.Contains(@"return v.projectId && producer && producer !== String(serverName ?? """") ? ""workspace"" : ""published"";", page);
Assert.Contains(@"${workspace ? sentChip(v) : """"}${stateChips(v)}", page);
// The server's name comes from its public info, the name its own renders carry.
Assert.Contains(@"api.get(""/api/v1/server/info"").then((info) => {", page);
var css = await server.Client.GetStringAsync("/admin/admin.css");
Assert.Contains(".seq-items.board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));", css);
}
[Test]
public async Task TheVideosStringsAreInEnglishAndItalian()
{
@@ -117,7 +154,8 @@ public sealed partial class AdminVideosTests(TestContext context)
// The keys the pages build from a value.
keys.AddRange(VideoSorts.All.Select(s => $"Admin.Videos.Sort.{char.ToUpperInvariant(s[0])}{s[1..]}"));
keys.AddRange(["Admin.Videos.Kind.Video", "Admin.Videos.Kind.Still", "Admin.Videos.Kind.Sequence", "Admin.Trash.Kind.Videos", "Admin.Nav.Videos", "Admin.Nav.Videos.Tip",
"Admin.Settings.VideosPath", "Admin.Settings.VideosPath.Tip", "Admin.Job.Kind.VideoCopy"]);
"Admin.Settings.VideosPath", "Admin.Settings.VideosPath.Tip", "Admin.Job.Kind.VideoCopy", "Admin.Videos.Lane.Published", "Admin.Videos.Lane.Published.Tip",
"Admin.Videos.Lane.Workspace", "Admin.Videos.Lane.Workspace.Tip"]);
keys.AddRange(Regex.Matches(trash + sequence, @"""(Admin\.(?:Trash\.[A-Za-z]*Video[A-Za-z]*|Videos\.[A-Za-z.]+)(?:\.[A-Za-z]+)*)""").Select(m => m.Groups[1].Value));
Assert.Contains("Admin.Trash.RestoredVideo", keys);
Assert.Contains("Admin.Videos.AllVideos.Tip", keys);
@@ -0,0 +1,119 @@
using System.Net;
using System.Net.Http.Json;
using Microsoft.Extensions.DependencyInjection;
using Chronos.Core.Archiving;
using Chronos.Data;
using Chronos.Data.Archiving;
using Chronos.Protocol;
using Chronos.Server.Storage;
using Chronos.Testing;
namespace Chronos.Server.Tests.Hosting;
/// <summary>The server lays out its archive folder whole at start (owner request 2026-11-06) and says when it cannot.</summary>
[Category("server")]
public sealed class ArchiveStructureStartupTests(TestContext context)
{
[Test]
public async Task StartingTheServerLaysOutTheArchiveFolder()
{
await using var server = await TestServer.StartAsync(context);
var paths = new ArchivePaths(server.Options.ArchivePath);
Assert.FileExists(paths.ManifestPath);
Assert.Empty(ArchiveStructure.Missing(paths));
Assert.True(Assert.NotNull(server.Services.GetRequiredService<ServerArchive>().Structure).IsComplete);
var health = Assert.NotNull(await server.Client.GetFromJsonAsync("/health", ProtocolJson.Default.HealthStatus));
Assert.Equal("ok", health.Checks["archive"]);
}
[Test]
public async Task AnArchiveMissingFoldersGetsThemAtStart()
{
var root = Path.Combine(context.CreateTempDirectory("existing"), "archive");
await using (var db = await ChronosDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(context.CreateTempDirectory("db"), "chronos.db")), context.Cancellation))
await new ArchiveService(db).CreateAsync(root, "Older", cancellationToken: context.Cancellation);
var paths = new ArchivePaths(root);
Directory.Delete(paths.TrashDirectory, recursive: true);
Directory.Delete(paths.StagingDirectory);
var notes = Path.Combine(root, "notes.txt");
File.WriteAllText(notes, "mine");
await using var server = await TestServer.StartAsync(context, o => o.ArchivePath = root);
Assert.Empty(ArchiveStructure.Missing(paths));
Assert.Equal("mine", File.ReadAllText(notes));
}
[Test]
public async Task TheDashboardWarnsWhileAFolderCannotBeCreated()
{
await using var server = await TestServer.StartAsync(context);
var admin = await server.AdminAsync();
var paths = new ArchivePaths(server.Options.ArchivePath);
Directory.Delete(paths.TrashVideosDirectory);
File.WriteAllText(paths.TrashVideosDirectory, "in the way");
var warned = await DashboardAsync(admin);
var problem = Assert.NotNull(warned.ArchiveProblem);
Assert.Equal(("failed", paths.TrashVideosDirectory), (problem.Code, problem.Folder));
var health = Assert.NotNull(await server.Client.GetFromJsonAsync("/health", ProtocolJson.Default.HealthStatus));
Assert.Equal(("ok", "incomplete"), (health.Status, health.Checks["archive"]));
Assert.Equal("in the way", File.ReadAllText(paths.TrashVideosDirectory));
// Once the file is out of the way, the next look at the dashboard makes the folder and the warning goes.
File.Delete(paths.TrashVideosDirectory);
Assert.Null((await DashboardAsync(admin)).ArchiveProblem);
Assert.True(Directory.Exists(paths.TrashVideosDirectory));
health = Assert.NotNull(await server.Client.GetFromJsonAsync("/health", ProtocolJson.Default.HealthStatus));
Assert.Equal("ok", health.Checks["archive"]);
}
[Test]
public async Task HealthSeesAFixOnTheHostWithoutTheDashboard()
{
await using var server = await TestServer.StartAsync(context);
var archive = server.Services.GetRequiredService<ServerArchive>();
var paths = new ArchivePaths(server.Options.ArchivePath);
Directory.Delete(paths.TrashVideosDirectory);
File.WriteAllText(paths.TrashVideosDirectory, "in the way");
archive.HealthRecheck = TimeSpan.Zero;
var health = Assert.NotNull(await server.Client.GetFromJsonAsync("/health", ProtocolJson.Default.HealthStatus));
Assert.Equal("incomplete", health.Checks["archive"]);
File.Delete(paths.TrashVideosDirectory);
health = Assert.NotNull(await server.Client.GetFromJsonAsync("/health", ProtocolJson.Default.HealthStatus));
Assert.Equal("ok", health.Checks["archive"]);
Assert.True(Directory.Exists(paths.TrashVideosDirectory));
}
[Test]
public async Task ARootThatLostItsArchiveJsonGetsNoFolders()
{
// Rc.14 review: an unmounted disk leaves an empty mount point; nothing is written onto the disk beneath it.
await using var server = await TestServer.StartAsync(context);
var admin = await server.AdminAsync();
var paths = new ArchivePaths(server.Options.ArchivePath);
var manifest = File.ReadAllBytes(paths.ManifestPath);
File.Delete(paths.ManifestPath);
Directory.Delete(paths.TrashDirectory, recursive: true);
var problem = Assert.NotNull((await DashboardAsync(admin)).ArchiveProblem);
Assert.Equal("unavailable", problem.Code);
Assert.False(Directory.Exists(paths.TrashDirectory), "nothing created");
var health = Assert.NotNull(await server.Client.GetFromJsonAsync("/health", ProtocolJson.Default.HealthStatus));
Assert.Equal("missing", health.Checks["archive"]);
// The disk is back: the next look completes the layout.
File.WriteAllBytes(paths.ManifestPath, manifest);
Assert.Null((await DashboardAsync(admin)).ArchiveProblem);
Assert.Empty(ArchiveStructure.Missing(paths));
}
private static async Task<DashboardDto> DashboardAsync(HttpClient admin)
{
using var response = await admin.GetAsync("/api/v1/server/dashboard");
await response.ExpectAsync(HttpStatusCode.OK);
return await response.ReadAsync(ProtocolJson.Default.DashboardDto);
}
}
@@ -52,6 +52,24 @@ public sealed partial class LoggingTests(TestContext context)
Assert.Equal((LogLevel.Debug, LogLevel.Warning, Chronos.Core.Diagnostics.LogLevel.Debug), (logging.FileLevel, logging.ConsoleLevel, CoreLog.MinimumLevel));
}
[Test]
public void AValueOutOfRangeIsNamedByItsVariable()
{
// Rc.14 review: the start's message named the setting's property, which the deploy guide never mentions.
ServerOptions Load(params (string Name, string Value)[] variables)
{
var environment = new Dictionary<string, string?> { ["CHRONOS_DATA_PATH"] = context.CreateTempDirectory("ranges"), ["CHRONOS_DB"] = "postgres" };
foreach (var (name, value) in variables) environment[name] = value;
return ServerOptions.Load(environment);
}
var logs = Assert.Throws<InvalidOperationException>(() => Load(("CHRONOS_LOG_MAX_FILE_MB", "50"), ("CHRONOS_LOG_MAX_TOTAL_MB", "10")).Validate());
Assert.True(logs.Message.StartsWith("CHRONOS_LOG_MAX_TOTAL_MB is out of range", StringComparison.Ordinal), logs.Message);
var port = Assert.Throws<InvalidOperationException>(() => Load(("CHRONOS_HTTP_PORT", "70000")).Validate());
Assert.Contains("CHRONOS_HTTP_PORT", port.Message);
// Parallelism alone is held to its range instead.
Assert.Equal(ServerOptions.MaxParallelism, Load(("CHRONOS_PARALLELISM", "128")).Parallelism);
}
[Test]
public async Task TheFileLevelChangesWhileTheServerRuns()
{