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:
@@ -5,22 +5,9 @@ using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums;
|
||||
namespace ZB.MOM.WW.ScadaBridge.StoreAndForward;
|
||||
|
||||
/// <summary>
|
||||
/// WP-9: SQLite persistence layer for store-and-forward messages.
|
||||
/// SQLite persistence layer for store-and-forward messages.
|
||||
/// Uses direct Microsoft.Data.Sqlite (not EF Core) for lightweight site-side storage.
|
||||
/// No max buffer size per design decision.
|
||||
///
|
||||
/// StoreAndForward-008: every method opens a fresh <see cref="SqliteConnection"/> for
|
||||
/// the duration of the call rather than holding a long-lived connection. This is a
|
||||
/// deliberate trade-off, not an oversight: Microsoft.Data.Sqlite maintains an internal
|
||||
/// connection pool keyed on the connection string, so <c>OpenAsync</c> on a previously
|
||||
/// used connection string reuses a pooled handle instead of performing a real file
|
||||
/// open. The retry sweep therefore relies on that pool for acceptable performance —
|
||||
/// it calls <see cref="RemoveMessageAsync"/> / <see cref="UpdateMessageIfStatusAsync"/>
|
||||
/// once per due message, and with no max buffer size (by design) the buffer can grow
|
||||
/// large. The connection-per-call style keeps each method self-contained and
|
||||
/// transaction-scoped; if profiling ever shows the pooled open to be a bottleneck on
|
||||
/// the hot retry path, the remedy is a batched sweep API that opens one connection (and
|
||||
/// one transaction) per sweep.
|
||||
/// </summary>
|
||||
public class StoreAndForwardStorage
|
||||
{
|
||||
@@ -71,7 +58,7 @@ public class StoreAndForwardStorage
|
||||
";
|
||||
await command.ExecuteNonQueryAsync();
|
||||
|
||||
// Audit Log #23 (ExecutionId Task 4): additively add the execution_id /
|
||||
// Additively add the execution_id /
|
||||
// source_script columns. CREATE TABLE IF NOT EXISTS above does NOT add
|
||||
// columns to a table that already exists from before these fields, so a
|
||||
// databases created by an older build needs the columns ALTER-ed in.
|
||||
@@ -82,7 +69,7 @@ public class StoreAndForwardStorage
|
||||
await AddColumnIfMissingAsync(connection, "execution_id", "TEXT");
|
||||
await AddColumnIfMissingAsync(connection, "source_script", "TEXT");
|
||||
|
||||
// Audit Log #23 (ParentExecutionId Task 6): additively add the
|
||||
// Additively add the
|
||||
// parent_execution_id column the same way — a sibling to execution_id.
|
||||
// Nullable with no default, so any row buffered before this migration
|
||||
// reads back ParentExecutionId = null (back-compat).
|
||||
@@ -92,7 +79,7 @@ public class StoreAndForwardStorage
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Audit Log #23 (ExecutionId Task 4): adds a column to <c>sf_messages</c>
|
||||
/// Adds a column to <c>sf_messages</c>
|
||||
/// only when it is not already present. SQLite lacks <c>ADD COLUMN IF NOT
|
||||
/// EXISTS</c>, so the schema is probed via <c>PRAGMA table_info</c> first.
|
||||
/// Idempotent — safe to run on every <see cref="InitializeAsync"/>.
|
||||
@@ -143,7 +130,7 @@ public class StoreAndForwardStorage
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WP-9: Enqueues a new message with Pending status.
|
||||
/// Enqueues a new message with Pending status.
|
||||
/// </summary>
|
||||
/// <param name="message">The message to enqueue.</param>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
@@ -174,13 +161,13 @@ public class StoreAndForwardStorage
|
||||
cmd.Parameters.AddWithValue("@status", (int)message.Status);
|
||||
cmd.Parameters.AddWithValue("@lastError", (object?)message.LastError ?? DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("@origin", (object?)message.OriginInstanceName ?? DBNull.Value);
|
||||
// Audit Log #23 (ExecutionId Task 4): the execution id is stored as its
|
||||
// The execution id is stored as its
|
||||
// canonical string form ("D") so it round-trips cleanly through the
|
||||
// TEXT column; null when not a cached call / not threaded.
|
||||
cmd.Parameters.AddWithValue("@executionId",
|
||||
message.ExecutionId.HasValue ? message.ExecutionId.Value.ToString("D") : DBNull.Value);
|
||||
cmd.Parameters.AddWithValue("@sourceScript", (object?)message.SourceScript ?? DBNull.Value);
|
||||
// Audit Log #23 (ParentExecutionId Task 6): the parent execution id is
|
||||
// The parent execution id is
|
||||
// stored as its canonical string form ("D") so it round-trips cleanly
|
||||
// through the TEXT column; null when not a routed cached call.
|
||||
cmd.Parameters.AddWithValue("@parentExecutionId",
|
||||
@@ -190,7 +177,7 @@ public class StoreAndForwardStorage
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WP-10: Gets all messages that are due for retry (Pending status, last attempt older than retry interval).
|
||||
/// Gets all messages that are due for retry (Pending status, last attempt older than retry interval).
|
||||
/// </summary>
|
||||
/// <returns>A task that resolves to the list of messages due for retry, ordered by creation time ascending.</returns>
|
||||
public async Task<List<StoreAndForwardMessage>> GetMessagesForRetryAsync()
|
||||
@@ -216,7 +203,7 @@ public class StoreAndForwardStorage
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WP-10: Updates a message after a delivery attempt.
|
||||
/// Updates a message after a delivery attempt.
|
||||
/// </summary>
|
||||
/// <param name="message">The message with updated retry count, status, and last error.</param>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
@@ -245,17 +232,10 @@ public class StoreAndForwardStorage
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WP-10: Updates a message after a delivery attempt, but only if the row is still
|
||||
/// Updates a message after a delivery attempt, but only if the row is still
|
||||
/// in the expected status. Returns true if the row was updated, false if it had
|
||||
/// already been changed (e.g. an operator retried or discarded the message) and so
|
||||
/// was skipped.
|
||||
///
|
||||
/// StoreAndForward-005: the retry sweep uses this for its state-changing writes so
|
||||
/// it cannot clobber a concurrent operator action (RetryParkedMessageAsync /
|
||||
/// DiscardParkedMessageAsync). Those operator operations are themselves SQL-
|
||||
/// conditional on <c>status = Parked</c>; making the sweep's writes conditional on
|
||||
/// the status the sweep observed closes the sweep-vs-management race rather than
|
||||
/// relying only on the in-process overlapping-sweep guard.
|
||||
/// </summary>
|
||||
/// <param name="message">The message with the updated values to persist.</param>
|
||||
/// <param name="expectedStatus">The status the row must currently have for the update to proceed.</param>
|
||||
@@ -289,7 +269,7 @@ public class StoreAndForwardStorage
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WP-10: Removes a successfully delivered message.
|
||||
/// Removes a successfully delivered message.
|
||||
/// </summary>
|
||||
/// <param name="messageId">The id of the message to remove.</param>
|
||||
/// <returns>A task that represents the asynchronous operation.</returns>
|
||||
@@ -306,13 +286,7 @@ public class StoreAndForwardStorage
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WP-12: Gets all parked messages, optionally filtered by category, with pagination.
|
||||
///
|
||||
/// StoreAndForward-006: the COUNT(*) and the paged SELECT run inside a single
|
||||
/// transaction so they observe one consistent snapshot. Without it, a concurrent
|
||||
/// enqueue/park/discard arriving between the two statements yields a TotalCount
|
||||
/// inconsistent with the returned page (flickering totals / off-by-one page math
|
||||
/// in the paginated UI).
|
||||
/// Gets all parked messages, optionally filtered by category, with pagination.
|
||||
/// </summary>
|
||||
/// <param name="category">Optional category filter; null returns parked messages from all categories.</param>
|
||||
/// <param name="pageNumber">1-based page number.</param>
|
||||
@@ -363,14 +337,7 @@ public class StoreAndForwardStorage
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WP-12: Moves a parked message back to pending for retry.
|
||||
///
|
||||
/// StoreAndForward-010: <c>last_attempt_at</c> is reset to NULL so the re-queued
|
||||
/// message is unambiguously due on the next retry sweep. An operator-initiated
|
||||
/// retry means "attempt this again now"; leaving the stale parked timestamp in
|
||||
/// place would make the message's retry timing depend on the configured retry
|
||||
/// interval relative to the original (pre-park) attempt — "try immediately" only
|
||||
/// by accident, and a long interval would instead delay the operator's retry.
|
||||
/// Moves a parked message back to pending for retry.
|
||||
/// </summary>
|
||||
/// <param name="messageId">The id of the parked message to move back to Pending.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the message was found and reset to Pending; <c>false</c> if not found or not in Parked status.</returns>
|
||||
@@ -394,7 +361,7 @@ public class StoreAndForwardStorage
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WP-12: Permanently discards a parked message.
|
||||
/// Permanently discards a parked message.
|
||||
/// </summary>
|
||||
/// <param name="messageId">The id of the parked message to discard.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> if the message was found and deleted; <c>false</c> if not found or not in Parked status.</returns>
|
||||
@@ -413,7 +380,7 @@ public class StoreAndForwardStorage
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WP-14: Gets buffer depth by category (count of pending messages per category).
|
||||
/// Gets buffer depth by category (count of pending messages per category).
|
||||
/// </summary>
|
||||
/// <returns>A task that resolves to a dictionary mapping each category to its pending message count.</returns>
|
||||
public async Task<Dictionary<StoreAndForwardCategory, int>> GetBufferDepthByCategoryAsync()
|
||||
@@ -442,7 +409,7 @@ public class StoreAndForwardStorage
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WP-13: Verifies messages are NOT deleted when an instance is deleted.
|
||||
/// Verifies messages are NOT deleted when an instance is deleted.
|
||||
/// Returns the count of messages for a given origin instance.
|
||||
/// </summary>
|
||||
/// <param name="instanceName">The origin instance name to count messages for.</param>
|
||||
@@ -537,7 +504,7 @@ public class StoreAndForwardStorage
|
||||
Status = (StoreAndForwardMessageStatus)reader.GetInt32(9),
|
||||
LastError = reader.IsDBNull(10) ? null : reader.GetString(10),
|
||||
OriginInstanceName = reader.IsDBNull(11) ? null : reader.GetString(11),
|
||||
// Audit Log #23 (ExecutionId Task 4): rows persisted before the
|
||||
// Rows persisted before the
|
||||
// additive migration have no execution_id / source_script value;
|
||||
// IsDBNull guards keep those reading back as null (back-compat).
|
||||
// Guid.TryParse (not Parse) guards the retry sweep: a corrupt
|
||||
@@ -545,7 +512,7 @@ public class StoreAndForwardStorage
|
||||
// than throwing FormatException and aborting the whole sweep.
|
||||
ExecutionId = ParseGuidColumn(reader, 12),
|
||||
SourceScript = reader.IsDBNull(13) ? null : reader.GetString(13),
|
||||
// Audit Log #23 (ParentExecutionId Task 6): rows persisted
|
||||
// Rows persisted
|
||||
// before the additive migration have no parent_execution_id
|
||||
// value; the IsDBNull guard inside ParseGuidColumn keeps those
|
||||
// reading back as null (back-compat). Guid.TryParse (not Parse)
|
||||
@@ -557,8 +524,7 @@ public class StoreAndForwardStorage
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Audit Log #23 (ExecutionId Task 4 / ParentExecutionId Task 6):
|
||||
/// defensively reads a nullable GUID column (<c>execution_id</c> or
|
||||
/// Defensively reads a nullable GUID column (<c>execution_id</c> or
|
||||
/// <c>parent_execution_id</c>). A <c>null</c> value (legacy pre-migration
|
||||
/// rows) and a malformed non-null value both yield <c>null</c> — a corrupt
|
||||
/// id must not throw and abort the retry sweep, which reads many rows.
|
||||
|
||||
Reference in New Issue
Block a user