From 5a5febaa6d805aba0ecc89a55b293557f42875f0 Mon Sep 17 00:00:00 2001 From: Vittorio Distefano Date: Sat, 21 Nov 2026 07:09:45 +0100 Subject: [PATCH] fix(config): name the key in a rejected config set config set reported the runtime's parse error alone, which points at the edited line but not at the dotted key, so a rejected nested value read as an anonymous TOML error. The message now starts with the key that was set. --- src/commands/config.rs | 3 ++- src/commands/config_tests.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/commands/config.rs b/src/commands/config.rs index 21f4960..60c1581 100644 --- a/src/commands/config.rs +++ b/src/commands/config.rs @@ -63,7 +63,8 @@ pub fn run_set(key: &str, value: &str) -> CliResult { set_toml_edit_segments(&mut doc, &segments, value)?; let new_content = doc.to_string(); - solver_config::validate_current_settings(&new_content)?; + solver_config::validate_current_settings(&new_content) + .map_err(|err| CliError::general(format!("cannot set `{key}`: {err}")))?; fs::write(path, &new_content).map_err(|e| CliError::IoError { context: "failed to write solver.toml".to_string(), diff --git a/src/commands/config_tests.rs b/src/commands/config_tests.rs index c192dd9..e21f6ed 100644 --- a/src/commands/config_tests.rs +++ b/src/commands/config_tests.rs @@ -206,7 +206,7 @@ fn run_set_rejects_zero_candidate_trace_capacity_without_writing() { assert_eq!(saved, original); assert!(error .to_string() - .contains("solver.toml does not load in the SolverForge runtime")); + .starts_with("cannot set `candidate_trace.max_entries`: solver.toml does not load in the SolverForge runtime")); } #[test]