mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-07 08:27:12 +00:00
Print full ~/... paths for assets instead of sandbox-relative paths
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1263637211
commit
53e218926f
2 changed files with 30 additions and 5 deletions
|
|
@ -305,6 +305,8 @@ pub async fn collect_assets(
|
|||
}
|
||||
|
||||
/// Collect all asset paths from manifest files under `{logs_dir}/artifacts/assets/*/retry_*/manifest.json`.
|
||||
///
|
||||
/// Returns the full on-disk paths to the downloaded asset files.
|
||||
pub fn collect_asset_paths(logs_dir: &Path) -> Vec<String> {
|
||||
let assets_dir = logs_dir.join("artifacts/assets");
|
||||
let Ok(nodes) = std::fs::read_dir(&assets_dir) else {
|
||||
|
|
@ -327,7 +329,11 @@ pub fn collect_asset_paths(logs_dir: &Path) -> Vec<String> {
|
|||
let Ok(summary) = serde_json::from_str::<AssetCollectionSummary>(&contents) else {
|
||||
continue;
|
||||
};
|
||||
all_paths.extend(summary.copied_paths);
|
||||
let retry_dir = retry_entry.path();
|
||||
for relative_path in &summary.copied_paths {
|
||||
let full_path = retry_dir.join(relative_path);
|
||||
all_paths.push(full_path.to_string_lossy().into_owned());
|
||||
}
|
||||
}
|
||||
}
|
||||
all_paths
|
||||
|
|
@ -718,9 +724,16 @@ mod tests {
|
|||
|
||||
let paths = collect_asset_paths(base);
|
||||
assert_eq!(paths.len(), 3);
|
||||
assert!(paths.contains(&"test-results/report.xml".to_string()));
|
||||
assert!(paths.contains(&"test-results/screenshot.png".to_string()));
|
||||
assert!(paths.contains(&"coverage/lcov.info".to_string()));
|
||||
let base_str = base.to_string_lossy();
|
||||
assert!(paths.contains(&format!(
|
||||
"{base_str}/artifacts/assets/node_a/retry_1/test-results/report.xml"
|
||||
)));
|
||||
assert!(paths.contains(&format!(
|
||||
"{base_str}/artifacts/assets/node_a/retry_1/test-results/screenshot.png"
|
||||
)));
|
||||
assert!(paths.contains(&format!(
|
||||
"{base_str}/artifacts/assets/node_b/retry_1/coverage/lcov.info"
|
||||
)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -1660,9 +1660,21 @@ fn print_assets(logs_dir: &std::path::Path, styles: &Styles) {
|
|||
if paths.is_empty() {
|
||||
return;
|
||||
}
|
||||
let home = dirs::home_dir();
|
||||
eprintln!("\n{}", styles.bold.apply_to("=== Assets ==="));
|
||||
for path in &paths {
|
||||
eprintln!("{path}");
|
||||
let display = match &home {
|
||||
Some(home_dir) => {
|
||||
let home_str = home_dir.to_string_lossy();
|
||||
if let Some(rest) = path.strip_prefix(home_str.as_ref()) {
|
||||
format!("~{rest}")
|
||||
} else {
|
||||
path.clone()
|
||||
}
|
||||
}
|
||||
None => path.clone(),
|
||||
};
|
||||
eprintln!("{display}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue