docs: add revisable-decisions section + RD-1 (feel-pg keeps Rust regex dialect)
public
docs: add revisable-decisions section + RD-1 (feel-pg keeps Rust regex dialect) Records, separately from the firm ADRs, the deliberate choice to leave feel-pg on the default RustRegex provider rather than building a host-dialect PgRegex now: the weighed trade-off (no server-side size win; parity with the TCK-validated reference dialect; the unsafe-FFI/ereport-catching cost of DirectFunctionCall), the decision taken, the trigger that would flip it (a need for native ~/regexp_* semantics inside Postgres), and the work a flip implies. ADR-16 host-regex seam. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| Changeset | 9641f3585a8db104c1c59325e036261de33358fa |
|---|---|
| Author (claimed) | Timo Stolz <timo.stolz@gmail.com>, |
| Parents | 1f80c0d770af |
| Children | |
| Pushlog | by timo via ssh |
modified DECISIONS.md +37 −0
| @@ -345,6 +345,43 @@ | ||
| 345 | 345 | invalid pattern produces, so the strict boundary surfaces it (ADR-14). ADR-15's |
| 346 | 346 | `regex-xpath-dialect` deviation is now per-target rather than global. |
| 347 | 347 | |
| 348 | +## Revisable design decisions | |
| 349 | + | |
| 350 | +Softer than the ADRs above: deliberate, **reversible** choices that are not | |
| 351 | +architectural commitments. Each records the trade-off, the decision taken now, the | |
| 352 | +trigger that would flip it, and the work a flip implies — so revisiting is cheap | |
| 353 | +and informed rather than a re-discovery. Expect these to change. | |
| 354 | + | |
| 355 | +### RD-1: feel-pg keeps the Rust regex dialect (no `PgRegex` provider yet) | |
| 356 | + | |
| 357 | +- **Weighed:** ADR-16 made the three regex builtins host-pluggable. The Postgres | |
| 358 | + candidate would be a `PgRegex` provider routing `matches`/`replace`/`split` | |
| 359 | + through Postgres' own POSIX ARE engine, so FEEL regex matches the native | |
| 360 | + `~`/`regexp_*` behaviour. Against that: (1) the bundle-size win that justified | |
| 361 | + the WASM switch does **not** exist server-side — the regex stack inside a `.so` | |
| 362 | + costs nothing that matters; (2) `RustRegex` keeps feel-pg on the **same dialect | |
| 363 | + as feel-core and the TCK fixtures** (the validated reference), whereas POSIX ARE | |
| 364 | + would be a third, untested dialect; (3) a `PgRegex` is real unsafe-FFI work — | |
| 365 | + `DirectFunctionCall` into `textregexreplace`/`regexp_split_to_array`/ | |
| 366 | + `textregexeq`, Datum/text marshalling, and crucially catching Postgres' regex | |
| 367 | + `ereport`/longjmp so a bad pattern yields a FEEL `null` instead of aborting the | |
| 368 | + whole query. | |
| 369 | +- **Decision (2026-06-16):** feel-pg stays on the default `RustRegex` provider. | |
| 370 | + The `evaluate_with` seam and a note in `feel-pg/src/lib.rs` keep the door open; | |
| 371 | + nothing is built. Net effect: regex results in Postgres equal those in | |
| 372 | + feel-core's test suite today. | |
| 373 | +- **Revisit trigger:** a concrete requirement that FEEL regex *inside* Postgres | |
| 374 | + behave exactly like the native `~`/`regexp_*` functions — e.g. users authoring | |
| 375 | + patterns they test against PG and expecting identical semantics. Until then, | |
| 376 | + dialect-parity with the reference core is the more valuable property. | |
| 377 | +- **If flipped:** implement `struct PgRegex` in feel-pg as a `feel_core::FeelRegex`, | |
| 378 | + mapping the three methods onto Postgres regex via `DirectFunctionCall` (wrap each | |
| 379 | + call so a regex error becomes `None` → FEEL null, never a longjmp unwinding | |
| 380 | + through Rust); pass it via `CompiledExpr::evaluate_with` instead of the default | |
| 381 | + `evaluate`; document POSIX ARE (and its flag/escape differences from XPath) as a | |
| 382 | + per-target divergence under ADR-16; and decide validation — the TCK fixtures are | |
| 383 | + XPath-leaning, so PG-dialect cases would need their own expectations. | |
| 384 | + | |
| 348 | 385 | ## Roadmap: deferred scope (recorded, not yet built) |
| 349 | 386 | |
| 350 | 387 | These were considered and deliberately deferred to keep the slice thin. Listed so |