feat(m9/T28b): trigger analysis-kind selector (UI) + --trigger-kind (CLI)

Surfaces the T28a backend "analysisKind" discriminator in both authoring
surfaces: an Advisory|Strict <select> (id="alarm-trigger-kind" /
"script-trigger-kind") added to the Expression fragment of
AlarmTriggerEditor and ScriptTriggerEditor, and a --trigger-kind option
on template alarm/script add+update in the CLI.

Key/value contract: "analysisKind":"Strict" when strict; key omitted for
Advisory — exactly as ValidationService.IsStrictAnalysis reads it.
Selector only shown for Expression triggers; non-Expression triggers do
not emit the key even if IsStrictAnalysisKind is set on the model.

Both projects build 0 warnings; 101 CentralUI Trigger tests + 33 CLI
Template tests pass.
This commit is contained in:
Joseph Doherty
2026-06-18 10:44:57 -04:00
parent f618ac0322
commit dcc6f623e2
8 changed files with 684 additions and 2 deletions
@@ -42,6 +42,16 @@ internal sealed class ScriptTriggerModel
/// <summary>Fire mode (Conditional + Expression). Defaults to <see cref="ScriptTriggerMode.OnTrue"/>.</summary>
public ScriptTriggerMode Mode { get; set; } = ScriptTriggerMode.OnTrue;
// M9-T28b: per-trigger analysis kind (Expression only). When true the
// codec serializes "analysisKind":"Strict"; when false (Advisory, the
// default) the key is omitted. Matches ValidationService.IsStrictAnalysis.
/// <summary>
/// When <see langword="true"/>, the trigger config carries
/// <c>"analysisKind":"Strict"</c> so ValidationService escalates the
/// blank-expression advisory to a deploy-blocking error.
/// </summary>
public bool IsStrictAnalysisKind { get; set; }
}
/// <summary>
@@ -148,6 +158,15 @@ internal static class ScriptTriggerConfigCodec
case ScriptTriggerKind.Expression:
model.Expression = root.TryGetProperty("expression", out var e) ? e.GetString() : null;
model.Mode = ReadMode(root);
// M9-T28b: read optional analysisKind discriminator (matches
// ValidationService.IsStrictAnalysis — "Strict" case-insensitive → strict;
// absent/"Advisory"/anything else → Advisory default).
if (root.TryGetProperty("analysisKind", out var ak)
&& ak.ValueKind == JsonValueKind.String)
{
model.IsStrictAnalysisKind = string.Equals(
ak.GetString(), "Strict", StringComparison.OrdinalIgnoreCase);
}
break;
}
}
@@ -196,6 +215,10 @@ internal static class ScriptTriggerConfigCodec
case ScriptTriggerKind.Expression:
w.WriteString("expression", model.Expression ?? "");
w.WriteString("mode", model.Mode.ToString());
// M9-T28b: emit "analysisKind":"Strict" only when explicitly set;
// Advisory is the default so the key is omitted to stay backward-compatible.
if (model.IsStrictAnalysisKind)
w.WriteString("analysisKind", "Strict");
break;
// Call → empty object.