fix(cli): preserve time-series sidecars in inline handoffs - #166
Open
pesap wants to merge 3 commits into
Open
Conversation
There was a problem hiding this comment.
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.directoryto 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() | ||
| ))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing
cargo test --workspacecargo fmt --all -- --check