refactor(scripted-alarms): #1101 the alarm load refuses a predicate's tag paths through ScriptCompileRules, not its own copy of the rule

ScriptedAlarmEngine.PreparePredicates called DependencyExtractor and refused on !IsValid — a second copy of
the rule ScriptCompileRules owns since #1083 (RefusesNonLiteralTagPaths / TagPathFindings), which the deploy
gate and the editor read. Now ScriptCompileRules.PathRefusals(kind, source, extraction?) is the one verdict
and text ("dependency extraction rejected — …") for both the gate (RoslynDeployScriptChecker) and the engine.
TagPathFindings takes an optional extraction so the engine, which still needs the extraction's Reads, parses
once. Behaviour identical: for AlarmPredicate every rejection refuses with its extractor message, joined "; ".

ScriptedAlarmEngineTagPathRuleParityTests runs 8 predicates (literal, two literals, variable, concatenated,
interpolated, empty, two refusals, dynamic beside a literal) through the gate and a real engine load and
asserts refused <=> refused with the gate's exact text; plus a control that the table holds both outcomes.
Mutation: an engine rule that refuses only empty paths fails 6 of 8 rows.
This commit is contained in:
Joseph Doherty
2026-12-04 17:38:16 -05:00
parent 59be7378d6
commit d28ea4a66a
5 changed files with 123 additions and 14 deletions
+6 -2
View File
@@ -331,9 +331,13 @@ scripted-alarm predicates) runs scripts through the shared `ScriptRunGuard`:
concatenation, interpolation). Each rejection carries a `TextSpan` in
user-source coordinates, emitted as code `OTSCRIPT_DYNPATH`. Which seams it refuses is
decided in `ScriptCompileRules` (#1083): `RefusesNonLiteralTagPaths(kind)` is true for a
scripted-alarm predicate only (the alarm load runs the extractor and refuses the alarm),
scripted-alarm predicate only (the alarm load refuses the alarm),
and `TagPathFindings(kind, source)` returns each rejection with a `Refuses` flag. The
deploy gate refuses on exactly those findings, and the editor draws them as an **error**
deploy gate and the scripted-alarm load (`ScriptedAlarmEngine`) both refuse through
`ScriptCompileRules.PathRefusals` — the same findings, the same `dependency extraction
rejected — …` text (#1101: the load used to apply its own copy of the rule;
`ScriptedAlarmEngineTagPathRuleParityTests` pins engine verdict == gate verdict) — and the
editor draws them as an **error**
(severity 8) where `Refuses` and a **warning** (severity 4) otherwise — so the two cannot
drift. In value and Calculation mode the warning says what the path does at runtime:
those seams read only their *declared* inputs (the literal `ctx.GetTag` paths, which