mbproxy: strip historical phase/wave/plan references from source comments
Comments described the *history* of how the code arrived (phase numbers, wave IDs, review IDs, dated TODOs) instead of what it does today. That scaffolding rotted as the codebase evolved. Cleaned 60 source files + .gitignore; behaviour unchanged (387/387 tests still pass). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -41,9 +41,8 @@ public sealed class BcdPduPipelineTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Phase 9: the rewriter consumes <see cref="PerPlcContext.CurrentRequest"/> rather
|
||||
/// than a per-pair last-request slot. Tests build a synthetic <see cref="InFlightRequest"/>
|
||||
/// to drive response decoding.
|
||||
/// The rewriter consumes <see cref="PerPlcContext.CurrentRequest"/>. Tests build a
|
||||
/// synthetic <see cref="InFlightRequest"/> to drive response decoding.
|
||||
/// </summary>
|
||||
private static InFlightRequest MakeInFlight(byte fc, ushort startAddress, ushort qty)
|
||||
=> new(
|
||||
@@ -51,9 +50,8 @@ public sealed class BcdPduPipelineTests
|
||||
Fc: fc,
|
||||
StartAddress: startAddress,
|
||||
Qty: qty,
|
||||
// Phase 9: always exactly one party. We don't have a real UpstreamPipe in
|
||||
// pipeline unit tests; the rewriter never dereferences the party list, so a
|
||||
// null-forgiving placeholder is safe.
|
||||
// We don't have a real UpstreamPipe in pipeline unit tests; the rewriter
|
||||
// never dereferences the party list, so an empty placeholder is safe.
|
||||
InterestedParties: Array.Empty<InterestedParty>(),
|
||||
SentAtUtc: DateTimeOffset.UtcNow);
|
||||
|
||||
@@ -107,9 +105,9 @@ public sealed class BcdPduPipelineTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Simulate sending an FC03/04 request then reading the response.
|
||||
/// Phase 9: builds an <see cref="InFlightRequest"/> matching the request and attaches
|
||||
/// it to the response-call context (replacing the per-pair last-request slot).
|
||||
/// Simulate sending an FC03/04 request then reading the response. Builds an
|
||||
/// <see cref="InFlightRequest"/> matching the request and attaches it to the
|
||||
/// response-call context.
|
||||
/// </summary>
|
||||
private void SendRequestThenProcessResponse(
|
||||
PerPlcContext ctx,
|
||||
@@ -361,11 +359,11 @@ public sealed class BcdPduPipelineTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Phase 12 (W2.13) — a client writing a 32-bit BCD value where either word exceeds
|
||||
/// 9999 must NOT be silently mutated by the `high*10000+low` reconstruction. Validation
|
||||
/// rejects the slot, increments invalidBcdWarnings, and passes the raw bytes through.
|
||||
/// Without W2.13 the codec would accept e.g. (high=9999, low=9999) → 99_989_999 →
|
||||
/// re-encode as (high=9998, low=9999), silently losing 1 from the high word.
|
||||
/// A client writing a 32-bit BCD value where either word exceeds 9999 must NOT be
|
||||
/// silently mutated by the `high*10000+low` reconstruction. Validation rejects the
|
||||
/// slot, increments invalidBcdWarnings, and passes the raw bytes through. (Otherwise
|
||||
/// the codec would accept e.g. (high=9999, low=9999) → 99_989_999 → re-encode as
|
||||
/// (high=9998, low=9999), silently losing 1 from the high word.)
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void FC16_32Bit_ClientHighOrLowAbove9999_PassesThroughRaw_WithInvalidBcdWarning()
|
||||
@@ -383,10 +381,10 @@ public sealed class BcdPduPipelineTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Phase 12 (W2.14) — a malformed FC16 request that claims qty=N but ships fewer than
|
||||
/// 6+N*2 bytes must NOT be partially rewritten. Without W2.14 each individual slot's
|
||||
/// per-slot bounds check would skip the OOB slot, leaving early slots rewritten and late
|
||||
/// slots untouched (a half-rewritten request reaching the PLC).
|
||||
/// A malformed FC16 request that claims qty=N but ships fewer than 6+N*2 bytes must
|
||||
/// NOT be partially rewritten. Without the up-front length check, each individual
|
||||
/// slot's per-slot bounds check would skip the OOB slot, leaving early slots rewritten
|
||||
/// and late slots untouched (a half-rewritten request reaching the PLC).
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void FC16_TruncatedRegisterData_PassesThroughRaw_NoPartialRewrite()
|
||||
@@ -405,12 +403,11 @@ public sealed class BcdPduPipelineTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Phase 12 (W3 test gap #15) — DL205/DL260 caps FC03/FC04 reads at qty=128 (above
|
||||
/// Modbus spec's 125; documented in DL260/dl205.md). The proxy must NOT truncate the
|
||||
/// qty field — a request with qty > 128 at non-BCD addresses must pass through
|
||||
/// unchanged so the PLC's own validator returns exception 03 to the client. This is
|
||||
/// the transparent-pass-through contract for FCs and addresses the rewriter doesn't
|
||||
/// own.
|
||||
/// DL205/DL260 caps FC03/FC04 reads at qty=128 (above Modbus spec's 125; documented
|
||||
/// in DL260/dl205.md). The proxy must NOT truncate the qty field — a request with
|
||||
/// qty > 128 at non-BCD addresses must pass through unchanged so the PLC's own
|
||||
/// validator returns exception 03 to the client. This is the transparent-pass-through
|
||||
/// contract for FCs and addresses the rewriter doesn't own.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void FC03_Request_QtyAbove128_AtNonBcdAddress_PassesThroughUnchanged()
|
||||
@@ -426,10 +423,9 @@ public sealed class BcdPduPipelineTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Phase 12 (W3 test gap) — symmetric inverse of the existing partial-overlap test:
|
||||
/// the write range starts ON the high register of a 32-bit pair (low word is BEFORE
|
||||
/// the write range). Must also be passed through raw with a partial warning, not
|
||||
/// half-rewritten.
|
||||
/// Symmetric inverse of the existing partial-overlap test: the write range starts ON
|
||||
/// the high register of a 32-bit pair (low word is BEFORE the write range). Must also
|
||||
/// be passed through raw with a partial warning, not half-rewritten.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void FC16_WriteStartsOnHighWord_Of32BitPair_PassesThroughRaw_WithPartialWarning()
|
||||
@@ -448,10 +444,9 @@ public sealed class BcdPduPipelineTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Phase 12 (W3 test gap) — mixed slots in a single FC03 read: a 16-bit BCD tag, a
|
||||
/// 32-bit BCD pair, and an unconfigured register. Each slot should be handled
|
||||
/// independently — the 16-bit and 32-bit rewritten, the unconfigured register passed
|
||||
/// through unchanged.
|
||||
/// Mixed slots in a single FC03 read: a 16-bit BCD tag, a 32-bit BCD pair, and an
|
||||
/// unconfigured register. Each slot should be handled independently — the 16-bit and
|
||||
/// 32-bit rewritten, the unconfigured register passed through unchanged.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void FC03_Mixed_16Bit_32Bit_AndNonBcd_InOneRead_OnlyConfiguredSlotsRewritten()
|
||||
@@ -488,9 +483,9 @@ public sealed class BcdPduPipelineTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Phase 12 (W3 test gap) — FC16 response handling. The response carries no register
|
||||
/// values (just an echo of [fc][start][qty]) so the rewriter must pass it through
|
||||
/// unchanged regardless of tag-map content.
|
||||
/// FC16 response handling. The response carries no register values (just an echo of
|
||||
/// [fc][start][qty]) so the rewriter must pass it through unchanged regardless of
|
||||
/// tag-map content.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void FC16_Response_PassesThroughUnchanged_RegardlessOfTagMap()
|
||||
|
||||
Reference in New Issue
Block a user