Skip to content

Conversation

@raphael-goetz
Copy link
Member

Resolves: #246

@github-actions
Copy link

github-actions bot commented Jan 29, 2026

GitLab Pipeline Action

General information

Link to pipeline: https://gitlab.com/code0-tech/development/aquila/-/pipelines/2293676811

Status: Passed
Duration: 1 minutes

Copy link
Contributor

Copilot AI left a 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 SagittariusFlowClient for 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");
Copy link

Copilot AI Jan 29, 2026

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.

Copilot uses AI. Check for mistakes.
Comment on lines 57 to 63
let json = match serde_json::to_vec_pretty(flows) {
Ok(b) => b,
Err(e) => {
log::error!("Failed to serialize flows to JSON: {:?}", e);
return;
}
};
Copy link

Copilot AI Jan 29, 2026

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() }).

Copilot uses AI. Check for mistakes.
Comment on lines +65 to +66
let final_path = Path::new("flowExport.json");
let tmp_path = Path::new("flowExport.json.tmp");
Copy link

Copilot AI Jan 29, 2026

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.

Suggested change
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);

Copilot uses AI. Check for mistakes.
@raphael-goetz raphael-goetz merged commit 9a863ab into main Jan 30, 2026
2 checks passed
@raphael-goetz raphael-goetz deleted the 246-flowJSON-export branch January 30, 2026 21:27
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.

Export Flows into JSON file to be able to start in STATIC

2 participants