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:
+37
-6
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user