fix(communication)+fix(siteruntime): carry DetachedScriptThreads/ScriptRunShedCount/SiteStreamAlarmDropCount across the health wire; restore drained counters on failed send (arch-review 2026-08-19 P8-1)
This commit is contained in:
@@ -333,6 +333,16 @@ public class HealthReportSenderTests
|
||||
/// un-sent report only, and the next successful report shipped with the
|
||||
/// counters at zero.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Extended for arch-review 2026-08-19 P8-1: <c>ScriptRunShedCount</c> is drained
|
||||
/// by <c>CollectReport</c> the exact same way as the five counters above, but
|
||||
/// <c>AddIntervalCounters</c> used to take only those five — a failed send
|
||||
/// destructively lost the shed count forever. <c>DetachedScriptThreads</c> and
|
||||
/// <c>SiteStreamAlarmDropCount</c> are deliberately NOT exercised here: they are
|
||||
/// point-in-time gauges (set via <c>Interlocked.CompareExchange</c>/<c>Read</c>,
|
||||
/// never zeroed by <c>CollectReport</c>), so a failed send loses nothing for them
|
||||
/// to restore.
|
||||
/// </remarks>
|
||||
[Fact]
|
||||
public async Task SendFailure_PreservesIntervalCountersForNextReport()
|
||||
{
|
||||
@@ -341,7 +351,7 @@ public class HealthReportSenderTests
|
||||
collector.SetActiveNode(true);
|
||||
// Pre-populate every per-interval counter so the restore path on each
|
||||
// field is exercised — script error, alarm error, dead letter, site
|
||||
// audit write failure, audit redaction failure.
|
||||
// audit write failure, audit redaction failure, script run shed.
|
||||
collector.IncrementScriptError();
|
||||
collector.IncrementScriptError();
|
||||
collector.IncrementAlarmError();
|
||||
@@ -351,6 +361,10 @@ public class HealthReportSenderTests
|
||||
collector.IncrementSiteAuditWriteFailures();
|
||||
collector.IncrementAuditRedactionFailure();
|
||||
collector.IncrementAuditRedactionFailure();
|
||||
collector.IncrementScriptRunShed();
|
||||
collector.IncrementScriptRunShed();
|
||||
collector.IncrementScriptRunShed();
|
||||
collector.IncrementScriptRunShed();
|
||||
|
||||
var options = Options.Create(new HealthMonitoringOptions
|
||||
{
|
||||
@@ -383,6 +397,7 @@ public class HealthReportSenderTests
|
||||
Assert.Equal(3, firstSuccess.DeadLetterCount);
|
||||
Assert.Equal(1, firstSuccess.SiteAuditWriteFailures);
|
||||
Assert.Equal(2, firstSuccess.AuditRedactionFailure);
|
||||
Assert.Equal(4, firstSuccess.ScriptRunShedCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user