fix(scripting): #1104 a jagged-array script result is refused identically in both runners
int[][] / byte[][] used to be the one result divergence left after #1100: in process ScriptResultMaterializer passed it (SdkValueBoundary.FromClr carries it as an array of Variants), while the worker's wire has no nested-array tag and answered "unsupported type". A script-fed node has a scalar DataType, so a Variant-of-arrays value is not what it declares either; not documented as a feature anywhere (only noted as the known divergence). Decision: refuse, via the shared rule. - IsPublishable: a 1-D array's element must be a PublishableScalarTypes scalar (no recursion). - EnsurePublishable: a nested array gets its own reason, still "... which an OPC UA node cannot carry: an array of arrays ...", with a flatten hint (SelectMany). Same "script threw: ..." text in both runners. - SdkValueBoundaryScriptResultTests: int[][] leaves the rule==FromClr theory; a separate fact pins the one deliberate difference (FromClr takes it, the rule refuses). - ParityTests: "jagged array" + "jagged byte array" rows. ShadowModeTests census: the jagged script now MATCHES; the unsupported_type mismatch is exercised by a decimal INPUT (design §14 #11), the real remaining worker-only refusal. - ContainmentTests.Unsupported_input_and_result_types: jagged now expects the materializer reason. Mutation: restoring the recursive element check fails 4 tests (2 parity rows, shadow census, containment unsupported-type). Behaviour change: a value script returning a jagged array now fails (Bad + script log) in process too, instead of publishing a Variant array onto a scalar-typed node.
This commit is contained in:
@@ -273,7 +273,8 @@ scripted-alarm predicates) runs scripts through the shared `ScriptRunGuard`:
|
||||
return null, a `bool`, an integer type, `float`, `double`, `string`, `DateTime` or `Guid`, or a
|
||||
one-dimensional array of one of them (`ScriptResultMaterializer.PublishableScalarTypes` — exactly what
|
||||
the server's OPC UA value boundary turns into a built-in Variant). Anything else — a `Dictionary`
|
||||
(it becomes `KeyValuePair<K,V>[]`), a `decimal`, an enum, a `TimeSpan`, a `char`, a tuple, a 2-D array —
|
||||
(it becomes `KeyValuePair<K,V>[]`), a `decimal`, an enum, a `TimeSpan`, a `char`, a tuple, a 2-D array, a
|
||||
jagged array (`int[][]` — #1104; it used to publish in process only, flatten it with `SelectMany`) —
|
||||
fails the run (Bad, script log) in both runners with `script threw: The script returned a value of type
|
||||
'…', which an OPC UA node cannot carry; …`. ⚠️ Behaviour change: in process such a value used to
|
||||
"succeed" and then fail inside the node write, so the node silently kept its previous value and status
|
||||
|
||||
Reference in New Issue
Block a user