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

+191
View File
@@ -0,0 +1,191 @@
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using Chronos.Core.Diagnostics;
using Chronos.Core.Imaging;
using Chronos.Core.IO;
using Chronos.Core.Model;
using Chronos.Core.Render;
using Chronos.Data.Processing;
using Chronos.Protocol;
namespace Chronos.Data.Sync;
/// <summary>
/// A server sequence opened with proxies (BRIEF §14.5 "edit with proxies, render where the originals are"): the
/// sequence and frame rows as the server lists them, and for each frame its cached proxy (a thumbnail when the server
/// had no proxy). Frames without a cached file are flagged <see cref="FrameFlags.Missing"/>, so analysis and renders
/// skip them. Not part of the local index.
/// </summary>
public sealed class RemoteSequence
{
/// <param name="files">Absolute path of each frame's proxy in frame order; null (and the frame flagged missing) when it is not cached.</param>
public RemoteSequence(string server, Sequence sequence, IReadOnlyList<Frame> frames, IReadOnlyList<string?> files)
{
if (files.Count != frames.Count) throw new ArgumentException("One file entry per frame is required.", nameof(files));
Server = server;
Sequence = sequence;
Frames = frames;
Files = files;
}
/// <summary>The server it belongs to (<see cref="SyncService.ServerKey"/>).</summary>
public string Server { get; }
/// <summary>The server's sequence: its id, <see cref="SequenceOrigin.Server"/>, its settings JSON and versions; no archive.</summary>
public Sequence Sequence { get; }
public IReadOnlyList<Frame> Frames { get; }
/// <summary>Absolute path of each frame's cached proxy, in frame order; null when it is not cached.</summary>
public IReadOnlyList<string?> Files { get; }
public int CachedCount => Files.Count(f => f is not null);
/// <summary>
/// The editor's frame source over the cached proxies, decoded by <paramref name="decoder"/> through the same
/// read-ahead window as archive renders. The result also implements <see cref="Core.Analysis.Deep.IFrameSource"/>
/// and <see cref="IAsyncDisposable"/>; dispose it when done. Frames are proxy-sized while the source reports the
/// originals' size, which <see cref="IRenderFrameSource"/> allows.
/// </summary>
public IRenderFrameSource OpenFrames(ImageDecoder decoder, FrameWindowOptions? window = null)
{
var frames = new SequenceFrames(Sequence, Frames, Files);
return new SequenceFrameSource(frames, frames.LightFrames(), decoder, window);
}
}
/// <summary>What the proxy cache keeps next to the files of one server sequence.</summary>
/// <param name="Kinds">
/// What each file is, in frame order: <see cref="ProxyCache.Proxy"/> or <see cref="ProxyCache.Thumb"/> (a thumbnail standing in
/// while the server has no proxy of the frame); null where no file is cached, and for a cache written before kinds were kept.
/// </param>
internal sealed record ProxyCacheIndex(SequenceDto Sequence, string? SettingsJson, int FramesVersion, IReadOnlyList<FrameDto> Frames, IReadOnlyList<string?> Files,
IReadOnlyList<string?>? Kinds = null);
[JsonSourceGenerationOptions(PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
[JsonSerializable(typeof(ProxyCacheIndex))]
internal sealed partial class ProxyCacheJson : JsonSerializerContext;
/// <summary>
/// Proxies of server sequences on this PC: <c>&lt;root&gt;/&lt;server hash&gt;/&lt;sequence id&gt;/</c> with one JPEG per
/// frame (named by frame id, so renumbering never mixes them up) and <c>remote.json</c>. Everything here can be
/// downloaded again, so the folder lives in the client's cache.
/// </summary>
internal sealed class ProxyCache(string root)
{
/// <summary>The asset kind of a cached proxy (the server's name for it).</summary>
public const string Proxy = "proxy";
/// <summary>The asset kind of a thumbnail cached in place of a proxy the server did not have.</summary>
public const string Thumb = "thumb";
private const string IndexFile = "remote.json";
public string Folder(string server, Guid remoteId) =>
Path.Combine(root, Convert.ToHexStringLower(SHA256.HashData(Encoding.UTF8.GetBytes(server)))[..16], remoteId.ToString("N"));
public static string FileName(Guid frameId) => frameId.ToString("N") + ".jpg";
public bool Exists(string server, Guid remoteId) => File.Exists(Path.Combine(Folder(server, remoteId), IndexFile));
public void Save(string server, Guid remoteId, ProxyCacheIndex index) =>
AtomicFile.WriteAllText(Path.Combine(Folder(server, remoteId), IndexFile), JsonSerializer.Serialize(index, ProxyCacheJson.Default.ProxyCacheIndex));
/// <summary>
/// What each cached file of a server sequence is, by frame id (<see cref="ProxyCacheIndex.Kinds"/>): none for a frame
/// without a file, null for a file of a cache written before kinds were kept.
/// </summary>
public IReadOnlyDictionary<Guid, string?> Kinds(string server, Guid remoteId)
{
var kinds = new Dictionary<Guid, string?>();
if (ReadIndex(server, remoteId) is not { } index) return kinds;
for (var i = 0; i < index.Frames.Count; i++)
{
if (index.Files[i] is not null) kinds[index.Frames[i].Id] = index.Kinds is { } known && i < known.Count ? known[i] : null;
}
return kinds;
}
/// <summary>The cached sequence, or null when it was never cached or the cache was cleared.</summary>
public RemoteSequence? Load(string server, Guid remoteId)
{
var folder = Folder(server, remoteId);
if (ReadIndex(server, remoteId) is not { } index) return null;
var dto = index.Sequence;
var sequence = RenderNodeClient.ToSequence(dto) with
{
Tags = dto.Tags,
Rating = dto.Rating,
Notes = dto.Notes,
MedianInterval = dto.MedianInterval,
TotalBytes = dto.TotalBytes,
Status = (SequenceStatus)dto.Status,
HeroFrameId = dto.HeroFrameId,
SettingsJson = index.SettingsJson,
SettingsVersion = dto.SettingsVersion,
FramesVersion = index.FramesVersion,
Origin = SequenceOrigin.Server,
SyncState = SyncState.RemoteOnly,
OwnerUserId = dto.OwnerUserId,
UpdatedAt = dto.UpdatedAt,
};
var files = index.Files.Select(f => f is not null && File.Exists(Path.Combine(folder, f)) ? Path.Combine(folder, f) : null).ToList();
var frames = index.Frames.Select((f, i) =>
{
var frame = RenderNodeClient.ToFrame(f);
return files[i] is null ? frame with { Flags = frame.Flags | FrameFlags.Missing } : frame;
}).ToList();
return new RemoteSequence(server, sequence, frames, files);
}
/// <summary>The index of a cached sequence; null when there is none or it cannot be read.</summary>
private ProxyCacheIndex? ReadIndex(string server, Guid remoteId)
{
var path = Path.Combine(Folder(server, remoteId), IndexFile);
if (!File.Exists(path)) return null;
ProxyCacheIndex? index;
try
{
index = JsonSerializer.Deserialize(File.ReadAllText(path), ProxyCacheJson.Default.ProxyCacheIndex);
}
catch (Exception ex) when (ex is JsonException or IOException)
{
Log.Warning("sync", $"Proxy cache of {remoteId} is unreadable", ex);
return null;
}
return index is null || index.Files.Count != index.Frames.Count ? null : index;
}
/// <summary>Removes the files of a sequence the server no longer has.</summary>
public void Delete(string server, Guid remoteId)
{
var folder = Folder(server, remoteId);
try
{
if (Directory.Exists(folder)) Directory.Delete(folder, recursive: true);
}
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
{
Log.Warning("sync", $"Proxy cache {folder} could not be removed", ex);
}
}
/// <summary>Deletes proxies of frames <paramref name="keep"/> does not name (frames removed on the server).</summary>
public static void Prune(string folder, IReadOnlySet<string> keep)
{
foreach (var file in Directory.EnumerateFiles(folder, "*.jpg"))
{
if (keep.Contains(Path.GetFileName(file))) continue;
try
{
File.Delete(file);
}
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
{
Log.Warning("sync", $"Stale proxy {file} could not be removed", ex);
}
}
}
}