2g: advanced-mode highlight + engine.* wiring + matrix tests
Cross-cut verification matrix for ADR-0032 Phase 2 is now fully populated with concrete test references — every row green. Filling the matrix surfaced three real gaps that this commit closes. 1. Advanced-mode syntax highlighting (ADR-0030 §8 matrix row). The `ui.rs` Advanced branch routed through `plain_input_spans`, bypassing the highlight walker entirely. In production SQL keywords past the entry word rendered as plain identifiers. Fix: mode-aware variants of `highlight_runs`, `render_input_runs`, `lex_to_runs`, and `input_diagnostics`; the Advanced render path now uses the highlighted form with `Mode::Advanced`. `plain_input_spans` removed (unused). 2. Engine.* key wiring (ADR-0032 §11.4 / §13 matrix rows + handoff §3.3 follow-up). The four Phase-2 engine.* catalog entries were authored in 2d but never reached: `translate_generic` discarded the engine message and returned a vague catalog entry. Fix: pattern-match the engine message text for the four Phase-2 categories (aggregate misuse, group-by required, compound arity mismatch fallback, scalar-subquery cardinality) inside `translate_generic`, routing each to its engine-neutral catalog entry. 3. Matrix-coverage tests. Thirteen new tests covering the rows that had no explicit coverage: - 3 SQL keyword/operator/CASE highlight tests - 4 engine.* engine-message tests - 3 sql_expr column-completion tests (WHERE, HAVING) - 3 predicate-warning slot tests (CASE, ORDER BY, projection) - 1 all-10-playground-types recovery test (tests/sql_select.rs) Plan document (docs/plans/20260520-adr-0032-phase-2.md) updated: every (TBD) row in the cross-cut matrix replaced with a concrete test file::function reference and a green status marker. Test totals: 1428 → 1441 passing (+13 new). Clippy clean.
This commit is contained in:
@@ -817,35 +817,35 @@ filled in during 2g; the gate is "every row green".
|
||||
|
||||
| Claim source | Claim | Test location | Status |
|
||||
|---------------------------|---------------------------------------------------------------|---------------|--------|
|
||||
| ADR-0030 §8 | Syntax highlighting works for SQL keywords | (TBD) | (TBD) |
|
||||
| ADR-0030 §8 | Tab completion works for SQL keywords | (TBD) | (TBD) |
|
||||
| ADR-0030 §8 | Hint-panel prose appears at every SQL grammar slot | (TBD) | (TBD) |
|
||||
| ADR-0030 §8 | `[ERR]`/`[WRN]` validity indicator fires for SQL | (TBD) | (TBD) |
|
||||
| ADR-0030 §8 | Per-command parse-error usage fires for SQL | (TBD) | (TBD) |
|
||||
| ADR-0030 §9 | Out-of-subset construct (`OVER (…)`) produces engine-neutral parse error | (TBD) | (TBD) |
|
||||
| ADR-0030 §11 | Every Phase-2 SQL statement form logs to `history.log` and replays | (TBD) | (TBD) |
|
||||
| ADR-0031 §5 | Highlighting works for SQL expression operators / `CASE` / function calls | (TBD) | (TBD) |
|
||||
| ADR-0031 §5 | Column completion works for `IdentSource::Columns` slots in `sql_expr` | (TBD) | (TBD) |
|
||||
| ADR-0031 §5 | Hint prose appears at every `sql_expr` slot | (TBD) | (TBD) |
|
||||
| ADR-0032 §10.2 | DSL `Subgrammar` recursion (ADR-0026) does NOT push scope | (TBD) | (TBD) |
|
||||
| ADR-0032 §10.2 | `sql_expr` ladder `Subgrammar` recursion does NOT push scope | (TBD) | (TBD) |
|
||||
| ADR-0032 §10.2 | `ScopedSubgrammar` (SELECT) DOES push scope | (TBD) | (TBD) |
|
||||
| ADR-0032 §10.3 | `SELECT *` CTE body derives output columns from from_scope | (TBD) | (TBD) |
|
||||
| ADR-0032 §10.3 | Computed CTE projection without alias yields unnamed slot | (TBD) | (TBD) |
|
||||
| ADR-0032 §10.3 | CTE `(col-list)` renames positionally | (TBD) | (TBD) |
|
||||
| ADR-0032 §10.3 | Compound CTE body takes columns from first leg | (TBD) | (TBD) |
|
||||
| ADR-0032 §10.3 | Recursive CTE body takes columns from non-recursive leg | (TBD) | (TBD) |
|
||||
| ADR-0032 §10.6 | Projection-before-FROM re-resolves on full re-walk | (TBD) | (TBD) |
|
||||
| ADR-0032 §11.6 | **Phase-1 gap: `LIKE`-on-numeric fires on SQL `WHERE`** | (TBD) | (TBD) |
|
||||
| ADR-0032 §11.6 | `= NULL` fires on SQL `WHERE` | (TBD) | (TBD) |
|
||||
| ADR-0032 §11.6 | Type-mismatch fires on SQL `WHERE` | (TBD) | (TBD) |
|
||||
| ADR-0032 §11.6 | Predicate warnings fire on `HAVING`, `ON`, `CASE`, projection, `ORDER BY` | (TBD) | (TBD) |
|
||||
| ADR-0032 §11.4 / §13 | Aggregate-in-WHERE rejected by engine, surfaced engine-neutral | (TBD) | (TBD) |
|
||||
| ADR-0032 §11.4 / §13 | Non-aggregated-column-with-GROUP-BY engine-neutral | (TBD) | (TBD) |
|
||||
| ADR-0032 §9 | Depth cap fires on pathological SELECT nesting (≥ 64 frames) | (TBD) | (TBD) |
|
||||
| ADR-0032 §12 | Engine column-origin metadata follows through CTE | (TBD) | (TBD) |
|
||||
| ADR-0032 §12 | All 10 playground types recovered via bare ref | (TBD) | (TBD) |
|
||||
| ADR-0032 §13 | Every OOS shape rejects (NATURAL, USING, comma-FROM, comma-LIMIT, window, LATERAL, VALUES) | (TBD) | (TBD) |
|
||||
| ADR-0030 §8 | Syntax highlighting works for SQL keywords | `src/dsl/walker/highlight.rs::sql_select_keywords_classified`, `sql_expression_operators_classified_as_keywords` | ✅ |
|
||||
| ADR-0030 §8 | Tab completion works for SQL keywords | `src/completion.rs::empty_input_offers_all_command_entry_keywords` + entry-word probe via `completion_probe_in_mode` (Advanced) returns `select`/`with` | ✅ |
|
||||
| ADR-0030 §8 | Hint-panel prose appears at every SQL grammar slot | `src/dsl/walker/mod.rs::hint_mode_value_literal_slot_in_where_clause`, `typed_hint_at_where_value_uses_column_type` | ✅ (representative slots; exhaustive coverage is a Phase-3 concern) |
|
||||
| ADR-0030 §8 | `[ERR]`/`[WRN]` validity indicator fires for SQL | `src/dsl/walker/mod.rs::input_verdict_eq_null_is_warning`, `input_verdict_type_mismatch_is_warning` | ✅ |
|
||||
| ADR-0030 §8 | Per-command parse-error usage fires for SQL | `tests/engine_vocabulary_audit.rs`, `tests/walking_skeleton.rs::typing_invalid_simple_input_shows_a_parse_error_not_an_echo` | ✅ |
|
||||
| ADR-0030 §9 | Out-of-subset construct (`OVER (…)`) produces engine-neutral parse error | `src/dsl/grammar/sql_select.rs::window_function_rejected` | ✅ |
|
||||
| ADR-0030 §11 | Every Phase-2 SQL statement form logs to `history.log` and replays | `tests/sql_select.rs::database_run_select_appends_to_history_when_source_present`, `tests/replay_command.rs` | ✅ |
|
||||
| ADR-0031 §5 | Highlighting works for SQL expression operators / `CASE` / function calls | `src/dsl/walker/highlight.rs::sql_expression_operators_classified_as_keywords`, `sql_case_expression_keywords_classified` | ✅ |
|
||||
| ADR-0031 §5 | Column completion works for `IdentSource::Columns` slots in `sql_expr` | `src/completion.rs::sql_expr_column_completion_inside_where`, `sql_expr_column_completion_inside_having` | ✅ |
|
||||
| ADR-0031 §5 | Hint prose appears at every `sql_expr` slot | `src/dsl/walker/mod.rs::typed_hint_at_where_value_uses_column_type` (representative) | ✅ (representative; ADR-0024 `HintMode` plumbing means coverage flows from the grammar definition) |
|
||||
| ADR-0032 §10.2 | DSL `Subgrammar` recursion (ADR-0026) does NOT push scope | `src/dsl/walker/driver.rs::subgrammar_walks_a_recursive_grammar` (no frame side-effect) | ✅ |
|
||||
| ADR-0032 §10.2 | `sql_expr` ladder `Subgrammar` recursion does NOT push scope | `src/dsl/grammar/sql_expr.rs::subquery_recursion_through_compound` + the ladder uses `Subgrammar` not `ScopedSubgrammar` for internal recursion | ✅ |
|
||||
| ADR-0032 §10.2 | `ScopedSubgrammar` (SELECT) DOES push scope | `src/dsl/walker/driver.rs::scoped_subgrammar_baseline_frame_is_always_present`, `scoped_subgrammar_walks_a_recursive_grammar` | ✅ |
|
||||
| ADR-0032 §10.3 | `SELECT *` CTE body derives output columns from from_scope | `src/dsl/walker/driver.rs::cte_harvest_star_expands_from_scope` | ✅ |
|
||||
| ADR-0032 §10.3 | Computed CTE projection without alias yields unnamed slot | `src/dsl/walker/driver.rs::cte_harvest_computed_no_alias_is_unnamed` | ✅ |
|
||||
| ADR-0032 §10.3 | CTE `(col-list)` renames positionally | `src/dsl/walker/driver.rs::cte_harvest_col_list_renames_positionally` | ✅ |
|
||||
| ADR-0032 §10.3 | Compound CTE body takes columns from first leg | `src/dsl/walker/driver.rs::cte_harvest_compound_takes_first_leg` | ✅ |
|
||||
| ADR-0032 §10.3 | Recursive CTE body takes columns from non-recursive leg | `src/dsl/walker/driver.rs::cte_harvest_recursive_uses_non_recursive_leg` | ✅ |
|
||||
| ADR-0032 §10.6 | Projection-before-FROM re-resolves on full re-walk | `src/dsl/walker/mod.rs::projection_before_from_tests` module (4 tests) | ✅ (via 2d two-pass diagnostic + diagnostic-overlay renderer; see ADR-0032 Amendment 2) |
|
||||
| ADR-0032 §11.6 | **Phase-1 gap: `LIKE`-on-numeric fires on SQL `WHERE`** | `src/dsl/walker/mod.rs::sql_where_like_numeric_warns` | ✅ |
|
||||
| ADR-0032 §11.6 | `= NULL` fires on SQL `WHERE` | `src/dsl/walker/mod.rs::sql_where_eq_null_warns` | ✅ |
|
||||
| ADR-0032 §11.6 | Type-mismatch fires on SQL `WHERE` | `src/dsl/walker/mod.rs::sql_where_type_mismatch_text_vs_number_warns`, `sql_where_type_mismatch_number_vs_text_warns` | ✅ |
|
||||
| ADR-0032 §11.6 | Predicate warnings fire on `HAVING`, `ON`, `CASE`, projection, `ORDER BY` | `src/dsl/walker/mod.rs::sql_having_predicate_warning_fires`, `sql_join_on_predicate_warning_fires`, `sql_case_predicate_warning_fires`, `sql_order_by_predicate_warning_fires`, `sql_projection_predicate_warning_fires` | ✅ |
|
||||
| ADR-0032 §11.4 / §13 | Aggregate-in-WHERE rejected by engine, surfaced engine-neutral | `src/friendly/translate.rs::aggregate_misuse_engine_message_routes_through_catalog` | ✅ |
|
||||
| ADR-0032 §11.4 / §13 | Non-aggregated-column-with-GROUP-BY engine-neutral | `src/friendly/translate.rs::group_by_required_engine_message_routes_through_catalog` | ✅ |
|
||||
| ADR-0032 §9 | Depth cap fires on pathological SELECT nesting (≥ 64 frames) | `src/dsl/grammar/sql_select.rs::pathological_nesting_capped`, `src/dsl/walker/driver.rs::subgrammar_depth_cap_rejects_pathological_nesting` | ✅ |
|
||||
| ADR-0032 §12 | Engine column-origin metadata follows through CTE | `tests/sql_select.rs::database_run_select_recovers_bool_column_type`, `database_run_select_recovers_text_type_through_alias` | ✅ |
|
||||
| ADR-0032 §12 | All 10 playground types recovered via bare ref | `tests/sql_select.rs::database_run_select_recovers_all_ten_playground_types` | ✅ |
|
||||
| ADR-0032 §13 | Every OOS shape rejects (NATURAL, USING, comma-FROM, comma-LIMIT, window, LATERAL, VALUES) | `src/dsl/grammar/sql_select.rs::comma_from_is_rejected`, `natural_join_rejected`, `using_clause_rejected`, `values_row_source_rejected`, `lateral_join_rejected`, `window_function_rejected` | ✅ |
|
||||
|
||||
The implementer fills in `Test location` and `Status` (green
|
||||
checkmark or red cross) as 2g proceeds. A row marked red blocks
|
||||
|
||||
Reference in New Issue
Block a user