test(ui): retain OtOpcUa component canaries and owned SQL proof

This commit is contained in:
Joseph Doherty
2026-11-14 02:03:08 -05:00
parent 06a3811331
commit 65fa9137b8
28 changed files with 843 additions and 0 deletions
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width,initial-scale=1" /><base href="/" />
<link rel="stylesheet" href="/_content/ZB.MOM.WW.OtOpcUa.AdminUI/lib/bootstrap/css/bootstrap.min.css" />
<ThemeHead /><link rel="stylesheet" href="/_content/ZB.MOM.WW.OtOpcUa.AdminUI/css/site.css" />
<link rel="stylesheet" href="/OtUiCanary.styles.css" />
<HeadOutlet @rendermode="InteractiveServer" /></head>
<body><Routes @rendermode="InteractiveServer" /><ThemeScripts />
<script src="/_content/ZB.MOM.WW.OtOpcUa.AdminUI/js/dialog-focus.js"></script>
<script src="/_content/ZB.MOM.WW.OtOpcUa.AdminUI/js/monaco-init.js"></script>
<script src="/_content/ZB.MOM.WW.OtOpcUa.AdminUI/lib/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="/_framework/blazor.web.js"></script></body></html>
@@ -0,0 +1,25 @@
@page "/deployment-pilot"
@layout ZB.MOM.WW.OtOpcUa.AdminUI.Components.Layout.MainLayout
@using ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages
@inject FixtureDeploymentState State
@inject FixtureDbReadControl Reads
<p class="notice">Local deployment-feedback fixture · synthetic Administrator, memory-only records and fabricated replies. No configuration is sent to any actor/fleet.</p>
@if(_ready)
{
<div class="d-flex flex-wrap gap-2 mb-3">
<button id="fixture-observe" type="button" @onclick="() => _interactive=true">Read local fixture status</button>
<output id="fixture-interactive-state">@(_interactive ? "ready" : "waiting")</output>
<button id="fixture-seal" type="button" @onclick="State.SealAsync">Mark synthetic application sealed</button>
<button id="fixture-fail-read" type="button" @onclick="() => Reads.FailReads=true">Fail synthetic history reads</button>
<button id="fixture-restore-read" type="button" @onclick="() => Reads.FailReads=false">Restore synthetic history reads</button>
</div>
<output id="fixture-request-count">@State.Requests</output>
<Deployments />
}
@code {
[SupplyParameterFromQuery(Name="sample")]public string? Sample{get;set;}
[SupplyParameterFromQuery(Name="run")]public string? Run{get;set;}
private bool _ready,_interactive;
protected override async Task OnInitializedAsync()
{State.Mode=Sample??"accept";await State.ResetAsync(Run??Sample??"default",Sample=="initial-error");_ready=true;}
}
@@ -0,0 +1,29 @@
@page "/diagnostic-pilot"
@layout ZB.MOM.WW.OtOpcUa.AdminUI.Components.Layout.MainLayout
@using ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages
@using ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.Clusters
@using ZB.MOM.WW.OtOpcUa.AdminUI.Hubs
@using ZB.MOM.WW.OtOpcUa.Commons.Messages.Logging
@inject IInProcessBroadcaster<ScriptLogEntry> Feed
<p class="notice">Local diagnostic component fixture · synthetic errors, no fleet/database connection.</p>
@switch (Sample)
{
case "historian": <AlarmsHistorian /> break;
case "fleet": <Fleet /> break;
case "deployments": <Deployments /> break;
case "audit": <ClusterAudit ClusterId="fixture-cluster" /> break;
case "log":
<button id="publish-diagnostic" type="button" @onclick="Publish">Emit synthetic local log</button>
<ScriptLog />
break;
default:
<h1>Diagnostic disclosure verification</h1>
<DiagnosticDetails Summary="Synthetic failure reason" Text="@Diagnostic" />
<DiagnosticDetails Summary="Missing detail" />
break;
}
@code {
[SupplyParameterFromQuery(Name="sample")] public string? Sample { get; set; }
private static string Diagnostic => "Synthetic local failure <script>ignored()</script> " + new string('x',5000) + " END-DIAGNOSTIC";
private void Publish() => Feed.Publish(new ScriptLogEntry("fixture-script","Error",Diagnostic,DateTime.UtcNow,null,null,null));
}
@@ -0,0 +1,18 @@
@page "/driver-diagnostic-pilot"
@layout ZB.MOM.WW.OtOpcUa.AdminUI.Components.Layout.MainLayout
@implements IDisposable
@using ZB.MOM.WW.OtOpcUa.AdminUI.Components.Shared.Drivers
@using ZB.MOM.WW.OtOpcUa.Commons.Messages.Drivers
@inject FaultableFixtureStatusStore Store
<h1>Local driver diagnostic verification</h1>
<p class="notice">Synthetic Administrator fixture · read-only local snapshots and fabricated failed reconnect reply; no actor/fleet operations.</p>
<DriverStatusPanel DriverInstanceId="driver-diagnostic-local" ClusterId="fixture-cluster" />
@code {
[SupplyParameterFromQuery(Name="sample")] public string? Sample { get; set; }
protected override void OnInitialized()
{
Store.ReadFailure = Sample=="read-error";
Store.Upsert(new DriverHealthChanged("fixture-cluster","driver-diagnostic-local","Faulted",null,FixtureDiagnostic.Text,1,DateTime.UtcNow,ReportingNodeId:"fixture-node"));
}
public void Dispose() => Store.ReadFailure=false;
}
@@ -0,0 +1,15 @@
@page "/editor-pilot"
@layout ZB.MOM.WW.OtOpcUa.AdminUI.Components.Layout.MainLayout
<h1>Local editor name verification</h1>
<p>Actual Monaco component/assets. Static synthetic code; diagnostics return an empty local fixture projection. No script execution or real analysis service.</p>
<MonacoEditor @ref="_editor" Value="return 1;" Language="csharp" EquipmentId="equipment-local" AriaLabel="@_label" ShowToolbar="false" />
<button id="rename-editor" class="btn btn-outline-secondary" @onclick="Rename">Rename local editor</button>
<button id="read-editor" class="btn btn-outline-secondary" @onclick="Read">Read local model</button>
<output id="editor-read">@_read</output>
@code {
private MonacoEditor? _editor;
private string _label = "Calculation script source";
private string? _read;
private void Rename() => _label = "Updated calculation script source";
private async Task Read() { var result = await _editor!.GetValueAsync(); _read = result.Error ?? result.Value; }
}
@@ -0,0 +1,30 @@
@page "/final-grammar-pilot"
@layout ZB.MOM.WW.OtOpcUa.AdminUI.Components.Layout.MainLayout
@using ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages
@using ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.Clusters
<p class="notice">Actual components · synthetic local read adapters. No fleet, directory, certificate-store, secret-value or configuration mutations are exercised.</p>
@switch(Sample)
{
case "account":<Account />break;
case "api-keys":<ApiKeys />break;
case "certificates":<Certificates />break;
case "role-grants":<RoleGrants />break;
case "reservations":<Reservations />break;
case "secrets":<SecretsAdmin />break;
case "clusters":<ClustersList />break;
case "overview":<ClusterOverview ClusterId="fixture-cluster" />break;
case "cluster-edit":<ClusterEdit ClusterId="fixture-cluster" />break;
case "cluster-new":<NewCluster />break;
case "cluster-acls":<ClusterAcls ClusterId="fixture-cluster" />break;
case "acl-new":<AclEdit ClusterId="fixture-cluster" />break;
case "cluster-audit":<ClusterAudit ClusterId="fixture-cluster" />break;
case "cluster-redundancy":<ClusterRedundancy ClusterId="fixture-cluster" />break;
case "node-edit":<NodeEdit ClusterId="fixture-cluster" NodeId="fixture-node" />break;
case "acl-edit":<AclEdit ClusterId="fixture-cluster" NodeAclId="fixture-acl" />break;
case "namespace-edit":<NamespaceEdit ClusterId="fixture-cluster" NamespaceId="fixture-retired" />break;
case "node-new":<NodeEdit ClusterId="fixture-cluster" />break;
case "namespaces":<ClusterNamespaces ClusterId="fixture-cluster" />break;
case "namespace-new":<NamespaceEdit ClusterId="fixture-cluster" />break;
case "home":<Home />break;
}
@code{[SupplyParameterFromQuery] public string? Sample{get;set;}}
@@ -0,0 +1,24 @@
@page "/grammar-pilot"
@layout ZB.MOM.WW.OtOpcUa.AdminUI.Components.Layout.MainLayout
@using ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages
@using ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.Uns
@using ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.Raw
<p class="notice">Local component fixture · synthetic data; no fleet or database connection. Only explicitly mapped synthetic operations exist; unlisted operations reject calls.</p>
@switch (Sample)
{
case "hosts": <Hosts /> break;
case "alerts": <Alerts /> break;
case "script-log": <ScriptLog /> break;
case "script-edit": <ScriptEdit /> break;
case "uns": <GlobalUns /> break;
case "raw": <GlobalRaw /> break;
case "diagnostics": <FleetDiagnostics /> break;
case "historian": <AlarmsHistorian /> break;
case "fleet": <Fleet /> break;
case "deployments": <Deployments /> break;
case "scripts": <Scripts /> break;
case "equipment": <EquipmentPage /> break;
}
@code {
[SupplyParameterFromQuery(Name="sample")] public string? Sample { get; set; }
}
@@ -0,0 +1,36 @@
@page "/live-tail-pilot"
@layout ZB.MOM.WW.OtOpcUa.AdminUI.Components.Layout.MainLayout
@using ZB.MOM.WW.OtOpcUa.AdminUI.Hubs
@using ZB.MOM.WW.OtOpcUa.Commons.Messages.Logging
@using ZB.MOM.WW.OtOpcUa.Commons.Messages.Alerts
@inject IInProcessBroadcaster<ScriptLogEntry> Logs
@inject IInProcessBroadcaster<AlarmTransitionEvent> Alarms
@inject ZB.MOM.WW.OtOpcUa.Commons.Interfaces.IAdminOperationsClient Operations
<p class="notice">Synthetic local live-tail feed. Buttons publish fabricated in-process display events only; they do not acknowledge, shelve or change fleet state.</p>
<div class="d-flex flex-wrap gap-2"><button id="fixture-emit-one" type="button" @onclick="()=>Publish(1)">Publish local sample</button><button id="fixture-emit-burst" type="button" @onclick="PublishBurst">Publish local bounded burst</button><button id="fixture-disconnect" type="button" @onclick="()=>Connect(false)">Disconnect local feed</button><button id="fixture-connect" type="button" @onclick="()=>Connect(true)">Connect local feed</button></div>
<button id="fixture-alarm-pending" type="button" @onclick="Hold">Hold fake acknowledgement</button>
<button id="fixture-alarm-failure" type="button" @onclick="Fail">Fail fake acknowledgement</button>
<button id="fixture-alarm-complete" type="button" @onclick="Complete">Complete fake acknowledgement</button>
<button id="fixture-alarm-observe" type="button" @onclick="ObserveCommands">Observe fake commands</button><output id="fixture-alarm-count">@_commands</output><output id="fixture-alarm-until">@_until</output>
@if(Sample=="alerts"){<ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.Alerts />}
else {<ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.ScriptLog />}
@code {
[SupplyParameterFromQuery]public string? Sample{get;set;}
private int _sequence,_commands;private string? _until;
private void Hold()=>SetMode("pending");private void Fail()=>SetMode("failure");
private void SetMode(string mode)=>((SyntheticOperationsFixture)(object)Operations).AlarmMode=mode;
private void Complete()=>((SyntheticOperationsFixture)(object)Operations).PendingAlarm?.TrySetResult(new(true,null,new(Guid.Empty)));
private void ObserveCommands(){var f=(SyntheticOperationsFixture)(object)Operations;_commands=f.AlarmRequests;_until=f.LastUnshelveAtUtc?.ToString("O");}
protected override void OnInitialized(){Connect(true);((SyntheticOperationsFixture)(object)Operations).ResetAlarmRequests();}
private void PublishBurst()=>Publish(Sample=="alerts"?250:600);
private void Connect(bool value){Logs.SetConnected(value);Alarms.SetConnected(value);}
private void Publish(int count)
{
for(var i=0;i<count;i++)
{
var text="Local sample "+(++_sequence);
if(Sample=="alerts")Alarms.Publish(new("fixture-alarm","Fixture/Press","Local alarm","Activated",500,text,"fixture",DateTime.UtcNow));
else Logs.Publish(new("fixture-script","Information",text,DateTime.UtcNow,null,null,null));
}
}
}
@@ -0,0 +1,36 @@
@page "/"
@layout ZB.MOM.WW.OtOpcUa.AdminUI.Components.Layout.MainLayout
<h1>Local OtOpcUa UI verification</h1>
<p>Actual AdminUI components with synthetic local state. No database, fleet, browse session, protocol or write service is connected.</p>
@if (Sample == "log") { <ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.ScriptLog /> }
else if (Sample == "uns") { <ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.Uns.GlobalUns /> }
else
{
<section id="standalone"><h2 class="h5">Standalone calculation form</h2><CalculationDriverForm /></section>
<section id="scoped"><h2 class="h5">Repeated form associations</h2>
<CascadingValue Value="_editContext"><CalculationDriverForm /><CalculationDriverForm /></CascadingValue></section>
<section><h2 class="h5">Synthetic UNS nodes</h2><UnsTree Roots="_roots" OnToggleExpand="Toggle" OnEdit="Edit" OnDelete="Edit" /></section>
<button id="open-confirm" class="btn btn-primary" @onclick="() => _confirmVisible=true">Open synthetic confirmation</button>
<button id="open-driver" class="btn btn-outline-secondary" @onclick="() => _driverVisible=true">Open local calculation driver</button>
<button id="open-two" class="btn btn-outline-secondary" @onclick="() => { _confirmVisible=true; _secondVisible=true; }">Attempt two local overlays</button>
<button id="show-toasts" class="btn btn-outline-secondary" @onclick="ShowToasts">Show local toasts</button>
<ToastNotification @ref="_toast" />
<output id="local-outcome">@_outcome</output>
<RawConfirmDialog @bind-Visible="_confirmVisible" Title="Delete synthetic driver" Message="Local test only. No service writes occur." OnConfirm="LocalSlowConfirm" />
<RawConfirmDialog @bind-Visible="_secondVisible" Title="Second synthetic dialog" Message="Rejected while another overlay is active." />
<DriverConfigModal @bind-Visible="_driverVisible" DriverType="Calculation" ClusterId="synthetic" />
}
@code {
[SupplyParameterFromQuery] public string? Sample { get; set; }
private ToastNotification? _toast;
private bool _secondVisible;
private void ShowToasts() { _toast!.ShowInfo("Synthetic local information", "Local information", 60000); _toast.ShowWarning("Synthetic local warning", "Local warning", 60000); }
private readonly EditContext _editContext = new(new object());
private bool _confirmVisible, _driverVisible;
private string _outcome = "No local action";
private readonly List<UnsNode> _roots = [new() { Kind=UnsNodeKind.Area, Key="area:local", DisplayName="Synthetic area", HasLazyChildren=true }];
private void Toggle(UnsNode node) => node.Expanded = !node.Expanded;
private void Edit(UnsNode node) => _outcome = "Local callback: " + node.Key;
private async Task LocalSlowConfirm() { await Task.Delay(700); _outcome = "Synthetic confirmation completed; no service called"; }
}
@@ -0,0 +1,17 @@
@page "/raw-caller-pilot"
@layout ZB.MOM.WW.OtOpcUa.AdminUI.Components.Layout.MainLayout
@inject FixtureTreeState State
<p class="notice">Composed actual RawTree/dialogs with fabricated local rename/delete replies and memory-only child reads. No database mutation or fleet request occurs.</p>
<button id="fixture-caller-observe" type="button" @onclick="Observe">Observe local request count</button><output id="fixture-caller-count">@_count</output><output id="fixture-caller-ready">@(_observed?"ready":"waiting")</output>
<RawTree Roots="_roots" />
@code {
private IReadOnlyList<RawNode> _roots=[];private int _count;private bool _observed;
private void Observe(){_count=State.CallerMutationRequests;_observed=true;}
protected override void OnInitialized()
{
var folder=new RawNode{Key="caller-folder-a",EntityId="caller-folder-a",Kind=RawNodeKind.Folder,DisplayName="Local folder A",ClusterId="caller-cluster",Loaded=true,RowVersion=[1]};
var cluster=new RawNode{Key="caller-cluster",EntityId="caller-cluster",Kind=RawNodeKind.Cluster,DisplayName="Local cluster",Loaded=true,Expanded=true,HasLazyChildren=true};
cluster.Children.Add(folder);cluster.ChildCount=1;_roots=[cluster];
State.CallerMutationRequests=0;State.CallerChildren.Clear();State.CallerChildren[cluster.Key]=[folder];
}
}
@@ -0,0 +1,19 @@
@page "/raw-pilot"
@layout ZB.MOM.WW.OtOpcUa.AdminUI.Components.Layout.MainLayout
<h1>Local Raw virtualization verification</h1>
<p>Actual RawTree with800 synthetic already-loaded tags. Local in-memory context contains fixture-only records; browser/protocol sessions and mutations reject calls.</p>
<div id="raw-scroller" style="height:360px;overflow:auto;border:1px solid var(--rule)">
<RawTree Roots="_roots" PickerMode="true" SelectedTagIds="_selected" OnSelectionChanged="SelectedChanged" ResolveDescendantTagIds="ResolveTags" />
</div>
<output id="selection-count">@_selected.Count selected</output>
@code {
private readonly HashSet<string> _selected = [];
private readonly List<RawNode> _roots = Build();
private static List<RawNode> Build()
{
var root = new RawNode { Kind=RawNodeKind.Device, Key="dev:local", DisplayName="Synthetic device", EntityId="device-local", ClusterId="synthetic", DriverType="Modbus", Expanded=true, Loaded=true, HasLazyChildren=true };
root.Children.AddRange(Enumerable.Range(0,800).Select(i => new RawNode { Kind=RawNodeKind.Tag, Key="tag:local-"+i, DisplayName=$"Synthetic tag {i:000}", EntityId="tag-local-"+i, ClusterId="synthetic" }));root.ChildCount=root.Children.Count;return [root];
}
private void SelectedChanged() { }
private Task<IReadOnlyList<string>> ResolveTags(RawNode node) => Task.FromResult<IReadOnlyList<string>>(node.Children.Select(n => n.EntityId!).ToArray());
}
@@ -0,0 +1,20 @@
@page "/status-icon-pilot"
@layout ZB.MOM.WW.OtOpcUa.AdminUI.Components.Layout.MainLayout
<p class="notice">Actual host styles and tree components, synthetic display-only hierarchy. Domain actions and child reads are refused by the local fixture.</p>
<h1>Local status and icon verification</h1>
<div id="semantic-paper"><span class="text-danger">Error text</span> <span class="text-warning">Warning text</span> <span class="text-success">Success text</span></div>
<section class="panel p-3" id="semantic-card"><span class="text-danger">Error text</span> <span class="text-warning">Warning text</span> <span class="text-success">Success text</span><div class="notice notice-alert">Application error notice</div><span class="chip chip-bad">Failed</span><span class="chip chip-warn">Degraded</span><span class="chip chip-ok">Healthy</span><span class="chip chip-idle">Disabled</span></section>
<RawTree Roots="_roots" />
@code {
private readonly IReadOnlyList<RawNode> _roots=Build();
private static IReadOnlyList<RawNode> Build()
{
RawNode? child=null;
foreach(var kind in Enum.GetValues<RawNodeKind>().Reverse())
{
var node=new RawNode{Kind=kind,Key="kind:"+kind,EntityId="local-"+kind,DisplayName="Local "+kind,Loaded=true,Expanded=true,HasLazyChildren=child is not null};
if(child is not null){node.Children.Add(child);node.ChildCount=1;}child=node;
}
return child is null?[]:[child];
}
}
@@ -0,0 +1,18 @@
@page "/tree-recovery-pilot"
@layout ZB.MOM.WW.OtOpcUa.AdminUI.Components.Layout.MainLayout
@inject FixtureTreeState State
<p class="notice">Synthetic local tree reads only. No configuration services or lazy child requests are dispatched.</p>
<button id="fixture-recover-tree" type="button" @onclick="()=>State.Fail=false">Restore local root reads</button>
<button id="fixture-observe-tree" type="button" @onclick="Observe">Observe local read counts</button>
<output id="fixture-tree-count">@_reads / @_unexpected</output>
@if(_ready)
{
@if(Sample=="raw"){<ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.Raw.GlobalRaw />}
else {<ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.Uns.GlobalUns />}
}
@code {
[SupplyParameterFromQuery]public string? Sample{get;set;}
private bool _ready;private int _reads,_unexpected;
protected override void OnInitialized(){State.Fail=true;State.Populated=Sample!="raw";State.Reads=0;State.Unexpected=0;_ready=true;}
private void Observe(){_reads=State.Reads;_unexpected=State.Unexpected;}
}
@@ -0,0 +1,20 @@
@page "/uns-caller-pilot"
@layout ZB.MOM.WW.OtOpcUa.AdminUI.Components.Layout.MainLayout
@inject FixtureTreeState State
<p class="notice">Actual UNS page/dialogs over fabricated local update/delete replies and per-circuit memory-only structure. No database/fleet mutation occurs.</p>
<button id="fixture-uns-restore-read" type="button" @onclick="()=>State.Fail=false">Restore local structure reads</button>
<button id="fixture-uns-observe" type="button" @onclick="Observe">Observe local request count</button><output id="fixture-uns-count">@_requests</output><output id="fixture-uns-ready">@(_observed?"ready":"waiting")</output>
<ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.Uns.GlobalUns />
@code {
[SupplyParameterFromQuery(Name="failAfterWrite")]public bool FailAfterWrite{get;set;}
private int _requests;private bool _observed;
private void Observe(){_requests=State.UnsMutationRequests;_observed=true;}
protected override void OnInitialized()
{
var line=new UnsNode{Kind=UnsNodeKind.Line,Key="caller-uns-line",EntityId="caller-uns-line",ClusterId="caller-uns-cluster",DisplayName="local-line",Expanded=true};
var area=new UnsNode{Kind=UnsNodeKind.Area,Key="caller-uns-area",EntityId="caller-uns-area",ClusterId="caller-uns-cluster",DisplayName="local-area",Expanded=true};area.Children.Add(line);
var cluster=new UnsNode{Kind=UnsNodeKind.Cluster,Key="caller-uns-cluster",EntityId="caller-uns-cluster",ClusterId="caller-uns-cluster",DisplayName="Local cluster",Expanded=true};cluster.Children.Add(area);
var enterprise=new UnsNode{Kind=UnsNodeKind.Enterprise,Key="caller-uns-enterprise",DisplayName="Local enterprise",Expanded=true};enterprise.Children.Add(cluster);
State.Fail=false;State.UnsFailAfterWrite=FailAfterWrite;State.UnsCallerRoots=[enterprise];State.UnsMutationRequests=0;
}
}
@@ -0,0 +1 @@
<Router AppAssembly="typeof(App).Assembly"><Found Context="routeData"><RouteView RouteData="routeData" /></Found></Router>
@@ -0,0 +1,14 @@
@using Microsoft.AspNetCore.Components
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Authorization
@using static Microsoft.AspNetCore.Components.Web.RenderMode
@using ZB.MOM.WW.Theme
@using OtUiCanary.Components
@using ZB.MOM.WW.OtOpcUa.AdminUI.Components.Shared
@using ZB.MOM.WW.OtOpcUa.AdminUI.Components.Shared.Raw
@using ZB.MOM.WW.OtOpcUa.AdminUI.Components.Shared.Drivers
@using ZB.MOM.WW.OtOpcUa.AdminUI.Components.Shared.Drivers.Forms
@using ZB.MOM.WW.OtOpcUa.AdminUI.Components.Shared.Uns
@using ZB.MOM.WW.OtOpcUa.AdminUI.Uns
@@ -0,0 +1,64 @@
using Microsoft.EntityFrameworkCore;
using ZB.MOM.WW.OtOpcUa.Configuration;
using ZB.MOM.WW.OtOpcUa.Configuration.Entities;
using ZB.MOM.WW.OtOpcUa.Configuration.Enums;
using ZB.MOM.WW.OtOpcUa.Commons.Messages.Admin;
/// <summary>Fixture-only memory-provider reads with controlled failure; no external DB is configured.</summary>
public sealed class FixtureDbReadControl(DbContextOptions<OtOpcUaConfigDbContext> options) : IDbContextFactory<OtOpcUaConfigDbContext>
{
public bool FailReads {get;set;}
public int DelayMilliseconds {get;set;}
public OtOpcUaConfigDbContext CreateDbContext()=>new(options);
public async Task<OtOpcUaConfigDbContext> CreateDbContextAsync(CancellationToken ct=default)
{
var fail=FailReads;var delay=DelayMilliseconds;
if(delay>0)await Task.Delay(delay,ct);
if(fail)throw new IOException("Synthetic fixture-only history read failure");
return CreateDbContext();
}
}
/// <summary>A fabricated deployment response and memory-only record, never an actor/fleet deployment.</summary>
public sealed class FixtureDeploymentState(FixtureDbReadControl reads)
{
public const string Revision="cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc";
public string Mode {get;set;}="accept";
public int Requests {get;private set;}
public Guid? LastAccepted {get;private set;}
private readonly SemaphoreSlim _resetGate=new(1,1);
private string? _run;
public async Task ResetAsync(string run,bool failInitial)
{
await _resetGate.WaitAsync();
try
{
// SSR and interactive initialization share this synthetic run; never reset a running scenario twice.
if(_run==run)return;
reads.FailReads=false;reads.DelayMilliseconds=0;Requests=0;LastAccepted=null;
await using var db=reads.CreateDbContext();
db.NodeDeploymentStates.RemoveRange(db.NodeDeploymentStates);db.Deployments.RemoveRange(db.Deployments);
await db.SaveChangesAsync();reads.FailReads=failInitial;_run=run;
}
finally {_resetGate.Release();}
}
public async Task<StartDeploymentResult> StartAsync(string actor,CancellationToken ct)
{
Requests++;var mode=Mode;
await Task.Delay(700,ct);
if(mode=="unknown")throw new IOException("Synthetic fixture-only missing actor reply");
if(mode=="nochanges")return new(StartDeploymentOutcome.NoChanges,null,null,null,new(Guid.NewGuid()));
if(mode=="rejected")return new(StartDeploymentOutcome.Rejected,null,null,"Synthetic preflight rejection",new(Guid.NewGuid()));
if(mode=="blocked")return new(StartDeploymentOutcome.AnotherDeploymentInFlight,null,null,"Synthetic other deployment in progress",new(Guid.NewGuid()));
var id=Guid.NewGuid();LastAccepted=id;
await using var db=reads.CreateDbContext();
db.Deployments.Add(new Deployment {DeploymentId=id,RevisionHash=Revision,CreatedBy=actor,Status=DeploymentStatus.AwaitingApplyAcks});
await db.SaveChangesAsync(ct);
return new(StartDeploymentOutcome.Accepted,new(id),new(Revision),null,new(Guid.NewGuid()));
}
public async Task SealAsync()
{
if(LastAccepted is not {} id)return;
await using var db=reads.CreateDbContext();var row=await db.Deployments.SingleAsync(d=>d.DeploymentId==id);
row.Status=DeploymentStatus.Sealed;row.SealedAtUtc=DateTime.UtcNow;await db.SaveChangesAsync();
}
}
@@ -0,0 +1,49 @@
using System.Reflection;
using ZB.MOM.WW.OtOpcUa.Commons.Interfaces;
using ZB.MOM.WW.OtOpcUa.AdminUI.Hubs;
using ZB.MOM.WW.OtOpcUa.Commons.Messages.Admin;
using ZB.MOM.WW.OtOpcUa.Commons.Messages.Drivers;
public static class FixtureDiagnostic
{
public static string Text => "Synthetic local failure <script>ignored()</script> " + new string('x',5000) + " END-DIAGNOSTIC";
}
public class SyntheticOperationsFixture : DispatchProxy
{
private FixtureDeploymentState? _deployments;
public int AlarmRequests { get; private set; }
public string AlarmMode { get; set; } = "success";
public TaskCompletionSource<AcknowledgeAlarmResult>? PendingAlarm { get; private set; }
public string? LastAlarmId { get; private set; }
public DateTime? LastUnshelveAtUtc { get; private set; }
public void ResetAlarmRequests(){AlarmRequests=0;LastAlarmId=null;LastUnshelveAtUtc=null;AlarmMode="success";PendingAlarm=null;}
public static IAdminOperationsClient WithDeployments(FixtureDeploymentState state)
{
var proxy=Create<IAdminOperationsClient,SyntheticOperationsFixture>();
((SyntheticOperationsFixture)(object)proxy)._deployments=state;return proxy;
}
protected override object? Invoke(MethodInfo? method, object?[]? args)
{
if(method?.Name==nameof(IAdminOperationsClient.AcknowledgeAlarmAsync))
{ AlarmRequests++;LastAlarmId=(string)args![0]!;if(AlarmMode=="pending"){PendingAlarm=new(TaskCreationOptions.RunContinuationsAsynchronously);return PendingAlarm.Task;}
if(AlarmMode=="failure")return Task.FromException<AcknowledgeAlarmResult>(new IOException(FixtureDiagnostic.Text));
return Task.FromResult(new AcknowledgeAlarmResult(true,null,new(Guid.Empty))); }
if(method?.Name==nameof(IAdminOperationsClient.ShelveAlarmAsync))
{ AlarmRequests++;LastAlarmId=(string)args![0]!;LastUnshelveAtUtc=(DateTime?)args[3];return Task.FromResult(new ShelveAlarmResult(true,null,new(Guid.Empty))); }
if(method?.Name==nameof(IAdminOperationsClient.StartDeploymentAsync))
return _deployments!.StartAsync((string)args![0]!, (CancellationToken)args[1]!);
if(method?.Name=="AskAsync" && method.GetGenericArguments().Single()==typeof(ReconnectDriverResult))
return Task.FromResult(new ReconnectDriverResult(false,FixtureDiagnostic.Text,Guid.Empty));
throw new InvalidOperationException("Disposable fixture rejects service operations.");
}
}
public sealed class FaultableFixtureStatusStore : IDriverStatusSnapshotStore
{
private readonly InMemoryDriverStatusSnapshotStore _inner = new();
public bool ReadFailure { get; set; }
public void Upsert(DriverHealthChanged snapshot) => _inner.Upsert(snapshot);
public bool TryGet(string id, out DriverHealthChanged snapshot) => _inner.TryGet(id,out snapshot);
public IReadOnlyCollection<DriverHealthChanged> GetAll() => _inner.GetAll();
public IReadOnlyCollection<StoredDriverHealth> GetAllWithReceiveTime() => ReadFailure ? throw new IOException(FixtureDiagnostic.Text) : _inner.GetAllWithReceiveTime();
public int EvictUnconfiguredStale(IReadOnlySet<string> ids, DateTime older) => _inner.EvictUnconfiguredStale(ids,older);
public event Action<DriverHealthChanged>? SnapshotChanged { add => _inner.SnapshotChanged += value; remove => _inner.SnapshotChanged -= value; }
}
@@ -0,0 +1,35 @@
using System.Reflection;
using ZB.MOM.WW.OtOpcUa.AdminUI.Acls;
using ZB.MOM.WW.OtOpcUa.AdminUI.ApiKeyAck;
using ZB.MOM.WW.OtOpcUa.AdminUI.Certificates;
using ZB.MOM.WW.OtOpcUa.Configuration.Entities;
using ZB.MOM.WW.OtOpcUa.Configuration.Services;
using ZB.MOM.WW.OtOpcUa.ControlPlane.Redundancy;
using ZB.MOM.WW.OtOpcUa.Core.Authorization;
using ZB.MOM.WW.Secrets.Abstractions;
using ZB.MOM.WW.Audit;
// Disposable read adapters: only explicitly listed reads succeed; all mutations/value reads reject.
internal static class FinalGrammarFixtures
{
internal static void Register(WebApplicationBuilder builder)
{
var services=builder.Services;
services.AddSingleton(RejectingFixture.WithRead<IApiKeyAdminService>("ListAsync",Task.FromResult<IReadOnlyList<ApiKey>>([])));
services.AddSingleton(RejectingFixture.WithRead<IApiKeyGalaxyAckIdentityService>("ListAsync",Task.FromResult<IReadOnlyDictionary<string,string>>(new Dictionary<string,string>())));
services.AddSingleton(RejectingFixture.WithRead<ILdapGroupRoleMappingService>("ListAllAsync",Task.FromResult<IReadOnlyList<LdapGroupRoleMapping>>([])));
services.Configure<ZB.MOM.WW.OtOpcUa.Security.Ldap.LdapOptions>(_=>{});
services.AddSingleton(RejectingFixture.WithReads<IAclScopeService>(new()
{
["LoadKnownPrincipalsAsync"]=Task.FromResult<IReadOnlyList<string>>(["fixture-principal"]),
["CheckPrincipalAsync"]=Task.FromResult(new PrincipalUsage(false,0,0)),
["CheckScopeAsync"]=Task.FromResult(new AclScopeCheck(true,"Synthetic local cluster scope"))
}));
services.AddSingleton(RejectingFixture.WithRead<IManualFailoverService>("GetSnapshot",new ManualFailoverSnapshot(null,[])));
services.AddSingleton(DispatchProxy.Create<IAuditWriter,RejectingFixture>());
builder.Configuration["OpcUa:PkiStoreRoot"]=Path.Combine(Path.GetTempPath(),"ot-ui-empty-pki-"+Guid.NewGuid().ToString("N"));
services.AddSingleton<CertificateStoreManager>();
IReadOnlyList<SecretMetadata> metadata=[new(){Name=new SecretName("fixture/metadata-only"),Description="Synthetic local metadata; value reads reject",ContentType=SecretContentType.Text,KekId="fixture-key",Revision=1,CreatedUtc=DateTimeOffset.Parse("2026-11-14T00:00:00Z"),UpdatedUtc=DateTimeOffset.Parse("2026-11-14T00:00:00Z"),UpdatedBy="fixture"}];
services.AddSingleton(RejectingFixture.WithRead<ISecretStore>("ListAsync",Task.FromResult(metadata)));
services.AddSingleton(DispatchProxy.Create<ISecretCipher,RejectingFixture>());
}
}
@@ -0,0 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup><TargetFramework>net10.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable></PropertyGroup>
<ItemGroup><ProjectReference Include="/Users/dohertj2/Desktop/OtOpcUa/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/ZB.MOM.WW.OtOpcUa.AdminUI.csproj" /><PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="10.0.7" /></ItemGroup>
</Project>
@@ -0,0 +1,107 @@
using System.Security.Claims;
using System.Reflection;
using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.DataProtection;
using OtUiCanary.Components;
using ZB.MOM.WW.OtOpcUa.AdminUI.Uns;
using ZB.MOM.WW.Secrets.Ui;
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseStaticWebAssets();
builder.Services.AddRazorComponents().AddInteractiveServerComponents();
builder.Services.AddDataProtection().UseEphemeralDataProtectionProvider();
builder.Services.AddAuthorizationCore(options =>
{
options.AddSecretsAuthorization();
// Fixture-only mirror of Security/ServiceCollectionExtensions.cs policy requirements;
// no cookie login, LDAP or real principal is configured in this component host.
options.AddPolicy(ZB.MOM.WW.OtOpcUa.Security.Auth.AdminUiPolicies.DriverOperator, p => p.RequireRole("Operator", "Administrator"));
options.AddPolicy(ZB.MOM.WW.OtOpcUa.Security.Auth.AdminUiPolicies.FleetAdmin, p => p.RequireRole("Administrator"));
options.AddPolicy(ZB.MOM.WW.OtOpcUa.Security.Auth.AdminUiPolicies.ConfigEditor, p => p.RequireRole("Administrator", "Designer"));
options.AddPolicy(ZB.MOM.WW.OtOpcUa.Security.Auth.AdminUiPolicies.AuthenticatedRead, p => p.RequireAuthenticatedUser());
});
builder.Services.AddCascadingAuthenticationState();
builder.Services.AddScoped<AuthenticationStateProvider, SyntheticAdministratorFixture>();
builder.Services.AddScoped<FixtureTreeState>();
builder.Services.AddScoped(sp => FixtureTreeProxy.Create<IRawTreeService>(sp.GetRequiredService<FixtureTreeState>()));
builder.Services.AddScoped(sp => FixtureTreeProxy.Create<IUnsTreeService>(sp.GetRequiredService<FixtureTreeState>()));
builder.Services.AddSingleton<ZB.MOM.WW.OtOpcUa.AdminUI.Hubs.IInProcessBroadcaster<ZB.MOM.WW.OtOpcUa.Commons.Messages.Logging.ScriptLogEntry>, ZB.MOM.WW.OtOpcUa.AdminUI.Hubs.InProcessBroadcaster<ZB.MOM.WW.OtOpcUa.Commons.Messages.Logging.ScriptLogEntry>>();
builder.Services.AddDbContextFactory<ZB.MOM.WW.OtOpcUa.Configuration.OtOpcUaConfigDbContext>(options => options.UseInMemoryDatabase("ot-ui-local-empty"));
builder.Services.AddScoped<RawTagCsvExportReader>();
builder.Services.AddSingleton<ZB.MOM.WW.OtOpcUa.AdminUI.Deployments.CredentialReferencePreflightState>();
builder.Services.AddSingleton(DispatchProxy.Create<ZB.MOM.WW.OtOpcUa.AdminUI.Browsing.IBrowserSessionService, RejectingFixture>());
builder.Services.AddSingleton(RejectingFixture.WithRead<ZB.MOM.WW.OtOpcUa.Commons.Interfaces.IClusterRoleInfo>("MembersWithRole", (IReadOnlyList<ZB.MOM.WW.OtOpcUa.Commons.Types.NodeId>)[new("fixture-driver-with-long-local-name")]));
builder.Services.AddSingleton<FixtureDbReadControl>();
builder.Services.AddSingleton<IDbContextFactory<ZB.MOM.WW.OtOpcUa.Configuration.OtOpcUaConfigDbContext>>(sp => sp.GetRequiredService<FixtureDbReadControl>());
builder.Services.AddSingleton<FixtureDeploymentState>();
builder.Services.AddSingleton<ZB.MOM.WW.OtOpcUa.Commons.Interfaces.IAdminOperationsClient>(sp => SyntheticOperationsFixture.WithDeployments(sp.GetRequiredService<FixtureDeploymentState>()));
builder.Services.AddScoped(sp => new ZB.MOM.WW.OtOpcUa.AdminUI.Deployments.DeploymentDriftProbe(sp.GetRequiredService<IDbContextFactory<ZB.MOM.WW.OtOpcUa.Configuration.OtOpcUaConfigDbContext>>(), _ => Task.FromResult(FixtureDeploymentState.Revision)));
builder.Services.AddSingleton<ZB.MOM.WW.OtOpcUa.AdminUI.Hubs.IInProcessBroadcaster<ZB.MOM.WW.OtOpcUa.Commons.Messages.Alerts.AlarmTransitionEvent>, ZB.MOM.WW.OtOpcUa.AdminUI.Hubs.InProcessBroadcaster<ZB.MOM.WW.OtOpcUa.Commons.Messages.Alerts.AlarmTransitionEvent>>();
builder.Services.AddSingleton(DispatchProxy.Create<ZB.MOM.WW.OtOpcUa.Commons.Interfaces.IFleetDiagnosticsClient, RejectingFixture>());
// A disposable localhost-only Akka membership shell; no application actors or seed peers.
var fixtureActors = Akka.Actor.ActorSystem.Create("ot-ui-local-only", Akka.Configuration.ConfigurationFactory.ParseString("""
akka.actor.provider = cluster
akka.remote.dot-netty.tcp.hostname = "127.0.0.1"
akka.remote.dot-netty.tcp.port = 0
akka.cluster.seed-nodes = []
akka.loglevel = WARNING
"""));
builder.Services.AddSingleton(fixtureActors);
var historianFixture = fixtureActors.ActorOf(Akka.Actor.Props.Create<ReadonlyHistorianStatusFixture>(), "historian-status-fixture");
builder.Services.AddSingleton(RejectingFixture.WithRead<Akka.Hosting.IRequiredActor<ZB.MOM.WW.OtOpcUa.Runtime.HistorianAdapterActorKey>>("get_ActorRef", historianFixture));
builder.Services.AddSingleton<FaultableFixtureStatusStore>();
builder.Services.AddSingleton<ZB.MOM.WW.OtOpcUa.AdminUI.Hubs.IDriverStatusSnapshotStore>(sp => sp.GetRequiredService<FaultableFixtureStatusStore>());
builder.Services.AddSingleton<ZB.MOM.WW.OtOpcUa.AdminUI.Hubs.IDriverResilienceStatusStore, ZB.MOM.WW.OtOpcUa.AdminUI.Hubs.InMemoryDriverResilienceStatusStore>();
builder.Services.AddScoped<ZB.MOM.WW.OtOpcUa.AdminUI.Hosts.DeployedDriverSet>();
FinalGrammarFixtures.Register(builder);
var app = builder.Build();
app.Lifetime.ApplicationStopping.Register(() => _ = fixtureActors.Terminate());
// Synthetic fixture-only records. This provider is in-memory, never the actual application's database.
using (var scope = app.Services.CreateScope())
{
var factory = scope.ServiceProvider.GetRequiredService<IDbContextFactory<ZB.MOM.WW.OtOpcUa.Configuration.OtOpcUaConfigDbContext>>();
using var db = factory.CreateDbContext();
db.ServerClusters.Add(new(){ClusterId="fixture-cluster",Name="Synthetic local cluster",Enterprise="fixture",Site="local",RedundancyMode=ZB.MOM.WW.OtOpcUa.Configuration.Enums.RedundancyMode.None,CreatedBy="fixture"});
db.ClusterNodes.Add(new(){ClusterId="fixture-cluster",NodeId="fixture-node",Host="localhost",ApplicationUri="urn:fixture:local",CreatedBy="fixture"});
db.NodeAcls.Add(new(){ClusterId="fixture-cluster",NodeAclId="fixture-acl",Principal="fixture-principal",ScopeKind=ZB.MOM.WW.OtOpcUa.Configuration.Enums.NodeAclScopeKind.Cluster,PermissionFlags=ZB.MOM.WW.OtOpcUa.Configuration.Enums.NodePermissions.ReadOnly});
db.Scripts.Add(new() { ScriptId="fixture-script", Name="Synthetic script with a deliberately long human-readable name", SourceCode="return 1;", SourceHash=new string('a',64) });
var diagnostic = "Synthetic local failure <script>ignored()</script> " + new string('x',5000) + " END-DIAGNOSTIC";
var deployment = new ZB.MOM.WW.OtOpcUa.Configuration.Entities.Deployment { RevisionHash=new string('b',64), CreatedBy="local-fixture-only", Status=ZB.MOM.WW.OtOpcUa.Configuration.Enums.DeploymentStatus.PartiallyFailed, FailureReason=diagnostic };
db.Deployments.Add(deployment);
db.NodeDeploymentStates.Add(new() { NodeId="fixture-driver-with-long-local-name", DeploymentId=deployment.DeploymentId, Status=ZB.MOM.WW.OtOpcUa.Configuration.Enums.NodeDeploymentStatus.Failed, FailureReason=diagnostic });
db.ConfigAuditLogs.Add(new() { Principal="local-fixture-only", EventType="SyntheticFailure", ClusterId="fixture-cluster", CorrelationId=Guid.Parse("71324bc9-ae5d-4f41-9f0b-a38a092f77d8"), DetailsJson=System.Text.Json.JsonSerializer.Serialize(new { message=diagnostic }) });
db.SaveChanges();
}
app.UseStaticFiles(); app.UseAntiforgery();
app.MapGet("/fixture/provenance", () => new { purpose="Disposable actual-component UI canary; explicit synthetic in-memory operations only, no external fleet/database/LDAP/COM connectivity", source="Authorized OtOpcUa checkout", theme=typeof(ZB.MOM.WW.Theme.ThemeShell).Assembly.GetName().Version?.ToString() });
app.MapPost("/api/script-analysis/diagnostics", () => Results.Json(new { markers = Array.Empty<object>() }));
app.MapPost("/fixture/alarm-feed/{id}", (string id, ZB.MOM.WW.OtOpcUa.AdminUI.Hubs.IInProcessBroadcaster<ZB.MOM.WW.OtOpcUa.Commons.Messages.Alerts.AlarmTransitionEvent> feed) =>
{
if(id is not ("alarm-a" or "alarm-b"))return Results.BadRequest();
feed.Publish(new(id,"Fixture/Press","Local "+id,"Activated",500,"Local display-only event "+id,"fixture",DateTime.UtcNow));
return Results.Ok(new {fixtureOnly=true});
});
app.MapRazorComponents<App>().AddInteractiveServerRenderMode();
app.Run();
internal sealed class SyntheticAdministratorFixture : AuthenticationStateProvider
{
public override Task<AuthenticationState> GetAuthenticationStateAsync() => Task.FromResult(new AuthenticationState(new ClaimsPrincipal(new ClaimsIdentity([new(ClaimTypes.Name,"local-fixture-only"), new(ClaimTypes.Role,"Administrator"),new(ClaimTypes.Role,SecretsAuthorization.ManageRole)], "synthetic-fixture"))));
}
public class RejectingFixture : DispatchProxy
{
private readonly Dictionary<string, object> _reads = [];
public static T WithRead<T>(string method, object value) where T : class
{
var proxy = Create<T, RejectingFixture>();
var fixture = (RejectingFixture)(object)proxy; fixture._reads[method] = value;
return proxy;
}
public static T WithReads<T>(Dictionary<string, object> reads) where T : class
{
var proxy = Create<T, RejectingFixture>();
var fixture = (RejectingFixture)(object)proxy;
foreach (var pair in reads) fixture._reads[pair.Key] = pair.Value;
return proxy;
}
protected override object? Invoke(MethodInfo? method, object?[]? args) => method is not null && _reads.TryGetValue(method.Name, out var value) ? value : throw new InvalidOperationException("Disposable fixture rejects service operations.");
}
@@ -0,0 +1,18 @@
# Disposable OtOpcUa actual-component host
This retained harness references the authorized OtOpcUa checkout; it does not copy or replace product components. It uses the exact accepted runtime Theme/Secrets packages through that project. `OtUiCanary.csproj` records the existing EF InMemory10.0.7 fixture dependency; it is not a production package change.
The identity/policies are synthetic and are not a real cookie/LDAP authentication path. EF reads/writes are memory-only; no ConfigDb connection string is registered. Raw/UNS scoped proxies accept only explicitly mapped synthetic records/operations and reject other calls. The operation proxy supports fake deployment/alarm cases and rejects other actor commands. Certificate inspection points at a unique nonexistent temporary PKI root; no certificate action is exercised. Shared Secrets exposes fabricated metadata only; secret-value reads and mutation services reject calls. The Akka membership/historian adapter uses loopback ephemeral ports and no seed peers or application actors.
`FinalGrammarPilot` renders actual components directly. Its page-property/AX checks do not certify production routing, route middleware, login POSTs, protocol sessions or production data scale. Existing destination-policy/role tests and prior bounded native route-policy fixtures provide separate evidence. Login remains statically posted to its original endpoint; no real login is attempted here.
The fixture endpoints under `/fixture/` modify only fabricated display/feed state. They are not product endpoints and are not deployed. LiveTailPilot controls fake request completion/failure and display events; they never acknowledge a real alarm. Other pilots isolate tree recovery/caller sequencing, diagnostics, editor labels, density, deployment reads, tails and page grammar. Native scripts in the OtOpcUa repository record exact contexts and raw outcomes; old evidence remains historical rather than silently becoming a new baseline.
Build/run from this directory (update the project reference only if using another authorized checkout):
```sh
dotnet build OtUiCanary.csproj --artifacts-path /tmp/ot-ui-canary-artifacts
dotnet /tmp/ot-ui-canary-artifacts/bin/OtUiCanary/debug/OtUiCanary.dll --urls http://127.0.0.1:0
```
Restore must use the approved official feeds/cache and verified package bytes. Record the actual selected loopback origin from startup output. Never bind publicly or reuse a live service configuration. The final acceptance report records the owned host shutdown and disposable SQL cleanup separately. No deployments, fleet writes or existing test-rig changes are part of this harness.
@@ -0,0 +1,9 @@
using Akka.Actor;
using ZB.MOM.WW.OtOpcUa.Core.AlarmHistorian;
using ZB.MOM.WW.OtOpcUa.Runtime.Historian;
/// <summary>A synthetic local status reply only; no sink, queue, writer or fleet actors exist.</summary>
public sealed class ReadonlyHistorianStatusFixture : ReceiveActor
{
public ReadonlyHistorianStatusFixture() => Receive<HistorianAdapterActor.GetStatus>(_ =>
Sender.Tell(new HistorianSinkStatus(4,1,DateTime.UtcNow,null,FixtureDiagnostic.Text,HistorianDrainState.BackingOff)));
}
@@ -0,0 +1,56 @@
using System.Reflection;
using ZB.MOM.WW.OtOpcUa.AdminUI.Uns;
/// <summary>Per-circuit synthetic display state; no external service or database is configured.</summary>
public sealed class FixtureTreeState
{
public bool Fail, Populated, UnsFailAfterWrite;
public int Reads, Unexpected, CallerMutationRequests, UnsMutationRequests;
public Dictionary<string,IReadOnlyList<RawNode>> CallerChildren=[];
public IReadOnlyList<UnsNode>? UnsCallerRoots;
public void RenameUns(string id,string name)
{
UnsNode Clone(UnsNode n)
{
var copy=new UnsNode {Kind=n.Kind,Key=n.Key,EntityId=n.EntityId,ClusterId=n.ClusterId,DisplayName=n.EntityId==id?name:n.DisplayName,Expanded=n.Expanded,Loaded=n.Loaded,HasLazyChildren=n.HasLazyChildren,ChildCount=n.ChildCount};
copy.Children.AddRange(n.Children.Select(Clone));return copy;
}
if(UnsCallerRoots is not null)UnsCallerRoots=UnsCallerRoots.Select(Clone).ToArray();
}
}
public class FixtureTreeProxy:DispatchProxy
{
private FixtureTreeState _state=null!;
public static T Create<T>(FixtureTreeState state) where T:class
{var p=Create<T,FixtureTreeProxy>();((FixtureTreeProxy)(object)p)._state=state;return p;}
protected override object? Invoke(MethodInfo? m,object?[]? a)
{
if(m?.Name=="LoadRootsAsync")
{_state.Reads++;return _state.Fail?Task.FromException<IReadOnlyList<RawNode>>(new IOException("Synthetic local root read failure <script>ignored()</script>")):Task.FromResult<IReadOnlyList<RawNode>>([]);}
if(m?.Name=="LoadStructureAsync")
{
_state.Reads++;
return _state.Fail?Task.FromException<IReadOnlyList<UnsNode>>(new IOException("Synthetic local structure read failure <script>ignored()</script>"))
:Task.FromResult<IReadOnlyList<UnsNode>>(_state.UnsCallerRoots??(_state.Populated?[new UnsNode{Key="eq:local",Kind=UnsNodeKind.Equipment,EntityId="local",DisplayName="Synthetic press",HasLazyChildren=true}]:[]));
}
if(m?.Name=="LoadAreaAsync" && a?[0] is string area && area.StartsWith("caller-uns-",StringComparison.Ordinal))
return Task.FromResult<AreaEditDto?>(new(area,"local-area",null,"caller-uns-cluster",[1]));
if(m?.Name=="LoadLineAsync" && a?[0] is string line && line.StartsWith("caller-uns-",StringComparison.Ordinal))
return Task.FromResult<LineEditDto?>(new(line,"caller-uns-area","local-line",null,[2]));
if((m?.Name=="UpdateAreaAsync"||m?.Name=="UpdateLineAsync") && a?[0] is string update && update.StartsWith("caller-uns-",StringComparison.Ordinal))
{
_state.UnsMutationRequests++;_state.RenameUns(update,(string)a[1]!);
if(_state.UnsFailAfterWrite)_state.Fail=true;
return Task.FromResult(new UnsMutationResult(true,null));
}
if(m?.Name=="DeleteClusterAsync" && a?[0] is string cluster && cluster.StartsWith("caller-uns-",StringComparison.Ordinal))
{_state.UnsMutationRequests++;return Task.FromResult(new UnsMutationResult(false,"Synthetic current cluster blocker <script>ignored()</script>; no real deletion was attempted."));}
if(m?.Name=="LoadEquipmentPickContextAsync")return Task.FromResult(new EquipmentPickContext([],[]));
if(m?.Name=="LoadChildrenAsync" && a?[0] is RawNode node && _state.CallerChildren.TryGetValue(node.Key,out var children))return Task.FromResult(children);
if(m?.Name=="DeleteFolderAsync" && a?[0] is string deleteId && deleteId.StartsWith("caller-",StringComparison.Ordinal))
{_state.CallerMutationRequests++;return Task.FromResult(new UnsMutationResult(false,"Synthetic local blocker <script>ignored()</script>: this folder has references. No real deletion was attempted."));}
if(m?.Name=="RenameFolderAsync" && a?[0] is string renameId && renameId.StartsWith("caller-",StringComparison.Ordinal))
{_state.CallerMutationRequests++;return Task.FromResult(RawRenameResult.Success(["Synthetic local rename advisory <script>ignored()</script>; no database configuration changed."]));}
_state.Unexpected++;throw new InvalidOperationException("Tree fixture refuses non-root operation: "+m?.Name);
}
}