feat: show table renders relationships as compact diagrams (ADR-0044)

show table <T> and add/drop relationship echoes now render the focal
structure box plus a Relationships section of compact stacked
connector diagrams (child-left/parent-right, n…1, actions); incidental
DDL echoes keep the prose References:/Referenced by: form. Selected by
command in handle_dsl_success via the "relationship-relevant" reach.

- output_render.rs: render_structure refactored into section helpers
  (box/prose/index/constraint), byte-identical output; new
  render_structure_with_diagrams + compact-box rendering
- app.rs: handle_dsl_success routes ShowTable/Add/DropRelationship to
  the diagram path, others to prose
- fixes: eager widths[1] index on compact (1-col) boxes; body-cell
  padding under title-widening (name wider than columns)

Tests: unit + snapshot + integration; add-relationship echo test
updated to the diagram form. Full suite 2203 pass / 0 fail / 1 ignored;
clippy clean. V1 still [/] (compound routing + self-ref remain).
This commit is contained in:
claude@clouddev1
2026-06-10 06:56:35 +00:00
parent cad90ec4a5
commit a0ee32393f
5 changed files with 258 additions and 32 deletions
+22 -2
View File
@@ -1689,8 +1689,28 @@ impl App {
fn handle_dsl_success(&mut self, command: &Command, description: Option<TableDescription>) {
self.note_ok_summary(command);
if let Some(desc) = description.as_ref() {
for line in crate::output_render::render_structure(desc) {
self.note_system(line);
// ADR-0044 §1 "relationship-relevant" reach: when a
// relationship is the subject of the command (`show table`,
// `add`/`drop relationship`), render the table's
// relationships as compact diagrams; every other DDL echo
// keeps the prose `References:` / `Referenced by:` form.
if matches!(
command,
Command::ShowTable { .. }
| Command::AddRelationship { .. }
| Command::DropRelationship { .. }
) {
for line in crate::output_render::render_structure_with_diagrams(
desc,
self.last_output_width,
self.mode,
) {
self.push_output(line);
}
} else {
for line in crate::output_render::render_structure(desc) {
self.note_system(line);
}
}
}
self.current_table = description;