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

+178
View File
@@ -0,0 +1,178 @@
using Chronos.Core.Model;
using Chronos.Data.Jobs;
namespace Chronos.App.Jobs;
/// <summary>Filter chips of the Jobs screen (BRIEF §12.6).</summary>
public enum JobFilter
{
All,
Running,
Queued,
Done,
Failed,
}
/// <summary>One job as the Jobs screen knows it: the last stored snapshot plus live progress while it runs.</summary>
public sealed class JobEntry(Job job)
{
public Job Job { get; internal set; } = job;
/// <summary>Latest progress event of the running job; null once it stops.</summary>
public JobProgressInfo? Live { get; internal set; }
/// <summary><see cref="JobListModel.Stamp"/> of the last update.</summary>
internal long Stamp { get; set; }
public Guid Id => Job.Id;
public JobState State => Job.State;
public long Done => Live?.Done ?? Job.ProgressDone;
public long Total => Live?.Total ?? Job.ProgressTotal;
public double? ItemsPerSecond => Live?.ItemsPerSecond ?? Job.ItemsPerSecond;
public TimeSpan? Eta => Live?.Eta ?? Job.Eta;
public string? Message => Live?.Message;
/// <summary>0…1, or null while the total is unknown.</summary>
public double? Fraction => Total > 0 ? Math.Clamp((double)Done / Total, 0, 1) : null;
public bool IsFinished => State is JobState.Done or JobState.Failed or JobState.Cancelled;
}
/// <summary>
/// The job list behind the Jobs screen and the job bar: merges stored snapshots (<see cref="JobEngine.JobChanged"/>,
/// repository pages) with live progress (<see cref="JobEngine.Progress"/>), keeps queue order and answers the
/// filters. WPF-free and not thread-safe; feed it on the UI thread (through <see cref="JobUpdateBuffer"/>).
/// </summary>
public sealed class JobListModel
{
private readonly Dictionary<Guid, JobEntry> _entries = [];
private long _stamp;
public int Count => _entries.Count;
public JobEntry? this[Guid id] => _entries.GetValueOrDefault(id);
/// <summary>
/// Change counter. Read it before requesting a page from the database and pass it to <see cref="ApplyLoaded"/>,
/// so a page that was read before an event cannot overwrite the newer state the event brought.
/// </summary>
public long Stamp => _stamp;
/// <summary>The priority queue the engine claims jobs by, which orders the queue here too (<see cref="JobPriorityQueue.ClaimsBefore"/>).</summary>
public JobPriorityQueue PriorityQueue { get; set; } = JobPriorityQueue.Off;
/// <summary>Inserts or replaces a snapshot that is known to be current (an engine event). True when something changed.</summary>
public bool Apply(Job job) => Store(job, ++_stamp);
/// <summary>Inserts a snapshot read from the database; skipped when an event updated the job after <paramref name="readAt"/>.</summary>
public bool ApplyLoaded(Job job, long readAt)
{
if (_entries.TryGetValue(job.Id, out var entry) && entry.Stamp > readAt) return false;
return Store(job, readAt);
}
private bool Store(Job job, long stamp)
{
if (!_entries.TryGetValue(job.Id, out var entry))
{
_entries[job.Id] = new JobEntry(job) { Stamp = stamp };
return true;
}
entry.Stamp = Math.Max(entry.Stamp, stamp);
if (entry.Job == job) return false;
entry.Job = job;
if (job.State != JobState.Running) entry.Live = null;
return true;
}
/// <summary>Live progress of a running job; ignored for unknown or no longer running jobs. True when something changed.</summary>
public bool Apply(JobProgressInfo progress)
{
if (!_entries.TryGetValue(progress.JobId, out var entry) || entry.State != JobState.Running) return false;
if (entry.Live == progress) return false;
entry.Live = progress;
return true;
}
/// <summary>Removes jobs no longer present (e.g. purged history).</summary>
public bool Remove(Guid id) => _entries.Remove(id);
/// <summary>
/// Display order: running (oldest start first), paused, queued in the order the engine claims them (the level of the
/// priority queue while it is on, priority, then age), then the history, newest finish first. Finished jobs before
/// <paramref name="clearedBefore"/> are hidden.
/// </summary>
public IReadOnlyList<JobEntry> Ordered(JobFilter filter = JobFilter.All, string? search = null, DateTimeOffset? clearedBefore = null)
{
var text = string.IsNullOrWhiteSpace(search) ? null : search.Trim();
return _entries.Values
.Where(e => Matches(e, filter) && Visible(e, clearedBefore) && (text is null || MatchesText(e, text)))
.OrderBy(Group)
.ThenBy(e => e.State == JobState.Queued && PriorityQueue.Enabled ? -(int)PriorityQueue.LevelOf(e.Job.Kind) : 0)
.ThenBy(e => e.State == JobState.Queued ? -(int)e.Job.Priority : 0)
.ThenBy(e => e.IsFinished ? -(e.Job.Finished ?? e.Job.Created).UtcTicks : (e.Job.Started ?? e.Job.Created).UtcTicks)
.ThenBy(e => e.Job.Created)
.ThenBy(e => e.Id)
.ToList();
}
/// <summary>Jobs per filter chip (after "Clear done").</summary>
public int CountOf(JobFilter filter, DateTimeOffset? clearedBefore = null) =>
_entries.Values.Count(e => Matches(e, filter) && Visible(e, clearedBefore));
/// <summary>1-based place of a queued job in the order workers claim jobs; 0 when it is not queued.</summary>
public int QueuePosition(Guid id)
{
if (!_entries.TryGetValue(id, out var entry) || entry.State != JobState.Queued) return 0;
return _entries.Values.Count(e => e.State == JobState.Queued && PriorityQueue.ClaimsBefore(e.Job, entry.Job)) + 1;
}
/// <summary>The job the job bar mirrors: the running job with the most recent progress, else the first running one.</summary>
public JobEntry? Current =>
_entries.Values.Where(e => e.State == JobState.Running)
.OrderByDescending(e => e.Live is not null)
.ThenBy(e => (e.Job.Started ?? e.Job.Created).UtcTicks)
.FirstOrDefault();
public int RunningCount => _entries.Values.Count(e => e.State == JobState.Running);
/// <summary>Running jobs claimed by this machine's workers (<paramref name="localWorkerId"/>), not by render nodes or other PCs.</summary>
public int RunningOn(string localWorkerId) => _entries.Values.Count(e => e.State == JobState.Running && JobText.IsLocal(e.Job.NodeId, localWorkerId));
public int QueuedCount => _entries.Values.Count(e => e.State == JobState.Queued);
/// <summary>
/// A job of <paramref name="kind"/> that the user waits for (not background work) is queued or running. Paused jobs
/// do not count: they wait for the user, or for an unmetered network, not for the queue.
/// </summary>
public bool IsBusy(JobKind kind) =>
_entries.Values.Any(e => e.Job.Kind == kind && e.Job.Priority != JobPriority.Background && e.State is JobState.Queued or JobState.Running);
/// <summary>Same order as <c>JobRepository.ClaimNextAsync</c> with the priority queue off: priority descending, then creation time and id.</summary>
public static bool ClaimsBefore(Job a, Job b) => JobPriorityQueue.Off.ClaimsBefore(a, b);
private static int Group(JobEntry e) => e.State switch
{
JobState.Running => 0,
JobState.Paused => 1,
JobState.Queued => 2,
_ => 3,
};
private static bool Matches(JobEntry e, JobFilter filter) => filter switch
{
JobFilter.Running => e.State is JobState.Running or JobState.Paused,
JobFilter.Queued => e.State == JobState.Queued,
JobFilter.Done => e.State == JobState.Done,
JobFilter.Failed => e.State is JobState.Failed or JobState.Cancelled,
_ => true,
};
private static bool Visible(JobEntry e, DateTimeOffset? clearedBefore) =>
clearedBefore is null || !e.IsFinished || (e.Job.Finished ?? e.Job.Created) > clearedBefore;
private static bool MatchesText(JobEntry e, string text) =>
(e.Job.TargetLabel?.Contains(text, StringComparison.CurrentCultureIgnoreCase) ?? false)
|| JobText.Kind(e.Job.Kind).Contains(text, StringComparison.CurrentCultureIgnoreCase);
}