v3(s7): apply Modbus RawTags exemplar to the S7 driver

Rename S7EquipmentTagParser -> S7TagDefinitionFactory; TryParse(reference)
-> FromTagConfig(tagConfig, rawPath, out def) (drops the leading-{ heuristic,
keys the def by RawPath, adds inverse ToTagConfig). Replace S7DriverOptions.Tags
(pre-declared S7TagDefinition list) with RawTags (IReadOnlyList<RawTagEntry>);
the driver builds its RawPath->def table from RawTags at Initialize via the
factory (skip+log on miss), resolver is byName-only, DiscoverAsync + init guards
+ address pre-parse now run off that table. Factory retires the pre-declared DTO
tag path (RawTags binding only). Cli BuildOptions serialises typed defs to
RawTagEntry. Tests migrated to a S7RawTags helper + FromTagConfig; parser test
files renamed. Coordinator's EquipmentTagConfigInspector S7 rename left to Wave-B
coordinator; Driver.S7.IntegrationTests (Docker-gated) left red per scope.

Driver.S7 + Cli build green; Driver.S7.Tests 264/264, S7.Cli.Tests 49/49.
This commit is contained in:
Joseph Doherty
2026-07-15 20:11:04 -04:00
parent c379e246d0
commit 1e26b9ab58
21 changed files with 425 additions and 251 deletions
@@ -87,16 +87,25 @@ public sealed class S7CommandBaseBuildOptionsTests
options.Slot.ShouldBe((short)2);
}
/// <summary>Verifies that BuildOptions forwards the tag list verbatim.</summary>
/// <summary>Verifies that BuildOptions serialises each typed tag to a RawTagEntry (RawPath =
/// the def's Name) whose TagConfig round-trips back to the same definition (v3 delivery shape).</summary>
[Fact]
public void BuildOptions_forwards_tag_list_verbatim()
public void BuildOptions_serialises_tags_to_raw_tag_entries()
{
var sut = new ProbeOnly { Host = "h" };
var tag = new S7TagDefinition("t", "MW0", S7DataType.Int16, Writable: false);
var options = sut.Invoke([tag]);
options.Tags.Count.ShouldBe(1);
options.Tags[0].ShouldBeSameAs(tag);
options.RawTags.Count.ShouldBe(1);
var entry = options.RawTags[0];
entry.RawPath.ShouldBe("t");
entry.WriteIdempotent.ShouldBe(tag.WriteIdempotent);
S7TagDefinitionFactory.FromTagConfig(entry.TagConfig, entry.RawPath, out var round).ShouldBeTrue();
round!.Name.ShouldBe("t");
round.Address.ShouldBe("MW0");
round.DataType.ShouldBe(S7DataType.Int16);
round.Writable.ShouldBeFalse();
}
}