fix(hint): labelled tier-3 block format + snapshot (ADR-0053 /runda)

Final /runda found the rendered block was three bare unlabelled lines,
deviating from the approved exemplar format. Fix:
- emit_tier3_block now renders a `Hint` heading + aligned `What:` /
  `Example:` / `Concept:` lines (hint.block.* labels); concept stays muted
- lock the format with an insta snapshot (hint_block_insert)
- amend ADR-0053 D2/D4 + exemplars: drop the `Next:` line (tier-2 ambient
  already owns live position-awareness — user-confirmed), align exemplars
  to the shipped format

2499 pass / 1 ignored, clippy clean.
This commit is contained in:
claude@clouddev1
2026-06-15 16:45:47 +00:00
parent 447112b17f
commit 329adfc935
5 changed files with 82 additions and 29 deletions
+37 -6
View File
@@ -3205,17 +3205,32 @@ impl App {
/// polish (the framed block) lands with the corpus.
fn emit_tier3_block(&mut self, stem: &str) -> bool {
let cat = crate::friendly::catalog();
if cat.get(&format!("{stem}.what")).is_none() {
let what_key = format!("{stem}.what");
if cat.get(&what_key).is_none() {
return false;
}
self.note_system(crate::friendly::translate(&format!("{stem}.what"), &[]));
// Labelled block (ADR-0053 D4): a `Hint` heading, then aligned
// `What:` / `Example:` / `Concept:` lines. `concept` renders
// muted (`OutputStyleClass::Hint`); the rest are plain system.
let labelled = |label: &str, value: &str| {
// Pad `<Label>:` to a common width so the values align.
format!(" {:<9}{value}", format!("{label}:"))
};
self.note_system(crate::t!("hint.block.heading"));
self.note_system(labelled(
&crate::t!("hint.block.what"),
&crate::friendly::translate(&what_key, &[]),
));
if cat.get(&format!("{stem}.example")).is_some() {
self.note_system(crate::friendly::translate(&format!("{stem}.example"), &[]));
self.note_system(labelled(
&crate::t!("hint.block.example"),
&crate::friendly::translate(&format!("{stem}.example"), &[]),
));
}
if cat.get(&format!("{stem}.concept")).is_some() {
self.push_category_three_prose(crate::friendly::translate(
&format!("{stem}.concept"),
&[],
self.push_category_three_prose(labelled(
&crate::t!("hint.block.concept"),
&crate::friendly::translate(&format!("{stem}.concept"), &[]),
));
}
true
@@ -5813,6 +5828,22 @@ mod tests {
);
}
/// Locks the rendered tier-3 block format (ADR-0053 D4): a `Hint`
/// heading + aligned `What:` / `Example:` / `Concept:` lines.
#[test]
fn insert_hint_block_renders_in_the_labelled_format() {
let mut app = App::new();
type_str(&mut app, "insert into Customers ");
f1(&mut app);
let block = app
.output
.iter()
.map(|l| l.text.as_str())
.collect::<Vec<_>>()
.join("\n");
insta::assert_snapshot!("hint_block_insert", block);
}
#[test]
fn f1_on_add_relationship_renders_the_relationship_block() {
let mut app = App::new();
+4
View File
@@ -224,6 +224,10 @@ pub const KEYS_AND_PLACEHOLDERS: &[(&str, &[&str])] = &[
),
("hint.ambient_expected", &["expected"]),
("hint.getting_started", &[]),
("hint.block.heading", &[]),
("hint.block.what", &[]),
("hint.block.example", &[]),
("hint.block.concept", &[]),
// Tier-3 teaching blocks (ADR-0053 D3) — Phase-B exemplars.
("hint.cmd.insert.what", &[]),
("hint.cmd.insert.example", &[]),
+7
View File
@@ -391,6 +391,13 @@ hint:
# H2 / ADR-0053: shown by `hint` / F1 when there is nothing specific
# to expand on (no recent error, empty input).
getting_started: "Start typing a command and press F1 for a hint, or type `help` for the full command list."
# Tier-3 block scaffolding (ADR-0053 D4): the heading + the labels the
# `what` / `example` / `concept` parts render under.
block:
heading: "Hint"
what: "What"
example: "Example"
concept: "Concept"
# ── Tier-3 teaching blocks (ADR-0053 D3) ──────────────────────────
# Per-form command hints (`hint.cmd.<form>`) and per-class error
# hints (`hint.err.<class>`), each a `what` (12 sentences) / `example`
@@ -0,0 +1,9 @@
---
source: src/app.rs
assertion_line: 5844
expression: block
---
Hint
What: Add one or more rows to a table.
Example: insert into Customers values ('Ann', 'ann@example.io')
Concept: A row is one record; each value lines up with a column, in order. Columns typed `serial`/`shortid` fill themselves — leave them out.