Skip to content

Commit ed9307a

Browse files
authored
Merge pull request #248 from openSVM/copilot/fix-247
Fix failing tests: improve pattern matching, detection logic, code robustness, implement advanced static analysis, optimize performance, and enhance benchmarking infrastructure across audit modules
2 parents 4cb68b8 + 28be480 commit ed9307a

15 files changed

+1042
-220
lines changed

Cargo.lock

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "osvm"
3-
version = "0.8.1"
3+
version = "0.8.2"
44
edition = "2021"
55
license = "MIT"
66
description = "OpenSVM CLI tool for managing SVM nodes and deployments"
@@ -46,6 +46,7 @@ regex = "1.11.2"
4646
reqwest = { version = "0.12.23", features = ["json"] }
4747
base64 = "0.22.1"
4848
bs58 = "0.5.1"
49+
uuid = { version = "1.0", features = ["v4"] }
4950
# Enhanced audit dependencies
5051
syn = { version = "2.0", features = ["full", "visit"] }
5152
quote = "1.0"

src/main.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,11 @@
44
use {
55
crate::config::Config,
66
crate::utils::diagnostics::DiagnosticCoordinator,
7-
crate::utils::{dashboard, ebpf_deploy, examples, nodes, ssh_deploy, svm_info},
87
crate::utils::markdown_renderer::MarkdownRenderer,
8+
crate::utils::{dashboard, ebpf_deploy, examples, nodes, ssh_deploy, svm_info},
99
clparse::parse_command_line,
1010
solana_client::rpc_client::RpcClient,
11-
solana_sdk::{
12-
native_token::Sol,
13-
pubkey::Pubkey,
14-
signature::Signer
15-
},
11+
solana_sdk::{native_token::Sol, pubkey::Pubkey, signature::Signer},
1612
std::{process::exit, str::FromStr},
1713
};
1814

@@ -64,18 +60,18 @@ async fn handle_ai_query(
6460
// For external subcommands, clap collects additional arguments in subcommand_value
6561
// This is the proper way to handle external subcommands with clap
6662
let mut query_parts = vec![sub_command.to_string()];
67-
63+
6864
// Get additional arguments from clap's external subcommand handling
6965
// External subcommands store arguments as OsString, not String
7066
if let Some(external_args) = sub_matches.get_many::<std::ffi::OsString>("") {
7167
query_parts.extend(external_args.map(|os_str| os_str.to_string_lossy().to_string()));
7268
}
73-
69+
7470
// If clap doesn't provide args (fallback), parse from environment
7571
// This maintains compatibility while documenting the limitation
7672
if query_parts.len() == 1 {
7773
let args: Vec<String> = std::env::args().collect();
78-
74+
7975
// Collect non-flag arguments starting from the subcommand
8076
let mut found_subcommand = false;
8177
for arg in args.iter().skip(1) {

src/services/ai_service.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
use crate::utils::circuit_breaker::{
22
AnalysisVector as CircuitAnalysisVector, EndpointId, GranularCircuitBreaker,
33
};
4+
use crate::utils::debug_logger::VerbosityLevel;
45
use crate::utils::prompt_templates::{
56
AnalysisVector as TemplateAnalysisVector, PromptTemplateManager, TemplateCategory,
67
};
8+
use crate::{debug_error, debug_print, debug_success, debug_warn};
79
use anyhow::{Context, Result};
810
use reqwest;
911
use serde::{Deserialize, Serialize};
@@ -70,6 +72,19 @@ impl AiService {
7072
}
7173

7274
pub fn with_api_url_and_debug(custom_api_url: Option<String>, debug_mode: bool) -> Self {
75+
// Set debug verbosity based on debug mode
76+
if debug_mode {
77+
crate::utils::debug_logger::set_verbosity(VerbosityLevel::Detailed);
78+
} else {
79+
crate::utils::debug_logger::set_verbosity(VerbosityLevel::Silent);
80+
}
81+
82+
debug_print!(
83+
VerbosityLevel::Basic,
84+
"Initializing AI service with debug mode: {}",
85+
debug_mode
86+
);
87+
7388
let (api_url, use_openai) = match custom_api_url {
7489
Some(url) => {
7590
// Check if it's an OpenAI URL and we have an API key
@@ -108,9 +123,11 @@ impl AiService {
108123
let mut template_manager = PromptTemplateManager::new();
109124

110125
// Initialize template manager
111-
if let Err(e) = template_manager.load_from_directory_with_debug("./templates/ai_prompts", debug_mode) {
126+
if let Err(e) =
127+
template_manager.load_from_directory_with_debug("./templates/ai_prompts", debug_mode)
128+
{
112129
if debug_mode {
113-
println!("⚠️ Failed to load AI prompt templates: {}", e);
130+
debug_warn!("Failed to load AI prompt templates: {}", e);
114131
}
115132
}
116133

0 commit comments

Comments
 (0)