6 - The Diagnostics Harness
The Diagnostics Harness
XRUIOS.Diagnostics is the fleet self-test - the old Program.cs test suite reborn for the ported architecture. Instead of calling each class in-process, it connects to the Manager broker as a normal app and exercises the live workers through it. It's the fastest way to answer "is the whole thing actually up and behaving?" - and the regression net to run before and after touching anything.
What it proves
Three things, end to end:
- Every worker is up and individually routable - each answers its own
<Worker>.Pinghealth probe. - A real capability round-trips - Calendar
AddEventreturns an id, thenGetEventsreads it back. - The permission wall holds - an ungranted call (
DeleteEvent) and an unknown capability are both refused.
The exit code is the number of hard failures, so it drops straight into CI or a pre-work smoke check.
The .csproj
It's a plain broker client, same shape as the CMD app:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>XRUIOS.Diagnostics</RootNamespace>
<AssemblyName>XRUIOS.Diagnostics</AssemblyName>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\XRUIOS.SecureLayer\XRUIOS.SecureLayer.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Spectre.Console" Version="0.49.1" />
</ItemGroup>
<ItemGroup>
<Reference Include="EclipseProject"><HintPath>..\..\libs\EclipseProject.dll</HintPath></Reference>
</ItemGroup>
</Project>
Nothing special: XRUIOS.SecureLayer for the client, EclipseProject.dll for the transport, Spectre.Console for the results table.
How the probes work
Each worker exposes a uniform health probe - <Short>.Ping (Calendar.Ping, Alarm.Ping, …) that echoes its own identity. Because the broker routes by capability name, a unique name per worker is what lets the harness confirm each one individually. The harness holds the list of workers, pings each, then runs the Calendar round-trip and the two security probes:
// liveness: ping every worker by its own name
foreach (var w in workers)
{
string echo = await mgr.InvokeAsync<string>(w + ".Ping", new() { ["input"] = "diag" });
bool ok = echo.Contains("XRUIOS.Worker." + w); // it answered, and it's the right one
}
// security: this must be REFUSED (the app isn't granted DeleteEvent)
try { await mgr.InvokeAsync<string>("DeleteEvent", new() { ["uid"] = "x" }); /* FAIL if it goes through */ }
catch { /* PASS - refused by XRUIOS.Permission */ }
The Manager grants the diagnostics app every <Worker>.Ping plus Calendar's GetEvents + AddEvent (but not DeleteEvent, so the refusal is a real test). That grant is data-driven in ManagerHost.StartCoreAsync from WorkerCatalog.AllShortNames, so a new worker is covered the moment it's in the catalog.
Running it
With an unlocked Manager and the fleet up:
dotnet run --project src/XRUIOS.Diagnostics
A proven run against all 27 workers:
Transport Post-quantum handshake PASS SECURE
Liveness Songs.Ping PASS up + routable
… (all 27 workers) …
Calendar AddEvent PASS uid 81e19ab7-…
Calendar GetEvents WARN write ok, read didn't list it (known CalendarClass quirk)
Security DeleteEvent (not granted) PASS refused: XRUIOS.Permission denied…
Security Unknown capability PASS refused: XRUIOS.Permission denied…
─────────── 31 passed 1 warn 0 failed · 32 probes ───────────
The one WARN is honest: GetEvents can return empty right after a write (a date/parse quirk in CalendarClass) - a functional bug, not a security one, so it's a WARN and the run still passes. See 7 - Proven at Runtime.
Extending it
As a worker's curated surface fills in (right now only Calendar's is live), add real probes for it here - a granted round-trip and, where relevant, a denied call to prove the wall. The harness grows into a full behavioural test of the fleet, one worker at a time, without ever reaching past the broker.
Back to 1 - Project Types.