fix(data): never let the compile_options probe block opening an index

Any failure of the informational PRAGMA compile_options probe is logged
and gives an empty list; before, anything but a SqliteException was cached
by the lazy value and rethrown by every later open.

Tests now cover the decode-tier fields end to end: the Library's
preview-only chip and its plural tooltip, server cards and frames carrying
previewOnlyCount and the preview size over the API.

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 11:17:55 +00:00
1 parent 5599e4de89
commit bbc7f244fa
4 files changed
+100 -21

No files matched your search

@@ -228,4 +228,41 @@ public sealed class SequenceTests(TestContext context)
using var analysis = await editor.GetAsync($"/api/v1/sequences/{id}/analysis");
Assert.Equal("analysis", (await analysis.ExpectErrorAsync(HttpStatusCode.NotFound, "not_found")).Details);
}
[Test]
public async Task CardsAndFramesCarryTheDecodeTierFields()
{
await using var server = await TestServer.StartAsync(context);
var (editor, _, _) = await server.UserAsync("alberto", "editor");
var first = await Uploads.UploadAsync(editor, Uploads.Photo(1000, 50), "t0.CR3", sessionKey: "t");
await Uploads.UploadAsync(editor, Uploads.Photo(1001, 51), "t1.CR3", sessionKey: "t");
var db = server.Database;
// The follow-up jobs of the upload (thumbnails, proxies, light analysis) rewrite the rows: let them finish first.
for (var waited = 0; waited < 600; waited++)
{
if ((await db.Jobs.ListAsync(Titano.Core.Model.JobState.Queued)).Items.Count == 0
&& (await db.Jobs.ListAsync(Titano.Core.Model.JobState.Running)).Items.Count == 0) break;
await Task.Delay(50, context.Cancellation);
}
// What a light analysis on the server records for CR3s it reads only through their previews.
var frames = await db.Frames.ListBySequenceAsync(first.SequenceId);
await db.Frames.UpdateTiersAsync([.. frames.Select(f => new Titano.Data.Repositories.FrameTierFields(f.Id, Titano.Core.Model.FrameFlags.PreviewOnly, 1620, 1080))]);
var sequence = (await db.Sequences.GetAsync(first.SequenceId))!;
await db.Sequences.UpsertAsync(sequence with { PreviewOnlyCount = 2 });
// The Library cards read the count (the chip), the remote editor the preview size (the output cap).
using var list = await editor.GetAsync("/api/v1/sequences");
await list.ExpectAsync(HttpStatusCode.OK);
Assert.Contains("\"previewOnlyCount\":2", await list.Content.ReadAsStringAsync());
using var listed = await editor.GetAsync("/api/v1/sequences");
Assert.Equal(2, (await listed.ReadAsync(ProtocolJson.Default.PageSequenceDto)).Items.Single(s => s.Id == first.SequenceId).PreviewOnlyCount);
using var page = await editor.GetAsync($"/api/v1/sequences/{first.SequenceId}/frames");
await page.ExpectAsync(HttpStatusCode.OK);
var json = await page.Content.ReadAsStringAsync();
Assert.Contains("\"previewWidth\":1620", json);
Assert.Contains("\"previewHeight\":1080", json);
using var typed = await editor.GetAsync($"/api/v1/sequences/{first.SequenceId}/frames");
var dtos = (await typed.ReadAsync(ProtocolJson.Default.PageFrameDto)).Items;
Assert.True(dtos.All(f => (f.PreviewWidth, f.PreviewHeight, f.Flags) == (1620, 1080, (long)Titano.Core.Model.FrameFlags.PreviewOnly)), "frame DTOs");
}
}