docs(src): fix CommentChecker findings across src/ — 1,032 → 5 (all false positives)
Comment/XML-doc changes only, no code logic: - strip project-tracking references (WP*, P*-*, row-NN, #NN, Task N) from comments, keeping the explanatory rationale - add missing summaries, <param>, <returns>, <typeparam> and <inheritdoc/> - replace misused <inheritdoc/> with real docs; where <inheritdoc/> was combined with useful remarks, move the rationale into // comments - drop stale replicationActor <param> on DeploymentManagerActor ctor Remaining 5 are false positives (CWE-1236 x2, failures-1, year-0001, M365). Build 0 errors / 0 warnings.
This commit is contained in:
@@ -21,7 +21,7 @@ using ZB.MOM.WW.ScadaBridge.StoreAndForward;
|
||||
namespace ZB.MOM.WW.ScadaBridge.SiteRuntime.Scripts;
|
||||
|
||||
/// <summary>
|
||||
/// WP3.1: launches one script or alarm on-trigger run directly from its owning coordinator
|
||||
/// Launches one script or alarm on-trigger run directly from its owning coordinator
|
||||
/// (<see cref="ScriptActor"/> / <see cref="AlarmActor"/>), replacing the short-lived
|
||||
/// <c>ScriptExecutionActor</c> and <c>AlarmExecutionActor</c>.
|
||||
///
|
||||
@@ -76,7 +76,7 @@ internal static class ScriptRunLauncher
|
||||
/// <param name="serviceProvider">Optional DI service provider for script execution services.</param>
|
||||
/// <param name="parentExecutionId">ExecutionId of the spawning execution for audit correlation; null for root runs.</param>
|
||||
/// <param name="executionTimeoutSeconds">Per-script execution timeout in seconds. Null or non-positive falls back to the global value.</param>
|
||||
/// <param name="scheduler">Script-execution scheduler seam (#18); null selects the process-wide shared instance.</param>
|
||||
/// <param name="scheduler">Script-execution scheduler seam; null selects the process-wide shared instance.</param>
|
||||
/// <param name="trace">Flow Debugger trace flag (design 2026-09-05 §5.2): when true the run emits <c>ScriptTrace</c> rows and returns them inline on the <see cref="ScriptCallResult"/>.</param>
|
||||
/// <param name="triggerExtra">Flow Debugger: trigger detail for a traced value-change run (stamped into the <c>ScriptRun</c> row's <c>Extra</c>); null for calls.</param>
|
||||
public static void LaunchScript(
|
||||
@@ -146,13 +146,12 @@ internal static class ScriptRunLauncher
|
||||
/// <param name="completionTarget">The owning <see cref="AlarmActor"/>, which receives the completion message.</param>
|
||||
/// <param name="logger">Logger for execution diagnostics.</param>
|
||||
/// <param name="healthCollector">
|
||||
/// Optional health collector for recording execution metrics (arch-review 2026-08-19
|
||||
/// P1-3): the alarm on-trigger run shares the script-error counter with
|
||||
/// Optional health collector for recording execution metrics: the alarm on-trigger run shares the script-error counter with
|
||||
/// <see cref="RunScriptAsync"/> so a wedged/failed alarm body is visible the same way a
|
||||
/// wedged/failed instance script is.
|
||||
/// </param>
|
||||
/// <param name="serviceProvider">
|
||||
/// Optional DI service provider (arch-review 2026-08-19 P1-3): resolves the singleton
|
||||
/// Optional DI service provider: resolves the singleton
|
||||
/// <see cref="ISiteEventLogger"/> (stuck-watchdog reporting) and
|
||||
/// <see cref="ScriptRunSummaryRecorder"/> (aggregate run counters), exactly like the
|
||||
/// instance-script path.
|
||||
@@ -164,7 +163,7 @@ internal static class ScriptRunLauncher
|
||||
/// write fired this alarm. Null when the firing value came from the Data Connection Layer
|
||||
/// (external data has no spawning execution) — that on-trigger run is a tree ROOT.
|
||||
/// </param>
|
||||
/// <param name="scheduler">Script-execution scheduler seam (#18); null selects the process-wide shared instance.</param>
|
||||
/// <param name="scheduler">Script-execution scheduler seam; null selects the process-wide shared instance.</param>
|
||||
/// <param name="siteCommunicationActor">Site transport for notification status queries, resolved on the actor thread.</param>
|
||||
public static void LaunchAlarmScript(
|
||||
string alarmName,
|
||||
@@ -268,7 +267,7 @@ internal static class ScriptRunLauncher
|
||||
// it is available to the catch blocks regardless of scope state.
|
||||
var siteEventLogger = serviceProvider?.GetService<ISiteEventLogger>();
|
||||
|
||||
// WP3.2 (site_events volume policy): both are singletons, resolved from the root
|
||||
// site_events volume policy: both are singletons, resolved from the root
|
||||
// provider up front so they too are available to the catch blocks. optionsMonitor is
|
||||
// null in tests that pass no serviceProvider (SingleServiceProvider et al.) — the
|
||||
// constructor-passed `options` is the fallback, exactly like siteEventLogger's null
|
||||
@@ -282,7 +281,7 @@ internal static class ScriptRunLauncher
|
||||
var emitPerRunEvents = ScriptRunEventPolicy.ShouldEmitPerRun(effectiveOptions, instanceName, scriptName);
|
||||
var runStopwatch = Stopwatch.StartNew();
|
||||
|
||||
// WP3.1: identify the worker this body is holding, so the watchdog can detach and
|
||||
// Identify the worker this body is holding, so the watchdog can detach and
|
||||
// replace it if the body wedges. Read in the FIRST synchronous segment — a script
|
||||
// that later hops threads on an await no longer holds this worker, and the run-stamp
|
||||
// guard in TryDetachWorker will (correctly) refuse to detach it.
|
||||
@@ -299,7 +298,7 @@ internal static class ScriptRunLauncher
|
||||
|
||||
try
|
||||
{
|
||||
// WP3.1 shed-at-dequeue: the deadline was armed at ENQUEUE, so an already-cancelled
|
||||
// Shed-at-dequeue: the deadline was armed at ENQUEUE, so an already-cancelled
|
||||
// token here means this run spent its entire budget queueing. Running it now would
|
||||
// burn a scarce script thread on work that is already stale — throw straight into
|
||||
// the existing timeout path instead, BEFORE the "started" event and before the body.
|
||||
@@ -421,7 +420,7 @@ internal static class ScriptRunLauncher
|
||||
Scope = scope
|
||||
};
|
||||
|
||||
// WP3.2: the aggregate ALWAYS records this run (that's the point of the interval
|
||||
// The aggregate ALWAYS records this run (that's the point of the interval
|
||||
// summary), but the per-run Info event itself is gated by ScriptRunEventPolicy —
|
||||
// off by default, on globally via PerRunScriptEvents, or on for named scripts via
|
||||
// PerRunScriptEventScripts. Fire-and-forget (the `_ =` discards the task) so the
|
||||
@@ -478,7 +477,7 @@ internal static class ScriptRunLauncher
|
||||
var errorMsg = $"Script '{scriptName}' on instance '{instanceName}' timed out after {timeout.TotalSeconds}s";
|
||||
logger.LogWarning("{Message} (run {RunId})", errorMsg, runId);
|
||||
|
||||
// Failures recorded to site event log; script NOT disabled after failure. WP3.2:
|
||||
// Failures recorded to site event log; script NOT disabled after failure.
|
||||
// Error-level emissions are unconditional — never gated by ScriptRunEventPolicy.
|
||||
_ = siteEventLogger?.LogEventAsync(
|
||||
"script", "Error", instanceName, $"ScriptActor:{scriptName}", errorMsg);
|
||||
@@ -504,7 +503,7 @@ internal static class ScriptRunLauncher
|
||||
{
|
||||
healthCollector?.IncrementScriptError();
|
||||
summaryRecorder?.RecordFailed(instanceName, scriptName, runStopwatch.ElapsedMilliseconds);
|
||||
// Failures recorded to site event log; script NOT disabled after failure. WP3.2:
|
||||
// Failures recorded to site event log; script NOT disabled after failure.
|
||||
// Error-level emissions are unconditional — never gated by ScriptRunEventPolicy.
|
||||
var errorMsg = $"Script '{scriptName}' on instance '{instanceName}' failed: {ex.Message}";
|
||||
logger.LogError(ex, "Script execution failed: {Script} on {Instance} (run {RunId})",
|
||||
@@ -556,6 +555,13 @@ internal static class ScriptRunLauncher
|
||||
/// the ACTOR thread, outside any launch scope. <c>elapsedMs</c> is 0 — the run never ran.
|
||||
/// Best-effort and never throws: a no-op when there is no provider or no writer.</para>
|
||||
/// </summary>
|
||||
/// <param name="serviceProvider">Root service provider used to resolve the audit writer and identity providers; no-op when <c>null</c>.</param>
|
||||
/// <param name="logger">Logger for best-effort failure reporting.</param>
|
||||
/// <param name="scriptName">Name of the script whose run was refused.</param>
|
||||
/// <param name="instanceName">Name of the instance owning the script.</param>
|
||||
/// <param name="parentExecutionId">ExecutionId of the spawning execution; null for root runs.</param>
|
||||
/// <param name="reason">Human-readable guard reason the run was refused.</param>
|
||||
/// <param name="triggerExtra">Trigger detail stamped into the row's <c>Extra</c> for a traced value-change run; null otherwise.</param>
|
||||
internal static void EmitSuppressedRun(
|
||||
IServiceProvider? serviceProvider,
|
||||
ILogger logger,
|
||||
@@ -668,7 +674,7 @@ internal static class ScriptRunLauncher
|
||||
CancellationTokenSource cts,
|
||||
ICanTell? siteCommunicationActor)
|
||||
{
|
||||
// arch-review 2026-08-19 P1-3: singletons resolved from the root provider up front,
|
||||
// Singletons resolved from the root provider up front,
|
||||
// exactly like RunScriptAsync, so they are available to the catch blocks regardless
|
||||
// of scope state. Null in tests that pass no serviceProvider — degrades the same way
|
||||
// the instance-script path does (no site event log / no aggregate counters).
|
||||
@@ -681,7 +687,7 @@ internal static class ScriptRunLauncher
|
||||
var scriptName = $"AlarmActor:{alarmName}";
|
||||
var runStopwatch = Stopwatch.StartNew();
|
||||
|
||||
// arch-review 2026-08-19 P1-3: identify the worker this body is holding, so the
|
||||
// Identify the worker this body is holding, so the
|
||||
// stuck-script watchdog can detach and replace it if the body wedges — same
|
||||
// mechanism, same gauge, as the instance-script path. Read in the FIRST synchronous
|
||||
// segment, before any await.
|
||||
@@ -716,7 +722,7 @@ internal static class ScriptRunLauncher
|
||||
timeout,
|
||||
instanceName,
|
||||
logger,
|
||||
// Final review M6: name the source so ScriptRuntimeContext's `_logTarget` derives
|
||||
// Name the source so ScriptRuntimeContext's `_logTarget` derives
|
||||
// the alarm this on-trigger run belongs to ("AlarmActor:Foo" -> "Foo") — without
|
||||
// it every Log.* line from an alarm script was attributed to the INSTANCE, not the
|
||||
// alarm. `scriptName` above is already the "AlarmActor:{alarmName}" source key, so
|
||||
@@ -795,7 +801,7 @@ internal static class ScriptRunLauncher
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Arms the stuck-script watchdog (S2, extended by WP3.1).
|
||||
/// Arms the stuck-script watchdog, which can also detach and replace a wedged worker.
|
||||
///
|
||||
/// <para>The CTS firing only REQUESTS cooperative cancellation; it does NOT free a thread
|
||||
/// blocked in synchronous I/O. When the deadline elapses, this waits
|
||||
|
||||
Reference in New Issue
Block a user