fix(hosts): a driver that never built a tag table reports NO ANSWER, not zero skips

Found on the docker-dev live gate, not in tests. Two drivers that faulted
during initialise (rtu-gate, opcua1) each rendered "0 tags" on /hosts against
two authored tags apiece, because a ledger that had never committed returned
SkippedTagReport.Empty.

A zero report is a positive claim -- "this driver skipped nothing" -- and
making it on behalf of a driver that never got as far as looking is exactly
the quiet inaccuracy #541 exists to remove. GetSkippedTags() and
SkippedTagLedger.Snapshot() now return null until the first committed build,
so the column renders the same em-dash it already used for a driver that
cannot report at all. Both are 'no answer'; neither is 'nothing skipped'.

Knock-on: a FOCAS driver whose only init threw now reports null rather than a
zero report, which is strictly more honest than the assertion the test
originally made.
This commit is contained in:
Joseph Doherty
2026-08-05 20:16:31 -04:00
parent 39db75083d
commit dd900f970a
19 changed files with 94 additions and 51 deletions
@@ -31,7 +31,7 @@ public sealed class AbCipDriver : IDriver, IReadable, IWritable, ITagDiscovery,
private readonly SkippedTagLedger _skippedTags = new();
/// <inheritdoc />
public SkippedTagReport GetSkippedTags() => _skippedTags.Snapshot();
public SkippedTagReport? GetSkippedTags() => _skippedTags.Snapshot();
private AbCipDriverOptions _options;
private readonly string _driverInstanceId;
@@ -17,7 +17,7 @@ public sealed class AbLegacyDriver : IDriver, IReadable, IWritable, ITagDiscover
private readonly SkippedTagLedger _skippedTags = new();
/// <inheritdoc />
public SkippedTagReport GetSkippedTags() => _skippedTags.Snapshot();
public SkippedTagReport? GetSkippedTags() => _skippedTags.Snapshot();
/// <summary>Mutable so <see cref="InitializeAsync"/> can adopt a re-parsed config on reinitialize
/// (#516). Only ever written on the init path, before any reader/session uses it.</summary>
@@ -42,7 +42,7 @@ public sealed class CalculationDriver : IDriver, IDependencyConsumer, ISubscriba
private readonly SkippedTagLedger _skippedTags = new();
/// <inheritdoc />
public SkippedTagReport GetSkippedTags() => _skippedTags.Snapshot();
public SkippedTagReport? GetSkippedTags() => _skippedTags.Snapshot();
// OPC UA status codes surfaced by the calc driver.
private const uint StatusGood = 0u;
@@ -27,7 +27,7 @@ public sealed class FocasDriver : IDriver, IReadable, IWritable, ITagDiscovery,
private readonly SkippedTagLedger _skippedTags = new();
/// <inheritdoc />
public SkippedTagReport GetSkippedTags() => _skippedTags.Snapshot();
public SkippedTagReport? GetSkippedTags() => _skippedTags.Snapshot();
/// <summary>Mutable so <see cref="InitializeAsync"/> can adopt a re-parsed config (#516). Written only
/// on the init path, together with <see cref="_clientFactory"/>, before either is used.</summary>
@@ -45,7 +45,7 @@ public sealed class GalaxyDriver
private readonly SkippedTagLedger _skippedTags = new();
/// <inheritdoc />
public SkippedTagReport GetSkippedTags() => _skippedTags.Snapshot();
public SkippedTagReport? GetSkippedTags() => _skippedTags.Snapshot();
private readonly string _driverInstanceId;
private readonly GalaxyDriverOptions _options;
@@ -79,7 +79,7 @@ public sealed class MTConnectDriver
private readonly SkippedTagLedger _skippedTags = new();
/// <inheritdoc />
public SkippedTagReport GetSkippedTags() => _skippedTags.Snapshot();
public SkippedTagReport? GetSkippedTags() => _skippedTags.Snapshot();
/// <summary>
/// The Agent could not be reached, answered unusably, or blew the per-call deadline. Distinct
@@ -25,7 +25,7 @@ public sealed class ModbusDriver
private readonly SkippedTagLedger _skippedTags = new();
/// <inheritdoc />
public SkippedTagReport GetSkippedTags() => _skippedTags.Snapshot();
public SkippedTagReport? GetSkippedTags() => _skippedTags.Snapshot();
// ---- instance fields (grouped at top for auditability) ----
@@ -70,7 +70,7 @@ public sealed class MqttDriver
private readonly SkippedTagLedger _skippedTags = new();
/// <inheritdoc />
public SkippedTagReport GetSkippedTags() => _skippedTags.Snapshot();
public SkippedTagReport? GetSkippedTags() => _skippedTags.Snapshot();
// ---- Write status codes (Gitea #508) ----
//
@@ -37,7 +37,7 @@ public sealed class OpcUaClientDriver : IDriver, ITagDiscovery, IReadable, IWrit
private readonly SkippedTagLedger _skippedTags = new();
/// <inheritdoc />
public SkippedTagReport GetSkippedTags() => _skippedTags.Snapshot();
public SkippedTagReport? GetSkippedTags() => _skippedTags.Snapshot();
/// <summary>
/// Recomputes the skip report from the freshly-built map. Derived by re-asking the map to resolve
@@ -36,7 +36,7 @@ public sealed class S7Driver
private readonly SkippedTagLedger _skippedTags = new();
/// <inheritdoc />
public SkippedTagReport GetSkippedTags() => _skippedTags.Snapshot();
public SkippedTagReport? GetSkippedTags() => _skippedTags.Snapshot();
private readonly string _driverInstanceId;
private readonly ILogger<S7Driver> _logger;
@@ -46,7 +46,7 @@ public sealed class SqlDriver
private IReadOnlyList<SkippedTag> _blobSkips = [];
/// <inheritdoc />
public SkippedTagReport GetSkippedTags() => _skippedTags.Snapshot();
public SkippedTagReport? GetSkippedTags() => _skippedTags.Snapshot();
/// <summary>
/// Republishes the skip ledger as the union of the blob-level skips and the catalog gate's
@@ -17,7 +17,7 @@ public sealed class TwinCATDriver : IDriver, IReadable, IWritable, ITagDiscovery
private readonly SkippedTagLedger _skippedTags = new();
/// <inheritdoc />
public SkippedTagReport GetSkippedTags() => _skippedTags.Snapshot();
public SkippedTagReport? GetSkippedTags() => _skippedTags.Snapshot();
// Mutable so ReinitializeAsync can apply a new config generation. The constructor seeds
// it; InitializeAsync re-parses driverConfigJson over the top of it.