perf(adminui): drift chip recomposes only when the config-edit watermark moves

This commit is contained in:
Joseph Doherty
2026-08-16 04:25:56 -04:00
parent d5f573b019
commit 684e59d871
5 changed files with 247 additions and 11 deletions
@@ -6,13 +6,13 @@
@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.ControlPlane.AdminOperations
@attribute [Authorize(Policy = AdminUiPolicies.ConfigEditor)]
@inject IDbContextFactory<OtOpcUaConfigDbContext> DbFactory
@inject IAdminOperationsClient AdminOps
@inject AuthenticationStateProvider AuthState
@inject ZB.MOM.WW.OtOpcUa.AdminUI.Deployments.DeploymentDriftProbe DriftProbe
@rendermode InteractiveServer
<PageTitle>Deployments</PageTitle>
@@ -104,16 +104,13 @@
.Take(50)
.ToListAsync();
// Drift: if no sealed deployment yet, no drift to report. Otherwise compare the latest
// sealed revision hash to a fresh snapshot of the live-edit state.
// Drift: if no sealed deployment yet, no drift to report. Otherwise the probe compares the
// latest sealed revision hash to the live-edit state — recomposing only when the ConfigEdit
// audit watermark has moved, so a re-render of this page is not a full fleet snapshot.
var latestSealed = _deployments.FirstOrDefault(d => d.Status == DeploymentStatus.Sealed);
if (latestSealed is null)
{
_drift = null;
return;
}
var current = await ConfigComposer.SnapshotAndFlattenAsync(db);
_drift = !string.Equals(current.RevisionHash, latestSealed.RevisionHash, StringComparison.Ordinal);
_drift = latestSealed is null
? null
: await DriftProbe.GetDriftAsync(latestSealed.RevisionHash, CancellationToken.None);
}
private async Task StartDeploymentAsync()