mbproxy: remediate the 2026-05-16 code-review findings
Fixes every finding from the codereviews/2026-05-16 multi-agent review (2 Critical, 20 Major, 38 Minor) and adds that review to the repo. Highlights: dashboard XSS escape; response cache invalidated on the write request (not just the response); ReloadValidator now runs at startup so port collisions / duplicate names / malformed Resilience profiles fail fast; AdminPort 0 genuinely disables the admin endpoint; PlcListener accept-loop faults propagate to the supervisor's faulted path; reconciler Restart builds before removing; Resilience pipelines are restart-only from a frozen snapshot; multiplexer connect-race leak, watchdog party-list snapshot, backend-response and FC16 framing validation; frontend reconnect retry and util.js load guard; plus the log-event/doc drift sweep and test-port hygiene. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -68,6 +68,28 @@ public sealed class StatusHubTests
|
||||
tracker.ActivePlcs().ShouldBeEmpty("no viewer may be stranded after the tab closes");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Reconnect_SameTab_NewConnectionDisconnectsFirst_DoesNotLeakViewer()
|
||||
{
|
||||
// Mirror of the reconnect test above with the disconnect ordering reversed: the
|
||||
// NEW connection's OnDisconnectedAsync arrives before the old one's. SignalR does
|
||||
// not guarantee the order, so the tracker must be correct either way.
|
||||
var tracker = new PlcSubscriptionTracker();
|
||||
|
||||
var first = MakeHub("conn-old", tracker, out _);
|
||||
await first.SubscribePlc("plc-1", "tab-A");
|
||||
|
||||
var second = MakeHub("conn-new", tracker, out _);
|
||||
await second.SubscribePlc("plc-1", "tab-A");
|
||||
|
||||
await second.OnDisconnectedAsync(null); // the new connection drops first
|
||||
tracker.ActivePlcs().ShouldContain("plc-1",
|
||||
"the tab is still open on the original connection");
|
||||
|
||||
await first.OnDisconnectedAsync(null);
|
||||
tracker.ActivePlcs().ShouldBeEmpty("no viewer may be stranded after the tab closes");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TwoTabs_FirstCloseKeepsActive_LastCloseClears()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user