69a6e0b4c8
v2-ci / unit-tests (push) Waiting to run
Opt-in (Scripting:Runner=OutOfProcess; InProcess stays the default and its code path is unchanged). Implements the P1 slice of docs/plans/2026-11-09-out-of-process-script-runner-design.md with the owner's §14 decisions: - Options: Scripting:Runner (InProcess | Shadow | OutOfProcess), Scripting:Runner:Seams, Scripting:Worker:* (Shards 2, HardGrace max(1 s,T), HeapLimitBytes 512 MiB, QuarantineAfterKills 2, UnavailableGrace 5 s, IsolationProbationRuns 20, PeCacheDir validated absolute + outside the content root (fail closed), ExecutablePath). Shadow is not implemented yet: runs InProcess with a startup Warning. - Core.Scripting: IScriptRunner seam + InProcessScriptRunner (today's guard, the parity baseline). - Core.Scripting.Protocol: protobuf envelopes, 4-byte LE framing (zero/oversize/truncated/garbage refused), Variant carrying the exact CLR type; unsupported types are explicit failures. - ScriptWorker app: compiles in the worker, P-thread scheduler, host-driven soft cancel, fail-fast watchdog, heartbeats, ctx.Logger forwarding, exits on pipe EOF / parent gone, forbidden-assembly self-check; Akka and Grpc.Core.Api excluded from its folder. Shipped in script-worker/ (Build + Publish). - Core.Scripting.OutOfProcess: K shards + isolation worker, soft T / hard T+G kill, attribution (deadline kill = one key; crash = suspects -> isolation; isolation crash = strike), kill-strike quarantine, backoff 250 ms -> 30 s, fail closed, cleared allow-listed env, nonce + pid handshake on a current-user pipe, Windows Job Object. - VirtualTag + Calculation seams use the runner when selected; a runner-side failure (worker restarted / runner unavailable) publishes BadResourceUnavailable (0x80040000) — ScadaBridge#112. Script faults keep BadInternalError. The scripted-alarm seam stays in process (alarms last). Tests: new ZB.MOM.WW.OtOpcUa.ScriptWorker.Tests (Category=ScriptWorker, real processes; green on macOS and on windev/Windows), seam tests in Host/Runtime/Calculation suites; mutation-checked. Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
33 lines
2.0 KiB
XML
33 lines
2.0 KiB
XML
<Project Sdk="Microsoft.NET.Sdk">
|
|
|
|
<!-- lmxopcua#780 — the out-of-process, pre-emptible script runner's worker (design §3, §6). A plain console app the
|
|
host launches per shard over a named pipe. It references only the compile/run core and the frame protocol, so
|
|
the host's cluster, database, OPC UA and secrets stacks are not in its assembly set; it checks itself against
|
|
ScriptWorkerEnvironment.ForbiddenAssemblyPrefixes at runtime as well. -->
|
|
<PropertyGroup>
|
|
<OutputType>Exe</OutputType>
|
|
<RootNamespace>ZB.MOM.WW.OtOpcUa.ScriptWorker</RootNamespace>
|
|
<AssemblyName>ZB.MOM.WW.OtOpcUa.ScriptWorker</AssemblyName>
|
|
<InvariantGlobalization>true</InvariantGlobalization>
|
|
<!-- Workstation, non-concurrent GC: the heap hard limit (DOTNET_GCHeapHardLimit) is the worker's memory bound. -->
|
|
<ServerGarbageCollection>false</ServerGarbageCollection>
|
|
<ConcurrentGarbageCollection>false</ConcurrentGarbageCollection>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<ProjectReference Include="..\..\Core\ZB.MOM.WW.OtOpcUa.Core.Scripting\ZB.MOM.WW.OtOpcUa.Core.Scripting.csproj"/>
|
|
<ProjectReference Include="..\..\Core\ZB.MOM.WW.OtOpcUa.Core.Scripting.Protocol\ZB.MOM.WW.OtOpcUa.Core.Scripting.Protocol.csproj"/>
|
|
</ItemGroup>
|
|
|
|
<!-- Core.Scripting reaches Akka and Grpc.Core.Api transitively through Commons (telemetry meter, log messages),
|
|
none of which the worker executes. Excluding their assets keeps them out of the worker's deps.json and output
|
|
folder, so they are not loadable at all, not merely unloaded (design §6 "assembly allow-list by
|
|
construction"). A code path that did touch them would fail with FileNotFoundException, which the
|
|
containment tests would catch. -->
|
|
<ItemGroup>
|
|
<PackageReference Include="Akka" ExcludeAssets="all" PrivateAssets="all"/>
|
|
<PackageReference Include="Grpc.Core.Api" ExcludeAssets="all" PrivateAssets="all"/>
|
|
</ItemGroup>
|
|
|
|
</Project>
|