fix(galaxy): picker-authored native alarms resolve via the feed's source reference (#895)
The gateway alarm feed names an alarm "Galaxy!<Area>.<tag>.<Attr>". The AdminUI Galaxy picker authors attributeRef "<tag>.<Attr>". OnAlarmFeedTransition reverse-mapped only the full reference, so a picker-authored native alarm never matched its condition and never went active. Its ack also dialled the bare reference, which AcknowledgeAlarm refuses. ResolveAlarmRawPath now matches the full reference, then SourceObjectReference, then the full reference without its Provider!Area. prefix. A fallback match records the full reference per RawPath, and AcknowledgeAsync dials it, so the gateway accepts the ack and the #869 confirmation watch matches. Found and re-verified live in the #615 G6 gate on the windev test Galaxy. Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
This commit is contained in:
+60
@@ -146,6 +146,66 @@ public sealed class GalaxyDriverRawPathKeyingTests
|
||||
ack.Calls[0].AlarmRef.ShouldBe(AttributeRef);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// lmxopcua#895 (G6 live gate, windev 2026-11-12): the real gateway feed names an alarm
|
||||
/// <c>Galaxy!Area.tag.Attr</c> with <c>SourceObjectReference = tag.Attr</c>, while the AdminUI Galaxy
|
||||
/// picker authors <c>attributeRef = tag.Attr</c>. The transition must resolve to the tag's RawPath (before
|
||||
/// the fix it surfaced under the full reference, which matched no condition, so the alarm never went
|
||||
/// active), and the ack must dial the provider-qualified reference the gateway accepts.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task Alarm_PickerAuthoredAttributeRef_ResolvesViaSourceObjectReference_AndAcksFullReference()
|
||||
{
|
||||
const string fullRef = "Galaxy!Area1.Tank1.Level";
|
||||
var feed = new FakeAlarmFeed();
|
||||
var ack = new RecordingAcknowledger();
|
||||
using var driver = new GalaxyDriver(
|
||||
"g", OptsWithRawTags(), hierarchySource: null, alarmAcknowledger: ack, alarmFeed: feed,
|
||||
ackCredentialResolver: FixedAckCredentialResolver.Fallback());
|
||||
await driver.SubscribeAlarmsAsync(["Tank1"], CancellationToken.None);
|
||||
var observed = new List<AlarmEventArgs>();
|
||||
driver.OnAlarmEvent += (_, args) => observed.Add(args);
|
||||
|
||||
feed.Emit(NewTransition(fullRef, AttributeRef));
|
||||
|
||||
observed.ShouldHaveSingleItem();
|
||||
observed[0].ConditionId.ShouldBe(RawPath);
|
||||
|
||||
await driver.AcknowledgeAsync(
|
||||
[new AlarmAcknowledgeRequest("Tank1", RawPath, "ack it")], CancellationToken.None);
|
||||
|
||||
ack.Calls.ShouldHaveSingleItem();
|
||||
ack.Calls[0].AlarmRef.ShouldBe(fullRef);
|
||||
}
|
||||
|
||||
/// <summary>lmxopcua#895: with no usable SourceObjectReference the <c>Provider!Area.</c> prefix is stripped
|
||||
/// to find the picker-authored tag.</summary>
|
||||
[Fact]
|
||||
public void ResolveAlarmRawPath_StripsProviderAndArea_WhenSourceReferenceDoesNotMatch()
|
||||
{
|
||||
using var driver = new GalaxyDriver("g", OptsWithRawTags(), hierarchySource: null);
|
||||
|
||||
driver.ResolveAlarmRawPath("Galaxy!Area1.Tank1.Level", sourceObjectReference: "").ShouldBe(RawPath);
|
||||
driver.ToAlarmAckReference(RawPath).ShouldBe("Galaxy!Area1.Tank1.Level");
|
||||
}
|
||||
|
||||
/// <summary>lmxopcua#895: a tag authored with the full provider-qualified reference still resolves directly,
|
||||
/// and an alarm no authored tag matches keeps the identity fallback (nothing learned).</summary>
|
||||
[Fact]
|
||||
public void ResolveAlarmRawPath_DirectMatchAndUnmatchedIdentity_AreUnchanged()
|
||||
{
|
||||
var opts = OptsWithRawTags() with
|
||||
{
|
||||
RawTags = [new RawTagEntry(RawPath, "{\"attributeRef\":\"Galaxy!Area1.Tank1.Level\"}", false)],
|
||||
};
|
||||
using var driver = new GalaxyDriver("g", opts, hierarchySource: null);
|
||||
|
||||
driver.ResolveAlarmRawPath("Galaxy!Area1.Tank1.Level", "Tank1.Level").ShouldBe(RawPath);
|
||||
driver.ToAlarmAckReference(RawPath).ShouldBe("Galaxy!Area1.Tank1.Level");
|
||||
driver.ResolveAlarmRawPath("Galaxy!Area1.Other.Attr", "Other.Attr").ShouldBe("Galaxy!Area1.Other.Attr");
|
||||
driver.ToAlarmAckReference("Galaxy!Area1.Other.Attr").ShouldBe("Galaxy!Area1.Other.Attr");
|
||||
}
|
||||
|
||||
// ===== helpers / fakes =====
|
||||
|
||||
private static GalaxyAttribute Attr(string name, int sec)
|
||||
|
||||
Reference in New Issue
Block a user