Skip to content

fix(cli): preserve time-series sidecars in inline handoffs - #166

Open
pesap wants to merge 3 commits into
mainfrom
fix/preserve-timeseries-sidecars
Open

fix(cli): preserve time-series sidecars in inline handoffs#166
pesap wants to merge 3 commits into
mainfrom
fix/preserve-timeseries-sidecars

Conversation

@pesap

@pesap pesap commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • preserve referenced time-series sidecars when inline pipeline JSON is persisted
  • preserve time-series associations when a plugin creates a translated System, matching components and supplemental attributes by name
  • rewrite sidecar references to portable paths next to the persisted JSON
  • add regression coverage for relative sidecars and translated associations

Testing

  • cargo test --workspace
  • cargo fmt --all -- --check

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the CLI’s inline pipeline JSON persistence so that referenced time-series sidecar directories are preserved alongside the persisted system_*.json, and the JSON is rewritten to reference a portable relative path. This helps downstream plugins resolve attached time-series data even when the system JSON is handed off inline.

Changes:

  • Persist inline system JSON via a new helper that can also copy time-series sidecar directories into the persistence directory.
  • Add logic to detect and rewrite time_series.directory to a bundled relative folder next to the persisted JSON.
  • Add a regression unit test covering relative sidecar preservation during persistence.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +159 to +176
let source = PathBuf::from(directory);
let source = if source.is_absolute() {
source
} else {
sidecar_parent_dir.join(source)
};
if source.is_dir() {
let sidecar_name = format!(
"{}_time_series",
path.file_stem().unwrap().to_string_lossy()
);
let destination = destination_dir.join(&sidecar_name);
copy_sidecar_directory(&source, &destination)?;
time_series.insert(
"directory".to_string(),
serde_json::Value::String(sidecar_name),
);
}
Comment on lines +191 to +205
fn time_series_metadata_mut(
value: &mut serde_json::Value,
) -> Option<&mut serde_json::Map<String, serde_json::Value>> {
let object = value.as_object_mut()?;
if object.contains_key("time_series") {
return object
.get_mut("time_series")
.and_then(serde_json::Value::as_object_mut);
}

if object.contains_key("system") {
return object.get_mut("system").and_then(time_series_metadata_mut);
}
object.get_mut("data").and_then(time_series_metadata_mut)
}
Comment on lines +224 to +227
return Err(RunError::Config(format!(
"Time-series sidecar contains unsupported symlink: {}",
source_path.display()
)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants