Skip to content

Commit 5a7580d

Browse files
committed
docs: add M1.6.1 integration tests plan document
1 parent e289702 commit 5a7580d

7 files changed

Lines changed: 1086 additions & 69 deletions

File tree

crates/mimi-cli/src/cli/error.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,18 @@ impl CliError {
6060
/// Format error for user display
6161
pub fn user_message(&self) -> String {
6262
match self {
63-
CliError::UsageError(msg) => format!("ERROR [E_USAGE]: {}\n hint: Check syntax with 'mimi --help'", msg),
64-
CliError::ConfigError(msg) => format!("ERROR [E_CONFIG]: {}\n hint: Run 'mimi config init production'", msg),
65-
CliError::NetworkError(msg) => format!("ERROR [E_NETWORK]: {}\n hint: Ensure Zenoh bus is running", msg),
63+
CliError::UsageError(msg) => format!(
64+
"ERROR [E_USAGE]: {}\n hint: Check syntax with 'mimi --help'",
65+
msg
66+
),
67+
CliError::ConfigError(msg) => format!(
68+
"ERROR [E_CONFIG]: {}\n hint: Run 'mimi config init production'",
69+
msg
70+
),
71+
CliError::NetworkError(msg) => format!(
72+
"ERROR [E_NETWORK]: {}\n hint: Ensure Zenoh bus is running",
73+
msg
74+
),
6675
CliError::AuthError(msg) => format!("ERROR [E_AUTH]: {}", msg),
6776
CliError::NotFound(msg) => format!("ERROR [E_NOT_FOUND]: {}", msg),
6877
CliError::IoError(e) => format!("ERROR [E_IO]: {}", e),

crates/mimi-cli/src/cli/formatter.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl Formatter {
3232
} else {
3333
format!("\x1b[32m✓\x1b[0m {}", message)
3434
}
35-
}
35+
},
3636
OutputFormat::Json => json!({"status": "success", "message": message}).to_string(),
3737
OutputFormat::Yaml => format!("status: success\nmessage: {}", message),
3838
}
@@ -47,11 +47,13 @@ impl Formatter {
4747
} else {
4848
format!("\x1b[31m✗\x1b[0m ERROR [{}]: {}", code, error)
4949
}
50-
}
51-
OutputFormat::Json => json!({"status": "error", "code": code, "message": error}).to_string(),
50+
},
51+
OutputFormat::Json => {
52+
json!({"status": "error", "code": code, "message": error}).to_string()
53+
},
5254
OutputFormat::Yaml => {
5355
format!("status: error\ncode: {}\nmessage: {}", code, error)
54-
}
56+
},
5557
}
5658
}
5759

@@ -65,21 +67,21 @@ impl Formatter {
6567
writeln!(output, "{:<width$} {}", key, value, width = max_key_len + 1).ok();
6668
}
6769
output
68-
}
70+
},
6971
OutputFormat::Json => {
7072
let mut obj = serde_json::Map::new();
7173
for (key, value) in pairs {
7274
obj.insert(key.to_string(), Value::String(value.to_string()));
7375
}
7476
serde_json::to_string_pretty(&Value::Object(obj)).unwrap_or_default()
75-
}
77+
},
7678
OutputFormat::Yaml => {
7779
let mut output = String::new();
7880
for (key, value) in pairs {
7981
writeln!(output, "{}: {}", key, value).ok();
8082
}
8183
output
82-
}
84+
},
8385
}
8486
}
8587

crates/mimi-cli/src/cli/handler.rs

Lines changed: 113 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use crate::cli::{Commands, GlobalOpts, OutputFormat, Priority, Formatter};
2-
use crate::config::ConfigLoader;
31
use crate::cli::error::{CliError, CliResult, EXIT_SUCCESS};
4-
use tracing::{info, debug};
2+
use crate::cli::{Commands, Formatter, GlobalOpts, OutputFormat, Priority};
3+
use crate::config::ConfigLoader;
4+
use tracing::{debug, info};
55

66
pub struct CommandHandler {
77
global_opts: GlobalOpts,
@@ -28,7 +28,10 @@ impl CommandHandler {
2828
follow,
2929
dry_run,
3030
..
31-
}) => self.handle_exec(&task, priority, timeout, r#async, follow, dry_run).await,
31+
}) => {
32+
self.handle_exec(&task, priority, timeout, r#async, follow, dry_run)
33+
.await
34+
},
3235

3336
Some(Commands::Query {
3437
query,
@@ -44,35 +47,35 @@ impl CommandHandler {
4447
ConfigSubcommand::Get { key } => self.handle_config_get(&key).await,
4548
ConfigSubcommand::Set { key, value } => {
4649
self.handle_config_set(&key, &value).await
47-
}
50+
},
4851
ConfigSubcommand::Init { profile } => self.handle_config_init(&profile).await,
4952
ConfigSubcommand::Validate => self.handle_config_validate().await,
5053
ConfigSubcommand::Reset => self.handle_config_reset().await,
5154
}
52-
}
55+
},
5356

