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

+462
View File
@@ -0,0 +1,462 @@
using System.Globalization;
using System.IO;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Threading;
using Chronos.App.Archiving;
using Chronos.App.DesignTime;
using Chronos.App.Editor;
using Chronos.App.Import;
using Chronos.App.Infrastructure;
using Chronos.App.Library;
using Chronos.App.Server;
using Chronos.App.Settings;
using Chronos.Core.Diagnostics;
using Chronos.Ui.Controls;
using Chronos.Ui.Theming;
namespace Chronos.App.Shell;
/// <summary>
/// <c>Chronos.exe --capture &lt;dir&gt;</c>: renders every client screen at 1440×900 in the dark and light themes to
/// <c>&lt;screen&gt;-&lt;theme&gt;.png</c> from <see cref="SampleData"/> (first run on an empty index, then a populated
/// one, then the sync table with transfers, a conflict and its confirmation, then the sequence editor on an archive
/// sequence and on a server sequence with proxies, its server job and a read-only account), plus the Library, the
/// editor's Exposure tab and the import plan in Arabic (<c>*-rtl-dark.png</c>, right to left), for visual review,
/// the pixel diff against <c>tests/visual/baselines</c> and phase reports (BRIEF §20.2), then exits. The pictures are
/// the same on any day and machine: the clock stands at <see cref="SampleData.Now"/>, formats are English and nothing
/// animates.
/// </summary>
public static class ScreenCapture
{
private static readonly AppTheme[] Themes = [AppTheme.Dark, AppTheme.Light];
public static async Task RunAsync(MainWindow window, ShellViewModel shell, SampleData sample, string directory)
{
var written = 0;
try
{
Directory.CreateDirectory(directory);
AppClock.Freeze(SampleData.Now);
CultureInfo.CurrentCulture = CultureInfo.DefaultThreadCurrentCulture = CultureInfo.GetCultureInfo("en");
Motion.SetIsEnabled(window, false);
window.WindowStartupLocation = WindowStartupLocation.Manual;
window.Left = -20000;
window.Top = -20000;
window.Width = 1440;
window.Height = 900;
window.ShowActivated = false;
window.ShowInTaskbar = false;
window.Show();
// First run: empty index, nothing connected, the welcome dialog over the empty Library.
await sample.OpenEmptyAsync();
await shell.StartAsync();
foreach (var theme in Themes)
{
ThemeManager.Apply(theme);
shell.Navigate(SectionKey.Library);
shell.ShowWelcome();
shell.Welcome!.ShowDiscovered(new Server.DiscoveredServer("Studio NAS", "https://nas.local:8443"));
written += await SaveAsync(window, directory, "welcome", theme);
shell.CompleteWelcome();
written += await SaveAsync(window, directory, "library-empty", theme);
shell.Navigate(SectionKey.Server);
written += await SaveAsync(window, directory, "server-signedout", theme);
}
// A populated archive, jobs in every state and a signed-in server.
await sample.FillAsync();
await shell.Library.RefreshAsync();
await shell.Jobs.ReloadAsync();
await shell.Services.Server.RestoreAsync();
await shell.Services.Sync.RefreshAsync();
await shell.Server.Sync.ReloadAsync();
// The server's sequences without a copy here join the Library as remote cards.
await shell.Library.RefreshAsync();
shell.About.SetResult(null);
await shell.Settings.DetectEncodersAsync();
await shell.Settings.SelfTestAsync();
await shell.Settings.DetectFormatsAsync(refresh: false);
foreach (var theme in Themes)
{
ThemeManager.Apply(theme);
shell.Library.LayoutIndex = 0;
shell.Library.ClearSelectionCommand.Execute(null);
shell.Navigate(SectionKey.Library);
written += await SaveAsync(window, directory, "library", theme, waitForThumbnails: shell);
if (shell.Library.Items.Count > 0) shell.Library.Items[0].IsSelected = true;
written += await SaveAsync(window, directory, "library-selection", theme, waitForThumbnails: shell);
shell.Library.LayoutIndex = 1;
written += await SaveAsync(window, directory, "library-list", theme, waitForThumbnails: shell);
shell.Library.LayoutIndex = 0;
shell.Library.ClearSelectionCommand.Execute(null);
shell.IsRailCollapsed = true;
written += await SaveAsync(window, directory, "library-rail-collapsed", theme, waitForThumbnails: shell);
shell.IsRailCollapsed = false;
written += await CaptureLibraryScenesAsync(window, shell, directory, theme);
shell.Navigate(SectionKey.Jobs);
if (shell.Jobs.Rows.Count > 0) shell.Jobs.Rows[0].IsExpanded = true;
written += await SaveAsync(window, directory, "jobs", theme);
shell.Navigate(SectionKey.Server);
written += await SaveAsync(window, directory, "server", theme);
shell.Navigate(SectionKey.Settings);
foreach (var page in Enum.GetValues<SettingsPage>())
{
shell.Settings.Page = page;
written += await SaveAsync(window, directory, "settings-" + page.ToString().ToLowerInvariant(), theme);
}
shell.Navigate(SectionKey.About);
written += await SaveAsync(window, directory, "about", theme);
// Edit with no sequence open: the picker (owner review 1, R7).
shell.Navigate(SectionKey.Edit);
await shell.Sequence.Picker.Loading;
written += await SaveAsync(window, directory, "edit-picker", theme, waitForThumbnails: shell);
foreach (var state in ImportScenes.States)
{
DismissToasts(window);
await ImportScenes.ShowAsync(shell, state);
if (!ImportScenes.ShowsToast(state)) DismissToasts(window);
written += await SaveAsync(window, directory, "import-" + state, theme);
}
DismissToasts(window);
foreach (var view in ArchiveScenes.Views)
{
await ArchiveScenes.ShowAsync(shell, view);
written += await SaveAsync(window, directory, "archive-" + view, theme);
}
}
// The sync table with proxies kept here and transfers in every state, then filtered to the conflict, then the
// conflict's confirmation (after the other screens, so the Jobs capture keeps its own sample).
await sample.CacheProxiesAsync();
await sample.FillSyncAsync();
await shell.Server.Sync.ReloadAsync();
// The job bar follows the upload the sync sample runs.
await shell.Jobs.ReloadAsync();
foreach (var theme in Themes)
{
ThemeManager.Apply(theme);
shell.Navigate(SectionKey.Server);
SelectSyncFilter(shell, SyncFilter.All);
written += await SaveAsync(window, directory, "server-sync", theme);
SelectSyncFilter(shell, SyncFilter.Conflicts);
written += await SaveAsync(window, directory, "server-conflict", theme);
if (shell.Server.Sync.Rows.FirstOrDefault() is { } conflict)
written += await SaveDialogAsync(new ConfirmDialog(SyncTableViewModel.ConflictRequest(conflict.Entry, SyncAction.KeepMine)), directory,
"server-conflict-confirm", theme);
SelectSyncFilter(shell, SyncFilter.All);
}
written += await CaptureEditorAsync(window, shell, sample, directory);
written += await CaptureRemoteEditorAsync(window, shell, sample, directory);
Log.Info("capture", $"{written} screenshot(s) written to {Path.GetFullPath(directory)}");
if (written == 0) Environment.ExitCode = 1;
}
catch (Exception ex)
{
Log.Error("capture", "Capture failed", ex);
Environment.ExitCode = 1;
}
finally
{
Application.Current.Shutdown();
}
}
/// <summary>
/// <c>library-timeline</c>, <c>library-mass</c> (the selection with the whole bar), <c>library-delete</c> (the dry run
/// of deleting that selection, behind its typed confirmation), <c>library-remote</c> (the server's sequences as
/// remote cards) and <c>library-viewname</c> (Save view), then the Library as it was.
/// </summary>
private static async Task<int> CaptureLibraryScenesAsync(MainWindow window, ShellViewModel shell, string directory, AppTheme theme)
{
var written = 0;
foreach (var scene in LibraryScenes.Scenes)
{
DismissToasts(window);
await LibraryScenes.ShowAsync(shell, scene);
written += await SaveAsync(window, directory, "library-" + scene, theme, waitForThumbnails: shell);
if (scene == "mass" && await LibraryScenes.DeleteRequestAsync(shell) is { } request)
written += await SaveDialogAsync(new ConfirmDialog(request), directory, "library-delete", theme);
}
shell.Library.Dialog?.CloseCommand.Execute(null);
shell.Library.ClearSelectionCommand.Execute(null);
shell.Library.ClearFiltersCommand.Execute(null);
shell.Library.LayoutIndex = 0;
await shell.Library.RefreshAsync();
return written;
}
private static void SelectSyncFilter(ShellViewModel shell, SyncFilter filter) =>
shell.Server.Sync.Chips.First(c => c.Filter == filter).SelectCommand.Execute(null);
/// <summary>A dialog shown off screen, saved, then closed.</summary>
private static async Task<int> SaveDialogAsync(Window dialog, string directory, string screen, AppTheme theme)
{
dialog.WindowStartupLocation = WindowStartupLocation.Manual;
dialog.Left = -20000;
dialog.Top = -20000;
dialog.ShowActivated = false;
dialog.ShowInTaskbar = false;
Motion.SetIsEnabled(dialog, false);
dialog.Show();
try
{
return await SaveAsync(dialog, directory, screen, theme);
}
finally
{
dialog.Close();
}
}
/// <summary>
/// The editor on the synthetic sunset: every step of the Edit path in both themes (<c>edit-&lt;step&gt;-&lt;theme&gt;.png</c>,
/// the Camera step with a keyframe selected, the Export step as Export.html with the crop mask and no compare), then
/// the preview overlays, the waveform, the "what changed" toast of Optimise all, the picker over the open sequence
/// (<c>edit-change</c>), the Export step of the sequence once the server has it (Sync on) with two "Save both" copies
/// to restore, and the Analysis step while the analysis runs (<c>edit-busy</c>).
/// </summary>
private static async Task<int> CaptureEditorAsync(MainWindow window, ShellViewModel shell, SampleData sample, string directory)
{
var written = 0;
var id = await sample.FillEditorAsync();
shell.OpenSequence(id);
await shell.Sequence.OpenAsync(id);
if (shell.Sequence.Editor is not { } editor)
{
Log.Warning("capture", "The editor sample did not open");
return 0;
}
foreach (var camera in editor.Tabs.OfType<CameraTab>()) camera.SelectedKey = 1;
foreach (var theme in Themes)
{
ThemeManager.Apply(theme);
foreach (var tab in editor.Tabs)
{
editor.SelectedTab = tab;
editor.IsCompare = tab is not ExportTab;
editor.CurrentIndex = tab is ExportTab ? 40 : 45;
written += await SaveEditorAsync(window, editor, directory, "edit-" + tab.Key.ToLowerInvariant(), theme);
}
editor.SelectedTab = editor.Exposure;
editor.IsCompare = true;
editor.ShowVectors = editor.ShowRegions = true;
written += await SaveEditorAsync(window, editor, directory, "edit-exposure-overlays", theme);
editor.ShowVectors = editor.ShowRegions = false;
editor.Exposure.ChartMode = ExposureChart.Waveform;
written += await SaveEditorAsync(window, editor, directory, "edit-exposure-waveform", theme);
editor.Exposure.ChartMode = ExposureChart.Luminance;
editor.OptimiseAllCommand.Execute(null);
written += await SaveEditorAsync(window, editor, directory, "edit-optimise", theme);
editor.Session.Undo();
foreach (var toast in window.Toasts.Toasts.ToList()) window.Toasts.Dismiss(toast);
// Change sequence: the picker over the open sequence, which stays open behind it until another opens.
shell.Sequence.ChangeSequenceCommand.Execute(null);
await shell.Sequence.Picker.Loading;
written += await SaveAsync(window, directory, "edit-change", theme, waitForThumbnails: shell);
shell.Sequence.CancelPickCommand.Execute(null);
}
// The server has the sequence (Sync can be ticked) and two copies of this PC's settings were kept by "Save both".
await sample.KeepEditorCopiesAsync(id);
await editor.Session.ReloadAsync();
await editor.RefreshSyncGateAsync();
var export = editor.Tabs.OfType<ExportTab>().Single();
export.SyncToServer = true;
editor.SelectedTab = export;
editor.IsCompare = false;
foreach (var theme in Themes)
{
ThemeManager.Apply(theme);
written += await SaveEditorAsync(window, editor, directory, "edit-export-copies", theme);
}
export.SyncToServer = false;
editor.SelectedTab = editor.Exposure;
editor.IsCompare = true;
written += await CaptureRightToLeftAsync(window, shell, editor, directory);
// Last, as it stays: an analysis of the sequence running (settings disabled, viewing tools live), on the step that follows it.
await sample.MarkAnalysingAsync(id);
await editor.AttachJobsAsync();
editor.SelectedTab = editor.Analysis;
// The job bar shows the analysis, the one job running.
await shell.Jobs.ReloadAsync();
foreach (var theme in Themes)
{
ThemeManager.Apply(theme);
written += await SaveEditorAsync(window, editor, directory, "edit-busy", theme);
}
return written;
}
/// <summary>
/// The Library, the editor's Exposure tab and the import plan in Arabic, dark: the layout mirrors while photos,
/// charts, the filmstrip and templates stay left to right. English is restored whatever happens.
/// </summary>
private static async Task<int> CaptureRightToLeftAsync(MainWindow window, ShellViewModel shell, EditorViewModel editor, string directory)
{
var written = 0;
var frame = editor.CurrentIndex;
ThemeManager.Apply(AppTheme.Dark);
UiLanguage.Apply("ar");
try
{
DismissToasts(window);
shell.Navigate(SectionKey.Library);
written += await SaveAsync(window, directory, "library-rtl", AppTheme.Dark, waitForThumbnails: shell);
shell.Navigate(SectionKey.Edit);
editor.SelectedTab = editor.Exposure;
editor.IsCompare = true;
editor.CurrentIndex = 45;
written += await SaveEditorAsync(window, editor, directory, "edit-exposure-rtl", AppTheme.Dark);
await ImportScenes.ShowAsync(shell, "plan");
DismissToasts(window);
written += await SaveAsync(window, directory, "import-plan-rtl", AppTheme.Dark);
}
finally
{
UiLanguage.Apply("en");
}
shell.Navigate(SectionKey.Edit);
editor.CurrentIndex = frame;
return written;
}
/// <summary>
/// A server sequence open with this PC's proxies (Sunrise over Superga, cached by the sync captures): the server in
/// the header, the preview from the proxies, the project from the server (<c>edit-remote</c>); its Export tab,
/// where the server picks the encoder and keeps the renders (<c>edit-remote-export</c>); a render running on the
/// server with its bar and Cancel (<c>edit-remote-running</c>); then, last as it stays, the sequence opened by an
/// account without the Edit right (<c>edit-remote-readonly</c>).
/// </summary>
private static async Task<int> CaptureRemoteEditorAsync(MainWindow window, ShellViewModel shell, SampleData sample, string directory)
{
var written = 0;
var id = sample.ProxiedSequenceId;
shell.OpenSequence(id);
await shell.Sequence.OpenAsync(id);
if (shell.Sequence.Editor is not { IsRemote: true } editor)
{
Log.Warning("capture", "The server sequence did not open in the editor");
return 0;
}
DismissToasts(window);
var export = editor.Tabs.OfType<ExportTab>().Single();
foreach (var theme in Themes)
{
ThemeManager.Apply(theme);
editor.SelectedTab = editor.Exposure;
editor.IsCompare = true;
written += await SaveEditorAsync(window, editor, directory, "edit-remote", theme);
editor.SelectedTab = export;
editor.IsCompare = false;
written += await SaveEditorAsync(window, editor, directory, "edit-remote-export", theme);
}
sample.RunServerRender();
await editor.AttachJobsAsync();
editor.SelectedTab = editor.Exposure;
editor.IsCompare = true;
foreach (var theme in Themes)
{
ThemeManager.Apply(theme);
written += await SaveEditorAsync(window, editor, directory, "edit-remote-running", theme);
}
sample.EndServerJobs();
await sample.RestrictAccountAsync();
await shell.Sequence.OpenAsync(id, reload: true);
if (shell.Sequence.Editor is not { IsReadOnly: true } viewer)
{
Log.Warning("capture", "The server sequence did not open read-only");
return written;
}
DismissToasts(window);
viewer.SelectedTab = viewer.Exposure;
foreach (var theme in Themes)
{
ThemeManager.Apply(theme);
written += await SaveEditorAsync(window, viewer, directory, "edit-remote-readonly", theme);
}
return written;
}
private static async Task<int> SaveEditorAsync(Window window, EditorViewModel editor, string directory, string screen, AppTheme theme)
{
await Settle(window);
if (!await editor.WhenIdleAsync(TimeSpan.FromSeconds(30))) Log.Warning("capture", $"{screen} was still busy");
return await SaveAsync(window, directory, screen, theme);
}
/// <summary>Toasts of one screen's scene stay out of the next screen's picture.</summary>
private static void DismissToasts(MainWindow window)
{
foreach (var toast in window.Toasts.Toasts.ToList()) window.Toasts.Dismiss(toast);
}
private static async Task<int> SaveAsync(Window window, string directory, string screen, AppTheme theme, ShellViewModel? waitForThumbnails = null)
{
await Settle(window);
if (waitForThumbnails?.Services.Thumbnails is { } thumbnails)
{
// Thumbnails decode on the thread pool; give them a moment, then settle again.
for (var i = 0; i < 40 && thumbnails.PendingLoads > 0; i++) await Task.Delay(50);
await Task.Delay(100);
await Settle(window);
}
return Save(window, Path.Combine(directory, $"{screen}-{theme.ToString().ToLowerInvariant()}.png")) ? 1 : 0;
}
private static async Task Settle(Window window)
{
window.UpdateLayout();
// Let bindings, templates, async continuations and deferred renders complete.
await window.Dispatcher.InvokeAsync(() => { }, DispatcherPriority.ApplicationIdle);
await Task.Delay(30);
await window.Dispatcher.InvokeAsync(() => { }, DispatcherPriority.ApplicationIdle);
window.UpdateLayout();
}
private static bool Save(Window window, string path)
{
if (VisualTreeHelper.GetChildrenCount(window) == 0) window.ApplyTemplate();
if (VisualTreeHelper.GetChildrenCount(window) == 0)
{
Log.Warning("capture", "Window has no visual tree; nothing to render");
return false;
}
var root = (FrameworkElement)VisualTreeHelper.GetChild(window, 0);
var dpi = VisualTreeHelper.GetDpi(window);
var width = (int)Math.Ceiling(root.ActualWidth * dpi.DpiScaleX);
var height = (int)Math.Ceiling(root.ActualHeight * dpi.DpiScaleY);
if (width <= 0 || height <= 0)
{
Log.Warning("capture", $"Root element has no size ({root.ActualWidth}×{root.ActualHeight}); skipped {Path.GetFileName(path)}");
return false;
}
var bitmap = new RenderTargetBitmap(width, height, dpi.PixelsPerInchX, dpi.PixelsPerInchY, PixelFormats.Pbgra32);
// A right-to-left window's content already renders mirrored, as on screen.
bitmap.Render(root);
var encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(bitmap));
using var stream = File.Create(path);
encoder.Save(stream);
return true;
}
}