-
Notifications
You must be signed in to change notification settings - Fork 0
Flow JSON Export #247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flow JSON Export #247
Conversation
GitLab Pipeline ActionGeneral informationLink to pipeline: https://gitlab.com/code0-tech/development/aquila/-/pipelines/2293676811 Status: Passed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request implements flow export functionality to support transitioning from DYNAMIC to STATIC mode as described in issue #246. The changes enable Aquila to export flows to a JSON file when running in DEVELOPMENT environment during DYNAMIC mode, allowing the exported file to be used for STATIC mode startup.
Changes:
- Added environment parameter to
SagittariusFlowClientfor environment-aware behavior - Implemented
export_flows_json_overwrite()method to write flows to JSON file with atomic file operations - Modified main.rs to convert environment enum to string and pass to flow client
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/sagittarius/flow_service_client_impl.rs | Added env field, environment checking logic, and JSON export functionality with atomic write-rename pattern |
| src/main.rs | Added environment enum to string conversion and passed env parameter to SagittariusFlowClient constructor |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| }; | ||
|
|
||
| let final_path = Path::new("flowExport.json"); |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filename uses camelCase ("flowExport.json") which is inconsistent with the snake_case naming convention used elsewhere in the codebase. The existing flow file is named "test_flow_one.json" (see configuration/mod.rs:63). Consider renaming to "flow_export.json" for consistency.
| let json = match serde_json::to_vec_pretty(flows) { | ||
| Ok(b) => b, | ||
| Err(e) => { | ||
| log::error!("Failed to serialize flows to JSON: {:?}", e); | ||
| return; | ||
| } | ||
| }; |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The exported JSON format is inconsistent with the expected import format. The export writes a bare array of flows, but init_flows_from_json() expects a JSON object with a "flows" field (see main.rs:153 and flow/test_flow_one.json). This means the exported file cannot be used directly with STATIC mode. Consider wrapping the array in a Flows struct: serde_json::to_vec_pretty(&Flows { flows: flows.to_vec() }).
| let final_path = Path::new("flowExport.json"); | ||
| let tmp_path = Path::new("flowExport.json.tmp"); |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file path is hardcoded and relative to the current working directory, which may vary depending on how the application is started. This is inconsistent with how flow_fallback_path is configurable via environment variables (see configuration/mod.rs:61-64). Consider either making the export path configurable via environment variable or using an absolute path based on a known location.
| let final_path = Path::new("flowExport.json"); | |
| let tmp_path = Path::new("flowExport.json.tmp"); | |
| let export_path = std::env::var("FLOW_EXPORT_PATH") | |
| .unwrap_or_else(|_| "flowExport.json".to_string()); | |
| let final_path = Path::new(&export_path); | |
| let tmp_path_string = format!("{}.tmp", export_path); | |
| let tmp_path = Path::new(&tmp_path_string); |
Resolves: #246