Add high-res critical image refresh import

This commit is contained in:
2026-03-18 00:44:58 +01:00
parent 30fd257ea5
commit 8cbcf66695
10 changed files with 183 additions and 18 deletions

View File

@@ -191,6 +191,48 @@ public sealed class CriticalImportMergeIntegrationTests
}
}
[Fact]
public async Task Reimport_images_only_refreshes_provenance_without_touching_curated_content()
{
var (parseResult, _) = await LoadPreparedSlashParseResultAsync();
var databasePath = CreateEmptyDatabasePath();
var loader = new CriticalImportLoader(databasePath);
await loader.LoadAsync(parseResult.Table);
await using (var dbContext = CreateDbContext(databasePath))
{
var result = await LoadResultAsync(dbContext, "36-45", "B");
result.IsCurated = true;
result.RawCellText = "Curated raw text";
result.DescriptionText = "Curated description";
result.RawAffixText = "+12H";
result.ParseStatus = "manually_curated";
result.SourcePageNumber = null;
result.SourceImagePath = null;
result.SourceImageCropJson = null;
await dbContext.SaveChangesAsync();
}
await loader.RefreshImageArtifactsAsync(parseResult.Table);
await using (var dbContext = CreateDbContext(databasePath))
{
var result = await LoadResultAsync(dbContext, "36-45", "B");
Assert.True(result.IsCurated);
Assert.Equal("Curated raw text", result.RawCellText);
Assert.Equal("Curated description", result.DescriptionText);
Assert.Equal("+12H", result.RawAffixText);
Assert.Equal("manually_curated", result.ParseStatus);
Assert.NotNull(result.SourcePageNumber);
Assert.False(string.IsNullOrWhiteSpace(result.SourceImagePath));
Assert.False(string.IsNullOrWhiteSpace(result.SourceImageCropJson));
}
}
private static ParsedCriticalTable CreateTrimmedTable(
ParsedCriticalTable table,
params (string RollBandLabel, string ColumnKey)[] excludedResults)