diff --git a/CHANGELOG.md b/CHANGELOG.md index ad8aaeca..926575b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,24 @@ fragment in [`changelog.d/`](https://github.com/riddler/statifier-ex/blob/v2.9.0 into the section below at release. See that README for the format and for when a change warrants an entry at all. +## [2.15.0] 2026-10-12 + +A minor release. A host registers named functions a chart may call from +`cond` and `expr` with the new `:function_providers` option, and +`Statifier.compile/2` now refuses a chart whose expressions call a +function nothing declares, with the new `Statifier.Compiler.Error` reason +`{:unknown_function, name, source}`. Such a chart used to compile and +raise `error.execution` at every evaluation of the call; the Changed +bullet says what a host does about it. + +### Added + +- A host registers named functions a chart may call from `cond` and `expr` with the `:function_providers` option, a list of `Predicator.FunctionProvider` modules, on `Statifier.compile/2`, `Statifier.MachineState.new/2` and `Statifier.Session.start_link/2`. A resumed session stamps the list it is given, a recording keeps it for `Statifier.Replay`, and `Statifier.MachineState.put_function_providers/2` re-stamps it on a position a host resumes itself. A provider may not replace `In` or a predicator builtin. `Statifier.compile/2` also accepts `:function_names`, the names alone, for a tool that does not load the modules. See "Host functions for `cond` and `expr`" in `docs/extending.md`. + +### Changed + +- `Statifier.compile/2` refuses a chart whose expressions call a function that is not `In`, a predicator builtin or a declared host function, with a `Statifier.Compiler.Error` whose reason is `{:unknown_function, name, source}`. Such a chart used to compile and raise `error.execution` at every evaluation of the call. Register the function with `:function_providers`, or declare its name with `:function_names`. + ## [2.14.0] 2026-10-11 A minor release with one Breaking entry. `Statifier.Validator.validate/3`, diff --git a/README.md b/README.md index 0f9435bc..405d564e 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Add `statifier` to your dependencies: ```elixir def deps do [ - {:statifier, "~> 2.14"} + {:statifier, "~> 2.15"} ] end ``` diff --git a/changelog.d/st-g648.md b/changelog.d/st-g648.md deleted file mode 100644 index 8c1d8ee1..00000000 --- a/changelog.d/st-g648.md +++ /dev/null @@ -1,7 +0,0 @@ -### Added - -- A host registers named functions a chart may call from `cond` and `expr` with the `:function_providers` option, a list of `Predicator.FunctionProvider` modules, on `Statifier.compile/2`, `Statifier.MachineState.new/2` and `Statifier.Session.start_link/2`. A resumed session stamps the list it is given, a recording keeps it for `Statifier.Replay`, and `Statifier.MachineState.put_function_providers/2` re-stamps it on a position a host resumes itself. A provider may not replace `In` or a predicator builtin. `Statifier.compile/2` also accepts `:function_names`, the names alone, for a tool that does not load the modules. See "Host functions for `cond` and `expr`" in `docs/extending.md`. - -### Changed - -- `Statifier.compile/2` refuses a chart whose expressions call a function that is not `In`, a predicator builtin or a declared host function, with a `Statifier.Compiler.Error` whose reason is `{:unknown_function, name, source}`. Such a chart used to compile and raise `error.execution` at every evaluation of the call. Register the function with `:function_providers`, or declare its name with `:function_names`. diff --git a/docs/upgrading.md b/docs/upgrading.md index 7532ba06..de9651f8 100644 --- a/docs/upgrading.md +++ b/docs/upgrading.md @@ -1,8 +1,8 @@ -# Upgrading from 2.5 to 2.14.0: what a host changes +# Upgrading from 2.5 to 2.15.0: what a host changes This page is for a host: the application that compiles charts, starts executions and supplies the services a chart reaches through `` and -``. For each release from 2.6.0 to 2.14.0 it says what a host must +``. For each release from 2.6.0 to 2.15.0 it says what a host must change to take the release, and then what a host may start doing with it. Where a host must change nothing, the page says NONE. The [Changelog](../CHANGELOG.md) says what the library changed; this page @@ -34,6 +34,13 @@ element, or that matches the validator's reasons exhaustively (the Breaking entry); a host that cancels a budget-halted session with events queued; and a host that waited for a further halted message after a delayed send fired into a budget-halted session. +2.15.0 changes one answer, and its "must change" names the hosts it +reaches: a host whose charts call a function from `cond` or `expr` that +is not `In`, a predicator builtin or a function the host declares, and a +host that matches the compiler's error reasons exhaustively. 2.15.0's +CHANGELOG lists that refusal under Changed, not as a Breaking entry: it +refuses only a chart that calls a function no evaluation context holds, +a call that raised `error.execution` whenever it was evaluated. A dependency requirement of `{:statifier, "~> 2.5"}` already accepts every version on this page. Raise it only when your host calls a function a later release added: each section names the @@ -533,3 +540,48 @@ one element, so the new refusal moves no case. The case schema's descriptions now say that a step's `expect_position` members are compared as JSON values, and that the corpus writes `active_invocations` sorted while the schema does not check the order; no verdict changes. + +## 2.15.0 + +**A host must change:** only where this reaches it. A +`{:statifier, "~> 2.14"}` requirement already accepts 2.15.0. + +- `Statifier.compile/2` refuses a chart whose expressions call a function + that is not `In`, a predicator builtin or a function the host declares, + with a `Statifier.Compiler.Error` whose reason is + `{:unknown_function, name, source}`, located at the element that holds + the call. Before 2.15.0 such a chart compiled, and every evaluation of + the call raised `error.execution`. Register the function with + `:function_providers`, or declare its name with `:function_names`. If + your host matches `Statifier.Compiler.Error`'s reasons exhaustively, add + a clause for the new reason. This includes a chart a host stored before + 2.15.0 and recompiles under it, from its source or from a + `Statifier.Chart` blob. + +**A host may start:** registering named functions a chart may call from +`cond` and `expr` (ADR-0078). Requires `{:statifier, "~> 2.15"}`. + +1. Write a `Predicator.FunctionProvider` module per family of functions. + A function reads only its arguments and the host term: it does no I/O, + reads no clock and no random source, and keeps no state, so a replay or + a resume evaluates it the same. +2. Pass the list as `:function_providers` to `Statifier.compile/2`, + `Statifier.MachineState.new/2` and `Statifier.Session.start_link/2`. + A provider may not replace `In` or a predicator builtin. A list that + does not resolve makes `Statifier.Session.start_link/2` refuse with + `{:error, {:function_providers, reason}}` before it starts anything, + and makes `Statifier.compile/2` and `Statifier.MachineState.new/2` + raise `ArgumentError`. +3. A tool that checks a chart without loading the modules passes + `:function_names`, the names alone, to `Statifier.compile/2`. +4. A session started with `:resume` stamps the list it is given, and a + recording keeps it for `Statifier.Replay`. A host that resumes a + position itself re-stamps the list with + `Statifier.MachineState.put_function_providers/2`. +5. A child session started for an `` does not inherit the list, + and a chart given as `` content cannot call a host function. + +The guide is the section "Host functions for `cond` and `expr`" of +[How to extend Statifier: `` handlers, `` types and host functions](extending.md). + +The conformance corpus does not change in 2.15.0. diff --git a/mix.exs b/mix.exs index 6552123a..b21653e4 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Statifier.MixProject do use Mix.Project - @version "2.14.0" + @version "2.15.0" @source_url "https://github.com/riddler/statifier-ex" def project do