ui: surface diagnostics in the ambient hint panel (ADR-0027 §2)

ambient_hint now reads the walker's schema-aware diagnostics.
input_diagnostics is non-empty only for a command that
structurally parses — so a non-empty result means "complete
and submittable, but wrong or dubious". That is checked early
(right after the Tab-cycle memo), ahead of slot hints and
completions: a command that parses but is flawed no longer
gets the misleading "Submit with Enter" prose, it gets the
diagnostic's why. pick_hint_diagnostic prefers the diagnostic
under the cursor, else the most severe.

The cursor-local invalid-ident hint is kept for genuinely
incomplete commands (no Match → no diagnostics).

5 ambient_hint tests (unknown table, type-mismatch over
submit-prose, LIKE-numeric, clean command still submittable,
cursor-following). The complex_and_or matrix cell referenced a
non-existent column `t`; fixed to a real column so it tests a
valid expression as intended. 1118 passing, clippy clean.
This commit is contained in:
claude@clouddev1
2026-05-19 09:39:58 +00:00
parent bbfb70c767
commit 400fb71460
3 changed files with 126 additions and 7 deletions
+5 -1
View File
@@ -61,8 +61,12 @@ fn in_list_open_paren_expects_an_item() {
#[test]
fn complex_and_or_expression_parses() {
let schema = schema_every_type();
// `note` is the text column — `t` is not a column of
// `Things`, and the schema-existence diagnostic (ADR-0027)
// would now correctly flag it; this cell tests a *valid*
// complex expression, so it uses a real column.
let a = assess_at_end(
"delete from Things where k > 1 and t like 'a%' or k = 9",
"delete from Things where k > 1 and note like 'a%' or k = 9",
&schema,
);
assert!(matches!(a.state, InputState::Valid));