5457
Some(Commands::Debug { subcommand }) => {
5558
use crate::cli::commands::DebugSubcommand;
5659
match subcommand {
5760
DebugSubcommand::Status => self.handle_debug_status().await,
5861
DebugSubcommand::BusLatency { num_messages } => {
5962
self.handle_debug_bus_latency(num_messages).await
60-
}
63+
},
6164
DebugSubcommand::MemoryStats => self.handle_debug_memory_stats().await,
6265
DebugSubcommand::AdapterTest { adapter } => {
6366
self.handle_debug_adapter_test(&adapter).await
64-
}
67+
},
6568
DebugSubcommand::TraceFlow { task_id } => {
6669
self.handle_debug_trace_flow(&task_id).await
67-
}
70+
},
6871
DebugSubcommand::Profile { duration } => {
6972
self.handle_debug_profile(duration).await
70-
}
73+
},
7174
DebugSubcommand::ValidateIntent { text } => {
7275
self.handle_debug_validate_intent(&text).await
73-
}
76+
},
7477
}
75-
}
78+
},
7679

7780
Some(Commands::Repl { .. }) => self.handle_repl().await,
7881

@@ -82,7 +85,7 @@ impl CommandHandler {
8285
println!("MiMi v{}", env!("CARGO_PKG_VERSION"));
8386
println!("Use 'mimi --help' for usage information");
8487
Ok(EXIT_SUCCESS)
85-
}
88+
},
8689
}
8790
}
8891

@@ -96,10 +99,16 @@ impl CommandHandler {
9699
follow: bool,
97100
dry_run: bool,
98101
) -> CliResult<i32> {
99-
info!("Executing task: {} (priority: {}, timeout: {}s)", task, priority, timeout);
102+
info!(
103+
"Executing task: {} (priority: {}, timeout: {}s)",
104+
task, priority, timeout
105+
);
100106

101107
if dry_run {
102-
let msg = format!("DRY RUN: Would execute task '{}' with priority {}", task, priority);
108+
let msg = format!(
109+
"DRY RUN: Would execute task '{}' with priority {}",
110+
task, priority
111+
);
103112
println!("{}", self.formatter.format_success(&msg));
104113
return Ok(EXIT_SUCCESS);
105114
}
@@ -117,7 +126,10 @@ impl CommandHandler {
117126
) -> CliResult<i32> {
118127
info!("Querying: {}", query);
119128

120-
println!("{}", self.formatter.format_success(&format!("Query: {}", query)));
129+
println!(
130+
"{}",
131+
self.formatter.format_success(&format!("Query: {}", query))
132+
);
121133
Ok(EXIT_SUCCESS)
122134
}
123135

@@ -129,7 +141,15 @@ impl CommandHandler {
129141
("log.level", &config.log.level),
130142
];
131143

132-
println!("{}", self.formatter.format_kv(&pairs.iter().map(|(k, v)| (*k, v.as_str())).collect::<Vec<_>>()));
144+
println!(
145+
"{}",
146+
self.formatter.format_kv(
147+
&pairs
148+
.iter()
149+
.map(|(k, v)| (*k, v.as_str()))
150+
.collect::<Vec<_>>()
151+
)
152+
);
133153
Ok(EXIT_SUCCESS)
134154
}
135155

@@ -146,9 +166,17 @@ impl CommandHandler {
146166

147167
if let Some(path) = &self.global_opts.config {
148168
ConfigLoader::save(&config, path)?;
149-
println!("{}", self.formatter.format_success(&format!("Set {}: {}", key, value)));
169+
println!(
170+
"{}",
171+
self.formatter
172+
.format_success(&format!("Set {}: {}", key, value))
173+
);
150174
} else {
151-
println!("{}", self.formatter.format_success("Config set (not saved - specify --config to persist)"));
175+
println!(
176+
"{}",
177+
self.formatter
178+
.format_success("Config set (not saved - specify --config to persist)")
179+
);
152180
}
153181

154182
Ok(EXIT_SUCCESS)
@@ -160,16 +188,26 @@ impl CommandHandler {
160188
let config = match profile {
161189
"development" => defaults::development_profile(),
162190
"production" => defaults::production_profile(),
163-
_ => return Err(CliError::UsageError(
164-
"profile must be 'development' or 'production'".to_string(),
165-
)),
191+
_ => {
192+
return Err(CliError::UsageError(
193+
"profile must be 'development' or 'production'".to_string(),
194+
))
195+
},
166196
};
167197

168198
if let Some(path) = &self.global_opts.config {
169199
ConfigLoader::save(&config, path)?;
170-
println!("{}", self.formatter.format_success(&format!("Initialized config with '{}' profile", profile)));
200+
println!(
201+
"{}",
202+
self.formatter
203+
.format_success(&format!("Initialized config with '{}' profile", profile))
204+
);
171205
} else {
172-
println!("{}", self.formatter.format_success("Config initialized (specify --config to save)"));
206+
println!(
207+
"{}",
208+
self.formatter
209+
.format_success("Config initialized (specify --config to save)")
210+
);
173211
}
174212

175213
Ok(EXIT_SUCCESS)
@@ -185,9 +223,16 @@ impl CommandHandler {
185223
let config = Default::default();
186224
if let Some(path) = &self.global_opts.config {
187225
ConfigLoader::save(&config, path)?;
188-
println!("{}", self.formatter.format_success("Config reset to defaults"));
226+
println!(
227+
"{}",
228+
self.formatter.format_success("Config reset to defaults")
229+
);
189230
} else {
190-
println!("{}", self.formatter.format_success("Config would be reset (specify --config to persist)"));
231+
println!(
232+
"{}",
233+
self.formatter
234+
.format_success("Config would be reset (specify --config to persist)")
235+
);
191236
}
192237
Ok(EXIT_SUCCESS)
193238
}
@@ -198,37 +243,72 @@ impl CommandHandler {
198243
}
199244

200245
async fn handle_debug_bus_latency(&self, num_messages: u32) -> CliResult<i32> {
201-
println!("{}", self.formatter.format_success(&format!("Would test bus latency with {} messages (not yet implemented)", num_messages)));
246+
println!(
247+
"{}",
248+
self.formatter.format_success(&format!(
249+
"Would test bus latency with {} messages (not yet implemented)",
250+
num_messages
251+
))
252+
);
202253
Ok(EXIT_SUCCESS)
203254
}
204255

205256
async fn handle_debug_memory_stats(&self) -> CliResult<i32> {
206-
println!("{}", self.formatter.format_success("Memory stats (not yet implemented)"));
257+
println!(
258+
"{}",
259+
self.formatter
260+
.format_success("Memory stats (not yet implemented)")
261+
);
207262
Ok(EXIT_SUCCESS)
208263
}
209264

210265
async fn handle_debug_adapter_test(&self, adapter: &str) -> CliResult<i32> {
211-
println!("{}", self.formatter.format_success(&format!("Testing adapter: {} (not yet implemented)", adapter)));
266+
println!(
267+
"{}",
268+
self.formatter.format_success(&format!(
269+
"Testing adapter: {} (not yet implemented)",
270+
adapter
271+
))
272+
);
212273
Ok(EXIT_SUCCESS)
213274
}
214275

215276
async fn handle_debug_trace_flow(&self, task_id: &str) -> CliResult<i32> {
216-
println!("{}", self.formatter.format_success(&format!("Tracing task: {} (not yet implemented)", task_id)));
277+
println!(
278+
"{}",
279+
self.formatter
280+
.format_success(&format!("Tracing task: {} (not yet implemented)", task_id))
281+
);
217282
Ok(EXIT_SUCCESS)
218283
}
219284

220285
async fn handle_debug_profile(&self, duration: u32) -> CliResult<i32> {
221-
println!("{}", self.formatter.format_success(&format!("Profiling for {} seconds (not yet implemented)", duration)));
286+
println!(
287+
"{}",
288+
self.formatter.format_success(&format!(
289+
"Profiling for {} seconds (not yet implemented)",
290+
duration
291+
))
292+
);
222293
Ok(EXIT_SUCCESS)
223294
}
224295

225296
async fn handle_debug_validate_intent(&self, text: &str) -> CliResult<i32> {
226-
println!("{}", self.formatter.format_success(&format!("Validating intent: {} (not yet implemented)", text)));
297+
println!(
298+
"{}",
299+
self.formatter.format_success(&format!(
300+
"Validating intent: {} (not yet implemented)",
301+
text
302+
))
303+
);
227304
Ok(EXIT_SUCCESS)
228305
}
229306

230307
async fn handle_repl(&self) -> CliResult<i32> {
231-
println!("{}", self.formatter.format_success("Starting REPL mode (M1.4.3)"));
308+
println!(
309+
"{}",
310+
self.formatter.format_success("Starting REPL mode (M1.4.3)")
311+
);
232312
Ok(EXIT_SUCCESS)
233313
}
234314

crates/mimi-cli/src/cli/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pub mod error;
33
pub mod formatter;
44
pub mod handler;
55

6-
pub use error::{CliError, CliResult, EXIT_SUCCESS};
76
pub use commands::{Cli, Commands, GlobalOpts, OutputFormat, Priority};
7+
pub use error::{CliError, CliResult, EXIT_SUCCESS};
88
pub use formatter::Formatter;
99
pub use handler::CommandHandler;

crates/mimi-cli/src/config/loader.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ impl ConfigLoader {
2020
CliError::ConfigError(format!("Cannot read config file {}: {}", path.display(), e))
2121
})?;
2222

23-
toml::from_str(&content).map_err(|e| {
24-
CliError::ConfigError(format!("Invalid TOML in config file: {}", e))
25-
})
23+
toml::from_str(&content)
24+
.map_err(|e| CliError::ConfigError(format!("Invalid TOML in config file: {}", e)))
2625
}
2726

2827
/// Save config to file
@@ -71,7 +70,7 @@ impl ConfigLoader {
7170
));
7271
}
7372
config.log.level = value.to_string();
74-
}
73+
},
7574
"memory.max_size" => config.memory.max_size = value.to_string(),
7675
_ => return Err(CliError::NotFound(format!("Unknown config key: {}", key))),
7776
}

0 commit comments

Comments
 (0)