Skip to content

Commit 2030d5c

Browse files
haasonsaasclaude
andauthored
fix(ci): normalize path separators in blast radius summaries (#82)
* fix(ci): normalize path separators in blast radius summaries path.display() uses native separators, producing backslashes on Windows. Since these paths appear in review comments (web UI), normalize to forward slashes so the output is consistent across platforms. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * test: add unit test for backslash path normalization in blast radius Directly tests format_blast_radius_summary with Windows-style backslash paths to verify they are normalized to forward slashes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5a88ce1 commit 2030d5c

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

src/review/pipeline/postprocess/blast_radius.rs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fn format_blast_radius_summary(dependents: &[PathBuf]) -> String {
4545
let listed = dependents
4646
.iter()
4747
.take(MAX_LISTED_DEPENDENTS)
48-
.map(|path| path.display().to_string())
48+
.map(|path| path.display().to_string().replace('\\', "/"))
4949
.collect::<Vec<_>>();
5050
let remaining = dependents.len().saturating_sub(listed.len());
5151

@@ -140,6 +140,35 @@ mod tests {
140140
assert!(comments[0].tags.iter().any(|tag| tag == "blast-radius:3"));
141141
}
142142

143+
#[test]
144+
fn format_blast_radius_summary_normalizes_backslash_paths() {
145+
use super::format_blast_radius_summary;
146+
147+
let dependents = vec![
148+
PathBuf::from("src\\a.rs"),
149+
PathBuf::from("src\\b.rs"),
150+
PathBuf::from("src\\c.rs"),
151+
];
152+
153+
let summary = format_blast_radius_summary(&dependents);
154+
assert!(
155+
summary.contains("src/a.rs"),
156+
"expected forward slashes in summary, got: {summary}"
157+
);
158+
assert!(
159+
summary.contains("src/b.rs"),
160+
"expected forward slashes in summary, got: {summary}"
161+
);
162+
assert!(
163+
summary.contains("src/c.rs"),
164+
"expected forward slashes in summary, got: {summary}"
165+
);
166+
assert!(
167+
!summary.contains('\\'),
168+
"summary should not contain backslashes: {summary}"
169+
);
170+
}
171+
143172
#[test]
144173
fn skips_blast_radius_summary_below_threshold() {
145174
let dir = tempfile::tempdir().unwrap();

0 commit comments

Comments
 (0)