Hmbown/CodeWhale · error
save
Error message
save
What it means
A test-only expect("save") panic in config tests: the ConfigStore save under test returned an Err instead of Ok. It indicates the save path itself failed (permissions, unwritable temp dir, or serialization of the TOML body), not an assertion about content — content checks come later via reading the file back.
Solutions
- Inspect the returned io::Error to see whether the temp dir was unwritable or the TOML render failed
- Ensure the test writes into a fresh tempfile::tempdir so no stale/locked file blocks the save
- If serialization failed, fix the config values the test constructs so they render to valid TOML
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at crates/config/src/tests.rs:4222 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15).
Data as JSON: /api/errors/b943829a7af2687a.
Report an issue: GitHub.
Appendix: source
Thrown at crates/config/src/tests.rs:4222
scrub_plaintext_api_keys_from_config_backup(&path).expect("scrub backup");
let backup = fs::read_to_string(backup_path).expect("read backup");
assert!(!backup.contains("old-test-credential"), "{backup}");
assert!(!backup.contains("api_key"), "{backup}");
assert!(backup.contains("model = \"old-model\""));
}
#[test]
fn config_store_save_preserves_comments() {
let dir = tempfile::tempdir().expect("tempdir");
let config_path = dir.path().join(CONFIG_FILE_NAME);
let original = "# my model\nmodel = \"deepseek-v4-flash\"\n# end comment\n";
fs::write(&config_path, original).expect("write config");
let mut store = ConfigStore::load(Some(config_path.clone())).expect("load config store");
store.config.model = Some("deepseek-v4-pro".to_string());
store.save().expect("save");
let body = fs::read_to_string(&config_path).expect("read config");
assert!(body.contains("# my model"), "prefix comment preserved");
assert!(body.contains("# end comment"), "suffix comment preserved");
assert!(body.contains("model = \"deepseek-v4-pro\""));
}
#[test]
fn config_store_save_preserves_disabled_keys() {
let dir = tempfile::tempdir().expect("tempdir");
let config_path = dir.path().join(CONFIG_FILE_NAME);
fs::write(
&config_path,
"# my note\nmodel = \"deepseek-v4-flash\"\n# base_url = \"http://localhost:11434/v1\"\n",
)
.expect("write config");
let mut store = ConfigStore::load(Some(config_path.clone())).expect("load config store");View on GitHub (pinned to 433685b202)