docs: record ADR-14 (error provenance and strict/lenient boundary)
public
docs: record ADR-14 (error provenance and strict/lenient boundary) ADR-14 documents Value::Error, the sticky strong-Kleene rule (Design 1), the provenance-keyed if, and the lenient/strict boundary policy; ADR-13 marked refined and the builtins roadmap notes a future assert-non-null tripwire. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| Changeset | 36f7261ef200e3aa8dc770c123a7ce76e41448f0 |
|---|---|
| Author (claimed) | Timo Stolz <timo.stolz@gmail.com>, |
| Parents | 34d8df00d1ef |
| Children | |
| Pushlog | by timo via ssh |
modified DECISIONS.md +45 −4
| @@ -202,9 +202,47 @@ | ||
| 202 | 202 | tests a wrong-type `if` condition, so nothing forces us off the safe path |
| 203 | 203 | here; we knowingly diverge from jDMN only on this untested input. |
| 204 | 204 | - **Consequence:** 0032-conditionals (cases 001–003) ingests and passes; |
| 205 | - `if 5 then 1 else 2` and `if "x" then 1 else 2` stay `null` (existing tests | |
| 206 | - unchanged). The divergence from jDMN is confined to untested wrong-type | |
| 207 | - conditions and is documented rather than silent. | |
| 205 | + `if 5 then 1 else 2` and `if "x" then 1 else 2` stay `null` (observably). The | |
| 206 | + divergence from jDMN is confined to untested wrong-type conditions and is | |
| 207 | + documented rather than silent. | |
| 208 | +- **Status:** Refined by **ADR-14** — the "wrong-type → null" outcome is now an | |
| 209 | + *error-null*, and the `if` rule keys on null *provenance* rather than the | |
| 210 | + static type of the condition. | |
| 211 | + | |
| 212 | +## ADR-14: Error provenance — `Value::Error` ("error-null") with sticky three-valued logic | |
| 213 | + | |
| 214 | +- **Context:** FEEL overloads `null` with two meanings: a legitimate absence | |
| 215 | + (missing field, explicit `null`) and the result of a *type/domain error* | |
| 216 | + (`1 + true`, `1/0`, comparing incomparable types). ADR-9 made both plain | |
| 217 | + `null`, which conflicts with "errors should never pass silently": an error that | |
| 218 | + becomes `null` then vanishes. ADR-13's `if` keyed on the static *type* of the | |
| 219 | + condition, which still swallowed a *computed* error-null (`if (5 + "x") …`). | |
| 220 | +- **Decision:** Track provenance with a distinct `Value::Error` ("error-null"). | |
| 221 | + It behaves **identically** to `Value::Null` for every FEEL operation | |
| 222 | + (equality: `error = null` → true; ordering; three-valued logic) so spec/TCK | |
| 223 | + results are unchanged. The error sources of ADR-9 now produce `Value::Error`; | |
| 224 | + the `null` literal, unbound variables and missing members stay `Value::Null`. | |
| 225 | + - **AND/OR (Design 1 — sticky, strong Kleene):** the truth value is exactly | |
| 226 | + strong three-valued logic — a dominating `false` (and) / `true` (or) wins | |
| 227 | + regardless of the other operand, so `false and (1/0)` is `false` and the TCK | |
| 228 | + stays green. Provenance is consulted **only** for the "unknown" null result: | |
| 229 | + it is an error-null iff a contributing unknown operand was *tainted* (an | |
| 230 | + error-null, or a wrong-typed value — a value-null is a legitimate untainted | |
| 231 | + unknown). Quantifiers fold the same rule. (The contagious/weak-Kleene | |
| 232 | + alternative — any error operand poisons the result — was rejected: it breaks | |
| 233 | + `false and <error> = false`.) | |
| 234 | + - **`if`:** `true` → then; `false`/value-null → else; error-null or wrong-type | |
| 235 | + condition → error-null (the error escalates, refining ADR-13). | |
| 236 | + - **Boundary policy (in the wrappers, per ADR-1/ADR-4):** *lenient* (default) | |
| 237 | + collapses error-null to JSON/jsonb `null`; *strict* surfaces it. `feel-pg`'s | |
| 238 | + `feel_eval(…, strict => true)` raises an ERROR; `feel-wasm`'s | |
| 239 | + `evaluate_strict` returns `{"error": …}`. The pure core never throws. | |
| 240 | +- **Consequence:** "errors never pass silently" is honoured without leaving the | |
| 241 | + spec: the core stays TCK-compliant (errors *are* null there) but provenance is | |
| 242 | + tracked, and the edge may escalate it. `Value` gains `contains_error()` and | |
| 243 | + `into_lenient()`; the fixture test and lenient wrappers compare/serialise the | |
| 244 | + lenient view. An in-expression `assert non null(x)` tripwire is a natural | |
| 245 | + complement once built-in functions land (see Roadmap). | |
| 208 | 246 | |
| 209 | 247 | ## Roadmap: deferred scope (recorded, not yet built) |
| 210 | 248 | |
| @@ -216,7 +254,10 @@ | ||
| 216 | 254 | `substring`, `contains`), list (`append`, `concatenate`, `distinct values`, |
| 217 | 255 | `sort`). Needs a function-call grammar production, FEEL's space-containing names |
| 218 | 256 | (`string length`), a builtin dispatch table, and reactivation of the many |
| 219 | - already-self-contained `feel-*-function` TCK dirs. | |
| 257 | + already-self-contained `feel-*-function` TCK dirs. Would also enable an | |
| 258 | + explicit `assert non null(x)` tripwire — an in-expression complement to the | |
| 259 | + strict boundary policy (ADR-14) for surfacing error-nulls where the author | |
| 260 | + wants them loud. | |
| 220 | 261 | - **Temporal types** — `date`/`time`/`date and time`/`duration` values, their |
| 221 | 262 | constructor functions, and `@"…"` literals. Largest lift; reverses ADR-5's |
| 222 | 263 | deferral and activates the placeholder `temporal-interval-mapping` deviation |