Public repository: timo / feel

Reader

An interpreter of FEEL, written in Rust, with integrations for PostgreSQL, WASM, Lua, and Python.

docs: ADR-42 + ROADMAP/README — 0009-invocation-arithmetic BKM-invocation coverage

public

docs: ADR-42 + ROADMAP/README — 0009-invocation-arithmetic BKM-invocation coverage

Records that the compliance-level-2 BKM-invocation suite required no engine or
ingester changes: the __result wrapper, positional invocation with typed parameters
(§10.3.2.13.2), arithmetic operators, and structured-input path access were all
already fully operational. This is the first arithmetic suite to combine BKM inlining
with invocation (the canonical §10.6.5 "Calculation" pattern).

Updates the running suite count to 2964 cases / 97 files.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Changeset0a59fdb55cfcfbfc1fed10568987464464f611d9
Author (claimed)Timo Stolz <timo.stolz@gmail.com>,
Parents3f9b0a90d291
Children
Pushlog
by timo via ssh

modified DECISIONS.md +29 −0

@@ -1975,3 +1975,32 @@
19751975
 
19761976
 - **Fixtures ingested:** `0008-LX-arithmetic` (compliance-level-2) — 3 cases,
19771977
   `f64_epsilon`. **Suite 2958 → 2961.**
1978
+
1979
+## ADR-42: 0009-invocation-arithmetic — BKM invocation + arithmetic (compliance-level-2)
1980
+
1981
+- **Context:** The compliance-level-2 suite `0009-invocation-arithmetic` exercises
1982
+  a BKM-backed literal-expression decision `MonthlyPayment` whose FEEL expression is
1983
+  `PMT(Loan.amount, Loan.rate, Loan.term)+fee`. The BKM `PMT` is a user-defined
1984
+  `function(p: number, r: number, n: number)` with body `(p*r/12)/(1-(1+r/12)**-n)`.
1985
+  Inputs are a structured `Loan : tLoan {amount, rate, term : number}` and scalar
1986
+  `fee : number`. Three test cases vary the loan parameters; `fee` is fixed at 100.
1987
+  Expected decimal results (2878.69…, 662.70…, 2961.03…) are exactly the ADR-41
1988
+  PMT values plus `fee`.
1989
+
1990
+- **Decision:** Ingest the suite as-is — no engine or ingester changes were required.
1991
+  The ingester's `_inline_bkms` path rewrites the BKM-backed decision into a
1992
+  self-contained `{PMT: function(...) ..., __result: PMT(Loan.amount, ...)+fee}.__result`
1993
+  expression (the same `__result` wrapper introduced for `0082-feel-coercion`).
1994
+  Invocation with positional args, typed-parameter binding (§10.3.2.13.2), implicit
1995
+  coercion (§10.3.2.9.4), arithmetic including left-associative `**` and unary minus
1996
+  tighter than `**` (ADR-8), and structured-input path access (ADR-41) are all fully
1997
+  operational. Numeric results use `f64_epsilon` (epsilon=1e-8) via the
1998
+  `decimal-vs-f64` deviation (ADR-2 / ADR-6).
1999
+
2000
+- **Consequence:** First compliance-level-2 suite that combines BKM inlining with
2001
+  positional invocation and arithmetic — the canonical §10.6.5 "Calculation" pattern
2002
+  from the spec. The f64 error for the loan values (~1e-11 absolute) is well within the
2003
+  1e-8 epsilon, so no epsilon widening was needed.
2004
+
2005
+- **Fixtures ingested:** `0009-invocation-arithmetic` (compliance-level-2) — 3 cases,
2006
+  `f64_epsilon`. **Suite 2961 → 2964.**

modified README.md +5 −3

@@ -137,7 +137,7 @@
137137
 `context put` *overloads* whose name is absent from the single-row table
138138
 (`date(from: …)`, `context put(…, keys: …)`; see `NAMED_ARG_OVERLOAD_SKIPS`).
139139
 
140
-The fixtures used by the test (96 files, ~2961 self-contained cases) are
140
+The fixtures used by the test (97 files, ~2964 self-contained cases) are
141141
 regenerated by pointing the script at each TCK dir, e.g.:
142142
 
143143
 ```sh
@@ -158,8 +158,10 @@
158158
   -o crates/feel-core/tests/fixtures/0070-instance-of.json
159159
 ```
160160
 
161
-The other ingested dirs include `0008-LX-arithmetic` (compliance-level-2, structured-input
162
-loan payment formula; ADR-41), `0100/0101/0102-feel-constants` (compliance-level-2,
161
+The other ingested dirs include `0009-invocation-arithmetic` (compliance-level-2, BKM
162
+invocation + arithmetic, canonical §10.6.5 calculation pattern; ADR-42),
163
+`0008-LX-arithmetic` (compliance-level-2, structured-input loan payment formula; ADR-41),
164
+`0100/0101/0102-feel-constants` (compliance-level-2,
163165
 boolean/number/string literal constants; ADR-40), `0105-feel-math` (compliance-level-2),
164166
 `0064`/`0065`/`0066` (and/or/not), `0071-feel-between`, `0075-feel-exponent`,
165167
 `0099-arithmetic-negation`, the single-word `feel-*-function` dirs (ADR-15), and

modified ROADMAP.md +7 −1

@@ -7,7 +7,7 @@
77
 without re-deriving the analysis.
88
 
99
 Coverage figures are case counts from `tools/ingest_tck.py` over the DMN-TCK
10
-compliance-level-3 suites. Today the fixture suite is **2961 cases / 96 files**
10
+compliance-level-3 suites. Today the fixture suite is **2964 cases / 97 files**
1111
 (`cargo test -p feel-core --test fixtures_test -- --nocapture`).
1212
 
1313
 ---
@@ -268,6 +268,12 @@
268268
   a structured `tLoan` context input. No engine or ingester change was needed —
269269
   `<component>` nesting, `Value::Context` binding, and path access were already
270270
   fully operational. **Suite 2958 → 2961.**
271
+- **BKM invocation + arithmetic — `0009-invocation-arithmetic`** ✅ **shipped (ADR-42).**
272
+  `0009-invocation-arithmetic` (compliance-level-2) — 3 cases: BKM-backed decision
273
+  `PMT(Loan.amount, Loan.rate, Loan.term)+fee` with `PMT` inlined via the `__result`
274
+  wrapper. First suite combining BKM inlining with positional invocation and arithmetic
275
+  (canonical §10.6.5 "Calculation" pattern). No engine or ingester change needed.
276
+  **Suite 2961 → 2964.**
271277
 - **Emoji / non-XID names** as bare context keys (`{🐎: "bar"}`,
272278
   `0083-feel-unicode`) — the lexer accepts XID identifiers only; 2 cases skipped
273279
   (`NON_XID_NAME_SKIPS`).