Files
ersatztv/ErsatzTV.Core/Graphics/GraphicsElementDefaults.cs
T
timothy 56f3e593a5 fix(732): close round-2 review findings, including two in the round-1 fix itself
Both round-2 reviewers returned BLOCKED, and the sharpest findings were defects the previous fix
commit introduced rather than ones it missed.

The mechanism that fix added was untested. Deleting EnsureBuiltInElementRow from the ALREADY-SEEDED
branch left the whole 2054-test suite green - and that is the branch every install carrying #74's
marker takes on its first #732 boot, i.e. exactly the population the fix exists for. The previous
commit message claimed the marker "is only ever written against a resolved element"; that was proven
only for the fresh-seed minority. Same shape for the duplicate guard inside it: without the guard the
already-seeded branch inserts a row on every boot, RefreshGraphicsElements neither reaps nor dedupes
them, and the SPA list fills with copies. Both now have tests, and both were confirmed to redden.

That claim was also still false. With the template file absent, EnsureBuiltInElementRow returns
without creating a row and the marker was written anyway - a narrower version of the stranding bug
round 1 found. The backfill now stays armed when nothing resolves. This is safe in a way it was not
in round 1: EnsureBuiltInElementRow closed the "row appears later" window that argued against it.

The clamp only shrank insetPixels, not the box. DrawBackgroundBox kept stroking at the original
border width, centred on a rect with no room for it, so an oversized border flooded the element and
painted over its interior. The box's own fields are clamped now, border first.

The catch was over-corrected. Round 1 asked for it to be broader; everything-but-cancellation
swallows genuinely fatal failures and boots a compromised process. It is a named filesystem set
again, plus a carve-out for an OperationCanceledException raised while the token is NOT cancelled -
that one is just a faulty read, and letting it escape is the restart loop the catch exists to stop.

The template rewrite was not atomic: WriteAllTextAsync truncates first, so an interrupted write left
a partial file matching no fingerprint, which the upgrade could then never repair, on a template now
attached to every channel. Write-then-move, with the temp file cleaned up on failure.

Also: YAML doubles like 1e100 and NaN reach float/int casts, so box dimensions are sanitized at the
boundary; the built-in row is created with a Name so it does not sort into the unnamed bucket in the
SPA until the first refresh; CreateChannelHandler threads the real cancellation token.

Decisions-Edit: yes
Refs: #732
2026-08-26 20:37:06 +02:00

11 lines
399 B
C#

namespace ErsatzTV.Core.Graphics;
public static class GraphicsElementDefaults
{
// Built-in "On Now / Next" text element; identity is by filename, never by user-editable Name.
public const string OnNowNextFileName = "on-now-next.yml";
// Display name only. Never use it for identity -- that is the filename above (#67 / #74).
public const string OnNowNextName = "On Now / Next";
}