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
+12 -5
View File
@@ -178,17 +178,24 @@ not yet implemented:
14 of ADR-0015). Pending pieces: `export` / `import` (Iter
5), `--resume` + persistent input history hydration +
migration framework scaffold (Iter 6).
- **Complex WHERE expressions** (C5a): AND/OR/comparison/LIKE
in UPDATE/DELETE/show-data filters. The bridge from DSL
fluency to real SQL.
- **Complex WHERE expressions** (C5a): implemented through
ADR-0026 steps 14 — the stratified expression grammar
(AND/OR/NOT, the six comparisons, LIKE/IN/BETWEEN/IS NULL,
parentheses) reached through a new `Subgrammar` node, the
recursive `Expr` AST + parameterised SQL, and `where` /
`limit` on `show data`. Type-mismatched comparisons run
permissively (§7). Still pending: the §7 advisory
*flagging* of type mismatches / `= NULL`, the seam with
ADR-0027's diagnostics-severity model.
- **SQL handling in advanced mode** (Q1): `sqlparser-rs` parser
+ a defined SQL subset (Q4 — its own ADR).
- **Column drops/renames/type changes** (B2 / C2 partial): the
rebuild-table primitive (ADR-0013) is in place; the grammar
and dispatch are pending.
- **Indexes**: `add index` / `drop index` done (ADR-0025).
`EXPLAIN QUERY PLAN` rendering for QA1 still pending (needs
its own QA2 rendering ADR).
`EXPLAIN QUERY PLAN` (QA1 / QA2) is designed in ADR-0028 —
the `explain` prefix command + span-styled plan tree —
but not yet implemented.
- **Modify relationship** (C3a): drop+add covers the use case
today.
- **m:n convenience** (C4): auto-generates a junction table