mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-09 03:20:56 +00:00
parent
712a02a844
commit
f3781b1bbb
5 changed files with 129 additions and 8 deletions
File diff suppressed because one or more lines are too long
91
nodes/simplify/diff.patch
Normal file
91
nodes/simplify/diff.patch
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
diff --git a/lib/crates/fabro-workflows/src/cli/asset.rs b/lib/crates/fabro-workflows/src/cli/asset.rs
|
||||
index d00eac1..d9a5194 100644
|
||||
--- a/lib/crates/fabro-workflows/src/cli/asset.rs
|
||||
+++ b/lib/crates/fabro-workflows/src/cli/asset.rs
|
||||
@@ -4,6 +4,7 @@ use anyhow::{bail, Context, Result};
|
||||
use clap::Args;
|
||||
|
||||
use crate::asset_snapshot::AssetCollectionSummary;
|
||||
+use crate::cli::cp::split_run_path;
|
||||
use crate::cli::runs::{default_runs_base, format_size, resolve_run};
|
||||
|
||||
/// An individual asset file discovered from a run's asset manifests.
|
||||
@@ -113,10 +114,7 @@ pub struct AssetCpArgs {
|
||||
|
||||
/// Parse `source` into (run_id, optional_asset_path) using the same colon-split logic as `cp`.
|
||||
fn parse_source(s: &str) -> (&str, Option<&str>) {
|
||||
- if s.starts_with('/') || s.starts_with("./") || s.starts_with("../") {
|
||||
- return (s, None);
|
||||
- }
|
||||
- match s.split_once(':') {
|
||||
+ match split_run_path(s) {
|
||||
Some((run_id, path)) => (run_id, Some(path)),
|
||||
None => (s, None),
|
||||
}
|
||||
@@ -241,16 +239,15 @@ pub fn cp_command(args: &AssetCpArgs) -> Result<()> {
|
||||
})?;
|
||||
}
|
||||
} else {
|
||||
- // Flat mode: check for filename collisions
|
||||
- let mut seen: std::collections::HashMap<String, &AssetEntry> =
|
||||
- std::collections::HashMap::new();
|
||||
+ // Flat mode: build filename map and check for collisions
|
||||
+ let mut by_filename: Vec<(String, &AssetEntry)> = Vec::with_capacity(entries.len());
|
||||
for entry in &entries {
|
||||
let filename = Path::new(&entry.relative_path)
|
||||
.file_name()
|
||||
.unwrap_or_else(|| std::ffi::OsStr::new(&entry.relative_path))
|
||||
.to_string_lossy()
|
||||
.into_owned();
|
||||
- if let Some(existing) = seen.get(&filename) {
|
||||
+ if let Some((_, existing)) = by_filename.iter().find(|(f, _)| f == &filename) {
|
||||
bail!(
|
||||
"Filename collision: '{}' exists in both node '{}' and '{}'. \
|
||||
Use --tree to preserve directory structure, or --node to filter.",
|
||||
@@ -259,16 +256,11 @@ pub fn cp_command(args: &AssetCpArgs) -> Result<()> {
|
||||
entry.node_slug
|
||||
);
|
||||
}
|
||||
- seen.insert(filename, entry);
|
||||
+ by_filename.push((filename, entry));
|
||||
}
|
||||
|
||||
- for entry in &entries {
|
||||
- let filename = Path::new(&entry.relative_path)
|
||||
- .file_name()
|
||||
- .unwrap_or_else(|| std::ffi::OsStr::new(&entry.relative_path))
|
||||
- .to_string_lossy()
|
||||
- .into_owned();
|
||||
- let dest_file = args.dest.join(&filename);
|
||||
+ for (filename, entry) in &by_filename {
|
||||
+ let dest_file = args.dest.join(filename);
|
||||
if let Some(parent) = dest_file.parent() {
|
||||
std::fs::create_dir_all(parent)?;
|
||||
}
|
||||
@@ -322,4 +314,4 @@ mod tests {
|
||||
assert_eq!(id, "./foo");
|
||||
assert_eq!(path, None);
|
||||
}
|
||||
-}
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/lib/crates/fabro-workflows/src/cli/cp.rs b/lib/crates/fabro-workflows/src/cli/cp.rs
|
||||
index 17a1461..d4b4e8d 100644
|
||||
--- a/lib/crates/fabro-workflows/src/cli/cp.rs
|
||||
+++ b/lib/crates/fabro-workflows/src/cli/cp.rs
|
||||
@@ -66,7 +66,7 @@ fn parse_direction(src: &str, dst: &str) -> Result<CopyDirection> {
|
||||
/// We distinguish local paths from run references by checking:
|
||||
/// - Paths starting with `/`, `./`, or `../` are always local
|
||||
/// - Otherwise, split on the first colon
|
||||
-fn split_run_path(s: &str) -> Option<(&str, &str)> {
|
||||
+pub(crate) fn split_run_path(s: &str) -> Option<(&str, &str)> {
|
||||
if s.starts_with('/') || s.starts_with("./") || s.starts_with("../") {
|
||||
return None;
|
||||
}
|
||||
@@ -390,4 +390,4 @@ mod tests {
|
||||
_ => panic!("Expected Upload"),
|
||||
}
|
||||
}
|
||||
-}
|
||||
+}
|
||||
\ No newline at end of file
|
||||
5
nodes/verify/script_invocation.json
Normal file
5
nodes/verify/script_invocation.json
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"command": "cargo clippy -- -D warnings 2>&1 && cargo test 2>&1",
|
||||
"language": "shell",
|
||||
"timeout_ms": null
|
||||
}
|
||||
5
nodes/verify/script_timing.json
Normal file
5
nodes/verify/script_timing.json
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"duration_ms": 37186,
|
||||
"exit_code": 0,
|
||||
"timed_out": false
|
||||
}
|
||||
6
nodes/verify/status.json
Normal file
6
nodes/verify/status.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"status": "success",
|
||||
"notes": "Script completed: cargo clippy -- -D warnings 2>&1 && cargo test 2>&1",
|
||||
"failure_reason": null,
|
||||
"timestamp": "2026-03-15T23:07:08.445171+00:00"
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue