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,116 @@
using System.Globalization;
using System.Text;
using System.Text.Json;
using Chronos.Core.Diagnostics;
using Chronos.Core.Model;
using Chronos.Data;
using Chronos.Data.Processing;
using Chronos.Server.Configuration;
using Chronos.Server.Jobs;
using Chronos.Server.Security;
namespace Chronos.Server.Api;
/// <summary>
/// <c>GET /api/v1/server/diagnostics</c> (BRIEF §22 Phase 8; ManageArchive): a zip with the environment report, the
/// effective configuration, the encoders, the latest failed jobs and the server logs. Everything passes through
/// <see cref="SecretScrubber"/> (admin and database passwords, tokens and keys are removed); no archive file is included.
/// </summary>
public static class DiagnosticsEndpoints
{
/// <summary>Failed jobs included, newest first.</summary>
public const int FailedJobs = 100;
public static void Map(RouteGroupBuilder api) =>
api.MapGet("/server/diagnostics", DownloadAsync).Requires(Permissions.ManageArchive);
private static async Task<IResult> DownloadAsync(HttpContext context, Caller caller, ChronosDatabase db, ServerOptions options, ServerState state,
AuditLog audit, TimeProvider time, IServiceProvider services)
{
var ct = context.RequestAborted;
var failures = (await db.Jobs.ListAsync(JobState.Failed, FailedJobs, null, ct)).Items;
var report = Report(options, state, time);
var settings = JsonSerializer.Serialize(options, ServerOptionsJson.Default.ServerOptions);
var encoders = Encoders(services.GetService<ProcessingService>());
// The bundle is built in a temporary file (zip writes are synchronous and logs can be large) that no crash leaves
// behind: Windows deletes it when the handle closes; elsewhere it is unlinked at once and lives on through the
// open handle (DeleteOnClose there would unlink by name at close, possibly a newer file of the same name).
var temp = Path.GetTempFileName();
var file = new FileStream(temp, FileMode.Create, FileAccess.ReadWrite, FileShare.None, 1 << 16,
OperatingSystem.IsWindows() ? FileOptions.DeleteOnClose : FileOptions.None);
if (!OperatingSystem.IsWindows()) File.Delete(temp);
try
{
await Task.Run(() =>
{
using var bundle = new DiagnosticsArchive(file);
bundle.AddText("environment.txt", report);
bundle.AddJson("settings.json", settings);
bundle.AddText("encoders.txt", encoders);
bundle.AddJobs("jobs-failed.json", failures);
bundle.AddLogs(options.LogPath, cancellationToken: ct);
}, ct);
file.Position = 0;
}
catch
{
await file.DisposeAsync();
throw;
}
await audit.WriteAsync(caller, context, "server_diagnostics", "server");
context.Response.Headers.CacheControl = "no-store";
var name = string.Create(CultureInfo.InvariantCulture, $"chronos-server-diagnostics-{time.GetUtcNow():yyyyMMdd-HHmm}.zip");
return Results.File(file, "application/zip", name);
}
private static string Report(ServerOptions options, ServerState state, TimeProvider time)
{
var sb = new StringBuilder();
sb.AppendLine(CultureInfo.InvariantCulture, $"Chronos Server {SystemEndpoints.Version} ({options.ServerName})");
sb.Append(DiagnosticsArchive.SystemReport());
sb.AppendLine(CultureInfo.InvariantCulture, $"Uptime {time.GetUtcNow() - state.StartedAt:d\\.hh\\:mm\\:ss}");
sb.AppendLine(CultureInfo.InvariantCulture, $"Database {state.Database} ({options.Database})");
// The SQLite build's options (BRIEF §6.2) explain behaviour differences between Windows versions.
if (options.Database == DatabaseKind.Sqlite)
sb.AppendLine("SQLite compile options: " + string.Join(' ', Chronos.Data.Sqlite.SqliteDatabase.CompileOptions));
sb.AppendLine(CultureInfo.InvariantCulture, $"TLS {options.TlsMode} {state.TlsFingerprint}");
sb.AppendLine(CultureInfo.InvariantCulture, $"Jobs one at a time, parallelism {options.Parallelism}, priority queue {(options.PriorityQueue ? "on" : "off")}");
sb.AppendLine(CultureInfo.InvariantCulture, $"Archive {options.ArchivePath} ({Space(options.ArchivePath)})");
sb.AppendLine(CultureInfo.InvariantCulture, $"Data {options.DataPath} ({Space(options.DataPath)})");
sb.AppendLine(CultureInfo.InvariantCulture, $"Container {File.Exists("/.dockerenv")}");
sb.AppendLine("Set by environment: " + string.Join(", ", options.Locked));
return sb.ToString();
}
private static string Encoders(ProcessingService? processing)
{
if (processing is null) return "No processing engine registered.\n";
var sb = new StringBuilder();
foreach (var provider in processing.Options.Encoders)
{
foreach (var c in provider.Capabilities)
{
sb.AppendLine(CultureInfo.InvariantCulture,
$"{provider.Name}: {c.Codec} {c.Name} ({(c.Hardware ? "hardware" : "software")}{(c.SupportsTenBit ? ", 10-bit" : string.Empty)}, max {c.MaxWidth}x{c.MaxHeight})");
}
}
return sb.ToString();
}
private static string Space(string path)
{
try
{
if (!Directory.Exists(path)) return "missing";
var full = Path.GetFullPath(path);
// Windows wants a drive root; Unix accepts any directory and reports the volume it is mounted on.
var drive = new DriveInfo(OperatingSystem.IsWindows() ? Path.GetPathRoot(full)! : full);
return string.Create(CultureInfo.InvariantCulture, $"{drive.AvailableFreeSpace / (1L << 30)} GB free of {drive.TotalSize / (1L << 30)} GB");
}
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or ArgumentException)
{
return "free space unknown";
}
}
}