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

+17 -5
View File
@@ -12,7 +12,9 @@ namespace Titano.Data.Archiving;
/// shows a warning at once; its next light analysis lists them. Tiers describe the host that probed or decoded the files
/// last. Only a file in a format this host decodes natively is flagged undecodable (it is damaged); one beyond this
/// host's decoders (HEIF or an unsupported RAW without a preview on the server) keeps its tier but no flag, so render
/// nodes and proxies can still provide its pixels, and a host that decodes a flagged frame clears the flag.
/// nodes and proxies can still provide its pixels, and a host that decodes a flagged frame clears the flag. A frame whose
/// original this host reads through its proxy (<see cref="ArchiveImages.NeedsProxy(ImageFileFormat)"/>) is preview-only
/// only while it has none: with its proxy it is not rendered from the embedded preview, so it caps nothing.
/// </summary>
internal sealed class FrameTiers(TitanoDatabase db, SequenceWriter writer, ArchiveIndexer indexer)
{
@@ -49,15 +51,22 @@ internal sealed class FrameTiers(TitanoDatabase db, SequenceWriter writer, Archi
return tiers;
}
/// <inheritdoc cref="RecordAsync(Archive, Sequence, IReadOnlyDictionary{Guid, FileTier}, IReadOnlyDictionary{Guid, bool}?, CancellationToken)"/>
public Task<IReadOnlyList<SidecarFrame>> RecordAsync(Archive archive, Sequence sequence, IReadOnlyDictionary<Guid, FileTier> tiers,
CancellationToken cancellationToken) => RecordAsync(archive, sequence, tiers, null, cancellationToken);
/// <summary>
/// Records <paramref name="tiers"/> (by frame id) where they change what the sidecar says, and returns the frames that
/// changed as they are now. Frames no longer in the sequence are ignored.
/// </summary>
/// <param name="proxied">By frame id, for frames whose original this host reads through its proxy, whether the frame's
/// own proxy is there now (<see cref="SequenceFrames.WithProxy"/>); their <see cref="FrameFlags.PreviewOnly"/> follows
/// it even where no tier is recorded.</param>
/// <exception cref="ArchiveOfflineException">The archive is offline or read-only.</exception>
public async Task<IReadOnlyList<SidecarFrame>> RecordAsync(Archive archive, Sequence sequence, IReadOnlyDictionary<Guid, FileTier> tiers,
CancellationToken cancellationToken)
IReadOnlyDictionary<Guid, bool>? proxied, CancellationToken cancellationToken)
{
if (tiers.Count == 0) return [];
if (tiers.Count == 0 && proxied is not { Count: > 0 }) return [];
var paths = new ArchivePaths(archive.RootPath);
ArchiveVolume.EnsureWritable(paths);
var changed = new List<SidecarFrame>();
@@ -70,8 +79,11 @@ internal sealed class FrameTiers(TitanoDatabase db, SequenceWriter writer, Archi
{
var frame = m.Frames[i];
frames[i] = frame;
if (!tiers.TryGetValue(frame.Id, out var tier)) continue;
var updated = SequenceFrames.WithTier(frame, tier, DecodesNatively(frame.Format));
bool? hasProxy = proxied is not null && proxied.TryGetValue(frame.Id, out var found) ? found : null;
SidecarFrame updated;
if (tiers.TryGetValue(frame.Id, out var tier)) updated = SequenceFrames.WithTier(frame, tier, DecodesNatively(frame.Format), hasProxy == true);
else if (hasProxy is { } proxy) updated = SequenceFrames.WithProxy(frame, proxy);
else continue;
if (updated.Tier == frame.Tier && updated.Flags == frame.Flags && updated.PreviewW == frame.PreviewW && updated.PreviewH == frame.PreviewH)
continue;
gained |= (updated.Flags & ~frame.Flags & FrameFlags.Undecodable) != 0;