refactor!: rename Titano to Chronos and move CI and releases to Gitea (#6)
CI / Build and test (push) Successful in 8m14s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 13m19s
CI / PostgreSQL 16 integration (push) Successful in 4m49s
CI / PostgreSQL 17 integration (push) Successful in 5m28s
CI / Docker image (push) Successful in 53s
Release / Server image (push) Failing after 10s

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 and the system SQLite. 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; the
  throw-away server runs without durability) and pe-check.
- Timed tests take their budget from TestTiming (CHRONOS_TEST_TIME_FACTOR,
  3 on the shared runner; the weekly performance gates keep theirs).

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>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #6.
This commit is contained in:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-10-23 12:45:18 +02:00
1 parent c99842cc86
commit f2b58522b9
1801 files changed
+11804 -10676

No files matched your search

@@ -0,0 +1,82 @@
using System.IO;
using Chronos.App.Infrastructure;
using Chronos.Core.Windows.Shell;
using Chronos.Testing;
namespace Chronos.App.Tests.Infrastructure;
/// <summary>BRIEF §6.2: the client's data folder, which is never inside a folder OneDrive synchronises.</summary>
public sealed class AppEnvironmentTests(TestContext context)
{
[Test]
public void APortableCopyInOneDriveKeepsItsDataInTheUserFolderAndSaysSo()
{
var oneDrive = context.CreateTempDirectory("onedrive");
var app = Directory.CreateDirectory(Path.Combine(oneDrive, "Desktop", "Chronos")).FullName;
File.WriteAllText(Path.Combine(app, PortableMode.MarkerFileName), "");
var local = context.CreateTempDirectory("local");
var environment = AppEnvironment.From(AppPaths.Resolve(app, local, [oneDrive]));
Assert.Equal(Path.Combine(local, "Chronos", "chronos.db"), environment.DatabasePath);
Assert.True(environment.IsPortable, "still a portable copy: updates fetch the portable zip, no sign-in entry");
Assert.Equal<string?>(oneDrive, environment.PortableSyncRoot);
Assert.Null(environment.SyncedFolder);
Assert.Null(environment.EarlierPortableData);
Assert.True(Directory.Exists(environment.LogDirectory));
Assert.False(Directory.Exists(Path.Combine(app, "data")), "nothing is written into the synchronised folder");
// Elsewhere (a USB stick) a portable copy keeps its data beside it.
var stick = context.CreateTempDirectory("stick");
File.WriteAllText(Path.Combine(stick, PortableMode.MarkerFileName), "");
var beside = AppEnvironment.From(AppPaths.Resolve(stick, local, [oneDrive]));
Assert.Equal(Path.Combine(stick, "data"), beside.DataDirectory);
Assert.Null(beside.PortableSyncRoot);
Assert.Null(beside.SyncedFolder);
}
[Test]
public void TheDataAPortableCopyKeptInOneDriveBeforeIsNamedAndLeftAlone()
{
var oneDrive = context.CreateTempDirectory("onedrive");
var app = Directory.CreateDirectory(Path.Combine(oneDrive, "Documents", "Chronos")).FullName;
File.WriteAllText(Path.Combine(app, PortableMode.MarkerFileName), "");
// An earlier version kept its index and settings beside the program.
var earlier = Directory.CreateDirectory(Path.Combine(app, "data")).FullName;
File.WriteAllText(Path.Combine(earlier, "settings.json"), "{}");
File.WriteAllBytes(Path.Combine(earlier, "chronos.db"), [1, 2, 3]);
var local = context.CreateTempDirectory("local");
var environment = AppEnvironment.From(AppPaths.Resolve(app, local, [oneDrive]));
Assert.Equal<string?>(earlier, environment.EarlierPortableData);
Assert.Equal(Path.Combine(local, "Chronos"), environment.DataDirectory);
Assert.SequenceEqual(new byte[] { 1, 2, 3 }, File.ReadAllBytes(Path.Combine(earlier, "chronos.db")));
Assert.Equal("{}", File.ReadAllText(Path.Combine(earlier, "settings.json")));
// A data folder with neither (logs only) holds nothing the user would miss.
File.Delete(Path.Combine(earlier, "settings.json"));
File.Delete(Path.Combine(earlier, "chronos.db"));
Directory.CreateDirectory(Path.Combine(earlier, "logs"));
Assert.Null(AppEnvironment.From(AppPaths.Resolve(app, local, [oneDrive])).EarlierPortableData);
}
[Test]
public void AUserFolderOneDriveSynchronisesIsReportedNotHidden()
{
// Nowhere is safe: Chronos starts all the same, and the folder that is synchronised is named for the warning.
var oneDrive = context.CreateTempDirectory("onedrive");
var local = Directory.CreateDirectory(Path.Combine(oneDrive, "AppData", "Local")).FullName;
var installed = AppEnvironment.From(AppPaths.Resolve(context.CreateTempDirectory("app"), local, [oneDrive]));
Assert.Equal<string?>(oneDrive, installed.SyncedFolder);
Assert.Null(installed.PortableSyncRoot);
Assert.True(Directory.Exists(installed.LogDirectory));
// A portable copy in that OneDrive has nowhere safe either: its data is not said to be kept outside it.
var app = Directory.CreateDirectory(Path.Combine(oneDrive, "Desktop", "Chronos")).FullName;
File.WriteAllText(Path.Combine(app, PortableMode.MarkerFileName), "");
var portable = AppEnvironment.From(AppPaths.Resolve(app, local, [oneDrive]));
Assert.Equal<(string?, string?)>((oneDrive, oneDrive), (portable.SyncedFolder, portable.PortableSyncRoot));
}
}
@@ -0,0 +1,156 @@
using System.IO;
using Chronos.App.Infrastructure;
using Chronos.App.Tests.Uploader;
using Chronos.Core.Model;
using Chronos.Data;
using Chronos.Data.Archiving;
using Chronos.Testing;
namespace Chronos.App.Tests.Infrastructure;
public sealed class AppServicesTests
{
/// <summary>Dialogs that answer like a user who cancels everything.</summary>
private sealed class NoDialogs : IAppDialogs
{
public string? PickFolder(string title, string? initialFolder = null) => null;
public string? PickJsonFile(string title) => null;
public bool Confirm(ConfirmRequest request) => false;
public bool SignIn(string server, string? username, Func<string, string, Task<string?>> signIn) => false;
}
[Test]
[WindowsOnly]
public void ExitStopsPollingAndTheEngineWhileTheUiThreadWaits()
{
var environment = AppEnvironment.ForCapture();
try
{
SingleThreadedContext.Run(async () =>
{
var root = Path.Combine(environment.DataDirectory, "archive");
await using (var setup = await ChronosDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(environment.DataDirectory, "setup.db"))))
await new ArchiveService(setup).CreateAsync(root, "Exit");
var services = new AppServices(environment, new AppSettings { Language = "en", LastArchivePath = root }, () => { }, new NoDialogs());
await services.OpenAsync(environment.DatabasePath);
// The archive was reopened and its first rescan queued: polling now waits for the next one.
var until = DateTime.UtcNow + TimeSpan.FromSeconds(30);
while ((await services.Database!.Jobs.ListAsync(null, JobKind.Scan)).Items.Count == 0)
{
Assert.True(DateTime.UtcNow < until, "no rescan queued");
await Task.Delay(50);
}
// App.OnExit blocks the UI thread until the services stop: nothing they await may continue on it.
Assert.True(services.DisposeAsync().AsTask().Wait(TimeSpan.FromSeconds(10)), "services stopped");
});
}
finally
{
environment.DeleteCaptureData();
}
}
/// <summary>BRIEF §7: polling follows the archive folder, also one chosen after the start (first run, Settings, relink).</summary>
[Test]
[WindowsOnly]
public void RescansFollowTheArchiveFolderChosenAfterTheStart()
{
var environment = AppEnvironment.ForCapture();
try
{
SingleThreadedContext.Run(async () =>
{
// The first run: the index opens before any archive folder is set.
var settings = new AppSettings { Language = "en" };
var services = new AppServices(environment, settings, () => { }, new NoDialogs());
try
{
await services.OpenAsync(environment.DatabasePath);
Assert.Null(await services.RescanAsync());
// The rescans run all the same: Settings › Archive › Rescan every reaches them.
settings.ScanIntervalMinutes = 30;
services.SaveSettings();
Assert.Equal<TimeSpan?>(TimeSpan.FromMinutes(30), services.PollingPeriod);
// The first-run dialog creates an archive: the next rescan is of it.
var firstRoot = Path.Combine(environment.DataDirectory, "first");
await services.ArchiveSetup.CreateAsync(firstRoot);
var first = Assert.NotNull(await services.RescanAsync());
Assert.Equal("first", first.Name);
// Settings › Archive moves to another archive, which the index lists after the first one: the next rescan
// is of the archive at the folder, no longer of the first one.
var other = Path.Combine(environment.DataDirectory, "zeta");
await new ArchiveService(services.Database!).CreateAsync(other, "zeta");
Assert.Equal("first", (await services.Database!.Archives.ListAsync())[0].Name);
async Task<int> ScansOfAsync(Guid archiveId) =>
(await services.Database!.Jobs.ListAsync(null, JobKind.Scan)).Items.Count(j => j.TargetIds.Contains(archiveId));
var scansOfFirst = await ScansOfAsync(first.Id);
settings.LastArchivePath = other;
services.SaveSettings();
var rescanned = Assert.NotNull(await services.RescanAsync());
Assert.Equal("zeta", rescanned.Name);
Assert.True(await ScansOfAsync(rescanned.Id) > 0, "the archive at the folder is rescanned");
Assert.Equal(scansOfFirst, await ScansOfAsync(first.Id));
// And back: the folder decides, whatever the order of the index.
settings.LastArchivePath = firstRoot;
services.SaveSettings();
Assert.Equal(first.Id, (await services.RescanAsync())?.Id);
}
finally
{
Assert.True(services.DisposeAsync().AsTask().Wait(TimeSpan.FromSeconds(10)), "services stopped");
}
});
}
finally
{
environment.DeleteCaptureData();
}
}
/// <summary>BRIEF §6.2: a restore staged in Settings › Advanced recovers an index that no longer opens.</summary>
[Test]
[WindowsOnly]
public void AStagedRestoreRecoversAnIndexThatNoLongerOpens()
{
var environment = AppEnvironment.ForCapture();
try
{
SingleThreadedContext.Run(async () =>
{
await using (var db = await ChronosDatabase.OpenAsync(DatabaseOptions.Sqlite(environment.DatabasePath)))
{
await db.Archives.UpsertAsync(new Archive { Id = Guid.CreateVersion7(), Name = "Kept", RootPath = @"C:\Kept", Created = DateTimeOffset.UtcNow });
var backup = await db.BackupAsync(environment.BackupDirectory, DatabaseBackups.Keep);
await DatabaseBackups.StageRestoreAsync(backup, environment.DatabasePath);
}
// The index is damaged beyond opening ("file is not a database").
File.Delete(environment.DatabasePath + "-wal");
File.Delete(environment.DatabasePath + "-shm");
await File.WriteAllBytesAsync(environment.DatabasePath, [.. Enumerable.Repeat((byte)0x5A, 8192)]);
var services = new AppServices(environment, new AppSettings { Language = "en" }, () => { }, new NoDialogs());
try
{
await services.OpenAsync(environment.DatabasePath);
Assert.Null(services.OpenError);
Assert.Equal(StagedRestoreResult.Restored, services.StagedRestore);
Assert.SequenceEqual(["Kept"], (await services.Database!.Archives.ListAsync()).Select(a => a.Name));
Assert.False(DatabaseBackups.HasStagedRestore(environment.DatabasePath));
}
finally
{
Assert.True(services.DisposeAsync().AsTask().Wait(TimeSpan.FromSeconds(10)), "services stopped");
}
});
}
finally
{
environment.DeleteCaptureData();
}
}
}
@@ -0,0 +1,63 @@
using System.Globalization;
using System.IO;
using System.Net;
using System.Net.Http;
using Chronos.App.Shell;
using Chronos.Core.Archiving;
using Chronos.Core.Localization;
using Chronos.Protocol;
using Chronos.Protocol.Client;
using Chronos.Testing;
namespace Chronos.App.Tests.Infrastructure;
/// <summary>An error toast says what happened in one localized sentence; framework and OS messages stay in the log.</summary>
public sealed class ErrorTextTests
{
public ErrorTextTests() => Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
[Test]
public void AServerFailureIsTheServersSentenceOrThatItDoesNotAnswer()
{
const string Unreachable = "The server does not answer; check the address and the network.";
Assert.Equal("The server is out of disk space.",
ErrorText.ForServer(new ChronosApiException(HttpStatusCode.InsufficientStorage, new ApiError("insufficient_storage", "The server is out of disk space.", null))));
Assert.Equal(Unreachable, ErrorText.ForServer(new HttpRequestException("No such host is known. (nas.local:8443)")));
Assert.Equal(Unreachable, ErrorText.ForServer(new TaskCanceledException("A task was canceled.")));
Assert.Equal(Unreachable, ErrorText.ForServer(new IOException("The response ended prematurely.")));
Assert.Equal(Unreachable, ErrorText.ForServer(new AggregateException(new HttpRequestException("Connection refused"))));
Assert.Equal("The certificate was not trusted, so nothing was sent.", ErrorText.ForServer(new UntrustedCertificateException("AB:CD")));
// Failures that already carry a catalog sentence keep it.
Assert.Equal(@"The archive D:\Shoots is offline.", ErrorText.ForServer(new ArchiveOfflineException(@"D:\Shoots", ArchiveAvailability.Offline)));
Assert.Equal("Something went wrong.", ErrorText.ForServer(new InvalidOperationException("Sequence contains no elements")));
Assert.Equal("Something went wrong.", ErrorText.ForServer(new ChronosApiException(HttpStatusCode.Conflict, new ApiError("conflict", " ", null))));
Assert.Equal(Unreachable, ErrorText.ForServer(new ChronosApiException(HttpStatusCode.BadGateway, new ApiError("bad_gateway", " ", null))));
}
[Test]
public void AReplyThatIsNotTheServersOwnSaysWhatItsStatusMeans()
{
// A reverse proxy answers for the server (the NAS setup): its page is no Chronos JSON, so ChronosClient keeps only
// the reason phrase, in English, which never reaches the screen.
static ChronosApiException Proxy(HttpStatusCode status, string reason) => new(status, new ApiError("http_" + (int)status, reason));
const string Unreachable = "The server does not answer; check the address and the network.";
Assert.Equal(Unreachable, ErrorText.ForServer(Proxy(HttpStatusCode.BadGateway, "Bad Gateway")));
Assert.Equal(Unreachable, ErrorText.ForServer(Proxy(HttpStatusCode.ServiceUnavailable, "Service Unavailable")));
Assert.Equal(Unreachable, ErrorText.ForServer(Proxy(HttpStatusCode.GatewayTimeout, "Gateway Timeout")));
Assert.Equal(Unreachable, ErrorText.For(Proxy(HttpStatusCode.BadGateway, "Bad Gateway")));
Assert.Equal("The request is larger than the server accepts.", ErrorText.ForServer(Proxy(HttpStatusCode.RequestEntityTooLarge, "Request Entity Too Large")));
Assert.Equal("Too many attempts; wait a minute and try again.", ErrorText.ForServer(Proxy(HttpStatusCode.TooManyRequests, "Too Many Requests")));
Assert.Equal("Unexpected server error; try again.", ErrorText.ForServer(Proxy(HttpStatusCode.InternalServerError, "Internal Server Error")));
Assert.Equal("Something went wrong.", ErrorText.ForServer(Proxy(HttpStatusCode.NotFound, "Not Found")));
// JSON of another shape has no code: its message is not the server's either.
Assert.Equal(Unreachable, ErrorText.ForServer(new ChronosApiException(HttpStatusCode.BadGateway, new ApiError(null!, "upstream connect error"))));
}
[Test]
public void AnyOtherFailureNeverShowsTheFrameworkText()
{
Assert.Equal("Something went wrong.", ErrorText.For(new HttpRequestException("No such host is known.")));
Assert.Equal("Something went wrong.", ErrorText.For(new IOException(@"Access to the path 'D:\Archive' is denied.")));
Assert.Equal(@"The archive D:\Shoots is read-only.", ErrorText.For(new ArchiveOfflineException(@"D:\Shoots", ArchiveAvailability.ReadOnly)));
}
}
@@ -0,0 +1,131 @@
using Microsoft.Win32;
using Chronos.App.Infrastructure;
using Chronos.Core.IO;
using Chronos.Testing;
using Chronos.Uploader.Infrastructure;
namespace Chronos.App.Tests.Infrastructure;
/// <summary>Settings › General › Startup: one sign-in entry shared by every copy of Chronos, which no copy takes over by starting.</summary>
public sealed class StartWithWindowsTests
{
private const string Installed = @"C:\Users\ada\AppData\Local\Programs\Chronos\Chronos.exe";
[Test]
public void AStartFollowsOnlyAnEntryAnUpdateLeftBehindInItsOwnFolder()
{
static bool Gone(string path) => false;
static bool Present(string path) => true;
var installed = StartupCommand.Format(Installed, RunKeyStartWithWindows.MinimizedOption);
// The entry already starts this copy: nothing to write.
Assert.False(RunKeyStartWithWindows.Follows(installed, Installed, Gone));
// An update renamed the program in its folder: the entry follows it.
Assert.True(RunKeyStartWithWindows.Follows(StartupCommand.Format(@"C:\Users\ada\AppData\Local\Programs\Chronos\Chronos.old.exe", "--minimized"),
Installed, Gone));
// The installed copy is still there: a portable copy, a second install or a development build that starts leaves it alone.
Assert.False(RunKeyStartWithWindows.Follows(installed, @"E:\Chronos\Chronos.exe", Present));
Assert.False(RunKeyStartWithWindows.Follows(installed, @"C:\src\Chronos\bin\Debug\Chronos.exe", Present));
// Gone from another folder (a USB stick that is not plugged in): still not this copy's entry.
Assert.False(RunKeyStartWithWindows.Follows(installed, @"E:\Chronos\Chronos.exe", Gone));
// No entry, or no executable path: nothing to follow.
Assert.False(RunKeyStartWithWindows.Follows(null, Installed, Gone));
Assert.False(RunKeyStartWithWindows.Follows(installed, null, Gone));
}
[Test]
[WindowsOnly]
public void AnEntryTaskManagerTurnedOffShowsOffUntilTheBoxIsTickedAgain()
{
// A scratch hive of its own: the user's sign-in entries are never touched.
var hive = @"Software\Chronos.StartupTests." + Guid.NewGuid().ToString("N");
try
{
using var root = Registry.CurrentUser.CreateSubKey(hive, writable: true);
var startup = new RunKeyStartWithWindows(Installed, root);
startup.SetEnabled(true);
Assert.True(startup.IsEnabled);
// Task Manager › Startup › Disable keeps the Run value and writes the switch apart.
TurnOff(root, StartupCommand.ClientValue);
Assert.False(startup.IsEnabled, "shown as off");
Assert.True(StartupCommand.Starts(Value(root, StartupCommand.RunKey, StartupCommand.ClientValue) as string, Installed), "the command stays");
// An update renamed the program: the command follows it, and the entry stays off.
const string renamed = @"C:\Users\ada\AppData\Local\Programs\Chronos\Chronos.next.exe";
var updated = new RunKeyStartWithWindows(renamed, root);
updated.Refresh();
Assert.True(StartupCommand.Starts(Value(root, StartupCommand.RunKey, StartupCommand.ClientValue) as string, renamed));
Assert.False(updated.IsEnabled, "still off after the update");
// Ticking the box turns it on again; unticking leaves nothing behind.
updated.SetEnabled(true);
Assert.True(updated.IsEnabled);
Assert.Null(Value(root, StartupApproval.RunKey, StartupCommand.ClientValue));
TurnOff(root, StartupCommand.ClientValue);
updated.SetEnabled(false);
Assert.Null(Value(root, StartupCommand.RunKey, StartupCommand.ClientValue));
Assert.Null(Value(root, StartupApproval.RunKey, StartupCommand.ClientValue));
}
finally
{
Registry.CurrentUser.DeleteSubKeyTree(hive, throwOnMissingSubKey: false);
}
}
[Test]
[WindowsOnly]
public void TheUploadersEntryHonoursTaskManagerToo()
{
var hive = @"Software\Chronos.StartupTests." + Guid.NewGuid().ToString("N");
try
{
using var root = Registry.CurrentUser.CreateSubKey(hive, writable: true);
var uploader = @"C:\Users\ada\AppData\Local\Programs\Chronos\Uploader\Chronos.Uploader.exe";
var startup = new RunKeyStartupRegistration(uploader, root);
startup.SetEnabled(true);
Assert.True(startup.IsEnabled);
TurnOff(root, StartupCommand.UploaderValue);
Assert.False(startup.IsEnabled, "shown as off");
startup.Refresh();
Assert.False(startup.IsEnabled, "a refresh keeps it off");
startup.SetEnabled(true);
Assert.True(startup.IsEnabled);
TurnOff(root, StartupCommand.UploaderValue);
startup.SetEnabled(false);
Assert.Null(Value(root, StartupCommand.RunKey, StartupCommand.UploaderValue));
Assert.Null(Value(root, StartupApproval.RunKey, StartupCommand.UploaderValue));
}
finally
{
Registry.CurrentUser.DeleteSubKeyTree(hive, throwOnMissingSubKey: false);
}
}
[Test]
public void ScreenshotsAndPortableCopiesKeepTheChoiceInMemory()
{
var startup = new MemoryStartWithWindows();
Assert.False(startup.IsEnabled);
startup.SetEnabled(true);
startup.Refresh();
Assert.True(startup.IsEnabled);
startup.SetEnabled(false);
Assert.False(startup.IsEnabled);
}
/// <summary>What Task Manager writes when the user disables an entry: 0x03, three zero bytes, then when.</summary>
private static void TurnOff(RegistryKey root, string name)
{
using var approved = root.CreateSubKey(StartupApproval.RunKey, writable: true);
approved.SetValue(name, new byte[] { 0x03, 0, 0, 0, 0x60, 0x1B, 0x3C, 0x92, 0x8A, 0x3F, 0xDB, 0x01 }, RegistryValueKind.Binary);
}
private static object? Value(RegistryKey root, string subKey, string name)
{
using var key = root.OpenSubKey(subKey);
return key?.GetValue(name);
}
}