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:
claude@clouddev1
2026-06-05 14:57:20 +00:00
parent 10f8c2a95c
commit 649fdcb38e
8 changed files with 259 additions and 93 deletions
+3 -1
View File
@@ -866,7 +866,9 @@ fn ambient_hint_core_in_mode(
// The form the user has committed to drives the
// usage template — `add index …` shows the
// `add index` usage, not the first `add` form.
let usage = crate::dsl::grammar::usage_key_for_input(input)
// Mode-aware (ADR-0042 G3): advanced-mode shared
// entry words show their SQL form, not the DSL one.
let usage = crate::dsl::grammar::usage_key_for_input_in_mode(input, mode)
.map(|key| crate::friendly::translate(key, &[]));
Some(AmbientHint::Prose(match usage {
Some(u) => crate::t!(