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:
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Plugin.JRay.Models;
|
||||
using Jellyfin.Plugin.JRay.Services;
|
||||
using Jellyfin.Plugin.JRay.Services.Interfaces;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -15,10 +16,11 @@ namespace Jellyfin.Plugin.JRay.Controllers;
|
||||
/// locally. See SPEC.md §2.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The <c>schema_version</c> check here refuses an unrecognised version rather
|
||||
/// than guessing at its shape. It is currently the only source that checks —
|
||||
/// sidecar reads do not — which JR-003 requires be fixed by moving the check
|
||||
/// into the shared read path.
|
||||
/// The <c>schema_version</c> check refuses an unrecognised version rather than
|
||||
/// guessing at its shape. It defers to <see cref="TruthSchema"/> rather than
|
||||
/// holding its own constant: this used to be the only source that checked while
|
||||
/// sidecar reads did not, so the version the plugin claimed to require and the
|
||||
/// one it would actually parse could drift apart.
|
||||
/// </remarks>
|
||||
[ApiController]
|
||||
[Route("Plugins/JRay/Items/{itemId}/Truth")]
|
||||
@@ -26,8 +28,6 @@ namespace Jellyfin.Plugin.JRay.Controllers;
|
||||
// TRACES: JR-003, JR-009, JR-014 | SR-003
|
||||
public class TruthController : ControllerBase
|
||||
{
|
||||
private const int SupportedSchemaVersion = 1;
|
||||
|
||||
private readonly IManagedTruthStore _managedTruthStore;
|
||||
private readonly ITruthDataService _truthDataService;
|
||||
|
||||
@@ -54,9 +54,9 @@ public class TruthController : ControllerBase
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
public async Task<IActionResult> PutTruth(Guid itemId, [FromBody] TruthFile truth, CancellationToken cancellationToken)
|
||||
{
|
||||
if (truth.SchemaVersion != SupportedSchemaVersion)
|
||||
if (!TruthSchema.IsSupported(truth))
|
||||
{
|
||||
return BadRequest($"Unsupported schema_version {truth.SchemaVersion}; expected {SupportedSchemaVersion}.");
|
||||
return BadRequest(TruthSchema.DescribeRejection(truth.SchemaVersion));
|
||||
}
|
||||
|
||||
var provenance = TruthProvenance.Local(TruthSource.Pushed, DateTime.UtcNow);
|
||||
|
||||
Reference in New Issue
Block a user