feat: H1a parse-error gaps G2–G4 + advanced near-miss matrix (ADR-0042)
Close the three remaining ADR-0042 triage gaps, each test-first, and lock the advanced-mode near-miss matrix. G2 — bare `select` dumped the 14-item expression first-set. Collapse it to "a projection: `*`, a column, or an expression" in the error message only (parser::format_walker_error), detected by the joint `distinct`+`all` quantifier signature unique to a projection start. Render-only: completion/hints still expand the full set (typing-surface matrix unchanged). G3 — the usage block was mode-blind: advanced `create table` showed the DSL `create table … with pk …` template. usage_key(s)_for_input gain mode-aware `_in_mode` variants selecting candidates by CommandCategory; render_usage_block and the typing-time ambient usage thread the submission mode. Advanced `create` now shows both SQL forms. A fallback covers shared SQL nodes (insert/update/delete) that declare no usage_ids of their own — without it they regressed to the available-commands fallback (caught by the new advanced matrix). G4 — `with` borrowed `select`'s usage template; give it its own parse.usage.with CTE template. Tests: new near_miss_matrix_advanced_mode (12 SQL-surface cases incl. the available-commands regression guard) + per-gap tests; removed the temporary baseline_dump. Full suite green (lib 1578 / it 386 / typing_surface_matrix 192); clippy clean.
This commit is contained in:
@@ -307,6 +307,8 @@ pub const KEYS_AND_PLACEHOLDERS: &[(&str, &[&str])] = &[
|
||||
("parse.usage.show_data", &[]),
|
||||
("parse.usage.show_table", &[]),
|
||||
("parse.usage.update", &[]),
|
||||
("parse.usage.with", &[]),
|
||||
("parse.expect.select_projection", &[]),
|
||||
// ---- Project lifecycle event notes ----
|
||||
("project.export_failed", &["error"]),
|
||||
("project.export_ok", &["path"]),
|
||||
|
||||
@@ -491,6 +491,15 @@ parse:
|
||||
# command-keyword renderings (each from
|
||||
# `parse.token.keyword.*`).
|
||||
available_commands: "available commands: {commands}"
|
||||
# ADR-0042 G2: collapse the SELECT projection-start expression
|
||||
# first-set (14 expression-starters plus the `distinct`/`all`
|
||||
# quantifiers) into one learner-sized gloss in the error
|
||||
# message. The detector keys on `distinct` AND `all` being
|
||||
# jointly expectable, which only happens at a projection start —
|
||||
# so the raw set is replaced *in the error line only*;
|
||||
# completion/hints still expand the full first-set.
|
||||
expect:
|
||||
select_projection: "a projection: `*`, a column, or an expression"
|
||||
# Per-command usage templates (ADR-0021 §1). Rendered under a
|
||||
# "usage:" prefix when a parse fails after consuming a
|
||||
# known command-entry keyword. The bracket convention `[...]`
|
||||
@@ -550,6 +559,10 @@ parse:
|
||||
replay: "replay <path> | replay '<path with spaces>'"
|
||||
# SQL `SELECT` (advanced mode; ADR-0030 / ADR-0031).
|
||||
select: "select (* | <expr>[ as <alias>][, ...]) from <Table> [where <expr>] [order by <expr>[ asc|desc][, ...]] [limit <n>]"
|
||||
# SQL `WITH` / CTE (advanced mode; ADR-0032). G4 (ADR-0042):
|
||||
# its own template — `with` previously borrowed `select`'s,
|
||||
# which never showed the CTE shape.
|
||||
with: "with [recursive] <Name> [(<col>[, ...])] as (<query>)[, ...] select ..."
|
||||
# App-lifecycle commands (per ADR-0003, surfaced through
|
||||
# the parser so they participate in usage templates +
|
||||
# completion). Templates here describe the surface
|
||||
|
||||
Reference in New Issue
Block a user