Merge scripting follow-ups: dynamic tag paths are editor warnings where the gate accepts them, one rule owns the split (#1083); returned collections materialised + capped identically in both runners, heartbeat tests sized for whole-process stalls (#1092); Calculation-mode {{equip}} hover (#1093)
This commit is contained in:
+28
-11
@@ -124,7 +124,7 @@ the `ConfigEditor` authorization policy (`AdminUiPolicies.ConfigEditor`: Adminis
|
||||
|
||||
| Route | Request DTO | Response DTO | Purpose |
|
||||
|-------|-------------|--------------|---------|
|
||||
| `POST /api/script-analysis/diagnostics` | `DiagnoseRequest(Code)` | `DiagnoseResponse(Markers)` | Roslyn + ForbiddenType + dynamic-path error markers |
|
||||
| `POST /api/script-analysis/diagnostics` | `DiagnoseRequest(Code)` | `DiagnoseResponse(Markers)` | Roslyn + ForbiddenType + dynamic-path markers (error for a predicate, warning otherwise — #1083) |
|
||||
| `POST /api/script-analysis/completions` | `CompletionsRequest(CodeText, Line, Column)` | `CompletionsResponse(Items)` | Scope, dot-member, and tag-path completions |
|
||||
| `POST /api/script-analysis/hover` | `HoverRequest(CodeText, Line, Column)` | `HoverResponse(Markdown?)` | Type + XML doc markdown |
|
||||
| `POST /api/script-analysis/signature-help` | `SignatureHelpRequest(CodeText, Line, Column)` | `SignatureHelpResponse(Label?, Parameters?, ActiveParameter)` | Parameter help |
|
||||
@@ -212,9 +212,10 @@ scripted alarms are the script's only users, and to *value* otherwise; pick whic
|
||||
seam you are authoring for. The per-equipment VirtualTag editor is value mode and the
|
||||
Calculation tag editor is Calculation mode. A body that lacks a `return` on some path
|
||||
(CS0161) is flagged while you type since #1063 (it used to be filtered as a "phantom"
|
||||
wrapper diagnostic while the gate refused it). Known remaining divergence: a dynamic
|
||||
tag path (`OTSCRIPT_DYNPATH`) is an editor error in every mode but a gate refusal only
|
||||
for a predicate. See `docs/VirtualTags.md` §"Deploy-time script compile gate" for
|
||||
wrapper diagnostic while the gate refused it). A dynamic tag path (`OTSCRIPT_DYNPATH`)
|
||||
is an editor **error** only in predicate mode, where the gate refuses it, and a
|
||||
**warning** in value and Calculation mode, where it deploys (#1083 — it used to be an
|
||||
error in every mode). See `docs/VirtualTags.md` §"Deploy-time script compile gate" for
|
||||
modes, caching and the upgrade note.
|
||||
|
||||
### Runtime safety (what happens after publish)
|
||||
@@ -263,7 +264,11 @@ scripted-alarm predicates) runs scripts through the shared `ScriptRunGuard`:
|
||||
caps a returned array / collection) with a failed run (Bad, script log) — not a timeout strike. A lazy
|
||||
sequence whose element type is `object`, an interface or another collection is refused: the host
|
||||
copies and compares a returned array recursively, so an open-slot array can nest or contain itself.
|
||||
Arrays, lists, strings and scalars are unchanged. **Still in-process-only limits** (the boundary is
|
||||
A concrete collection (`List<double>`, `HashSet<string>`, `Queue<long>`, …) gets the same treatment
|
||||
since #1092 — it is held to the cap by its `Count`, then copied into the same typed array
|
||||
(`double[]`, …), and refused for an open element type (`List<object>`) — because the out-of-process
|
||||
worker's wire carries arrays but no collection type (it used to answer `unsupported type` while the
|
||||
in-process runner returned the list itself). Arrays, strings and scalars are unchanged. **Still in-process-only limits** (the boundary is
|
||||
`Scripting:Runner=OutOfProcess`): memory exhaustion inside a run (the sample is after the fact), a
|
||||
non-terminating loop (an orphan thread, then quarantine) and the same two inside an enumerated
|
||||
sequence. See `docs/VirtualTags.md` §"Known resource limits (accepted trade-offs)". The out-of-process
|
||||
@@ -314,11 +319,20 @@ scripted-alarm predicates) runs scripts through the shared `ScriptRunGuard`:
|
||||
`DependencyExtractor.Extract(code).Rejections` enumerates every `ctx.GetTag` /
|
||||
`ctx.SetVirtualTag` call whose first argument is NOT a string literal (variable,
|
||||
concatenation, interpolation). Each rejection carries a `TextSpan` in
|
||||
user-source coordinates, emitted as code `OTSCRIPT_DYNPATH`. This is the exact
|
||||
check the deploy gate (and the scripted-alarm load) enforces for a scripted-alarm
|
||||
predicate — the editor shows the squiggle where the literal must appear. In value
|
||||
and Calculation mode the editor marks it an error too, but the gate does not refuse
|
||||
it there: a known editor-stricter divergence, excluded from `EditorGateParityTests`.
|
||||
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),
|
||||
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**
|
||||
(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
|
||||
are what gets subscribed and what re-triggers the script), so a dynamic read returns
|
||||
Bad (`BadNodeIdUnknown`, null value) unless the same path is also read with a literal
|
||||
elsewhere in the script; an empty literal path always reads Bad (and an empty
|
||||
`SetVirtualTag` path throws). Making the gate refuse these in value/Calculation scripts
|
||||
was declined — it would reject configurations that deploy today. `EditorGateParityTests`
|
||||
carries dynamic, concatenated, interpolated and empty paths in all three modes.
|
||||
|
||||
---
|
||||
|
||||
@@ -520,7 +534,10 @@ inline script panel):
|
||||
|
||||
- **Hover** — hovering a `{{equip}}/<RefName>` path literal shows an
|
||||
*"Equipment-relative path — resolved through the equipment's tag reference at
|
||||
deploy"* note.
|
||||
deploy"* note. In **Calculation** mode it instead says the token is refused there and
|
||||
why — a Calculation tag is raw/device-level with no owning equipment, so nothing
|
||||
substitutes it and the deploy gate refuses the script (#1093, matching the
|
||||
`OTSCRIPT_EQUIPCALC` marker on the same span). This hover needs no tag catalog.
|
||||
- **Completions** — typing `{{equip}}/` inside a `GetTag`/`SetVirtualTag` literal
|
||||
offers the owning equipment's **reference effective names** (needs an equipment
|
||||
context; inert on the shared ScriptEdit page).
|
||||
|
||||
+5
-3
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user