Requirements register, spec rewrite, and TRACES tags

jRay had no requirement IDs, so nothing in this repo could be traced to and
the CI gate had no denominator to read. The other two components had already
moved to registers; this brings the plugin level with them.

Adds docs/requirements.md with 46 permanent JR-nnn IDs, each carrying a parent
requirement, priority, status and verification tier, plus a per-requirement
verification plan. JR is flat rather than split by theme: the plugin is one
deployable with one audience, and JRay-public-server already ships UR/DR, so a
second repo using those prefixes would make UR-007 ambiguous across registers.

Rewrites SPEC.md as requirements prose with Current:/Gap: on every one. It had
drifted into a format-plus-API reference that documented schema_version 1 while
owning a format whose v2 shape was specified only in the other two repos, said
nothing about SR-002's scene-scoped semantics, and carried the manifest
exchange as a "planned" aside while its configuration classes were already
implemented. Plugin-side exchange obligations move here from the server's
spec, where they were an ownership inversion.

Adds JR-038..041 for PR-005, which had no software row in any repo -- it was
held structurally by SR-004 and GR-005 both being prohibitions, and a goal
preserved only by prohibitions is the kind that erodes unnoticed. jRay is the
component that actually opens a socket.

Tags 18 units with the requirements they satisfy. Tags name what the code
satisfies, so FileTransformationRegistration is not tagged JR-021: that
requirement is a prohibition and was still violated elsewhere when this was
written.

Vendors jray-project as a submodule for the system spec and shared gate.

