fix(alarms): surface composed-member attributes across flatten/validate/UI
Three layers were each blind to nested composition in different ways: - FlatteningPipeline only loaded compositions for templates in the parent's inheritance chain, so depth-2 composed attributes (e.g. Pump.AlarmSensor.SensorReading) never materialized. Walk composed chains breadth-first so the flattener's nested step has the data it needs. - InstanceConfigure's alarm trigger picker was fed only direct, non-locked attributes, hiding inherited and composed-member paths. Feed it the full flattened attribute list via FlatteningPipeline. - ValidationService.ExtractAttributeNameFromTriggerConfig only recognized "attributeName", silently passing alarms still using the legacy "attribute" key. Accept both keys, matching FlatteningService, AlarmActor, and AlarmTriggerConfigCodec.
This commit is contained in:
@@ -220,11 +220,16 @@ public class ValidationService
|
||||
|
||||
internal static string? ExtractAttributeNameFromTriggerConfig(string triggerConfigJson)
|
||||
{
|
||||
// Accept both keys to stay consistent with FlatteningService.PrefixTriggerAttribute,
|
||||
// AlarmActor.ParseEvalConfig and AlarmTriggerConfigCodec. Old data may still use
|
||||
// "attribute"; the UI codec writes the canonical "attributeName".
|
||||
try
|
||||
{
|
||||
using var doc = JsonDocument.Parse(triggerConfigJson);
|
||||
if (doc.RootElement.TryGetProperty("attributeName", out var prop))
|
||||
return prop.GetString();
|
||||
if (doc.RootElement.TryGetProperty("attribute", out var legacyProp))
|
||||
return legacyProp.GetString();
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user