fix(calculation): probe JSON options stricter than the real spawn/reinit path (review)

CalculationDriverProbe.Opts (Test-Connect) omitted AllowTrailingCommas and
ReadCommentHandling that CalculationDriverFactoryExtensions.JsonOptions
(spawn) and CalculationDriver.ReinitJsonOptions (in-place ApplyDelta) both
set, so a config blob the real deploy path tolerates could fail Test-Connect
as "invalid JSON" even though deploying it would succeed. Aligned the three
option sets. Also adds CalculationDriverProbeTests.cs, which previously did
not exist at all for this driver type's Test-Connect surface.

Part of code-reviews/Driver.Calculation/findings.md (-003, -004).
This commit is contained in:
Joseph Doherty
2026-08-10 06:59:29 -04:00
parent a836e0d983
commit b4a03b4baa
2 changed files with 78 additions and 0 deletions
@@ -13,10 +13,16 @@ namespace ZB.MOM.WW.OtOpcUa.Driver.Calculation;
/// </summary>
public sealed class CalculationDriverProbe : IDriverProbe
{
// Mirrors CalculationDriverFactoryExtensions.JsonOptions / CalculationDriver.ReinitJsonOptions
// (AllowTrailingCommas + ReadCommentHandling included) so a config blob the real spawn/reinit path
// tolerates never fails Test-Connect as "invalid JSON" — the probe must never be STRICTER than the
// path it is standing in for.
private static readonly JsonSerializerOptions Opts = new()
{
PropertyNameCaseInsensitive = true,
UnmappedMemberHandling = JsonUnmappedMemberHandling.Skip,
ReadCommentHandling = JsonCommentHandling.Skip,
AllowTrailingCommas = true,
Converters = { new JsonStringEnumConverter() },
};