fix(triggers): don't false-flag Children/Parent attribute refs in expression validation

This commit is contained in:
Joseph Doherty
2026-05-16 06:08:06 -04:00
parent 5065384305
commit 0a535cd4a5

View File

@@ -428,6 +428,18 @@ public class ValidationService
while ((index = expression.IndexOf(marker, index, StringComparison.Ordinal)) >= 0)
{
// Only treat this as a self-attribute reference when it is not a member
// access. A bare `Attributes["X"]` resolves against the flattened
// configuration; `Children["Pump"].Attributes["X"]` and
// `Parent.Attributes["X"]` are member accesses (preceded by '.') whose
// dotted/composed canonical names cannot be checked against the flat
// self-attribute set — skip them rather than emit a false positive.
if (index > 0 && expression[index - 1] == '.')
{
index += marker.Length;
continue;
}
var cursor = index + marker.Length;
// Skip whitespace between '[' and the literal.
while (cursor < expression.Length && char.IsWhiteSpace(expression[cursor]))