feat(seed): set override clause + column-fill (ADR-0048 Phase 2)

Build the two SD2 surfaces Phase 1 deferred:

- `set` override clause (D2): comma-separated per-column pins —
  `= 'v'` (fixed), `in ('a','b')` (pick-list), `as <generator>`
  (named), `between x and y` (range; numeric and quoted dates).
  Type-aware via the typed `current_column_value` slot; an override
  drops its column from the generic-fill advisory (D13). Folded from
  the flat matched path (build_seed_overrides) and applied to the
  per-column plan (apply_seed_overrides).
- `<table>.<column>` column-fill (D1 form 2): an UPDATE over existing
  rows. Refuses PK/autogen targets, empty-table no-op, FK-samples the
  parent, collision-free for UNIQUE/identifier targets, one undo step;
  `set` may only adjust the filled column.

Supporting work: KNOWN_GENERATORS vocabulary + generator_for_name
(src/seed/vocabulary.rs, D9); a range Generator + range_bounds_reason;
IdentSource::Generators and HighlightClass::Function; completion of the
generator vocabulary after `as` and the set/.col column slots; the
typing-time validity indicator for an unknown generator; help,
parse-error pedagogy rows, and the D13 advisory's Phase-2/3 wording.

A bounded override (fixed value / too-short pick-list) on a
single-column-UNIQUE target is a friendly error rather than a silent
uniqueness cap (post-implementation /runda finding, user-chosen).

Dates in the range form are quoted (no date-literal token exists);
ADR-0048 D2 amended accordingly. Both modes (D5); reproducible (D4).
This commit is contained in:
claude@clouddev1
2026-06-12 09:44:30 +00:00
parent 78c38e8b33
commit a12facc784
20 changed files with 1913 additions and 65 deletions
+1 -1
View File
@@ -553,7 +553,7 @@ pub const KEYS_AND_PLACEHOLDERS: &[(&str, &[&str])] = &[
("ok.rows_seeded", &["count", "table"]),
("ok.rows_updated", &["count"]),
("seed.capped", &["requested"]),
("seed.advisory_generic", &["columns"]),
("seed.advisory_generic", &["columns", "column", "table"]),
// ---- Client-side success notes (ADR-0017 §6, ADR-0018 §9) ----
("client_side.auto_fill_add_serial", &["count"]),
("client_side.auto_fill_add_shortid", &["count"]),
+13 -2
View File
@@ -337,6 +337,13 @@ help:
seed <T> [<count>] — fill a table with generated sample rows
(default 20). Existing rows are kept;
foreign keys draw from existing parent rows.
seed <T> ... set <c> = 'v' | in ('a','b') | as <gen> | between x and y
— pin how a column is generated: a fixed
value, a pick-list, a named generator
(email, name, product, ...), or a range.
seed <T>.<col> [set ...] — fill one column across the EXISTING rows
(the follow-up to `add column`).
seed <T> ... --seed <n> — reproducible: same data for the same n.
insert: |-
insert into <T> [(cols)] [values] (vals) — add a row
update: |-
@@ -573,7 +580,7 @@ parse:
change_column: |-
change column [in] [table] <Table>: <Name> (<Type>)
[--force-conversion | --dont-convert]
seed: "seed <Table> [count]"
seed: "seed <Table> [count] [set <col> = ... | in (...) | as <gen> | between x and y] | seed <Table>.<col>"
show_data: "show data <Table>"
show_table: "show table <Table>"
show_tables: "show tables"
@@ -988,7 +995,11 @@ db:
# generic text that look like fixed value sets.
seed:
capped: "(of {requested} requested — ran out of distinct value combinations)"
advisory_generic: "{columns} filled with generic text — they look like fixed value sets."
# ADR-0048 D13 (Phase 2/3 wording): name the generically-filled
# enum-ish / CHECK columns and point at the concrete repairs — the
# `set` clause on a fresh seed, or the column-fill form for the rows
# just created.
advisory_generic: "{columns} filled with generic text — they look like fixed value sets. Pin them next time with `set {column} in ('…', '…')`, or fix these rows with `seed {table}.{column} set {column} in ('…', '…')`."
ok:
# ADR-0040: the generic `[ok] <verb> <subject>` summary line was