From b4045ffc3c4d5bd930f10cb24b0c87d546069aa7 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Mon, 9 Mar 2026 22:53:05 -0400 Subject: [PATCH] Fix PR body rendering bugs found in PR #15 code review Use 4-backtick fences for plan section to prevent LLM-generated triple backticks from breaking the markdown. Fix singular/plural grammar for stage, node, and edge counts. Co-Authored-By: Claude Opus 4.6 --- lib/crates/arc-workflows/src/pull_request.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/crates/arc-workflows/src/pull_request.rs b/lib/crates/arc-workflows/src/pull_request.rs index 3a5eb633a..027650e8c 100644 --- a/lib/crates/arc-workflows/src/pull_request.rs +++ b/lib/crates/arc-workflows/src/pull_request.rs @@ -130,7 +130,8 @@ fn format_arc_details_section(retro: &Retro, dot_source: Option<&str>) -> String let total_cost_str = format_cost(retro.stats.total_cost); let stage_count = retro.stages.len(); parts.push(format!( - "
\nRan {stage_count} stages in {total_duration} for {total_cost_str}" + "
\nRan {stage_count} {} in {total_duration} for {total_cost_str}", + if stage_count == 1 { "stage" } else { "stages" } )); parts.push(String::new()); @@ -161,7 +162,9 @@ fn format_arc_details_section(retro: &Retro, dot_source: Option<&str>) -> String let (graph_name, node_count, edge_count) = parse_dot_summary(dot); parts.push(format!( - "
\nRan {graph_name} ({node_count} nodes and {edge_count} edges)" + "
\nRan {graph_name} ({node_count} {} and {edge_count} {})", + if node_count == 1 { "node" } else { "nodes" }, + if edge_count == 1 { "edge" } else { "edges" } )); parts.push(String::new()); parts.push("```dot".to_string()); @@ -235,9 +238,9 @@ fn assemble_pr_body( parts.push("
".to_string()); parts.push("Full plan".to_string()); parts.push(String::new()); - parts.push("```md".to_string()); + parts.push("````md".to_string()); parts.push(plan.to_string()); - parts.push("```".to_string()); + parts.push("````".to_string()); parts.push(String::new()); parts.push("
".to_string()); } @@ -554,7 +557,7 @@ mod tests { let section = format_arc_details_section(&retro, Some(dot)); assert!(section.contains("implement.dot")); - assert!(section.contains("2 nodes and 1 edges")); + assert!(section.contains("2 nodes and 1 edge")); assert!(section.contains("```dot")); assert!(section.contains("digraph implement")); } @@ -614,7 +617,7 @@ mod tests { assert!(body.contains("This is the narrative.")); assert!(body.contains("### Plan Summary")); assert!(body.contains("
\nFull plan")); - assert!(body.contains("```md\nFull plan text here\n```")); + assert!(body.contains("````md\nFull plan text here\n````")); assert!(body.contains("### Retro")); assert!(body.contains("### Arc Details")); }