refactor!: rename Titano to Chronos and move CI and releases to Gitea
CI / Build and test (pull_request) Failing after 2m3s
CI / PostgreSQL 16 integration (pull_request) Skipped
CI / PostgreSQL 17 integration (pull_request) Skipped
CI / Docker image (pull_request) Skipped
CI / Windows tests and installer (pull_request) Skipped
CI / YAML check (pull_request) Successful in 4s

The owner renamed the product and moved the repository to the self-hosted
Gitea (https://gitea.encke-hake.ts.net/BalboSoft/Chronos) for more control,
and asked for Actions and a first automatic release with the server package
and the Windows exe (docs/requests/2026-10-23-chronos-gitea.md).

- Chronos everywhere: a byte-exact rename of contents and paths, then a
  per-language review of the forms the old name's ending had dictated.
- Gitea instead of GitHub: the update check, licence, issue and support
  links read ChronosReleasesUrl; the update check takes the highest stable
  version, offers a pre-release build its final release and reports a
  repository it cannot see as a failed check. EULA, security policy and
  Gitea issue forms live at the repository root.
- Gitea Actions for the Linux act_runner (.gitea/workflows): CI, release,
  nightly image and performance gates in the .NET SDK container with git
  checkout. The release cross-compiles the Windows programs, checks their
  icon, version and DPI manifest, packs installers and zips, publishes the
  Gitea release and pushes the server image (REGISTRY_TOKEN). Windows-only
  tests run in an opt-in job on a Windows runner (WINDOWS_RUNNER).
- New Chronos.Tools commands: zip, gitea-release, postgres-ci (replaces the
  docker-exec script, which Gitea's service containers do not allow) and
  pe-check.

BREAKING CHANGE: programs, settings, data folders, file types, environment
variables and the Docker image use the new name; nothing is migrated from
Titano, which never had a release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-10-23 11:34:48 +02:00
1 parent c99842cc86
commit 5f27a86406
1799 files changed
+11728 -10668

No files matched your search

@@ -0,0 +1,86 @@
using Chronos.Core.Model;
using Chronos.Data.Repositories;
using Chronos.Data.Tests.Infrastructure;
using Chronos.Testing;
namespace Chronos.Data.Tests.Perf;
/// <summary>
/// §1.1 / Phase 3 gate on the 500,000-photo library: the Library opens (archive totals, filter lists and the first
/// page, exactly what the Library screen asks at start) in under 1 s on its first query through a new connection pool,
/// and every filter, search and sort answers its first page plus the total in under 200 ms. The index was just written
/// by the same machine, so the OS page cache (and PostgreSQL's shared buffers) are warm: the gate covers query plans
/// and indexes, not a disk read after a reboot. Opt-in: <c>CHRONOS_PERF=1</c>.
/// </summary>
[Category("perf")]
[RequiresEnvironment(PerfGate.Variable)]
[Serial]
[Timeout(3_600_000)]
public abstract class LibraryPerfTests(TestContext context) : RepositoryTest(context)
{
public const double OpenBudgetMs = 1_000;
public const double FilterBudgetMs = 200;
[Test]
public async Task TheLibraryOpensAndFiltersWithinTheGates()
{
var options = await NewOptionsAsync(multiConnection: true);
await using (var build = await ChronosDatabase.OpenAsync(options, Ct)) await SyntheticLibrary.BuildAsync(build, Context);
// A new connection pool and SQLite page cache, as at application start.
var db = Own(await ChronosDatabase.OpenAsync(options, Ct));
var first = await PerfGate.TimeAsync(() => OpenLibraryAsync(db));
var again = await PerfGate.MedianAsync(() => OpenLibraryAsync(db));
Context.Log($"perf: {Dialect} library open {first:F0} ms first, {again:F0} ms again (budget {OpenBudgetMs:F0} ms)");
var failures = new List<string>();
if (first > OpenBudgetMs) failures.Add($"open {first:F0} ms");
var firstPage = await db.Sequences.ListAsync(new SequenceQuery { Limit = 200 }, Ct);
foreach (var (name, query) in Filters(firstPage.NextCursor))
{
var ms = await PerfGate.MedianAsync(async () =>
{
await db.Sequences.ListAsync(query, Ct);
if (query.Cursor is null) await db.Sequences.CountAsync(query, Ct);
});
Context.Log($"perf: {Dialect} {name} {ms:F1} ms (budget {FilterBudgetMs:F0} ms)");
if (ms > FilterBudgetMs) failures.Add($"{name} {ms:F0} ms");
}
Assert.True(failures.Count == 0, "over budget: " + string.Join(", ", failures));
}
/// <summary>What the Library screen loads when it opens: totals and filter lists, then the first page.</summary>
private async Task OpenLibraryAsync(ChronosDatabase db)
{
await db.Sequences.GetStatsAsync(null, Ct);
await db.Tags.ListAsync(Ct);
await db.Archives.ListAsync(Ct);
await db.Sequences.ListAsync(new SequenceQuery { Limit = 200 }, Ct);
}
private static IEnumerable<(string Name, SequenceQuery Query)> Filters(string? secondPage)
{
yield return ("year", new SequenceQuery { Year = 2021, Limit = 200 });
yield return ("camera", new SequenceQuery { Camera = "Canon EOS R5", Limit = 200 });
yield return ("tag", new SequenceQuery { Tag = SyntheticLibrary.Tag(0), Limit = 200 });
yield return ("status", new SequenceQuery { WithoutStatus = SequenceStatus.AnalyzedLight, Limit = 200 });
yield return ("search", new SequenceQuery { Text = "harbour", Limit = 200 });
yield return ("search-miss", new SequenceQuery { Text = "no such words", Limit = 200 });
yield return ("combined", new SequenceQuery { Year = 2024, Camera = "ILCE-7M4", WithStatus = SequenceStatus.Verified, Limit = 200 });
yield return ("sort-title", new SequenceQuery { Sort = SequenceSort.Title, Limit = 200 });
yield return ("sort-size", new SequenceQuery { Sort = SequenceSort.Size, Limit = 200 });
yield return ("sort-frames", new SequenceQuery { Sort = SequenceSort.FrameCount, Limit = 200 });
yield return ("next-page", new SequenceQuery { Limit = 200, Cursor = secondPage });
}
}
public sealed class SqlitePerfLibraryTests(TestContext context) : LibraryPerfTests(context)
{
protected override Backend Backend => Backend.SqliteFile;
}
[RequiresEnvironment(PgTestServer.Variable)]
public sealed class PostgresPerfLibraryTests(TestContext context) : LibraryPerfTests(context)
{
protected override Backend Backend => Backend.Postgres;
}
+26
View File
@@ -0,0 +1,26 @@
using System.Diagnostics;
namespace Chronos.Data.Tests.Perf;
/// <summary>Timing helpers of the opt-in performance gates (<c>CHRONOS_PERF=1</c>, category <c>perf</c>).</summary>
internal static class PerfGate
{
public const string Variable = "CHRONOS_PERF";
public static async Task<double> TimeAsync(Func<Task> action)
{
var watch = Stopwatch.StartNew();
await action();
return watch.Elapsed.TotalMilliseconds;
}
/// <summary>Median of <paramref name="runs"/> timed runs after one untimed warm-up.</summary>
public static async Task<double> MedianAsync(Func<Task> action, int runs = 5)
{
await action();
var times = new double[runs];
for (var i = 0; i < runs; i++) times[i] = await TimeAsync(action);
Array.Sort(times);
return times[runs / 2];
}
}
@@ -0,0 +1,117 @@
using System.Diagnostics;
using System.Globalization;
using System.Text.Json;
using Chronos.Core.Archiving;
using Chronos.Core.Model;
using Chronos.Data.Archiving;
using Chronos.Data.Tests.Archiving;
using Chronos.Data.Tests.Infrastructure;
using Chronos.Testing;
namespace Chronos.Data.Tests.Perf;
/// <summary>
/// Phase 2 gate, §1.1 scaled to one fifth: 400 sequences of 250 real photos (100,000 frames; the §1.1 shape has 2,000
/// such sequences) adopted from files, then the index thrown away and rebuilt from the archive — once with the index
/// snapshot the scan left behind and once from the sidecars alone. The rebuilt index must equal the original in every
/// column of every sequence and frame (only <see cref="Sequence.UpdatedAt"/>, the time of the rebuild, may differ),
/// within a fifth of the 10 minutes §1.1 allows for 500,000 photos. Opt-in: <c>CHRONOS_PERF=1</c>.
/// </summary>
[Category("perf")]
[RequiresEnvironment(PerfGate.Variable)]
[Serial]
[Timeout(3_600_000)]
public abstract class RebuildPerfTests(TestContext context) : DatabaseTest(context)
{
public const int Scale = 5;
public const int Sequences = SyntheticLibrary.Sequences / Scale;
public const int FramesPerSequence = SyntheticLibrary.FramesPerSequence;
public const double RebuildBudgetSeconds = 600.0 / Scale;
private static readonly JsonSerializerOptions Json = new() { WriteIndented = false };
[Test]
public async Task AHundredThousandFrameArchiveRebuildsFromSidecarsAlone()
{
var root = Context.CreateTempDirectory("archive");
var watch = Stopwatch.StartNew();
Parallel.For(0, Sequences, new ParallelOptions { CancellationToken = Ct }, s =>
{
var start = ArchiveFixture.Start.AddDays(3 * s);
var folder = Path.Combine(root, start.Year.ToString(CultureInfo.InvariantCulture), $"{start:yyyy-MM-dd} Roof {s:000}", "originals");
Photos.WriteSeries(folder, start, FramesPerSequence, firstSeed: 1 + s * FramesPerSequence);
});
Context.Log($"perf: wrote {Sequences * FramesPerSequence:N0} photos in {Sequences:N0} folders in {watch.Elapsed.TotalSeconds:F1} s");
var (db, service, archive) = await OpenIndexAsync(root, adopt: true);
watch.Restart();
var adopted = await service.Indexer.ScanAsync(archive, ScanMode.Full, null, _ => ValueTask.CompletedTask, Ct);
Context.Log($"perf: {Dialect} adopted {adopted.Adopted} folders in {watch.Elapsed.TotalSeconds:F1} s");
Assert.Equal(Sequences, adopted.Adopted);
Assert.Empty(adopted.Failed);
var original = await DumpAsync(db, archive.Id);
Assert.Equal(Sequences * (FramesPerSequence + 1), original.Count);
foreach (var snapshot in new[] { true, false })
{
if (!snapshot) File.Delete(new ArchivePaths(root).SnapshotPath);
var (freshDb, fresh, reopened) = await OpenIndexAsync(root, adopt: false);
watch.Restart();
var rebuilt = await fresh.Indexer.ScanAsync(reopened, ScanMode.Rebuild, null, _ => ValueTask.CompletedTask, Ct);
var seconds = watch.Elapsed.TotalSeconds;
Context.Log($"perf: {Dialect} rebuilt {Sequences * FramesPerSequence:N0} frames {(snapshot ? "with" : "without")} the snapshot in {seconds:F1} s (budget {RebuildBudgetSeconds:F0} s)");
Assert.Equal((Sequences, 0), (rebuilt.Indexed, rebuilt.Adopted));
AssertSameIndex(original, await DumpAsync(freshDb, reopened.Id));
Assert.Less(seconds, RebuildBudgetSeconds, "rebuild from sidecars");
}
}
/// <summary>A new empty index of this test's dialect with the archive at <paramref name="root"/> adopted or opened in it.</summary>
private async Task<(ChronosDatabase Db, ArchiveService Service, Archive Archive)> OpenIndexAsync(string root, bool adopt)
{
var db = Own(await ChronosDatabase.OpenAsync(await NewOptionsAsync(multiConnection: true), Ct));
var service = new ArchiveService(db, new ArchiveServiceOptions { Owner = "perf", LeaseWait = TimeSpan.FromSeconds(20) });
var archive = adopt ? await service.AdoptAsync(root, "Main", Ct) : await service.OpenAsync(root, Ct);
return (db, service, archive);
}
/// <summary>Every sequence and frame row as JSON with all its columns, in folder and index order.</summary>
private async Task<List<string>> DumpAsync(ChronosDatabase db, Guid archiveId)
{
var rows = new List<string>();
foreach (var location in await db.Sequences.ListLocationsAsync(archiveId, Ct))
{
var sequence = JsonSerializer.SerializeToNode((await db.Sequences.GetAsync(location.Id, Ct))!, Json)!.AsObject();
sequence.Remove(nameof(Sequence.UpdatedAt));
rows.Add("S " + sequence.ToJsonString(Json));
var after = -1;
while (await db.Frames.ListBySequenceAsync(location.Id, after, 1000, Ct) is { Count: > 0 } page)
{
rows.AddRange(page.Select(f => " F " + JsonSerializer.Serialize(f, Json)));
after = page[^1].Index;
}
}
return rows;
}
/// <summary>Equal row for row; a difference names its first row instead of printing two 100,000-line dumps.</summary>
private static void AssertSameIndex(List<string> expected, List<string> actual)
{
for (var i = 0; i < System.Math.Min(expected.Count, actual.Count); i++)
{
if (expected[i] != actual[i]) Assert.Fail($"row {i} differs after the rebuild:\n before {expected[i]}\n after {actual[i]}");
}
Assert.Equal(expected.Count, actual.Count, "rows after the rebuild");
}
}
public sealed class SqliteRebuildPerfTests(TestContext context) : RebuildPerfTests(context)
{
protected override Backend Backend => Backend.SqliteFile;
}
[RequiresEnvironment(PgTestServer.Variable)]
public sealed class PostgresRebuildPerfTests(TestContext context) : RebuildPerfTests(context)
{
protected override Backend Backend => Backend.Postgres;
}
@@ -0,0 +1,119 @@
using System.Diagnostics;
using Chronos.Core.Imaging;
using Chronos.Core.Model;
using Chronos.Testing;
namespace Chronos.Data.Tests.Perf;
/// <summary>
/// The §1.1 library: 2,000 sequences of 250 photos (500,000 frames) over twelve years, a dozen cameras, sixty tags and
/// mixed status flags, written straight into the index (no files). Everything but ids and hashes follows the seed, so
/// every run measures the same library.
/// </summary>
internal static class SyntheticLibrary
{
public const int Sequences = 2_000;
public const int FramesPerSequence = 250;
public const int Photos = Sequences * FramesPerSequence;
public static readonly (string Make, string Model)[] Cameras =
[
("Canon", "Canon EOS R5"), ("Canon", "Canon EOS 5D Mark IV"), ("Canon", "Canon EOS R6"), ("NIKON CORPORATION", "NIKON Z 7_2"),
("NIKON CORPORATION", "NIKON D850"), ("SONY", "ILCE-7M4"), ("SONY", "ILCE-7RM5"), ("FUJIFILM", "X-T5"), ("FUJIFILM", "GFX100S"),
("Panasonic", "DC-S5M2"), ("OM Digital Solutions", "OM-1"), ("GoPro", "HERO12 Black"),
];
private static readonly string[] Subjects =
["Harbour", "Milky Way", "Storm front", "Construction site", "City lights", "Glacier", "Sunrise", "Aurora", "Harvest", "Tide", "Fog", "Market"];
private static readonly string[] Places =
["Dolomites", "Trieste", "Lofoten", "Atacama", "Iceland", "Rome", "Garda", "Etna", "Patagonia", "Namib", "Kyoto", "Sardinia"];
private static readonly ImageFileFormat[] Formats = [ImageFileFormat.Cr3, ImageFileFormat.Nef, ImageFileFormat.Arw, ImageFileFormat.Jpeg, ImageFileFormat.Raf, ImageFileFormat.Dng];
public static string Tag(int i) => i switch
{
0 => "milky way",
1 => "harbour",
2 => "client",
_ => $"tag {i:00}",
};
/// <summary>Writes the library into <paramref name="db"/> and returns its archive.</summary>
public static async Task<Archive> BuildAsync(ChronosDatabase db, TestContext context, int seed = 7)
{
var watch = Stopwatch.StartNew();
var archive = new Archive { Id = Guid.CreateVersion7(), Name = "Perf", RootPath = "/archive/perf", Created = DateTimeOffset.UtcNow };
await db.Archives.UpsertAsync(archive, context.Cancellation);
var random = new Random(seed);
var sequences = new List<Sequence>(Sequences);
for (var i = 0; i < Sequences; i++)
{
var (make, model) = Cameras[random.Next(Cameras.Length)];
var first = new DateTime(2015, 1, 1).AddDays(random.Next(12 * 365)).AddMinutes(random.Next(24 * 60));
var interval = 2 + random.Next(30);
var status = (random.Next(4) > 0 ? SequenceStatus.AnalyzedLight : 0) | (random.Next(3) == 0 ? SequenceStatus.ProxiesBuilt : 0)
| (random.Next(2) == 0 ? SequenceStatus.Verified : 0) | (random.Next(10) == 0 ? SequenceStatus.HasWarnings : 0);
var tags = Enumerable.Range(0, random.Next(5)).Select(_ => Tag(random.Next(60))).Distinct().ToArray();
sequences.Add(new Sequence
{
Id = Guid.CreateVersion7(),
ArchiveId = archive.Id,
Title = random.Next(8) == 0 ? null : $"{Subjects[random.Next(Subjects.Length)]} {Places[random.Next(Places.Length)]} {i}",
Folder = $"{first.Year}/{first:yyyy-MM-dd}_{i:0000}",
CameraMake = make,
CameraModel = model,
FirstCapture = first,
LastCapture = first.AddSeconds(interval * (FramesPerSequence - 1)),
FrameCount = FramesPerSequence,
MedianInterval = interval,
TotalBytes = FramesPerSequence * 25_000_000L,
Status = status,
Rating = random.Next(6),
Tags = tags,
UpdatedAt = DateTimeOffset.UtcNow,
});
}
foreach (var s in sequences) await db.Sequences.UpsertAsync(s, context.Cancellation);
await db.Frames.BulkInsertAsync(sequences.SelectMany((s, i) => Frames(s, seed, i)), context.Cancellation);
context.Log($"perf: built {Sequences:N0} sequences / {Photos:N0} photos in {watch.Elapsed.TotalSeconds:F1} s");
return archive;
}
private static IEnumerable<Frame> Frames(Sequence sequence, int seed, int index)
{
// Seeded by the sequence's position, not its random id, so every run builds the same frames.
var random = new Random(unchecked((seed * 100_003) + index));
var format = Formats[random.Next(Formats.Length)];
for (var i = 0; i < FramesPerSequence; i++)
{
var flags = random.Next(2_000) switch
{
0 => FrameFlags.Missing,
1 => FrameFlags.Corrupt,
2 or 3 => FrameFlags.Duplicate,
_ => FrameFlags.None,
};
yield return new Frame
{
Id = Guid.CreateVersion7(),
SequenceId = sequence.Id,
Index = i,
RelativePath = $"{sequence.Folder}/originals/IMG_{i:0000}.{format.ToString().ToUpperInvariant()}",
FileName = $"IMG_{i:0000}.{format.ToString().ToUpperInvariant()}",
Size = 20_000_000 + random.Next(10_000_000),
Sha256 = Convert.ToHexStringLower(Guid.NewGuid().ToByteArray()) + Convert.ToHexStringLower(Guid.NewGuid().ToByteArray()),
CapturedAt = sequence.FirstCapture!.Value.AddSeconds(sequence.MedianInterval!.Value * i),
TimestampSource = TimestampSource.ExifOriginal,
ExposureTime = 1 / 250.0,
FNumber = 8,
Iso = 100,
FocalLength = 24,
Width = 6000,
Height = 4000,
Format = format,
Flags = flags,
};
}
}
}