From 24f537296540da7867608458387038d35dfc2ea3 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 3 Oct 2026 10:13:58 +0000 Subject: [PATCH] test(tools): fixtures annotations and exit codes; docs for this round MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - New Titano.Tools.Tests program (CI and release run it): the warning annotation escapes workflow-command characters, and a missing fixture fails the command unless --allow-missing is given. - ARCHITECTURE, STATUS, CHANGELOG and README describe the portable update package, resumable and cancellable download, the release ordering, the rebuild gate in the §1.1 shape and the new numbers. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC --- .github/workflows/ci.yml | 3 ++ .github/workflows/release.yml | 2 +- README.md | 1 + Titano.slnx | 1 + docs/ARCHITECTURE.md | 12 +++--- docs/CHANGELOG.md | 13 +++++-- docs/STATUS.md | 10 ++--- src/Titano.Tools/Titano.Tools.csproj | 3 ++ .../FixturesCommandTests.cs | 37 +++++++++++++++++++ tests/Titano.Tools.Tests/Program.cs | 8 ++++ .../Titano.Tools.Tests.csproj | 11 ++++++ 11 files changed, 86 insertions(+), 15 deletions(-) create mode 100644 tests/Titano.Tools.Tests/FixturesCommandTests.cs create mode 100644 tests/Titano.Tools.Tests/Program.cs create mode 100644 tests/Titano.Tools.Tests/Titano.Tools.Tests.csproj diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8df564be..1b556aeb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,6 +82,9 @@ jobs: - name: Test · Server run: dotnet run --project tests/Titano.Server.Tests -c Release --no-build -- --junit out/junit/server.xml + - name: Test · Tools + run: dotnet run --project tests/Titano.Tools.Tests -c Release --no-build -- --junit out/junit/tools.xml + - name: Test · Core.Windows if: runner.os == 'Windows' run: dotnet run --project tests/Titano.Core.Windows.Tests -c Release --no-build -- --junit out/junit/core-windows.xml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 59a68f85..f07db794 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -73,7 +73,7 @@ jobs: - name: Build and test run: | dotnet build Titano.slnx -c Release -p:TitanoVersion="$VERSION" -p:TitanoReleasesRepo="$RELEASES_REPO" - for t in Core Data Server Core.Windows App; do + for t in Core Data Server Tools Core.Windows App; do dotnet run --project "tests/Titano.$t.Tests" -c Release --no-build -- --junit "out/junit/$t.xml" done diff --git a/README.md b/README.md index 4a3160d7..de869086 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ dotnet build Titano.slnx -c Release dotnet run --project tests/Titano.Core.Tests -c Release -- --junit out/core.xml dotnet run --project tests/Titano.Data.Tests -c Release dotnet run --project tests/Titano.Server.Tests -c Release +dotnet run --project tests/Titano.Tools.Tests -c Release dotnet run --project tests/Titano.Core.Windows.Tests -c Release # Windows dotnet run --project tests/Titano.App.Tests -c Release # Windows diff --git a/Titano.slnx b/Titano.slnx index 4ba03d78..eee03c3e 100644 --- a/Titano.slnx +++ b/Titano.slnx @@ -18,5 +18,6 @@ + diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index e790a519..3636cdd1 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -63,7 +63,7 @@ Dependencies point one way: `Core` ← `Core.Windows`, `Data`, `Protocol` ← `S | Host | Composition root | What it runs | |---|---|---| -| Titano (desktop) | `App/Infrastructure/AppServices` | SQLite index in `%LOCALAPPDATA%\Titano` (or `.\data` when portable); `ArchiveService` with WIC first, then managed decoders; `ProcessingService` with Media Foundation, then managed encoders; one `JobEngine` with the handlers of both; thumbnails; `ServerSession`; the render node while opted in and signed in; update check and download (`About/UpdateCheck`, `About/UpdateDownload`); diagnostics bundle | +| Titano (desktop) | `App/Infrastructure/AppServices` | SQLite index in `%LOCALAPPDATA%\Titano` (or `.\data` when portable); `ArchiveService` with WIC first, then managed decoders; `ProcessingService` with Media Foundation, then managed encoders; one `JobEngine` with the handlers of both; thumbnails; `ServerSession`; the render node while opted in and signed in; update check and download (`About/UpdateCheck`, `About/UpdateDownload`, `About/UpdateFlow`: the setup, or the portable zip for a portable copy, verified against `SHA256SUMS`, resumable, cancellable, failing after 60 s without data); diagnostics bundle | | Titano Server | `Server/Hosting/ServerHost.Build` | Options from `server.json` + `TITANO_*`; PostgreSQL (or SQLite on Windows); `ArchiveModule` then `ProcessingModule` register job handler providers; `JobEngineHost` (never claims renders); `RenderNodeService`/`RenderNodeMonitor`; `UploadService`; `EventHub` (WebSocket); embedded admin panel; LAN discovery beacon; Windows service host | | Titano Uploader | `Uploader/App.xaml.cs` | `TitanoClient`, persisted queue, watch folders; no database | | Titano Setup | `Setup/Program` | TPK1 payload extraction, registry, shortcuts, silent mode, uninstaller | @@ -149,8 +149,8 @@ snapshot when fresh). Writers coordinate through lease files, so a desktop and a - IDs are UUIDv7 (`Guid.CreateVersion7()`); timestamps UTC; capture times are camera wall-clock with an optional offset. - The only OS actions the programs perform are those of BRIEF §8.6: open a URL and show a folder or file in Explorer - (`ShellActions` in the App), the format-volume dialog (`Core.Windows/Devices`). Downloaded updates are shown in - Explorer, never started. + (`ShellActions` in the App), the format-volume dialog (`Core.Windows/Devices`). Downloaded updates (the setup, or + the portable zip for a portable copy) are shown in Explorer, never started. ## 6. Tests @@ -164,8 +164,10 @@ snapshot when fresh). Writers coordinate through lease files, so a desktop and a committed); tests depending on them skip when absent and CI shows a warning per missing sample. - Fuzz tests: truncate and corrupt valid inputs at many offsets; assert no exception escapes. - Performance gates (`tests/Titano.Data.Tests/Perf`, `[Category("perf")]`, run only with `TITANO_PERF=1`): the - 500,000-photo library (Library open < 1 s, filters < 200 ms) on SQLite and PostgreSQL, and the 100,000-frame - rebuild from sidecars. `.github/workflows/perf.yml` runs them weekly against PostgreSQL 17. + 500,000-photo library (Library open < 1 s on a new connection pool, filters < 200 ms; the OS cache is warm from + building it) and the 100,000-frame rebuild from sidecars (400 sequences of 250 real photos, every column compared, + < 120 s), each on SQLite and PostgreSQL. `.github/workflows/perf.yml` runs them weekly against PostgreSQL 17. +- `Titano.Tools.Tests` covers the tools whose output CI relies on (fixtures annotations and exit codes). ## 7. Localization diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index e7898c29..ff29bf56 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -51,8 +51,9 @@ commits follow Conventional Commits (release notes are generated from them by `T - Titano desktop: shell with rail, job bar and toasts; Welcome, Library (virtualised grid and list, filters, sort, hover scrubbing), Jobs, Server (trust-on-first-use sign-in, DPAPI token), Settings (general, archive, rendering with encoder inventory and self-test, storage, server, updates, advanced) and About; `--capture` screenshots. -- Update check against the public releases repository and **Download**: the setup is fetched into - `%TEMP%\Titano\updates`, verified against the release's `SHA256SUMS` and shown in Explorer. +- Update check against the public releases repository and **Download**: the setup (the portable zip for a portable + copy) is fetched into `%TEMP%\Titano\updates`, verified against the release's `SHA256SUMS` and shown in Explorer; + an interrupted download resumes, *Cancel* stops it, and a transfer that stalls for 60 s fails. - Diagnostics bundle (Settings › Advanced, About): environment, codec and encoder inventory, scrubbed settings, recent failed jobs and logs. - Titano Server: configuration from `server.json` and `TITANO_*`, TLS (auto, PEM, proxy), API v1 (auth, users, @@ -72,11 +73,15 @@ commits follow Conventional Commits (release notes are generated from them by `T - Release workflow: tests, self-contained publish, optional Authenticode signing, installers, portable and server zips, `SHA256SUMS`, release notes from Conventional Commits, multi-arch GHCR image, and the public releases repository (README, EULA draft, SECURITY policy, issue forms, Unraid template, compose file, screenshots, `i18n/`). -- Performance gates (`perf.yml`, weekly): 500,000-photo library on SQLite and PostgreSQL 17, 100,000-frame rebuild - from sidecars. +- Performance gates (`perf.yml`, weekly): 500,000-photo library and 100,000-frame rebuild from sidecars (every + column compared), each on SQLite and PostgreSQL 17. +- `Titano.Tools.Tests`: the fixtures command's warning annotations and exit codes. ### Fixed - Release workflow: signing and the public-repository publish never ran (step conditions cannot read the step's own secrets); the publish job lacked the .NET SDK for `make-icon`; re-publishing an existing tag failed; the portable zip lacked `portable.txt`. - CI fixtures step reported missing RAW samples as a silent pass; it now emits a warning per missing sample. +- Release workflow: the server image and its `:latest` tag were pushed before the Windows tests passed, and + publishing an older tag again moved `:latest` back; the image now follows the tests and `:latest` the newest + stable release. Stable release notes started at the last release candidate instead of the previous stable tag. diff --git a/docs/STATUS.md b/docs/STATUS.md index d9464e4b..63efda06 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -6,8 +6,8 @@ Phase plan: docs/BRIEF.md §22. Windows behaviour is verified on CI (`windows-la |---|---| | 0 Bootstrap | Done: solution, rules, Titano.Testing, zero-package guard, i18n, WPF shell, server skeleton, Docker, icons, CI. | | 1 Metadata and imaging | Done: metadata parsers, managed codecs, native RAW development (DNG, CR2, NEF, ARW, PEF, RAF), WIC provider and codec inventory, decode tiers, thumbnails and proxies, `diagnose`. Real-camera fixtures wait for verified raw.pixls.us URLs (CI warns per missing sample). | -| 2 Data layer and archive | Done: SQLite binding, PostgreSQL wire client, migrations, repositories, job engine, archive layout, sidecars, scan, rebuild, verify, duplicates, orphans, adopt, mass rename. Gate measured: a 100,000-frame archive rebuilds from sidecars into the identical index in 1.1 s (budget 120 s). | -| 3 Library and Archive manager | Library, Jobs, Settings, Welcome, Server and About screens done; Archive manager screen in progress. Gate measured on 500,000 photos: Library open 313 ms cold on SQLite, 162 ms on PostgreSQL (budget 1 s); every filter, search, sort and next page ≤ 8.4 ms (budget 200 ms). | +| 2 Data layer and archive | Done: SQLite binding, PostgreSQL wire client, migrations, repositories, job engine, archive layout, sidecars, scan, rebuild, verify, duplicates, orphans, adopt, mass rename. Gate measured: a 100,000-frame archive (400 sequences of 250 photos) rebuilds from sidecars into an index identical in every column in 1.8 s on SQLite and 4.7 s on PostgreSQL (budget 120 s). | +| 3 Library and Archive manager | Library, Jobs, Settings, Welcome, Server and About screens done; Archive manager screen in progress. Gate measured on 500,000 photos: Library open 259 ms on SQLite and 181 ms on PostgreSQL on a new connection pool (warm OS cache; budget 1 s); every filter, search, sort and next page ≤ 6.4 ms (budget 200 ms). | | 4 Card import | Engine done (plan, sessions, hash-verified copy, verified erase, import jobs); screen in progress. | | 5 Analysis advisor | Engine done (light and deep analysis, advisor, presets, analysis jobs); editor integration in progress. | | 6 Engine, encoding, editor | Render pipeline, MP4/AVI/GIF/APNG/image sequences, Media Foundation H.264/HEVC/AV1 done; sequence editor in progress. | @@ -26,10 +26,10 @@ docker compose -f deploy/docker/docker-compose.yml up -d # server + TITANO_PERF=1 dotnet run --project tests/Titano.Data.Tests -c Release -- --filter category:perf --verbose # performance gates ``` -- Diagnostics: Settings › Advanced › *Export bundle* (desktop) or admin panel › Logs › *Diagnostics* (server, +- Diagnostics: Settings › Advanced › Diagnostics › *Export bundle* (desktop) or admin panel › Logs › *Diagnostics* (server, `GET /api/v1/server/diagnostics`). Open the zip: logs, reports, settings and failed jobs, no passwords or tokens. -- Update download: About › *Check for updates*, then *Download* when a newer release exists; the verified setup - appears in Explorer. +- Update download: About › *Check for updates*, then *Download* when a newer release exists; the verified setup (the + portable zip in a portable copy) appears in Explorer. *Cancel* stops it; the next *Download* resumes. ## Next steps (Phase 8 gate) diff --git a/src/Titano.Tools/Titano.Tools.csproj b/src/Titano.Tools/Titano.Tools.csproj index 167ccda0..9f803e63 100644 --- a/src/Titano.Tools/Titano.Tools.csproj +++ b/src/Titano.Tools/Titano.Tools.csproj @@ -5,6 +5,9 @@ Titano.Tools Titano.Tools + + + diff --git a/tests/Titano.Tools.Tests/FixturesCommandTests.cs b/tests/Titano.Tools.Tests/FixturesCommandTests.cs new file mode 100644 index 00000000..190a5bbb --- /dev/null +++ b/tests/Titano.Tools.Tests/FixturesCommandTests.cs @@ -0,0 +1,37 @@ +using Titano.Testing; +using Titano.Tools.Commands; + +namespace Titano.Tools.Tests; + +/// The fixtures command reports a sample it cannot fetch instead of passing silently (BRIEF §20.2). +public sealed class FixturesCommandTests(TestContext context) +{ + [Test] + public void TheWarningAnnotationNamesTheFixtureAndEscapesWorkflowCommandCharacters() + { + var entry = new FixturesCommand.Entry("canon-eos-r5.cr3", new Uri("https://raw.pixls.us/data/Canon/EOS%20R5/IMG_0001.CR3"), null, null, "Cr3"); + var line = FixturesCommand.Annotation("tests/fixtures/manifest.json", entry, "Response status code 404, 100% missing\r\nretry later."); + Assert.Equal( + "::warning file=tests/fixtures/manifest.json,title=RAW fixture missing::canon-eos-r5.cr3 (Cr3) could not be fetched from " + + "https://raw.pixls.us/data/Canon/EOS%2520R5/IMG_0001.CR3: Response status code 404, 100%25 missing%0D%0Aretry later. " + + "Its decode tests are skipped. Replace the url in the manifest (see its 'instructions').", + line); + Assert.True(FixturesCommand.Annotation("a:b,c.json", entry, "x").StartsWith("::warning file=a%3Ab%2Cc.json,title=", StringComparison.Ordinal)); + } + + [Test] + public async Task AMissingFixtureFailsTheCommandUnlessMissingFilesAreAllowed() + { + var folder = context.CreateTempDirectory(); + var manifest = Path.Combine(folder, "manifest.json"); + // Port 1 refuses the connection at once (or the proxy answers with an error): the fixture stays missing. + await File.WriteAllTextAsync(manifest, """ + { "files": [ { "name": "missing.dng", "url": "https://127.0.0.1:1/missing.dng", "sha256": null, "size": null, "format": "Dng" } ] } + """); + var output = Path.Combine(folder, "external"); + + Assert.Equal(1, await new FixturesCommand().RunAsync(["--manifest", manifest, "--out", output])); + Assert.Equal(0, await new FixturesCommand().RunAsync(["--manifest", manifest, "--out", output, "--allow-missing"])); + Assert.FileMissing(Path.Combine(output, "missing.dng")); + } +} diff --git a/tests/Titano.Tools.Tests/Program.cs b/tests/Titano.Tools.Tests/Program.cs new file mode 100644 index 00000000..9668382f --- /dev/null +++ b/tests/Titano.Tools.Tests/Program.cs @@ -0,0 +1,8 @@ +using Titano.Testing; + +namespace Titano.Tools.Tests; + +internal static class TestMain +{ + public static Task Main(string[] args) => TestRunner.RunAsync(args, typeof(TestMain).Assembly); +} diff --git a/tests/Titano.Tools.Tests/Titano.Tools.Tests.csproj b/tests/Titano.Tools.Tests/Titano.Tools.Tests.csproj new file mode 100644 index 00000000..280ec8d0 --- /dev/null +++ b/tests/Titano.Tools.Tests/Titano.Tools.Tests.csproj @@ -0,0 +1,11 @@ + + + Exe + net10.0 + Titano.Tools.Tests + + + + + +