feat(truth): schema_version 2 read path, v2 only
Replaces the v1 shape rather than accepting both. `anneal_sec` and the top-level `sample_fps` are deleted, not zeroed; `extraction` and `cut` blocks arrive; `scenes` become objects carrying belief and route, so a window records how far to trust it instead of being a bare float pair. `TruthSchema.IsSupported` is the single gate and is applied on all four read paths — sidecar, managed store load, managed PUT, and converted manifest. Previously only the controller checked, so the version the plugin claimed to require and the one it would actually parse were free to drift. Rejections name the file and the version found, so an item that looks empty is distinguishable from one that was refused. `ManifestConverter` carries belief, route and both provenance blocks through: dropping them would silently downgrade every fetched manifest against a locally extracted one. TRACES: JR-002, JR-003 | SR-003
This commit is contained in:
@@ -49,12 +49,30 @@ public sealed class ManagedTruthStore : IManagedTruthStore
|
||||
try
|
||||
{
|
||||
using var stream = File.OpenRead(path);
|
||||
return await JsonSerializer.DeserializeAsync<TruthFile>(stream, JsonOptions, cancellationToken)
|
||||
var truth = await JsonSerializer.DeserializeAsync<TruthFile>(stream, JsonOptions, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
// Managed truth is checked on the way out as well as on the way in.
|
||||
// Data written by an earlier plugin version is already on disk, and
|
||||
// it did not pass today's PUT.
|
||||
if (!TruthSchema.IsSupported(truth))
|
||||
{
|
||||
_logger.LogWarning(
|
||||
"JRay: ignoring managed truth {Path} — schema_version {Found}, expected {Expected}. Re-push or re-extract this item.",
|
||||
path,
|
||||
truth?.SchemaVersion ?? 0,
|
||||
TruthSchema.SupportedVersion);
|
||||
return null;
|
||||
}
|
||||
|
||||
return truth;
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or JsonException)
|
||||
{
|
||||
_logger.LogWarning(ex, "JRay: failed to read managed truth file {Path}", path);
|
||||
_logger.LogWarning(
|
||||
ex,
|
||||
"JRay: failed to read managed truth file {Path}. If this is v1 data, re-push it — v1 is no longer read.",
|
||||
path);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user