Skip to content

RuleScript v1.10.0-rc1.4

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 07 Jul 05:32

RuleScript v1.10.0-rc1.4

RuleScript v1.10.0-rc1.4 corrects HostTrigger runtime lifetime behavior when a trigger dispatcher waits for host requests inside parallel.

HostTrigger Runtime Lifetime

trigger task dispatchers now remain active after a single HostTrigger request is handled. When the runtime is started with StartAsync, a dispatcher waiting on dispatch; continues waiting for future trigger requests instead of completing the runtime after the first request.

parallel:
    trigger task:
        dispatch;
    end
end

@HostTrigger("HostPrint")
function HostPrint(msg: string):
    Print(msg);
end
var engine = new RuleScriptEngine
{
    ExecutionTimeoutEnabled = false
};

var runtime = engine.CreateRuntime(script);
var running = runtime.StartAsync();

await runtime.TriggerAsync("HostPrint", ["hello"]);

Console.WriteLine(runtime.State);       // Running
Console.WriteLine(running.IsCompleted); // False

await runtime.TriggerAsync("HostPrint", ["again"]);

await runtime.StopAsync();
await running;

Built-in Function Handling

HostTrigger handlers continue to execute through the normal interpreter function path. Built-in functions such as Print remain built-ins and are not treated as host functions registered by the embedding application.

This preserves the existing behavior where:

  • Print(msg) emits the runtime print event.
  • Host function thread-safety checks apply only to registered host functions.
  • HostTrigger handler execution does not require special casing for built-in functions.

Compatibility Notes

  • Existing parallel, trigger task, and dispatch syntax is unchanged.
  • Existing HostTrigger metadata and request queue behavior is unchanged.
  • StartAsync remains active for long-running HostTrigger runtimes until StopAsync is called.
  • Built-in function behavior is unchanged.

Validation

This release candidate is covered by tests for:

  • dispatching a HostTrigger request without completing StartAsync
  • keeping the runtime state as Running after a single trigger request
  • using the built-in Print function from a HostTrigger handler
  • existing HostTrigger FIFO and metadata behavior
  • full regression coverage