docs: ADR-28 + ROADMAP — in-list unary tests; retire ±∞ / range-promotion forms
public
docs: ADR-28 + ROADMAP — in-list unary tests; retire ±∞ / range-promotion forms
Record Form 1 (comma-list-of-tests `in`-RHS, ADR-28) and the two follow-up forms
the TCK measurement retired rather than deferred:
* null endpoint is NOT ±∞ — `5 in [null..10]` expects null (unknown bound →
unknown result), which feel-core's three-valued `range_contains` already
yields, so those cases are already green; no membership change to make;
* `(< 10)` is an opaque unary-test value, NOT a promoted range — `(<10)=(null..10)`
and `(=10)=[10..10]` are false while `(<10)=(<10)`/`(=10)=(=10)`/`(!=10)=(!=10)`
are true, so the desugar-to-range model is wrong; deferred (needs a new Value
variant, spec-murky). This resolves the range_006 question ADR-27 left open.
Also note the one cross-type `=` skip (ADR-14) and narrow the deferred set to:
reverse-bracket intervals, `not(tests)`, omitted-endpoint unbounded ranges, and the
value-position comparison-test value. Suite figures updated to 2720 / 86 files.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| Changeset | 7bc61ed86b5d4e66080ee6879b481333ed353d08 |
|---|---|
| Author (claimed) | Timo Stolz <timo.stolz@gmail.com>, |
| Parents | 668bb84424d9 |
| Children | |
| Pushlog | by timo via ssh |
modified DECISIONS.md +70 −8
| @@ -915,9 +915,70 @@ | ||
| 915 | 915 | unit test instead. |
| 916 | 916 | - **Consequence:** ranges are first-class — constructible, comparable, type-checkable, |
| 917 | 917 | usable in value position and as `in` membership. Still deferred (the bracket-ambiguity |
| 918 | - forms): comma-list-of-tests `in`, the reverse-bracket interval notation `]a..b]` / | |
| 919 | - `[a..b[`, unbounded ranges (`[1..]`, `(null..10)`), and the comparison-test-as-range | |
| 920 | - value (`(< 10)`). See ROADMAP.md for entry points. | |
| 918 | + forms): comma-list-of-tests `in` (**now done, ADR-28**), the reverse-bracket interval | |
| 919 | + notation `]a..b]` / `[a..b[`, unbounded ranges (`[1..]`, `(null..10)`), and the | |
| 920 | + comparison-test-as-range value (`(< 10)`). See ROADMAP.md for entry points. | |
| 921 | + | |
| 922 | +## ADR-28: comma-list-of-tests `in`-RHS (positive unary test lists) | |
| 923 | + | |
| 924 | +- **Context:** the one bracket-ambiguity form left after ADR-27 was the comma-*list of | |
| 925 | + tests* on the right of `in` — `x in [1,2,3]`, `x in (false,true)`, `x in (1,<5,>=10)`, | |
| 926 | + `x in [[2..4],[1..3]]`. A reviewer sharpened the diagnosis: the `in`-RHS is a *different | |
| 927 | + grammatical category* (DMN rule 49, *positive unary tests*), not an `expression` — which | |
| 928 | + is what separate lalrpop nonterminals are for. The earlier "would force a hand-written | |
| 929 | + parser" worry was specific to the scope-dependent special-character-name oracle, and a TCK | |
| 930 | + measurement showed that has ~0 payoff in the expression slice. So: stay on lalrpop. | |
| 931 | +- **Decision:** give `InRhs` its own test-mode productions instead of delegating the whole | |
| 932 | + RHS to `Sum`. | |
| 933 | + - **Bracket-free `NbSum` chain is the lever.** The bare-endpoint branch of `InRhs` routes | |
| 934 | + through `NbSum`/`NbProduct`/…/`NbPrimary` — a copy of the `Sum` precedence chain whose | |
| 935 | + *leftmost* primary drops `List`, `RangeLit` and the `"(" Expr ")"` grouping. By never | |
| 936 | + *starting* with `[`/`(`, it leaves the `in [` / `in (` states with exactly **one** | |
| 937 | + bracket production (the test-list / interval) instead of two competing ones (test-list | |
| 938 | + vs. the value `List`/`RangeLit` reachable through a full `Sum`). With only one, the | |
| 939 | + interval-vs-list split is a clean first-element factoring — parse the first `Sum`, then | |
| 940 | + branch on `..` (interval) vs. `,`/`]`/`)` (list) — a FIRST-overlap on a shared prefix, | |
| 941 | + *not* a token-role conflict, so it is LR(1)-clean. `build.rs`'s gate passed on the first | |
| 942 | + build. (This is the discriminator that also explains why reverse-OPEN `]a..b]` is fatal: | |
| 943 | + it overloads `]` as an opener against its closer role — same token, two actions, not | |
| 944 | + factorable. See ROADMAP.) | |
| 945 | + - **Elements reuse existing machinery.** `UnaryTestElem` is `CmpOp Sum` (a comparison) or | |
| 946 | + a bare `Sum`; a nested interval `[2..4]` arrives as a `RangeLit` *value* that | |
| 947 | + `unary_test_from_expr` reclassifies to `UnaryTest::Interval`. `Expr::In` already carries | |
| 948 | + `Vec<UnaryTest>` and `eval_in` already OR-folds it (ADR-27), so **eval is untouched** — | |
| 949 | + `x in [1,2,3]` → `[Endpoint(1),Endpoint(2),Endpoint(3)]`, `x in [[2..4],[1..3]]` → | |
| 950 | + `[Interval,Interval]`, all evaluate as the OR of element tests. | |
| 951 | + - **`(=10)`/`(!=10)` come free.** A one-element paren test whose element is a comparison | |
| 952 | + is structurally just a `Compare` element, so the `in`-position cases (`10 in (=10)` → | |
| 953 | + true) fall out of the same test-mode grammar with no extra work — the *parser* half of | |
| 954 | + "comparison-as-range" without its eval half. | |
| 955 | +- **Two plan hypotheses the TCK then falsified** (measured, not argued): | |
| 956 | + - **Null endpoint is *not* ±∞.** `5 in [null..10]` and friends expect **null**, not | |
| 957 | + `true` — a null bound is "unknown ⇒ unknown result", which feel-core's three-valued | |
| 958 | + `range_contains` already returns. So those five 0072 cases were already green via the | |
| 959 | + widened ingester; the planned ±∞ membership change was dropped (it would have flipped | |
| 960 | + them red). | |
| 961 | + - **`(< 10)` is *not* a promoted range.** 0068 says `(< 10) = (null..10)` → **false** and | |
| 962 | + `(= 10) = [10..10]` → **false**, while `(< 10) = (< 10)`, `(= 10) = (= 10)`, | |
| 963 | + `(!= 10) = (!= 10)` → **true**. A parenthesised comparison-test value equals an | |
| 964 | + *identical test* but is *never* equal to a `Range` — i.e. it is an **opaque unary-test | |
| 965 | + value**, not the range the desugar hypothesis assumed. Modelling it needs a new `Value` | |
| 966 | + variant touching equality; deferred as genuinely spec-murky (this resolves the | |
| 967 | + `range_006` question the ADR-27 consequence list left open). | |
| 968 | +- **Cross-type equality skip.** One 0072 case, `true in [false, 2, 3]`, expects `false`, but | |
| 969 | + feel-core makes a non-null type mismatch under `=` an **error-null** (ADR-14; | |
| 970 | + `100 = "100"` → error, `{a:1} = 1` → null), so it OR-folds to null. Skipped by id | |
| 971 | + (`CROSS_TYPE_EQUALITY_SKIPS`) rather than weakening `=`; aligning cross-type equality with | |
| 972 | + the TCK's `false` is a separate decision. | |
| 973 | +- **Tests:** widened the ingester `in`-RHS gate (`_balanced_bracket_group`, and the | |
| 974 | + value-position `(<…)` reject now fires only when *not* after `in`); re-ingested | |
| 975 | + `0072-feel-in` (255 → 325). Suite **2650 → 2720**. A data-driven `lib.rs` test | |
| 976 | + (`in_unary_test_lists_tck_0072`) covers the forms directly. | |
| 977 | +- **Consequence:** the comma-list / paren-list / `(=e)` test forms are in. Of the originally | |
| 978 | + planned follow-ups only this one was real; the ±∞ and range-promotion forms were retired | |
| 979 | + by the TCK. Still deferred: reverse-bracket intervals `]a..b]` / `[a..b[` (the fatal | |
| 980 | + token-role case + the filter-free-endpoint refactor), unbounded `[1..]` / `[..10]` omitted | |
| 981 | + endpoints, and the opaque comparison-test value `(< 10)` in value position. | |
| 921 | 982 | |
| 922 | 983 | ## Adding a wrapper — the host-binding contract |
| 923 | 984 | |
| @@ -1301,11 +1362,12 @@ | ||
| 1301 | 1362 | arithmetic/comparison/component access, the temporal built-ins, and an injected |
| 1302 | 1363 | clock landed; the boundary is canonical ISO-8601 (native PG casts; WASM `Date` |
| 1303 | 1364 | objects). Reversed ADR-5's deferral and made the `temporal-interval-mapping` |
| 1304 | - deviation live. *Unary tests* are now **partly done**: the comparison forms | |
| 1305 | - (`x in <10` / `x in =@"…"`) and single intervals over any endpoints landed | |
| 1306 | - (`Expr::In` carries `Vec<UnaryTest>`); the comma-list / bare-equality forms | |
| 1307 | - (`x in (1,2,3)` / `1 in 1`) and `not(3)` remain deferred (the bracket | |
| 1308 | - disambiguation — see [ROADMAP.md](ROADMAP.md)). *Still deferred:* | |
| 1365 | + deviation live. *Unary tests* are now **done** for the bracket forms: the | |
| 1366 | + comparison forms (`x in <10` / `x in =@"…"`), single intervals over any endpoints, | |
| 1367 | + bare equality (`1 in 1`, ADR-27), and the comma-list / paren-list / `(=e)` test | |
| 1368 | + forms (`x in [1,2,3]` / `x in (1,<5,>=10)`, **ADR-28**) all landed (`Expr::In` | |
| 1369 | + carries `Vec<UnaryTest>`). *Still deferred:* `not(tests)` negation, the opaque | |
| 1370 | + comparison-test value `(< 10)` in value position (see [ROADMAP.md](ROADMAP.md)), | |
| 1309 | 1371 | special-character/hyphen names (`Date-Time`, ADR-17 deviation); and temporal |
| 1310 | 1372 | values outside jiff's representable range (ADR-18, `TEMPORAL_RANGE_SKIPS`). |
| 1311 | 1373 | - **inputNode context binding in ingestion** — *done (ADR-11/ADR-12).* Each |
modified ROADMAP.md +57 −39
| @@ -7,7 +7,7 @@ | ||
| 7 | 7 | without re-deriving the analysis. |
| 8 | 8 | |
| 9 | 9 | Coverage figures are case counts from `tools/ingest_tck.py` over the DMN-TCK |
| 10 | -compliance-level-3 suites. Today the fixture suite is **2598 cases / 85 files** | |
| 10 | +compliance-level-3 suites. Today the fixture suite is **2720 cases / 86 files** | |
| 11 | 11 | (`cargo test -p feel-core --test fixtures_test -- --nocapture`). |
| 12 | 12 | |
| 13 | 13 | --- |
| @@ -21,10 +21,10 @@ | ||
| 21 | 21 | `1156-range-function` 41 cases ingested, `0068-feel-equality` +3 (range equality), |
| 22 | 22 | `0072-feel-in` +8 (range membership) — suite 2598 → 2650; plus `1130-feel-interval`'s |
| 23 | 23 | 132-case relation truth table as a unit test (its decisions are boxed contexts the |
| 24 | -ingester does not read). **Still deferred:** the bracket-disambiguation forms below | |
| 25 | -(comma-list-of-tests `in`), reverse-bracket interval literals (`]a..b]` / `[a..b[`), | |
| 26 | -unbounded ranges (`[1..]`, `(null..10)`), and the comparison-test-as-range value | |
| 27 | -(`(< 10)`). | |
| 24 | +ingester does not read). **Comma-list-of-tests `in` now also shipped (ADR-28)** — | |
| 25 | +see below. **Still deferred:** reverse-bracket interval literals (`]a..b]` / `[a..b[`), | |
| 26 | +unbounded ranges (`[1..]`, `[..10]`), and the comparison-test-as-range *value* | |
| 27 | +(`(< 10)` in value position) — the last two reshaped by a TCK measurement (below). | |
| 28 | 28 | |
| 29 | 29 | The grammar work needed **no LALR/LR rewrite**: a range literal is a `Primary` that |
| 30 | 30 | shares its `"[" Sum` / `"(" Sum` prefix with the list literal / grouping and branches |
| @@ -78,45 +78,63 @@ | ||
| 78 | 78 | |
| 79 | 79 | --- |
| 80 | 80 | |
| 81 | -## `in` unary-test list forms (deferred from Tier 2 / ADR for unary tests) | |
| 81 | +## `in` unary-test list forms | |
| 82 | 82 | |
| 83 | -**Status:** comparison tests (`x in < e`, `x in = e`, …), single intervals (any | |
| 84 | -endpoints), **bare equality** (`1 in 1`, `date(…) in date(…)`) and **range | |
| 85 | -membership** (`x in range("[1..3]")`, `x in [a..b]`) shipped — `0072-feel-in` is at | |
| 86 | -255/324 cases. The bare-endpoint form (`<e:Sum>` → `unary_test_from_expr`) landed | |
| 87 | -with Tier 3; it is *not* the list ambiguity, so it needed no bracket surgery. | |
| 88 | -**Payoff of the rest:** ~69 cases (the remaining `0072` forms). | |
| 83 | +**Status: ✅ comma-list-of-tests shipped (ADR-28).** The comma-list / paren-list / | |
| 84 | +one-element-paren-test forms — `x in [1,2,3]`, `x in (false,true)`, | |
| 85 | +`x in (1,<5,>=10)`, `x in [[2..4],[1..3]]`, `x in (=10)` / `(!=10)` — now parse as | |
| 86 | +positive unary tests and OR-fold. With the earlier comparison tests, single intervals, | |
| 87 | +bare equality and range membership (ADR-27), **`0072-feel-in` rose 255 → 325 cases** | |
| 88 | +(two skipped: one cross-type, one pre-existing). Suite **2650 → 2720 (+70)**. | |
| 89 | 89 | |
| 90 | -Still-deferred forms, all blocked by the same **interval-vs-list bracket ambiguity** | |
| 91 | -in LR(1) (a bracket here is a *list of tests*, not one value): | |
| 90 | +The fix was **no** hand-written parser and **no** `Tier 3`-style inlining of the value | |
| 91 | +brackets: the `in`-RHS is its *own* grammatical category, so it got its own test-mode | |
| 92 | +productions plus a bracket-free `NbSum` chain for the bare-endpoint branch. Because | |
| 93 | +`NbSum` never *starts* with `[`/`(`, the `in [` / `in (` state has exactly one bracket | |
| 94 | +production (test-list / interval) instead of two competing ones (test-list vs. the | |
| 95 | +value `List`/`RangeLit`), so the interval-vs-list split is a clean first-element | |
| 96 | +factoring (`..` vs `,`/`]`/`)`) — LR(1)-clean, gate green on the first build. | |
| 92 | 97 | |
| 93 | -- comma-lists: `x in [1, 2, 3]`, `x in (false, true)`, `x in (1, < 5, >= 10)` | |
| 94 | - (OR of equality/comparison tests — list membership); | |
| 95 | -- lists of intervals: `x in [[2..4], [1..3]]` (OR of nested interval tests — distinct | |
| 96 | - from the now-supported `x in <single range value>`); | |
| 97 | -- parenthesised single test `(= e)` / `(!= e)`; `not(tests)` negation (the latter | |
| 98 | - also collides with the `not(…)` boolean built-in). | |
| 98 | +### What the TCK measurement reshaped (don't re-derive these) | |
| 99 | 99 | |
| 100 | -### Why it's hard | |
| 101 | -After `in [` (or `(`), the parser cannot tell with one token of lookahead whether | |
| 102 | -it is opening a single interval (`[a..b]`), a list literal used as a membership | |
| 103 | -test (`[1,2,3]`), or — once Tier 3 lands — a range literal. `IntervalStart`/the | |
| 104 | -`List` production both start with `[`, producing a shift/reduce conflict | |
| 105 | -(`build.rs` fails). A clean fix means inlining the bracket body so the decision is | |
| 106 | -made *after* the first endpoint (a following `..` ⇒ interval; a `,`/`]` ⇒ list), | |
| 107 | -rather than via separate `IntervalStart`/`List` nonterminals — i.e. one | |
| 108 | -`"[" AfterLBracket` rule that yields either an interval or a test list, mirrored | |
| 109 | -for `(` and for nested elements. The grammar work is contained but fiddly; do it | |
| 110 | -together with Tier 3 (both need the same disambiguation). | |
| 100 | +Two forms that looked like "next increments" were **retired by reading the TCK**, not | |
| 101 | +deferred on suspicion: | |
| 111 | 102 | |
| 112 | -### Entry points | |
| 113 | -- Grammar: replace the `InRhs` productions + the `Interval`/`List` overlap in | |
| 114 | - [feel.lalrpop](crates/feel-core/src/feel.lalrpop) with inlined bracket-body | |
| 115 | - rules; `Expr::In` already carries `Vec<UnaryTest>` and the OR eval already | |
| 116 | - handles multiple tests ([eval.rs](crates/feel-core/src/eval.rs) `eval_in`). | |
| 117 | -- Detector: `_in_rhs_supported`/`_single_interval` in | |
| 118 | - [tools/ingest_tck.py](tools/ingest_tck.py) already classify the RHS; widen them | |
| 119 | - to accept the list forms once the grammar does. | |
| 103 | +- **Null endpoint is not ±∞.** `5 in [null..10]` (and `(null..10]`, `[1..null)`, …) | |
| 104 | + expect **null**, not membership-true. A null bound is "unknown ⇒ unknown result", | |
| 105 | + which feel-core's three-valued `range_contains` already yields — so these five 0072 | |
| 106 | + cases are *already green*. There is **no** ±∞ membership change to make. | |
| 107 | +- **`(< 10)` is an opaque unary-test value, not a promoted range.** 0068 says | |
| 108 | + `(< 10) = (null..10)` and `(= 10) = [10..10]` are **false**, while `(< 10) = (< 10)`, | |
| 109 | + `(= 10) = (= 10)`, `(!= 10) = (!= 10)` are **true**. So a parenthesised comparison | |
| 110 | + test in *value* position equals an identical test but is never equal to a `Range` — | |
| 111 | + the "desugar to range" model is wrong. Realising it needs a new `Value` variant | |
| 112 | + (a unary-test value with reflexive, range-incompatible equality); deferred as | |
| 113 | + genuinely spec-murky. Note: the *membership* (`in`-position) forms `x in (=10)` / | |
| 114 | + `(!=10)` already work — only the value-position equality is open. | |
| 115 | +- **Cross-type `=` skip.** `true in [false, 2, 3]` expects `false`; feel-core returns | |
| 116 | + error-null for a non-null type mismatch under `=` (ADR-14), so it OR-folds to null. | |
| 117 | + One 0072 case skipped (`CROSS_TYPE_EQUALITY_SKIPS`); aligning cross-type equality | |
| 118 | + with the TCK's `false` is a separate ADR-level decision. | |
| 119 | + | |
| 120 | +### Still deferred | |
| 121 | + | |
| 122 | +- **Reverse-bracket intervals** `]a..b]` / `[a..b[` — two independent surgeries: | |
| 123 | + reverse-OPEN `]…]` is the *fatal* token-role case (a stateful logos pass emitting a | |
| 124 | + distinct `RBracketValue` opener; no in-grammar fork is viable), reverse-CLOSE `[…[` | |
| 125 | + needs a filter-free endpoint nonterminal. Do both with the range-property handler so | |
| 126 | + `0074-feel-properties` goes green in one move rather than half-red. | |
| 127 | +- **`not(tests)` negation** — collides with the `not(…)` boolean built-in. | |
| 128 | +- **Unbounded omitted-endpoint ranges** `[1..]` / `[..10]` (distinct from a `null` | |
| 129 | + endpoint) and the **value-position comparison-test value** `(< 10)` (above). | |
| 130 | + | |
| 131 | +### Entry points (for the reverse-bracket / value-test work) | |
| 132 | + | |
| 133 | +- Grammar: [feel.lalrpop](crates/feel-core/src/feel.lalrpop) — the `InRhs` / | |
| 134 | + `UnaryTestElem` / `NbSum` chain is the template; reverse brackets need the lexer-mode | |
| 135 | + opener + filter-free endpoint. | |
| 136 | +- Detector: `_balanced_bracket_group` / `_in_rhs_supported` in | |
| 137 | + [tools/ingest_tck.py](tools/ingest_tck.py) already accept the bracket test-lists. | |
| 120 | 138 | |
| 121 | 139 | --- |
| 122 | 140 | |