feat(native-alarms): per-binding IsMesReportable on native alarm source bindings (ScadaBridge#59)

TemplateNativeAlarmSource.IsMesReportable + tri-state InstanceNativeAlarmSourceOverride
.IsMesReportableOverride flatten onto ResolvedNativeAlarmSource; NativeAlarmActor stamps every
mirrored condition and InstanceActor the quiet-binding placeholder, so ScriptAlarm,
Alarms.MesReportableAsync() and the #60 wire fields carry it. Additive to the 900-999 severity band.
Migration AddNativeAlarmSourceMesReportable. Management commands, CLI --mes-reportable, Central UI
(template dialog checkbox, instance override select), Transport DTOs/importer/diff and the revision
hash (true-only, so existing hashes are unchanged) carry it.

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
Joseph Doherty
2026-11-09 15:09:54 -05:00
parent 69a2017000
commit f98369a786
38 changed files with 2579 additions and 43 deletions
@@ -651,9 +651,10 @@ public static class InstanceCommands
var setConnectionOption = new Option<string?>("--connection") { Description = "Connection name override (blank = inherited)" };
var setSourceRefOption = new Option<string?>("--source-ref") { Description = "Source reference override (blank = inherited)" };
var setFilterOption = new Option<string?>("--filter") { Description = "Condition filter override (blank = inherited)" };
var setMesOption = new Option<bool?>("--mes-reportable") { Description = "MES-reportable override for the binding: true or false; omit to inherit" };
var setCmd = new Command("set") { Description = "Set (upsert) a native alarm source override on an instance" };
setCmd.Add(setIdOption); setCmd.Add(setSourceOption); setCmd.Add(setConnectionOption);
setCmd.Add(setSourceRefOption); setCmd.Add(setFilterOption);
setCmd.Add(setSourceRefOption); setCmd.Add(setFilterOption); setCmd.Add(setMesOption);
setCmd.SetAction(async (ParseResult result) =>
{
return await CommandHelpers.ExecuteCommandAsync(
@@ -663,7 +664,8 @@ public static class InstanceCommands
result.GetValue(setSourceOption)!,
result.GetValue(setConnectionOption),
result.GetValue(setSourceRefOption),
result.GetValue(setFilterOption)));
result.GetValue(setFilterOption),
result.GetValue(setMesOption)));
});
group.Add(setCmd);
@@ -180,6 +180,7 @@ public static class TemplateCommands
var filterOption = new Option<string?>("--filter") { Description = "Condition filter; omit to clear and mirror all conditions" };
var descriptionOption = new Option<string?>("--description") { Description = "Description; omit to clear" };
var lockedOption = new Option<bool>("--locked") { Description = "Lock status; omit for unlocked" };
var mesOption = new Option<bool>("--mes-reportable") { Description = "Every condition under this binding is MES-reportable (additive to the 900-999 severity band); omit for false" };
var cmd = new Command("update") { Description = "Replace the fields of a native alarm source binding" };
cmd.Add(idOption);
cmd.Add(nameOption);
@@ -188,6 +189,7 @@ public static class TemplateCommands
cmd.Add(filterOption);
cmd.Add(descriptionOption);
cmd.Add(lockedOption);
cmd.Add(mesOption);
cmd.SetAction(async (ParseResult result) =>
{
return await CommandHelpers.ExecuteCommandAsync(
@@ -195,7 +197,8 @@ public static class TemplateCommands
new UpdateTemplateNativeAlarmSourceCommand(
result.GetValue(idOption), result.GetValue(nameOption)!,
result.GetValue(connectionOption)!, result.GetValue(sourceOption)!,
result.GetValue(filterOption), result.GetValue(descriptionOption), result.GetValue(lockedOption)));
result.GetValue(filterOption), result.GetValue(descriptionOption), result.GetValue(lockedOption),
result.GetValue(mesOption)));
});
return cmd;
}
@@ -838,6 +841,8 @@ public static class TemplateCommands
var descOption = new Option<string?>("--description") { Description = "Description" };
var lockedOption = new Option<bool>("--locked") { Description = "Lock status" };
lockedOption.DefaultValueFactory = _ => false;
var mesOption = new Option<bool>("--mes-reportable") { Description = "Every condition under this binding is MES-reportable (additive to the 900-999 severity band)" };
mesOption.DefaultValueFactory = _ => false;
var addCmd = new Command("add") { Description = "Add a native alarm source binding to a template" };
addCmd.Add(templateIdOption);
@@ -847,6 +852,7 @@ public static class TemplateCommands
addCmd.Add(filterOption);
addCmd.Add(descOption);
addCmd.Add(lockedOption);
addCmd.Add(mesOption);
addCmd.SetAction(async (ParseResult result) =>
{
return await CommandHelpers.ExecuteCommandAsync(
@@ -858,7 +864,8 @@ public static class TemplateCommands
result.GetValue(sourceRefOption)!,
result.GetValue(filterOption),
result.GetValue(descOption),
result.GetValue(lockedOption)));
result.GetValue(lockedOption),
result.GetValue(mesOption)));
});
group.Add(addCmd);
+6 -4
View File
@@ -333,7 +333,7 @@ Bind a native alarm source to a template — a read-only mirror of an OPC UA Ala
Conditions server's or the MxAccess Gateway's alarms (no ack-back).
```sh
scadabridge --url <url> template native-alarm-source add --template-id <int> --name <string> --connection <string> --source-ref <string> [--filter <string>] [--description <string>] [--locked]
scadabridge --url <url> template native-alarm-source add --template-id <int> --name <string> --connection <string> --source-ref <string> [--filter <string>] [--description <string>] [--locked] [--mes-reportable]
```
| Option | Required | Description |
@@ -345,6 +345,7 @@ scadabridge --url <url> template native-alarm-source add --template-id <int> --n
| `--filter` | no | Condition filter (omit to mirror all conditions under the source) |
| `--description` | no | Description |
| `--locked` | no | Lock the binding in derived templates |
| `--mes-reportable` | no | Every condition under this binding is MES-reportable (additive to the 900-999 severity band) |
#### `template native-alarm-source list`
@@ -359,10 +360,10 @@ scadabridge --url <url> template native-alarm-source list --template-id <int>
Replace the fields of an existing native alarm source binding.
```sh
scadabridge template native-alarm-source update --id <source-id> --name <name> --connection <name> --source-ref <reference> [--filter <expression>] [--description <text>] [--locked]
scadabridge template native-alarm-source update --id <source-id> --name <name> --connection <name> --source-ref <reference> [--filter <expression>] [--description <text>] [--locked] [--mes-reportable]
```
The ID, name, connection, and source reference are required. Omitted filter and description clear those values; omitted `--locked` means unlocked. Requires Designer access; the server enforces locking rules.
The ID, name, connection, and source reference are required. Omitted filter and description clear those values; omitted `--locked` means unlocked and omitted `--mes-reportable` means not MES-reportable. Requires Designer access; the server enforces locking rules.
#### `template native-alarm-source remove`
@@ -621,7 +622,7 @@ Override an inherited native alarm source binding for a single instance (upsert)
options keep the inherited value.
```sh
scadabridge --url <url> instance native-alarm-source set --instance-id <int> --source <string> [--connection <string>] [--source-ref <string>] [--filter <string>]
scadabridge --url <url> instance native-alarm-source set --instance-id <int> --source <string> [--connection <string>] [--source-ref <string>] [--filter <string>] [--mes-reportable <true|false>]
```
| Option | Required | Description |
@@ -631,6 +632,7 @@ scadabridge --url <url> instance native-alarm-source set --instance-id <int> --s
| `--connection` | no | Connection name override (blank = inherited) |
| `--source-ref` | no | Source reference override (blank = inherited) |
| `--filter` | no | Condition filter override (blank = inherited) |
| `--mes-reportable` | no | MES-reportable override for the binding: `true` or `false` (omit = inherited) |
#### `instance native-alarm-source clear`