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
|
||||
|
||||
+4
-3
@@ -137,9 +137,10 @@ processes:
|
||||
`KeyValuePair<K,V>[]` — what a returned `Dictionary` becomes — a `decimal`, an enum, a `TimeSpan`, …) is refused by
|
||||
`ScriptResultMaterializer` inside the run in BOTH runners, with the same `script threw: … which an OPC UA node cannot
|
||||
carry …` reason (lmxopcua#1100: in process it used to pass and then fail in the node write, leaving the node on its
|
||||
previous value and status with only a server-log warning). The one remaining result divergence is a jagged array
|
||||
(`int[][]`): the publish path carries it (as an array of Variants) and the in-process runner returns it, but the wire
|
||||
has no nested-array tag, so the worker answers `unsupported type`. A returned collection (`List<double>`) is copied
|
||||
previous value and status with only a server-log warning). A jagged array
|
||||
(`int[][]`, `byte[][]`) is refused the same way since lmxopcua#1104 (`… cannot carry: an array of arrays …`, with a
|
||||
flatten hint): it used to be the one result divergence — in process it was published as an array of Variants on a node
|
||||
whose DataType is a scalar type, while the wire has no nested-array tag and the worker answered `unsupported type`. A returned collection (`List<double>`) is copied
|
||||
into a typed array by both runners first (lmxopcua#1092).
|
||||
- **Attribution happens before release.** The worker's exit path runs attribution (strike, quarantine, suspect
|
||||
marks) synchronously **before** it completes any evaluation the worker held, so a script killed for its deadline is
|
||||
|
||||
Reference in New Issue
Block a user