ui: validity indicator rendering + warning theme colour (ADR-0027 step D)

Adds the `[ERR]` / `[WRN]` validity indicator to the input
row. `App` gains `input_indicator: Option<Severity>` (the
runtime owns its timing — step E) and a pure
`input_validity_verdict()` query that runs `input_verdict`
in simple mode only (advanced mode is raw SQL, ADR-0027 §7).

`render_input_panel` reserves the rightmost six columns of
the input row unconditionally (ADR-0027 §4) — a five-column
label plus a one-column gap — so the typed command never
shifts sideways when the indicator appears or hides. The
label renders only when `input_indicator` is set: `[ERR]` in
`theme.error`, `[WRN]` in the new amber `theme.warning`
(defined for both light and dark themes).

The indicator is not yet wired live — `input_indicator`
stays `None` until the debounce lands (step E). Covered by a
render test and the theme contrast test; the input-panel
snapshot is updated for the six-column reservation.
This commit is contained in:
claude@clouddev1
2026-05-19 07:27:54 +00:00
parent 73c74701c2
commit 1a9d950cc2
5 changed files with 85 additions and 3 deletions
+10
View File
@@ -38,6 +38,10 @@ pub struct Theme {
pub mode_advanced: Color,
pub system: Color,
pub error: Color,
/// Validity-indicator WARNING colour (ADR-0027 §4) — an
/// amber distinct from `error`'s red. Drives the `[WRN]`
/// label; `[ERR]` reuses `error`.
pub warning: Color,
// ---- Per-token-class colours (ADR-0022 §3) -------------------
pub tok_keyword: Color,
pub tok_identifier: Color,
@@ -62,6 +66,8 @@ impl Theme {
mode_advanced: Color::Rgb(0xFF, 0x9E, 0x6B),
system: Color::Rgb(0x9F, 0xD8, 0x91),
error: Color::Rgb(0xFF, 0x6B, 0x6B),
warning: Color::Rgb(0xF5, 0xA9, 0x4B), // amber
// Token classes — distinct enough to tell apart at a
// glance, quiet enough that 80-char lines don't read
// like a Christmas tree. Identifier and punct sit
@@ -92,6 +98,8 @@ impl Theme {
mode_advanced: Color::Rgb(0xB0, 0x4A, 0x12),
system: Color::Rgb(0x2E, 0x7C, 0x3C),
error: Color::Rgb(0xC0, 0x39, 0x2B),
warning: Color::Rgb(0xA6, 0x5A, 0x00), // burnt amber
// Light-theme token palette: same intent as dark —
// identifier/punct close to fg/muted; warm tones for
// literals + flags; cool accent for keyword.
@@ -144,6 +152,7 @@ mod tests {
("tok_string", t.tok_string),
("tok_flag", t.tok_flag),
("tok_error", t.tok_error),
("warning", t.warning),
] {
assert_ne!(
c, t.bg,
@@ -161,6 +170,7 @@ mod tests {
("tok_string", t.tok_string),
("tok_flag", t.tok_flag),
("tok_error", t.tok_error),
("warning", t.warning),
] {
assert_ne!(
c, t.bg,