docs(comments): strip internal task/milestone/bundle bookkeeping from code comments
Remove project bookkeeping citations from shipped code comments across the solution: hyphenated task IDs (WP-14, StoreAndForward-025), milestone/task/ issue refs (M3, Task 4, Audit Log #23, #21), Bundle X task-bundle labels, and C/D/K/S/T phase labels. Comment text only — no code logic, string/log literals, or XML-doc structure changed. Genuine descriptions are preserved (only the citation is stripped), and technical lookalikes are retained (UTF-8, SHA-256, T00:00:00, M365, UTC-5, pre-C4/pre-C5 schema versions). Flagged by the new CommentChecker TaskReferenceInComment / TrackingReferenceInComment checks plus targeted grep passes; full solution builds clean, append-only guard tests pass.
This commit is contained in:
@@ -14,9 +14,9 @@ using ZB.MOM.WW.ScadaBridge.StoreAndForward;
|
||||
namespace ZB.MOM.WW.ScadaBridge.ExternalSystemGateway;
|
||||
|
||||
/// <summary>
|
||||
/// WP-6: HTTP/REST client that invokes external APIs.
|
||||
/// WP-7: Dual call modes — Call (synchronous) and CachedCall (S&F on transient failure).
|
||||
/// WP-8: Error classification applied to HTTP responses and exceptions.
|
||||
/// HTTP/REST client that invokes external APIs.
|
||||
/// Dual call modes — Call (synchronous) and CachedCall (S&F on transient failure).
|
||||
/// Error classification applied to HTTP responses and exceptions.
|
||||
/// </summary>
|
||||
public class ExternalSystemClient : IExternalSystemClient
|
||||
{
|
||||
@@ -123,7 +123,7 @@ public class ExternalSystemClient : IExternalSystemClient
|
||||
// attempt above; letting EnqueueAsync re-invoke the handler would
|
||||
// dispatch the same request a second time.
|
||||
//
|
||||
// ExternalSystemGateway-015: the entity's MaxRetries is a non-nullable
|
||||
// The entity's MaxRetries is a non-nullable
|
||||
// int whose default is 0, and the Store-and-Forward engine interprets a
|
||||
// stored MaxRetries of 0 as "no limit" (retry forever) — see
|
||||
// StoreAndForwardMessage.MaxRetries ("0 = no limit") and the retry-sweep
|
||||
@@ -139,19 +139,19 @@ public class ExternalSystemClient : IExternalSystemClient
|
||||
system.MaxRetries > 0 ? system.MaxRetries : null,
|
||||
system.RetryDelay > TimeSpan.Zero ? system.RetryDelay : null,
|
||||
attemptImmediateDelivery: false,
|
||||
// Audit Log #23 (M3): pin the S&F message id to the
|
||||
// Pin the S&F message id to the
|
||||
// TrackedOperationId so the retry loop can read it back via
|
||||
// StoreAndForwardMessage.Id and emit per-attempt + terminal
|
||||
// cached-call telemetry (Bundle E Tasks E4/E5). Null -> S&F
|
||||
// mints its own GUID (legacy pre-M3 behaviour).
|
||||
// cached-call telemetry. Null -> S&F
|
||||
// mints its own GUID (legacy behaviour).
|
||||
messageId: trackedOperationId?.ToString(),
|
||||
// Audit Log #23 (ExecutionId Task 4): thread the originating
|
||||
// Thread the originating
|
||||
// script execution's ExecutionId + SourceScript onto the
|
||||
// buffered row so the retry-loop cached-call audit rows carry
|
||||
// the same provenance the script-side cached rows do.
|
||||
executionId: executionId,
|
||||
sourceScript: sourceScript,
|
||||
// Audit Log #23 (ParentExecutionId Task 6): thread the spawning
|
||||
// Thread the spawning
|
||||
// inbound-API request's ExecutionId onto the buffered row so
|
||||
// the retry-loop cached-call audit rows correlate back to the
|
||||
// cross-execution chain. Null for a non-routed run.
|
||||
@@ -162,7 +162,7 @@ public class ExternalSystemClient : IExternalSystemClient
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WP-7/10: Delivers a buffered ExternalSystem call during a store-and-forward
|
||||
/// Delivers a buffered ExternalSystem call during a store-and-forward
|
||||
/// retry sweep. Returns true on success, false on permanent failure (the message
|
||||
/// is parked); throws <see cref="TransientExternalSystemException"/> on a
|
||||
/// transient failure so the engine retries.
|
||||
@@ -173,7 +173,7 @@ public class ExternalSystemClient : IExternalSystemClient
|
||||
public async Task<bool> DeliverBufferedAsync(
|
||||
StoreAndForwardMessage message, CancellationToken cancellationToken = default)
|
||||
{
|
||||
// ExternalSystemGateway-018: a malformed (not just empty/null-fielded)
|
||||
// A malformed (not just empty/null-fielded)
|
||||
// PayloadJson would otherwise throw `JsonException` here, which the S&F
|
||||
// engine treats as a transient failure and retries forever (poison
|
||||
// message). Re-running the same deserialization against the same payload
|
||||
@@ -229,7 +229,7 @@ public class ExternalSystemClient : IExternalSystemClient
|
||||
Dictionary<string, JsonElement>? Parameters);
|
||||
|
||||
/// <summary>
|
||||
/// WP-6: Executes the HTTP request against the external system.
|
||||
/// Executes the HTTP request against the external system.
|
||||
/// </summary>
|
||||
/// <param name="system">The external system definition.</param>
|
||||
/// <param name="method">The external system method to invoke.</param>
|
||||
@@ -242,8 +242,8 @@ public class ExternalSystemClient : IExternalSystemClient
|
||||
IReadOnlyDictionary<string, object?>? parameters,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
// ExternalSystemGateway-022: validate the verb against the documented set
|
||||
// (GET/POST/PUT/PATCH/DELETE — per ESG-023's design-doc reconciliation)
|
||||
// Validate the verb against the documented set
|
||||
// (GET/POST/PUT/PATCH/DELETE)
|
||||
// BEFORE constructing the request. `new HttpMethod(string)` accepts any
|
||||
// token-character string (e.g. "FOO", "DLETE"), and the body-vs-query
|
||||
// branch below only knows POST/PUT/PATCH and GET/DELETE — so an
|
||||
@@ -256,7 +256,7 @@ public class ExternalSystemClient : IExternalSystemClient
|
||||
|
||||
var client = _httpClientFactory.CreateClient($"ExternalSystem_{system.Name}");
|
||||
|
||||
// ExternalSystemGateway-019: HttpClient.Timeout defaults to 100 seconds
|
||||
// HttpClient.Timeout defaults to 100 seconds
|
||||
// and is enforced internally by SendAsync via its own private CTS — a
|
||||
// TaskCanceledException raised by that internal CTS does not trip
|
||||
// either the caller's token or the gateway's timeout CTS, so it falls
|
||||
@@ -277,8 +277,7 @@ public class ExternalSystemClient : IExternalSystemClient
|
||||
var url = BuildUrl(system.EndpointUrl, method.Path, parameters, method.HttpMethod);
|
||||
|
||||
// The request and response own IDisposable resources (StringContent, the
|
||||
// response content stream). Dispose both, including on the exception paths
|
||||
// (ExternalSystemGateway-005).
|
||||
// response content stream). Dispose both, including on the exception paths.
|
||||
using var request = new HttpRequestMessage(new HttpMethod(method.HttpMethod), url);
|
||||
|
||||
// Apply authentication
|
||||
@@ -354,8 +353,7 @@ public class ExternalSystemClient : IExternalSystemClient
|
||||
|
||||
// Bound the external error body before embedding it into a
|
||||
// script-visible message / event-log entry — a misbehaving or hostile
|
||||
// endpoint must not be able to inflate every error string
|
||||
// (ExternalSystemGateway-007).
|
||||
// endpoint must not be able to inflate every error string.
|
||||
var errorBody = Truncate(body, MaxErrorBodyChars);
|
||||
|
||||
if (ErrorClassifier.IsTransient(response.StatusCode))
|
||||
@@ -371,7 +369,7 @@ public class ExternalSystemClient : IExternalSystemClient
|
||||
|
||||
// The design requires permanent failures to be visible in Site Event
|
||||
// Logging — emit a warning so the gateway is not silent on a permanent
|
||||
// failure (ExternalSystemGateway-012).
|
||||
// failure.
|
||||
_logger.LogWarning(
|
||||
"Permanent HTTP {StatusCode} from external system {System} calling {Method}: {Error}",
|
||||
(int)response.StatusCode, system.Name, method.Name, errorBody);
|
||||
@@ -383,13 +381,13 @@ public class ExternalSystemClient : IExternalSystemClient
|
||||
|
||||
/// <summary>
|
||||
/// Upper bound (characters) on an external error response body echoed into a
|
||||
/// script-visible error message — see ExternalSystemGateway-007.
|
||||
/// script-visible error message.
|
||||
/// </summary>
|
||||
private const int MaxErrorBodyChars = 2048;
|
||||
|
||||
/// <summary>
|
||||
/// ExternalSystemGateway-022: documented HTTP-verb allowlist. Matches the
|
||||
/// design doc's enumerated set (GET/POST/PUT/PATCH/DELETE per ESG-023) and
|
||||
/// Documented HTTP-verb allowlist. Matches the
|
||||
/// design doc's enumerated set (GET/POST/PUT/PATCH/DELETE) and
|
||||
/// the body-vs-query branching above; any addition here must update both.
|
||||
/// </summary>
|
||||
private static readonly HashSet<string> SupportedHttpMethods = new(StringComparer.OrdinalIgnoreCase)
|
||||
@@ -435,7 +433,7 @@ public class ExternalSystemClient : IExternalSystemClient
|
||||
// A method that targets the base URL itself has an empty (or "/") path.
|
||||
// Appending a trailing "/" in that case yields ".../api/" which some
|
||||
// servers treat as a distinct resource — only append a segment when the
|
||||
// method actually defines a non-empty relative path (ExternalSystemGateway-006).
|
||||
// method actually defines a non-empty relative path.
|
||||
var trimmedBase = baseUrl.TrimEnd('/');
|
||||
var trimmedPath = path.Trim().TrimStart('/');
|
||||
var url = string.IsNullOrEmpty(trimmedPath)
|
||||
@@ -454,7 +452,7 @@ public class ExternalSystemClient : IExternalSystemClient
|
||||
// Only append "?" when the effective query string is non-empty — a method
|
||||
// whose parameter values are all null produces no query string, and the
|
||||
// URL must then be identical to the no-parameters case rather than ending
|
||||
// in a bare "?" (ExternalSystemGateway-017).
|
||||
// in a bare "?".
|
||||
if (queryString.Length > 0)
|
||||
{
|
||||
url += "?" + queryString;
|
||||
@@ -466,7 +464,7 @@ public class ExternalSystemClient : IExternalSystemClient
|
||||
|
||||
private void ApplyAuth(HttpRequestMessage request, ExternalSystemDefinition system)
|
||||
{
|
||||
// ESG-021: distinguish "intentionally unauthenticated" (AuthType = none)
|
||||
// Distinguish "intentionally unauthenticated" (AuthType = none)
|
||||
// from "AuthConfiguration is missing or empty for a type that requires it"
|
||||
// (deployment glitch, decryption failure, operator typo). The unauthenticated
|
||||
// case is silent; the requires-creds-but-empty case logs a Warning so an
|
||||
@@ -512,7 +510,7 @@ public class ExternalSystemClient : IExternalSystemClient
|
||||
}
|
||||
else
|
||||
{
|
||||
// ESG-021: malformed Basic config (no ':' separator) means the
|
||||
// Malformed Basic config (no ':' separator) means the
|
||||
// request goes out with no Authorization header. Warn so the
|
||||
// failure mode is visible inside ZB.MOM.WW.ScadaBridge.
|
||||
_logger.LogWarning(
|
||||
@@ -526,7 +524,7 @@ public class ExternalSystemClient : IExternalSystemClient
|
||||
break;
|
||||
|
||||
default:
|
||||
// ESG-021: unknown AuthType silently fell through here before. Warn.
|
||||
// Unknown AuthType silently fell through here before. Warn.
|
||||
_logger.LogWarning(
|
||||
"ApplyAuth: External system '{System}' has unknown AuthType '{AuthType}'; request will be sent without an auth header. Allowed values: apikey, basic, none.",
|
||||
system.Name, system.AuthType);
|
||||
@@ -539,7 +537,7 @@ public class ExternalSystemClient : IExternalSystemClient
|
||||
string methodName,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
// ExternalSystemGateway-011: name-keyed repository lookups instead of
|
||||
// Name-keyed repository lookups instead of
|
||||
// fetch-all-then-filter — definitions are resolved on every hot-path call
|
||||
// (a script's ExternalSystem.Call()), so the repository performs an indexed
|
||||
// query rather than loading every system / every method into memory.
|
||||
|
||||
Reference in New Issue
Block a user