WHERE expressions: matrix cells + predicate_tail grammar fix (ADR-0026 step 6)

Adds tests/typing_surface/where_expression.rs — 9 matrix
cells for the complex WHERE / show-data limit typing surface:
operator candidates after an operand, AND / OR after a
predicate, NOT, BETWEEN / IN bounds, and `show data`
where / limit.

Writing the cells surfaced a grammar bug. `predicate_tail`'s
`[NOT] negatable` branch started with `Optional(not)`, and an
Optional-first `Seq` always "commits" — so on an incomplete
input the walker's `Choice` returned that branch's
`Incomplete` early and discarded every sibling branch's
expected set, dropping `is` and the comparison operators from
completion after a column. Fixed by splitting it into
explicit `NOT negatable` and bare `negatable` branches — no
`predicate_tail` branch starts with an `Optional` now. The
matched terminal sequence is unchanged, so `build_expr` is
untouched.

Docs: ADR-0026 gains an "As-built notes" section recording
the option-1 builder realization, its two deviations from the
§3 sketch, and the deferral of §7 diagnostic flagging to
ADR-0027. requirements.md C5a -> [x] (steps 1-4) with the
test baseline refreshed to 1079; CLAUDE.md's deferred list
reconciled (C5a implemented; the QA1/QA2 note now points at
ADR-0028).
This commit is contained in:
claude@clouddev1
2026-05-18 23:19:53 +00:00
parent f75f71bbe4
commit a50c6cdf70
15 changed files with 733 additions and 34 deletions
+20 -11
View File
@@ -26,12 +26,13 @@ repo is pushed).
## Test baseline
After ADR-0025 (indexes): **1037 passing, 0 failing, 1
ignored** (`cargo test` — the one ignored test is a
long-standing `` ```ignore `` doc-test in
`src/friendly/mod.rs`). Clippy clean with the nursery lint
group enabled. (Earlier reference points: 1006 after ADR-0024
+ the handoff-14 cleanup; 449 after B2/C2.)
After ADR-0026 steps 14 (complex WHERE expressions):
**1070 passing, 0 failing, 1 ignored** (`cargo test` — the
one ignored test is a long-standing `` ```ignore `` doc-test
in `src/friendly/mod.rs`). Clippy clean with the nursery lint
group enabled. (Earlier reference points: 1039 after ADR-0025
(indexes); 1006 after ADR-0024 + the handoff-14 cleanup; 449
after B2/C2.)
---
@@ -157,12 +158,20 @@ group enabled. (Earlier reference points: 1006 after ADR-0024
writes. Bulk insert, complex WHERE expressions, and SELECT
in advanced mode are explicitly tracked separately — see
C5a below.)*
- [ ] **C5a** Complex WHERE expressions (AND/OR, comparison
- [x] **C5a** Complex WHERE expressions (AND/OR, comparison
operators, LIKE, IS NULL, IN, BETWEEN) for UPDATE/DELETE/
show-data filtering; also adds `where` and `limit` to
`show data`. Tracks the natural progression from DSL into
real SQL fluency that motivates the playground. Designed in
ADR-0026; implementation pending.
show-data filtering; `show data` also gains `where` and
`limit`.
*(ADR-0026 steps 14: the stratified expression grammar
reached through a new `Subgrammar` node, the recursive
`Expr` AST + `build_expr`, wiring into update / delete /
show data, and `Expr` → parameterised SQL with an implicit
primary-key `ORDER BY` for `limit`. Type-mismatched WHERE
comparisons are permissive — they run rather than being
rejected (§7). The §7 advisory **flagging** of type
mismatches / `= NULL` is the seam with ADR-0027's
diagnostics-severity model and is tracked there — see
ADR-0026 "As-built notes".)*
## SQL handling