diff --git a/archreview/plans/R2-09-driver-fleet-batch-plan.md.tasks.json b/archreview/plans/R2-09-driver-fleet-batch-plan.md.tasks.json
index d3016198..ef0a502d 100644
--- a/archreview/plans/R2-09-driver-fleet-batch-plan.md.tasks.json
+++ b/archreview/plans/R2-09-driver-fleet-batch-plan.md.tasks.json
@@ -161,7 +161,7 @@
{
"id": "B5.2",
"subject": "B5: rewrite the four multi-device ResolveHost bodies via EquipmentTagRefResolver + empty-host guard",
- "status": "pending",
+ "status": "completed",
"blockedBy": [
"B5.1"
]
diff --git a/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDriver.cs b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDriver.cs
index e276bf53..ca7e045f 100644
--- a/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDriver.cs
+++ b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbCip/AbCipDriver.cs
@@ -501,10 +501,19 @@ public sealed class AbCipDriver : IDriver, IReadable, IWritable, ITagDiscovery,
// ---- IPerCallHostResolver ----
- ///
+ ///
+ /// Resolve a read/write/subscribe reference to the device host that keys its per-host
+ /// resilience (bulkhead / circuit breaker). CONV-4: routes through
+ /// so an equipment-tag reference (raw TagConfig
+ /// JSON) resolves to its OWN authored device rather than the first-device fallback — else a
+ /// broken device B would trip device A's breaker. The resolver caches parses, so this adds
+ /// no per-call cost after first use.
+ ///
+ /// The tag reference (authored name or equipment-tag JSON).
+ /// The device host key.
public string ResolveHost(string fullReference)
{
- if (_tagsByName.TryGetValue(fullReference, out var def))
+ if (_resolver.TryResolve(fullReference, out var def) && !string.IsNullOrEmpty(def.DeviceHostAddress))
return def.DeviceHostAddress;
return _options.Devices.FirstOrDefault()?.HostAddress ?? DriverInstanceId;
}
diff --git a/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbLegacy/AbLegacyDriver.cs b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbLegacy/AbLegacyDriver.cs
index a45cd80a..b5f21f9c 100644
--- a/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbLegacy/AbLegacyDriver.cs
+++ b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.AbLegacy/AbLegacyDriver.cs
@@ -511,10 +511,18 @@ public sealed class AbLegacyDriver : IDriver, IReadable, IWritable, ITagDiscover
// ---- IPerCallHostResolver ----
- ///
+ ///
+ /// Resolve a reference to the device host that keys its per-host resilience
+ /// (bulkhead / circuit breaker). CONV-4: routes through
+ /// so an equipment-tag reference (raw TagConfig
+ /// JSON) resolves to its OWN authored device rather than the first-device fallback. The
+ /// resolver caches parses, so this adds no per-call cost after first use.
+ ///
+ /// The tag reference (authored name or equipment-tag JSON).
+ /// The device host key.
public string ResolveHost(string fullReference)
{
- if (_tagsByName.TryGetValue(fullReference, out var def))
+ if (_resolver.TryResolve(fullReference, out var def) && !string.IsNullOrEmpty(def.DeviceHostAddress))
return def.DeviceHostAddress;
return _options.Devices.FirstOrDefault()?.HostAddress ?? DriverInstanceId;
}
diff --git a/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.FOCAS/FocasDriver.cs b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.FOCAS/FocasDriver.cs
index 25386b28..9fca75f6 100644
--- a/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.FOCAS/FocasDriver.cs
+++ b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.FOCAS/FocasDriver.cs
@@ -1114,10 +1114,20 @@ public sealed class FocasDriver : IDriver, IReadable, IWritable, ITagDiscovery,
// ---- IPerCallHostResolver ----
- ///
+ ///
+ /// Resolve a reference to the device host that keys its per-host resilience
+ /// (bulkhead / circuit breaker). CONV-4: routes through
+ /// so an equipment-tag reference (raw TagConfig
+ /// JSON) resolves to its OWN authored device rather than the first-device fallback. The
+ /// empty-host guard covers FOCAS's ?? "" default so an address-less equipment tag
+ /// falls back rather than keying an empty host. The resolver caches parses, so this adds no
+ /// per-call cost after first use.
+ ///
+ /// The tag reference (authored name or equipment-tag JSON).
+ /// The device host key.
public string ResolveHost(string fullReference)
{
- if (_tagsByName.TryGetValue(fullReference, out var def))
+ if (_resolver.TryResolve(fullReference, out var def) && !string.IsNullOrEmpty(def.DeviceHostAddress))
return def.DeviceHostAddress;
return _options.Devices.FirstOrDefault()?.HostAddress ?? DriverInstanceId;
}
diff --git a/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.TwinCAT/TwinCATDriver.cs b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.TwinCAT/TwinCATDriver.cs
index 831e0c9a..a538dc16 100644
--- a/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.TwinCAT/TwinCATDriver.cs
+++ b/src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.TwinCAT/TwinCATDriver.cs
@@ -706,10 +706,20 @@ public sealed class TwinCATDriver : IDriver, IReadable, IWritable, ITagDiscovery
///
public const string UnresolvedHostSentinel = "";
- ///
+ ///
+ /// Resolve a reference to the device host that keys its per-host resilience
+ /// (bulkhead / circuit breaker). CONV-4: routes through
+ /// so an equipment-tag reference (raw TagConfig
+ /// JSON) resolves to its OWN authored device rather than the first-device fallback. The
+ /// empty-host guard keeps an address-less equipment tag on the fallback rather than keying
+ /// the . The resolver caches parses, so this adds no
+ /// per-call cost after first use.
+ ///
+ /// The tag reference (authored name or equipment-tag JSON).
+ /// The device host key.
public string ResolveHost(string fullReference)
{
- if (_tagsByName.TryGetValue(fullReference, out var def))
+ if (_resolver.TryResolve(fullReference, out var def) && !string.IsNullOrEmpty(def.DeviceHostAddress))
return def.DeviceHostAddress;
// First device's HostAddress when one exists; otherwise the unresolved sentinel —
// intentionally NOT DriverInstanceId, which is a config-DB key, not a host address.
diff --git a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.FOCAS.Tests/FocasResolveHostTests.cs b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.FOCAS.Tests/FocasResolveHostTests.cs
index c4827c9c..1fe06c2c 100644
--- a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.FOCAS.Tests/FocasResolveHostTests.cs
+++ b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.FOCAS.Tests/FocasResolveHostTests.cs
@@ -16,37 +16,45 @@ public sealed class FocasResolveHostTests
private const string DeviceA = "focas://10.0.0.5:8193";
private const string DeviceB = "focas://10.0.0.6:8193";
- private static FocasDriver NewDriver() => new(
- new FocasDriverOptions
- {
- Devices = [new FocasDeviceOptions(DeviceA), new FocasDeviceOptions(DeviceB)],
- Probe = new FocasProbeOptions { Enabled = false },
- },
- "focas-1", new FakeFocasClientFactory());
+ // FOCAS's equipment-ref resolver validates against the initialized Devices map, so — unlike
+ // the other drivers — the driver must be initialized (as it always is when ResolveHost runs at
+ // runtime) before an equipment ref resolves. Probe off / no connect: init just parses devices.
+ private static async Task NewDriverAsync()
+ {
+ var drv = new FocasDriver(
+ new FocasDriverOptions
+ {
+ Devices = [new FocasDeviceOptions(DeviceA), new FocasDeviceOptions(DeviceB)],
+ Probe = new FocasProbeOptions { Enabled = false },
+ },
+ "focas-1", new FakeFocasClientFactory());
+ await drv.InitializeAsync("{}", CancellationToken.None);
+ return drv;
+ }
/// An equipment-tag ref naming device B resolves to device B's host, not the first device.
[Fact]
- public void ResolveHost_EquipmentTagRef_ReturnsItsOwnDeviceHost()
+ public async Task ResolveHost_EquipmentTagRef_ReturnsItsOwnDeviceHost()
{
- var drv = NewDriver();
+ var drv = await NewDriverAsync();
var json = $$"""{"deviceHostAddress":"{{DeviceB}}","address":"R100","dataType":"Byte"}""";
drv.ResolveHost(json).ShouldBe(DeviceB);
}
/// An equipment ref with no deviceHostAddress falls back to the first device, not an empty host.
[Fact]
- public void ResolveHost_EquipmentTagRef_WithoutDeviceHost_FallsBack()
+ public async Task ResolveHost_EquipmentTagRef_WithoutDeviceHost_FallsBack()
{
- var drv = NewDriver();
+ var drv = await NewDriverAsync();
var json = """{"address":"R100","dataType":"Byte"}""";
drv.ResolveHost(json).ShouldBe(DeviceA);
}
/// An unresolvable ref keeps the current first-device fallback.
[Fact]
- public void ResolveHost_UnknownRef_KeepsCurrentFallback()
+ public async Task ResolveHost_UnknownRef_KeepsCurrentFallback()
{
- var drv = NewDriver();
+ var drv = await NewDriverAsync();
drv.ResolveHost("totally-unknown").ShouldBe(DeviceA);
}
}