Repository navigation
Expressions and ${{ }} templates in workflow definitions now use Risor v3 (v3.0.0-rc.3) instead of deepnoodle-ai/expr (#129).
Warning
Breaking change for workflow definitions using expr-only syntax. There is no compatibility mode. Upgrade the root and submodule packages together.
Modules
| Module | Version |
|---|---|
github.com/deepnoodle-ai/workflow |
v0.2.0 |
github.com/deepnoodle-ai/workflow/postgres |
postgres/v0.2.0 |
github.com/deepnoodle-ai/workflow/sqlite |
sqlite/v0.2.0 |
github.com/deepnoodle-ai/workflow/decisions |
decisions/v0.2.0 |
What changed
- Risor v3 expressions and type checking:
Loadchecks and compiles every expression and${{ }}template with Risor's checker and structural type API, reporting types and did-you-mean field suggestions (#129). - Converging alternatives as host facts:
Loaddeclares converging branch alternatives to Risor (SomeNotNull), so(report ?? approve).verdicttype-checks without?.. - Deterministic execution limits: Expression runs enforce Risor's exact step (
1,000,000), allocation (1,000,000units), and depth (200) limits;Loadenforces Risor's check deadline and complexity bounds. - Stricter checking:
len(x)and list methods reject nullable values (writelen(x ?? [])), conditions that can never change fail atLoad, and division by literal zero fails atLoad.
Migrating expressions from v0.1.x
v0.1.x (expr) |
v0.2.0 (Risor v3) |
|---|---|
a.n != nil |
a.n != null |
coalesce(a.n, 0) + 1 |
(a.n ?? 0) + 1 |
coalesce(report, approve).verdict |
(report ?? approve).verdict |
filter(verify, it.confirmed) |
verify.filter(it => it.confirmed) |
any(xs, it.ok), all(xs, it.ok) |
xs.some(x => x.ok), xs.every(x => x.ok) |
map(xs, it.id), count(xs, it.ok) |
xs.map(x => x.id), xs.count(x => x.ok) |
upper(s), lower(s), sum(xs) |
s.toUpperCase(), s.toLowerCase(), xs.sum() |
input.items | filter(it > 1) |
input.items.filter(it => it > 1) |
if(c, "yes", "no") |
c ? "yes" : "no" |
try(a.n, 0) |
try { a.n } catch { 0 } (use ?? for null) |
a.n ?? 0 > 1 |
(a.n ?? 0) > 1 |
len(input.labels) (optional) |
len(input.labels ?? []) |
concat(xs, "extra") |
concat(xs, ["extra"]) |
switch on a numeric enum |
Requires a default (Risor 3.0 has string literal types only) |
Reserved step names now follow Risor v3: null, const, else, in, not, catch, match, as, is, let, var, for, while, do, break, continue, return, function, throw, finally, import, fail, fixed, range, type, and walk are newly reserved, while it and expr-only functions (split, upper, filter, map, count, coalesce, …) are now allowed as step names.
Full changelog: v0.1.2...v0.2.0