feat: DSL→SQL teaching echo — §4 styled-runs polish (ADR-0038)
Lands the last open item on ADR-0038: the de-emphasised styled-runs rendering treatment for the echo + every category-3 prose line. The echoed SQL now reads as code — the dimmed `Executing SQL:` label plus the SQL portion lexed and coloured the same way the input echo treats user-typed input (ADR-0028 §5 styled-runs over input_render::lex_to_runs in advanced mode). Category-3 prose lines (the DontConvert caveat and the existing illuminating `client_side.*` notes — shortid auto-fill, type-conversion transforms) all render dimmed too, per §6's "de-emphasised prose line" wording, so every cat-3 line is visually consistent. * New `OutputKind::TeachingEcho` variant + a custom branch in `ui::render_output_line` mirroring the OutputKind::Echo input-echo path: strip the canonical `Executing SQL:` prefix, render it with `theme.muted`, then lex the rest in `Mode::Advanced` and emit one span per token. Tag stays `[system]` for visual consistency with other system output. * New `OutputStyleClass::Hint` styled-runs class, resolved to `theme.muted` in `output_span_style`. Used for the cat-3 prose lines (dont_convert caveat + the existing client_side notes). * New const `crate::echo::TEACHING_ECHO_LABEL = "Executing SQL: "` — the byte boundary the ui.rs branch needs is fixed (an i18n template can't provide that), so the label moves from i18n to a constant. The `echo.executing_sql` i18n key is retired (en-US.yaml + keys.rs); a comment in en-US.yaml points future locales at re-introducing it if needed. * App-side helpers: `push_teaching_echo(sql)` builds the TeachingEcho line; `push_category_three_prose(text)` builds a System line with a whole-text Hint span. `note_ok_summary` and `handle_dsl_change_column_success` / `handle_dsl_add_column_success` use these instead of plain `note_system` for the echo, the caveat, and the illuminating notes. Existing tests pass unchanged — text content is the same; only styling changes. New tests pin the polish: * `ui::tests::teaching_echo_line_renders_dim_prefix_and_lexed_sql` asserts the TeachingEcho rendering produces a dim prefix span + keyword-coloured SQL spans (confirming the lexer ran in advanced mode). * `ui::tests::category_three_prose_line_renders_all_dim` pins the whole-text Hint coverage. * `ui::tests::hint_class_resolves_to_muted_foreground` pins the theme resolution across both light and dark. * `app::tests::polished_echo_carries_teaching_echo_kind_and_caveat_a_hint_span` pins the App-side wiring (kind + styled_runs shape). Tests: 2019 passed / 0 failed / 1 ignored (pre-existing); clippy clean (`--all-targets -D warnings`, nursery). ADR-0038 is now feature-complete — every catalogue row implemented, round-tripped, AND polished per §4.
This commit is contained in:
@@ -874,11 +874,13 @@ db:
|
||||
Cannot add this CHECK to `{table}.{column}`: {total} row(s) do not satisfy `{rule}`.
|
||||
|
||||
# ---- DSL command success summaries (ADR-0019 §9 sweep) --------------
|
||||
# DSL → SQL teaching echo (ADR-0038): the equivalent advanced-mode SQL,
|
||||
# rendered beneath `[ok]` for a DSL-form command run in an advanced
|
||||
# effective mode (ADR-0037).
|
||||
echo:
|
||||
executing_sql: "Executing SQL: {sql}"
|
||||
# (The DSL → SQL teaching echo's `Executing SQL:` prefix used to live
|
||||
# here as `echo.executing_sql`; with the ADR-0038 §4 styled-runs polish
|
||||
# the line is now built from a hardcoded constant in `crate::echo`
|
||||
# because the dim-prefix + lex-the-rest rendering path in
|
||||
# `ui::render_output_line` needs a fixed byte boundary the i18n
|
||||
# template couldn't provide. Re-introduce a key here if a non-English
|
||||
# locale lands.)
|
||||
|
||||
ok:
|
||||
# Generic `[ok] <verb> <subject>` header used for every
|
||||
|
||||
Reference in New Issue
Block a user