Public repository: timo / feel

Reader

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

docs: ADR-32 + ROADMAP — opaque value-position comparison-test value

public

docs: ADR-32 + ROADMAP — opaque value-position comparison-test value

Records the opaque unary-test value `(< 10)` decision (reflexive,
range-incompatible equality; resolves the `range_006` question ADR-28
left open) and closes the ADR-27 → ADR-32 range arc. Suite 2728 → 2736.

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

modified DECISIONS.md +43 −0

@@ -1157,6 +1157,49 @@
11571157
   semantics; needs a new `Value` variant), which is unrelated to endpoints — and which, once
11581158
   built, is the spec-canonical *value* form of an unbounded range.
11591159
 
1160
+## ADR-32: opaque comparison-test value `(< 10)` in value position (DMN §10.3.4.6)
1161
+
1162
+- **Context:** the last range deferral after ADR-27 → ADR-31 — a parenthesised comparison
1163
+  test in *value* position, `(< 10)` / `(= 10)` / `(!= 10)`. ADR-28 measured its semantics
1164
+  off 0068 and explicitly left it open (the `range_006` question): a desugar to a one-endpoint
1165
+  `Range` was *falsified* — `(< 10) = (null..10)` and `(= 10) = [10..10]` are **false**, while
1166
+  `(< 10) = (< 10)`, `(= 10) = (= 10)`, `(!= 10) = (!= 10)` are **true**. So it equals an
1167
+  *identical test* reflexively but is **never** equal to a `Range`: an opaque unary-test value,
1168
+  not the unbounded range it superficially resembles. The `in`-position forms (`x in (=10)` /
1169
+  `(!=10)`) already worked as *tests* (ADR-28); only this value-position equality was open.
1170
+- **Decision:** model it as a dedicated, opaque `Value` variant — not a `Range`.
1171
+  - **Grammar — one new `Primary` alternative, LR(1)-clean.** `Primary → "(" CmpOp Sum ")"`.
1172
+    No `CmpOp` token is in `FIRST(Expr)`, so seeing a `CmpOp` straight after `(` is an
1173
+    unambiguous new path that never competes with the `"(" Expr ")"` grouping or the
1174
+    `"(" Sum ".." …` range form — `build.rs`'s no-conflict gate passed on the first build.
1175
+    A new AST node `Expr::UnaryTestVal(CmpOp, Box<Expr>)` carries it (distinct from
1176
+    `Expr::Compare`, which has a left operand and yields a boolean).
1177
+  - **Value — a boxed opaque variant.** `Value::UnaryTestVal(Box<UnaryTestVal>)`, payload
1178
+    `{ op: CmpOp, endpoint: Value }`. Boxed so the variant stays one word and `Value` does
1179
+    not grow past 40 bytes (the `value_size_did_not_grow` test). Construction (`eval.rs`)
1180
+    evaluates and `forced`s the endpoint, exactly like a range endpoint.
1181
+  - **Equality — structural, reflexive, range-incompatible.** A new arm pair in
1182
+    `feel_equal_depth`: `(UnaryTestVal, UnaryTestVal)` is a *definite* `false` on a differing
1183
+    operator, else the three-valued equality of the endpoints (so `(<10) = (<10)` is true);
1184
+    `(UnaryTestVal, _)` / `(_, UnaryTestVal)` is a *definite* `false` — against a `Range` or
1185
+    anything else (null/error are settled earlier). This is the crux: a `false`, **not** the
1186
+    type-mismatch error-null the final `_` arm would give, which is what 0068 demands.
1187
+  - **No order, no host type, conforms to nothing but `Any`.** It is not orderable
1188
+    (`as_interval` → `None`, so the Allen relations error-null on it), has no `instance of`
1189
+    type but `Any` (the structural `types.rs` arms only match concrete shapes), and the
1190
+    wrappers (feel-py / feel-lua) cross it out as host `None`/`nil` like a native closure.
1191
+    `string((< 10))` renders the written form `(< 10)` (endpoint quoted as a list member is).
1192
+- **Tests:** `value_position_comparison_test` (the true/false reflexive + range-incompatible
1193
+  pairs, the operator/endpoint structural cases, `string(...)`, and a regression block proving
1194
+  the `in`-position *test* forms are unchanged). Re-ingested **only** `0068-feel-equality` — the
1195
+  ingester's value-position paren-comparison reject now fires only for a *bracket*-led
1196
+  comparison (`[< 10]`, which has no production) not directly after `in`; the paren form is
1197
+  admitted. 0068 **101 → 109** (the eight `range_006`/`range_007…012` cases, incl. the
1198
+  ADR-28-deferred `range_006`). Suite **2728 → 2736**; closed loop (`fixtures_test`) green.
1199
+- **Consequence:** every §10.3.4.6 range *and* comparison-test-value grammar form is now in —
1200
+  the ADR-27 → ADR-32 range arc is closed. The remaining `in`-RHS deferral (`not(tests)`
1201
+  negation) was itself resolved by ADR-30; nothing range-shaped remains open.
1202
+
11601203
 ## Adding a wrapper — the host-binding contract
11611204
 
11621205
 The four wrappers (feel-pg, feel-wasm, feel-py, planned feel-lua) implement the same

