Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(migrations): update migration tests for schema v12 to v13

Steven Enamakelc62987737e82
diff --git a/crates/openhuman-core/src/config/migrations/mod_tests.rs b/crates/openhuman-core/src/config/migrations/mod_tests.rs
index 4234363c1c..184dc02b28 100644
--- a/crates/openhuman-core/src/config/migrations/mod_tests.rs
+++ b/crates/openhuman-core/src/config/migrations/mod_tests.rs
@@ -250,7 +250,7 @@ async fn run_pending_v7_to_v8_rolls_back_default_model_when_save_fails() {
}
#[tokio::test]
-async fn run_pending_v12_to_v13_retires_persisted_tier_slugs() {
+async fn bare_core_v12_to_v13_preserves_provider_model_values() {
let tmp = TempDir::new().unwrap();
fs::create_dir_all(tmp.path().join("workspace")).unwrap();
@@ -262,19 +262,45 @@ async fn run_pending_v12_to_v13_retires_persisted_tier_slugs() {
run_pending(&mut config).await;
assert_eq!(config.schema_version, CURRENT_SCHEMA_VERSION);
- assert_eq!(
- config.default_model.as_deref(),
- Some(crate::config::MODEL_MANAGED_DEFAULT)
- );
- assert_eq!(
- config.orchestrator.model.as_deref(),
- Some(crate::config::MODEL_MANAGED_DEFAULT)
- );
+ assert_eq!(config.default_model.as_deref(), Some("chat-v1"));
+ assert_eq!(config.orchestrator.model.as_deref(), Some("reasoning-v1"));
let on_disk = std::fs::read_to_string(&config.config_path).unwrap();
assert!(
- !on_disk.contains("chat-v1") && !on_disk.contains("reasoning-v1"),
- "no retired tier slug may survive on disk, got:\n{on_disk}"
+ on_disk.contains("chat-v1") && on_disk.contains("reasoning-v1"),
+ "bare core must leave provider-owned values unchanged, got:\n{on_disk}"
+ );
+}
+
+#[tokio::test]
+async fn registered_normalizer_runs_at_current_schema_and_retries_failed_save() {
+ let tmp = TempDir::new().unwrap();
+ fs::create_dir_all(tmp.path().join("workspace")).unwrap();
+ let mut config = config_in(&tmp);
+ config.schema_version = CURRENT_SCHEMA_VERSION;
+ config.default_model = Some("legacy-value".to_string());
+ let blocker = tmp.path().join("blocker");
+ fs::write(&blocker, "not a directory").unwrap();
+ config.config_path = blocker.join("nested").join("config.toml");
+
+ crate::inference::registry::register_config_normalizer(
+ "migration-test",
+ std::sync::Arc::new(|config| {
+ if config.default_model.as_deref() == Some("legacy-value") {
+ config.default_model = Some("normalized-value".to_string());
+ true
+ } else {
+ false
+ }
+ }),
);
+ run_pending(&mut config).await;
+ assert_eq!(config.default_model.as_deref(), Some("legacy-value"));
+
+ config.config_path = tmp.path().join("config.toml");
+ run_pending(&mut config).await;
+ assert_eq!(config.default_model.as_deref(), Some("normalized-value"));
+ let on_disk = fs::read_to_string(&config.config_path).unwrap();
+ assert!(on_disk.contains("normalized-value"));
}
#[tokio::test]