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:
22 files changed
+601
-59
No files matched your search
@@ -63,6 +63,28 @@ public sealed class ProcessingModuleTests(TestContext context)
|
||||
Assert.Contains(Drain(events), e => e is SequenceChangedEvent { Change: "settings" } changed && changed.SequenceId == sequenceId);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AProxyThatArrivesHasTheSequenceAnalysedAgain()
|
||||
{
|
||||
await using var server = await TestServer.StartAsync(context, services: Production);
|
||||
var (editor, _, _) = await server.UserAsync("alberto", "editor");
|
||||
// A HEIF original the server cannot decode (BRIEF §2.3): what it renders depends on the proxy a client sends.
|
||||
var upload = await Uploads.UploadAsync(editor, [0, 0, 0, 24, .. "ftypheic"u8, 0, 0, 0, 0, .. "mif1heic"u8, .. Uploads.Photo(2000, 1)], "IMG_0001.HEIC",
|
||||
sessionKey: "roof");
|
||||
await LightAnalysesAsync(server, upload.SequenceId, 1);
|
||||
var frame = Assert.NotNull(await server.Database.Frames.GetAsync(upload.FrameId));
|
||||
|
||||
using var image = new Core.Imaging.ImageBuffer(320, 240);
|
||||
var exif = ExifWriter.BuildJpegApp1(new FrameMetadata { CapturedAt = frame.CapturedAt, Software = "Titano" });
|
||||
using var proxy = new ByteArrayContent(JpegEncoder.Encode(image, new JpegEncodeOptions { App1Segments = [exif[4..]] }));
|
||||
proxy.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("image/jpeg");
|
||||
using (var stored = await editor.PutAsync($"/api/v1/frames/{frame.Id}/proxy", proxy))
|
||||
await stored.ExpectAsync(HttpStatusCode.NoContent);
|
||||
|
||||
// A frame read from its proxy is no longer preview-only, so the advisor's Auto values are worked out again.
|
||||
await LightAnalysesAsync(server, upload.SequenceId, 2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TheServerRendersManagedFormatsAndLeavesMp4ToRenderNodes()
|
||||
{
|
||||
@@ -196,6 +218,19 @@ public sealed class ProcessingModuleTests(TestContext context)
|
||||
return drained;
|
||||
}
|
||||
|
||||
/// <summary>Waits until <paramref name="count"/> light analyses of the sequence have finished.</summary>
|
||||
private static async Task LightAnalysesAsync(TestServer server, Guid sequenceId, int count)
|
||||
{
|
||||
var until = DateTime.UtcNow + TimeSpan.FromSeconds(30);
|
||||
while (true)
|
||||
{
|
||||
var done = (await server.Database.Jobs.ListAsync(JobState.Done, JobKind.LightAnalyse, 200)).Items.Count(j => j.TargetIds.Contains(sequenceId));
|
||||
if (done >= count) return;
|
||||
Assert.True(DateTime.UtcNow < until, $"light analyses finished: {done} of {count}");
|
||||
await Task.Delay(100);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Uploads a synthetic scene with Exif into one new sequence; returns its id.</summary>
|
||||
private static async Task<Guid> UploadSceneAsync(HttpClient editor)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user