fix(adminui): lane D-b review r0 fixes (I1, M1, M2, M5-M9, N1-N3, N5, H3)
I1: /hosts eviction keyed off the AUTHORED DriverInstances, so a driver deleted in /raw but not yet deployed - still running, still publishing - vanished every tick. The stores' sweep is now EvictUnconfiguredStale(set, olderThanUtc): an entry goes only when unconfigured AND its PublishedUtc is older than 60 s. Tests cover unconfigured+fresh kept (positive control), unconfigured+stale evicted, configured+stale kept, and the deploy hand-off. M1: Test Connect falls back to the driver's documented ProbeTimeoutSeconds default (Galaxy 30, OpcUaClient 15, ...) when the key is absent. M2: the budget never undercuts the config's root timeoutMs (+1 s). M5: RawBrowseModal compares the open generation captured before the await, so a close-then-reopen mid-open closes the stale session. M6: /alarms-historian keeps a 30 s re-poll on 'not registered' (a driver node may still be starting) instead of stopping for good. M7: /scripts source fetch failure shows in the dialog, not the error boundary. M8: the export modal maps only its preview rows; the endpoint writes via Results.Text (no second byte[] copy). M9: /hosts config queries are ordered, so SequenceEqual change detection holds. N1 tooltip, N2 CRLF-safe regex, N3 throttled Warning for subscriber faults, N5 equipment-import help text now describes RFC 4180 quoting. H3: MonacoEditor documents that themes are page-global. Refs #745 Claude-Session: https://claude.ai/code/session_01Ub9hGmYLQvn9XETzw7CMsT
This commit is contained in:
@@ -34,6 +34,25 @@ public sealed class TestConnectBudgetTests
|
||||
public void No_valid_configured_timeout_falls_back(string? json)
|
||||
=> TestConnectBudget.Resolve(json, fallbackSeconds: 10).ShouldBe(10);
|
||||
|
||||
[Theory]
|
||||
[InlineData("GalaxyMxGateway", 30)]
|
||||
[InlineData("OpcUaClient", 15)]
|
||||
[InlineData("Modbus", 5)]
|
||||
[InlineData("Sql", 10)] // no documented default ⇒ the caller's fallback
|
||||
public void An_absent_key_uses_the_drivers_documented_default(string driverType, int expected)
|
||||
=> TestConnectBudget.Resolve("{}", fallbackSeconds: 10, driverType).ShouldBe(expected);
|
||||
|
||||
[Fact]
|
||||
public void A_configured_value_beats_the_driver_default()
|
||||
=> TestConnectBudget.Resolve("{\"ProbeTimeoutSeconds\":7}", 10, "GalaxyMxGateway").ShouldBe(7);
|
||||
|
||||
[Theory]
|
||||
[InlineData("{\"ProbeTimeoutSeconds\":5,\"timeoutMs\":8000}", 9)] // M2: 8 s request + 1 s, never cut short
|
||||
[InlineData("{\"ProbeTimeoutSeconds\":5,\"timeoutMs\":2000}", 5)] // positive control: a short request timeout changes nothing
|
||||
[InlineData("{\"timeoutMs\":120000}", 60)] // still clamped
|
||||
public void The_budget_never_undercuts_the_configs_request_timeout(string json, int expected)
|
||||
=> TestConnectBudget.Resolve(json, 10, "Modbus").ShouldBe(expected);
|
||||
|
||||
[Fact]
|
||||
public void The_fallback_is_clamped_too()
|
||||
{
|
||||
@@ -46,7 +65,7 @@ public sealed class TestConnectBudgetTests
|
||||
{
|
||||
var src = AdminUiSource.Read("Components", "Shared", "Drivers", "DriverTestConnectButton.razor");
|
||||
|
||||
src.ShouldContain("TestConnectBudget.Resolve(json, TimeoutSeconds)");
|
||||
src.ShouldContain("TestConnectBudget.Resolve(json, TimeoutSeconds, DriverType)");
|
||||
src.ShouldContain("@implements IAsyncDisposable");
|
||||
src.ShouldContain("System.Threading.Timer");
|
||||
src.ShouldNotContain("System.Timers.Timer");
|
||||
|
||||
Reference in New Issue
Block a user