feat: ADR-0036 Phase 1 — validate advanced-mode INSERT literals + show the value

Capture literal VALUES at parse onto Command::SqlInsert (no grammar change,
no reparse); validate them against column types before the still-verbatim
insert (reusing impl_value_for for DSL-parity wording); read them in the
error enricher so a constraint error names the real value. Execution,
auto-fill, and command identity unchanged. Adds run_sql_insert_with_literals
(runtime path); run_sql_insert stays the no-capture raw entry.

Proven: malformed date 2025/01/15 now refused in advanced-mode SQL; replayed
UNIQUE shows the real value. Tests +3 (expression runs, multi-row, natural
order) + 2 flipped/strengthened. 1930 pass / 0 fail / 0 skip; clippy clean.
This commit is contained in:
claude@clouddev1
2026-05-26 21:58:25 +00:00
parent dc9a4759ce
commit 1d5534b2bd
8 changed files with 312 additions and 22 deletions
+9
View File
@@ -422,6 +422,15 @@ pub enum Command {
/// `DataResult` when true; otherwise it surfaces the
/// affected-row count (+ auto-show) as before.
returning: bool,
/// Captured literal values per `VALUES` row, per position
/// (ADR-0036 Phase 1). `Some(v)` for a bare literal (incl. a
/// signed number); `None` for an expression position (nothing
/// static to validate). Empty when the row source is a
/// `SELECT`/`WITH` query. The worker validates these against the
/// column types before the (still verbatim) insert; the error
/// enricher reads them to show the offending value. Execution
/// itself is unchanged — these are *not* bound.
literal_rows: Vec<Vec<Option<Value>>>,
},
/// A SQL `UPDATE` validated by the walker (ADR-0033 §2,
/// advanced mode). Grammar-as-text: the worker executes `sql`