TRACES: JR-001, JR-004, JR-005, JR-007, JR-008, JR-009, JR-010, JR-011
TRACES: JR-012, JR-013, JR-014, JR-015, JR-016, JR-017, JR-018, JR-019
TRACES: JR-020, JR-024, JR-025, JR-036, JR-038

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-30 18:57:48 +02:00
co-authored by Claude Opus 5
parent 32f976e79f
commit 3b24fe1b3c
20 changed files with 1299 additions and 213 deletions
@@ -0,0 +1,110 @@
namespace Jellyfin.Plugin.JRay.Configuration;
/// <summary>
/// How far a configured manifest server is trusted. See the JRay public server
/// specification, §9 "Trusting third-party servers".
/// </summary>
public enum ServerTrustLevel
{
/// <summary>
/// Accept manifests, but never contribute to this server and never send
/// library inventory beyond the single item being queried. The default for
/// user-added servers.
/// </summary>
FetchOnly = 0,
/// <summary>
/// Eligible to contribute to, subject to <see cref="ManifestServer.AllowContribute"/>.
/// </summary>
Full = 1,
}
/// <summary>
/// The minimum cut-match tier a fetched manifest must reach before it is stored.
/// See the public server specification, §3 "Cut matching".
/// </summary>
public enum MatchTier
{
/// <summary>Audio 0.600.85, or runtimes within ±30s. Surfaced as a caveat in the UI.</summary>
Loose = 0,
/// <summary>Runtimes within ±2s.</summary>
Runtime = 1,
/// <summary>Audio signature score ≥ 0.85; may carry a non-zero offset.</summary>
Audio = 2,
/// <summary>Identical <c>video_hash</c> — the same file.</summary>
Exact = 3,
}
/// <summary>
/// One entry in the ordered list of manifest servers the plugin queries
/// (public server specification, §9 "Multiple servers").
/// </summary>
/// <remarks>
/// The list is ordered because order *is* the user's trust ranking, made
/// explicit: for a fetch, servers are tried in order and the first acceptable
/// result wins. Querying every server for every item would multiply egress and
/// leak the library to more parties.
///
/// <c>FetchOnly</c> is the default for user-added servers. Adding a third-party
/// server means trusting its operator not to serve deliberately wrong actor
/// data — the client-side controls bound the damage to bad overlay content,
/// they cannot make wrong data right.
/// </remarks>
// TRACES: JR-025 | PR-005, PR-006
public class ManifestServer
{
/// <summary>
/// Initializes a new instance of the <see cref="ManifestServer"/> class.
/// </summary>
public ManifestServer()
{
Url = string.Empty;
Name = string.Empty;
Token = string.Empty;
Enabled = false;
AllowContribute = false;
TrustLevel = ServerTrustLevel.FetchOnly;
}
/// <summary>
/// Gets or sets the base URL of the server, e.g. "https://jray.tourolle.paris".
/// HTTPS is required for non-loopback servers: a plaintext server would let
/// any network intermediary rewrite actor overlays.
/// </summary>
public string Url { get; set; }
/// <summary>
/// Gets or sets the display label shown in the configuration page.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Gets or sets the API token used to contribute manifests. Optional —
/// required only to contribute, never to fetch. This is an anonymous bearer
/// capability rather than an account (public server specification, §5a).
/// </summary>
public string Token { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this server is queried at all.
/// Lets an admin disable an entry without deleting it and losing its token.
/// </summary>
public bool Enabled { get; set; }
/// <summary>
/// Gets or sets a value indicating whether locally generated manifests may be
/// contributed to this server. Independent of fetching, and off by default:
/// contribution is never fanned out, because broadcasting uploads to every
/// configured server would multiply privacy exposure without the user
/// intending it.
/// </summary>
public bool AllowContribute { get; set; }
/// <summary>
/// Gets or sets how far this server is trusted.
/// </summary>
public ServerTrustLevel TrustLevel { get; set; }
}
@@ -1,3 +1,4 @@
using System.Collections.ObjectModel;
using MediaBrowser.Model.Plugins;
namespace Jellyfin.Plugin.JRay.Configuration;
@@ -5,8 +6,28 @@ namespace Jellyfin.Plugin.JRay.Configuration;
/// <summary>
/// Plugin configuration.
/// </summary>
/// <remarks>
/// Every manifest-exchange switch here defaults to <b>off</b>, including the
/// pre-configured community server, so no traffic leaves an installation until
/// an admin acts. Fetching and contributing each reveal to a server operator
/// that some instance holds a given title; that is inherent to the exchange, so
/// the defaults bound the exposure rather than pretending to remove it.
/// </remarks>
// TRACES: JR-036, JR-038 | PR-005
public class PluginConfiguration : BasePluginConfiguration
{
/// <summary>
/// The community manifest exchange. Shipped pre-configured but
/// <b>disabled</b>, so no traffic leaves an installation until an admin opts
/// in (public server specification, §9).
/// </summary>
public const string CommunityServerUrl = "https://jray.tourolle.paris";
/// <summary>
/// Display name for <see cref="CommunityServerUrl"/>.
/// </summary>
public const string CommunityServerName = "JRay Community";
/// <summary>
/// Initializes a new instance of the <see cref="PluginConfiguration"/> class.
/// </summary>
@@ -15,6 +36,24 @@ public class PluginConfiguration : BasePluginConfiguration
TruthFileSuffix = ".jray.json";
CacheDurationMinutes = 60;
EnableOverlay = true;
// Manifest sharing is a network egress feature, so every part of it is
// off by default (public server specification, §9 "Configuration").
EnableManifestSharing = false;
ContributeManifests = false;
ComputeAudioSignatures = false;
MinimumMatchTier = MatchTier.Runtime;
// Pre-configured but disabled: the admin opts in by enabling it, rather
// than by having to discover and type a URL.
Servers.Add(new ManifestServer
{
Url = CommunityServerUrl,
Name = CommunityServerName,
Enabled = false,
AllowContribute = false,
TrustLevel = ServerTrustLevel.FetchOnly,
});
}
/// <summary>
@@ -37,4 +76,62 @@ public class PluginConfiguration : BasePluginConfiguration
/// any previously injected script is removed.
/// </summary>
public bool EnableOverlay { get; set; }
/// <summary>
/// Gets or sets a value indicating whether JRay may fetch actor-timeline
/// manifests from the configured servers. Off by default — this is a network
/// egress feature and must be opt-in.
/// </summary>
/// <remarks>
/// Fetching reveals to a server operator that some instance holds a given
/// title. That is inherent to the exchange, and each configured server
/// multiplies the exposure, which the configuration page states plainly.
/// </remarks>
public bool EnableManifestSharing { get; set; }
/// <summary>
/// Gets or sets a value indicating whether locally generated manifests may be
/// contributed back. A separate opt-in from downloading, and off by default.
/// </summary>
/// <remarks>
/// Contribution additionally requires <see cref="ManifestServer.AllowContribute"/>
/// on the specific server and a token for it. Uploads are never fanned out to
/// every configured server.
/// </remarks>
public bool ContributeManifests { get; set; }
/// <summary>
/// Gets or sets the minimum cut-match tier a fetched manifest must reach
/// before it is stored.
/// </summary>
/// <remarks>
/// Defaults to <see cref="MatchTier.Runtime"/>. <see cref="MatchTier.Loose"/>
/// admits manifests whose runtime differs by up to 30s, which may be a
/// different trim of the same cut — usable, but it should be surfaced as a
/// caveat rather than applied silently.
/// </remarks>
public MatchTier MinimumMatchTier { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the plugin computes audio
/// signatures for library items, enabling content-based cut matching and
/// identification of files whose providence is unknown.
/// </summary>
/// <remarks>
/// Off by default. Uses the FFmpeg binary Jellyfin already ships (via
/// <c>IMediaEncoder.EncoderPath</c>), so there is no extra dependency, but it
/// costs roughly a second or two of I/O per item and is therefore opt-in.
/// </remarks>
public bool ComputeAudioSignatures { get; set; }
/// <summary>
/// Gets the ordered list of manifest servers.
/// </summary>
/// <remarks>
/// Order is the user's trust ranking: for a fetch, servers are tried in order
/// and the first result clearing <see cref="MinimumMatchTier"/> wins. For a
/// series, first-match applies per <i>episode</i>, so a later server is
/// queried only for the episodes earlier ones lacked.
/// </remarks>
public Collection<ManifestServer> Servers { get; } = new();
}