fix(proxies): use only a frame's own proxy and let tiers, reports and built flags follow it

- Renders, analyses, the server's manifests and proxy downloads take a proxy only
  when its Exif capture time is the frame's (ArchiveImages.IsProxyOf); one left at
  the index by a frame renumbered since counts as missing and is asked for again
  (V-24).
- A frame whose original the host reads through its proxy (HEIF on the server) is
  preview-only only while it has none: the light analysis and the proxy pass keep
  the flag, the preview-only count, the light finding and the advisor's output cap
  in step with the proxies, and an arriving proxy queues a light analysis on the
  server (V-1, V-25).
- The deep checkpoint's content key includes whether each frame is read from its
  original or its proxy, and analysis.json lists the frames measured from proxies;
  an unreadable verdict on a frame now read from its proxy makes the report stale
  (V-26).
- Thumbnails drawn from proxies are compared with the archive's thumbnail size
  instead of 320 px (V-27).
- A resumed thumbnail or proxy pass sets ThumbsBuilt/ProxiesBuilt only when the
  frames an earlier run did still have theirs, and the proxy pass logs frames
  waiting for a client's proxy apart from unreadable ones (V-28).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-12 16:07:31 +00:00
1 parent 32a0e9bbc1
commit b4f1fa32d5
22 files changed
+601 -59

No files matched your search

+2 -2
View File
@@ -60,8 +60,8 @@ public static class FileEndpoints
/// <summary>
/// Files the body (a JPEG made from the original, its Exif capture time the frame's, as large as the archive's proxies,
/// at most <see cref="ArchiveImages.MaxProxyBytes"/>) as the proxy of a frame the server cannot decode
/// (<see cref="ServerProxies"/>); the sequence's thumbnails and proxy state follow as background jobs. 204; 413
/// <c>too_large</c>; 422 <c>proxy_not_wanted</c> (the server decodes that original itself, or it is missing or
/// (<see cref="ServerProxies"/>); the sequence's thumbnails, proxy state and light analysis follow as background jobs.
/// 204; 413 <c>too_large</c>; 422 <c>proxy_not_wanted</c> (the server decodes that original itself, or it is missing or
/// damaged), <c>invalid_proxy</c>, <c>proxy_mismatch</c> or <c>proxy_too_small</c>, which concern that proxy only; 409
/// <c>proxies_disabled</c>, which concerns them all; 503 <c>archive_offline</c>.
/// </summary>
+3 -2
View File
@@ -5,13 +5,14 @@ namespace Titano.Server.Jobs;
/// <summary>
/// Follow-up work after frames arrive (BRIEF §14.4): thumbnails, proxies and light analysis of the sequence; after a
/// proxy sent by a client or render node arrives, the thumbnails and the sequence's proxy state. Queued at background
/// proxy sent by a client or render node arrives, the thumbnails, the sequence's proxy state and the light analysis (a
/// frame read from its proxy is no longer preview-only, so the advisor's Auto values change). Queued at background
/// priority once per sequence while one is still waiting, and only for kinds this server can run.
/// </summary>
public sealed class SequenceJobs(TitanoDatabase db, JobEngineHost jobs)
{
private static readonly JobKind[] AfterNewFrames = [JobKind.Thumbs, JobKind.Proxies, JobKind.LightAnalyse];
private static readonly JobKind[] AfterProxy = [JobKind.Thumbs, JobKind.Proxies];
private static readonly JobKind[] AfterProxy = [JobKind.Thumbs, JobKind.Proxies, JobKind.LightAnalyse];
private readonly SemaphoreSlim _gate = new(1, 1);
@@ -1,12 +1,14 @@
using Titano.Core.Archiving;
using Titano.Core.Model;
using Titano.Data.Archiving;
namespace Titano.Server.Storage;
/// <summary>
/// Proxies are files under the sequence's <c>proxies/</c> folder; a thumbnail is the JPEG byte range of its entry in
/// <c>thumbs.pack</c>. A thumbnail made from a different original (the frame was renumbered or replaced) counts as not
/// built yet, like a missing one.
/// built yet, like a missing one, and so does a proxy whose capture time is another frame's
/// (<see cref="ArchiveImages.IsProxyOf"/>).
/// </summary>
internal sealed class ArchiveAssetLocator : IFrameAssetLocator
{
@@ -21,7 +23,7 @@ internal sealed class ArchiveAssetLocator : IFrameAssetLocator
private static AssetLocation? Proxy(SequencePaths paths, Frame frame)
{
var file = new FileInfo(paths.Proxy(frame.Index));
return file.Exists ? new AssetLocation(file.FullName, 0, file.Length, Jpeg) : null;
return file.Exists && ArchiveImages.IsProxyOf(file.FullName, frame.CapturedAt) ? new AssetLocation(file.FullName, 0, file.Length, Jpeg) : null;
}
private static AssetLocation? Thumbnail(SequencePaths paths, Frame frame)
+4 -3
View File
@@ -35,8 +35,9 @@ public static class ServerProxies
/// <summary>
/// Every frame of <paramref name="sequence"/> in index order, as a manifest lists it: a proxy is there when the server
/// built them all or one was sent for the frame; it is wanted for a frame the server cannot decode that has none
/// (and is not missing), unless <paramref name="spec"/> is null.
/// built them all or one was sent for the frame (<see cref="ArchiveImages.IsProxyOf"/>: one left at its index by a
/// frame renumbered since is another photo's); it is wanted for a frame the server cannot decode that has none (and is
/// not missing), unless <paramref name="spec"/> is null.
/// </summary>
public static async Task<List<ManifestFrame>> FramesAsync(TitanoDatabase db, Archive archive, Sequence sequence, ProxySpec? spec,
CancellationToken cancellationToken)
@@ -51,7 +52,7 @@ public static class ServerProxies
var batch = await db.Frames.ListBySequenceAsync(sequence.Id, after, Page, cancellationToken);
foreach (var f in batch)
{
var sent = !proxies && CannotDecode(f.Format) && File.Exists(folder.Proxy(f.Index));
var sent = !proxies && CannotDecode(f.Format) && ArchiveImages.IsProxyOf(folder.Proxy(f.Index), f.CapturedAt);
var wanted = spec is not null && !proxies && !sent && CannotDecode(f.Format) && (f.Flags & (FrameFlags.Missing | FrameFlags.Corrupt)) == 0;
frames.Add(new ManifestFrame(f.Id, f.Index, f.FileName, f.Size, f.Sha256 ?? string.Empty, proxies || sent, thumbs, (long)f.Flags, wanted));
}