modified ROADMAP.md +21 −22

@@ -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 **2728 cases / 86 files**
10
+compliance-level-3 suites. Today the fixture suite is **2736 cases / 86 files**
1111
 (`cargo test -p feel-core --test fixtures_test -- --nocapture`).
1212
 
1313
 ---
@@ -25,9 +25,9 @@
2525
 **reverse-bracket interval literals (`]a..b]` / `[a..b[`) + range properties (`.start`
2626
 / `.end` / `.start included` / `.end included`) now shipped (ADR-29)** — see below.
2727
 **Unbounded omitted-endpoint ranges (`[1..)` / `(..10]`, distinct from a `null`
28
-bound) now shipped (ADR-31)** — see below. **Still deferred:** only the
29
-comparison-test-as-range *value* (`(< 10)` in value position) — reshaped by a TCK
30
-measurement (below).
28
+bound) now shipped (ADR-31)** — see below. **The opaque comparison-test *value*
29
+(`(< 10)` in value position) now shipped (ADR-32)** — see below. **Nothing
30
+range-shaped remains deferred:** the ADR-27 → ADR-32 range arc is closed.
3131
 
3232
 The grammar work needed **no LALR/LR rewrite**: a range literal is a `Primary` that
3333
 shares its `"[" Sum` / `"(" Sum` prefix with the list literal / grouping and branches
@@ -111,10 +111,9 @@
111111
   `(< 10) = (null..10)` and `(= 10) = [10..10]` are **false**, while `(< 10) = (< 10)`,
112112
   `(= 10) = (= 10)`, `(!= 10) = (!= 10)` are **true**. So a parenthesised comparison
113113
   test in *value* position equals an identical test but is never equal to a `Range` —
114
-  the "desugar to range" model is wrong. Realising it needs a new `Value` variant
115
-  (a unary-test value with reflexive, range-incompatible equality); deferred as
116
-  genuinely spec-murky. Note: the *membership* (`in`-position) forms `x in (=10)` /
117
-  `(!=10)` already work — only the value-position equality is open.
114
+  the "desugar to range" model is wrong. ✅ **Now shipped (ADR-32):** an opaque
115
+  `Value::UnaryTestVal` variant with exactly that reflexive, range-incompatible equality.
116
+  (The *membership* `in`-position forms `x in (=10)` / `(!=10)` already worked via ADR-28.)
118117
 - **Cross-type `=` skip.** `true in [false, 2, 3]` expects `false`; feel-core returns
119118
   error-null for a non-null type mismatch under `=` (ADR-14), so it OR-folds to null.
120119
   One 0072 case skipped (`CROSS_TYPE_EQUALITY_SKIPS`); aligning cross-type equality
@@ -166,20 +165,20 @@
166165
 `004_e`/`004_f`); the closed loop needed no fixture change. Exercised by the
167166
 `unbounded_ranges` and `unbounded_closed_bracket_is_a_parse_error` unit tests.
168167
 
169
-### Still deferred
170
-
171
-- **Value-position comparison-test value** `(< 10)` — grammar-clean (`"(" CmpOp Sum ")"`,
172
-  no token in `FIRST(Expr)` clashes); blocked on a new opaque `Value` variant with
173
-  reflexive, range-incompatible equality (ADR-28's measured semantics: `(<10) = (<10)` true,
174
-  `(<10) = (null..10)` false).
175
-
176
-### Entry points (for the remaining value-test work)
177
-
178
-- Grammar: [feel.lalrpop](crates/feel-core/src/feel.lalrpop) — the `InRhs` /
179
-  `UnaryTestElem` / `NbSum` / `Endpoint` chains are the templates; the value-test `(< 10)`
180
-  needs a new `Primary` alternative.
181
-- Detector: `_balanced_bracket_group` / `_in_rhs_supported` / `_value_range_brackets_ok`
182
-  in [tools/ingest_tck.py](tools/ingest_tck.py).
168
+### Shipped: opaque comparison-test value (ADR-32)
169
+
170
+`(< 10)` / `(= 10)` / `(!= 10)` in **value** position — exactly as forecast, grammar-clean
171
+with a single new `Primary` alternative `"(" CmpOp Sum ")"` (no `CmpOp` token in
172
+`FIRST(Expr)`, so no clash with grouping or the range form; build.rs gate green). It is an
173
+**opaque** `Value::UnaryTestVal { op, endpoint }` (boxed; `Value` stays 40 bytes), **not** a
174
+promoted range: equality is structural and reflexive (`(<10) = (<10)` → true) but
175
+range-incompatible (`(<10) = (null..10)`, `(=10) = [10..10]` → false) — the measured 0068
176
+semantics that falsified the desugar hypothesis (ADR-28's `range_006` question, now resolved).
177
+It has no order, no host type, and conforms to no `instance of` type but `Any`; `string(...)`
178
+echoes the written form. The ingester's value-position reject now fires only for a *bracket*-led
179
+comparison (`[< 10]`, no production) not after `in`. Re-ingested `0068-feel-equality`
180
+**101 → 109** (the eight `range_006`/`range_007…012` cases). Exercised by the
181
+`value_position_comparison_test` unit test (incl. an `in`-position regression block).
183182
 
184183
 ---
185184