fix(proxies): judge proxies by one rule and record tiers and reports as they stand

- ArchiveImages.IsProxyOf compares capture times to the microsecond the index
  keeps (sidecars and Exif keep 100 ns ticks), and for frames read through
  proxies also applies the policy's size rule, so the proxy pass, uploads,
  thumbnails, renders, analyses, tiers, manifests and downloads agree.
- Proxy headers are cached per file while length and write time are unchanged
  (and the file has settled), so manifests cost a stat per proxy.
- FrameTiers.RecordAsync checks proxy presence when it writes the sidecar and
  returns the sequence's frames as they are, so a deep analysis or render that
  ran while proxies arrived no longer flags the frames preview-only again, and
  the analysis advises from the current flags.
- Server manifests ignore ProxiesBuilt for frames the server cannot decode, so
  frames added since the last proxy pass are asked for their proxies.
- GET /sequences/{id}/analysis/report answers 404 for a report that found
  frames unreadable before their proxies arrived (DeepReports.ReadCurrentAsync).
- The deep checkpoint key marks only frames read from proxies, so checkpoints
  written by earlier versions still resume.

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:52:30 +00:00
1 parent b4f1fa32d5
commit 4014b0e669
16 files changed
+514 -99

No files matched your search

@@ -32,10 +32,14 @@ public sealed class RemoteEditingTests(TestContext context)
var sequence = (await server.Database.Sequences.GetAsync(frame.SequenceId))!;
var path = new ArchivePaths(server.Options.ArchivePath).Sequence(sequence.Folder).AnalysisPath;
Directory.CreateDirectory(Path.GetDirectoryName(path)!);
const string report = """{"version":1,"frameCount":1}""";
var report = Reports.Minimal(1).ToJson();
await File.WriteAllTextAsync(path, report, context.Cancellation);
Assert.Equal(report, await client.GetAnalysisReportAsync(frame.SequenceId, context.Cancellation));
// One made for other frames is not this sequence's report.
await File.WriteAllTextAsync(path, Reports.Minimal(2).ToJson(), context.Cancellation);
Assert.Null(await client.GetAnalysisReportAsync(frame.SequenceId, context.Cancellation), "another frame count");
var gone = await Assert.ThrowsAsync<TitanoApiException>(() => client.GetAnalysisReportAsync(Guid.CreateVersion7(), context.Cancellation));
Assert.Equal(HttpStatusCode.NotFound, gone.Status);
}