refactor(historian): single-parse ExtractTagHistorize + review-nit tests/docs
Stop parsing TagConfig twice per tag on the deploy hot path: Phase7Composer's equipment-tag Select lambda is now block-bodied (captures isHistorized/historianTagname once), and DeploymentArtifact.BuildEquipmentTagPlans captures locals before result.Add. Add wrong-type-historianTagname InlineData to ExtractTagHistorizeTests. Extend the parity round-trip fixture with a 4th tag (isHistorized:false + JSON-null tagname) exercising the artifact-side private guard path. Align DeploymentArtifact's ExtractTagHistorize doc-comment with the composer-side phrasing (ExtractTagFullName / ExtractTagAlarm cross-reference).
This commit is contained in:
@@ -437,6 +437,7 @@ public static class DeploymentArtifact
|
||||
// ordinary equipment tags now (GalaxyMxGateway is a standard Equipment-kind driver).
|
||||
if (!equipmentNamespaces.Contains(nsId)) continue;
|
||||
|
||||
var (isHistorized, historianTagname) = ExtractTagHistorize(tagConfig);
|
||||
result.Add(new EquipmentTagPlan(
|
||||
TagId: tagId!,
|
||||
EquipmentId: equipmentId!,
|
||||
@@ -447,8 +448,8 @@ public static class DeploymentArtifact
|
||||
FullName: ExtractTagFullName(tagConfig),
|
||||
Writable: writable,
|
||||
Alarm: ExtractTagAlarm(tagConfig),
|
||||
IsHistorized: ExtractTagHistorize(tagConfig).IsHistorized,
|
||||
HistorianTagname: ExtractTagHistorize(tagConfig).HistorianTagname));
|
||||
IsHistorized: isHistorized,
|
||||
HistorianTagname: historianTagname));
|
||||
}
|
||||
|
||||
result.Sort((a, b) =>
|
||||
@@ -678,7 +679,8 @@ public static class DeploymentArtifact
|
||||
/// the <c>isHistorized</c> bool (absent / not a bool / non-object root / blank / malformed ⇒
|
||||
/// <c>false</c>) and the optional <c>historianTagname</c> string override (absent / not a string /
|
||||
/// whitespace-or-empty ⇒ <c>null</c>, meaning the historian tagname defaults to the tag's FullName,
|
||||
/// resolved later). The raw string value is used — not trimmed. Never throws. The live-edit side
|
||||
/// resolved later). The raw string value is used — not trimmed — matching <c>ExtractTagFullName</c> /
|
||||
/// <c>ExtractTagAlarm</c>. Never throws. The live-edit side
|
||||
/// (<c>Phase7Composer.ExtractTagHistorize</c>) MUST parse identically (byte-parity).</summary>
|
||||
private static (bool IsHistorized, string? HistorianTagname) ExtractTagHistorize(string? tagConfig)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user