修复 AGC Rust 测试夹具未跟随执行器与协议正交拆分

补 select_game_creator_model 第 4 个协议参数(传 None,按执行器推导协议)
补四处 GameCreatorAppConfig 字面量的 selected_model_protocol: None
目的:HEAD 上测试模块编译失败(9 个错误),挡住预检与运行时分类的定向验证
验证:cargo test --features=cocos-editor-execute,unity-editor-execute,godot-editor-execute --bin genarrative-ai-game-creator-shell tests::configuration:: 45 passed
This commit is contained in:
kdletters
2026-10-02 12:56:59 +08:00
parent 98cb0d237e
commit 563f6a8e04
@@ -38,9 +38,9 @@ fn custom_llm_config_save_reload_and_selection_preserve_overlay_and_credentials(
write_game_creator_config_atomically(&overlay, r#"{"llm":{"customEnabled":true,"apiKey":"fixture-key","baseUrl":"https://custom.example/v1","visibleModels":["a/v1","b:v2"]},"selectedModelId":"a/v1","selectedModelIsDefault":true}"#).unwrap();
let mut config = read_game_creator_app_config().unwrap().config;
assert_eq!(config.llm.model, "a/v1");
let selected = select_game_creator_model("b:v2".into(), false, None).unwrap();
let selected = select_game_creator_model("b:v2".into(), false, None, None).unwrap();
assert_eq!(selected.config.llm.model, "b:v2");
assert!(select_game_creator_model("not-listed".into(), false, None).is_err());
assert!(select_game_creator_model("not-listed".into(), false, None, None).is_err());
config.llm.visible_models = vec!["b:v2".into()];
config.llm.api_key = "changed-fixture-key".into();
write_game_creator_app_config(config).unwrap();
@@ -817,6 +817,7 @@ fn app_config_commands_write_runtime_config_file() {
agent_llm,
selected_model_id: "default".to_string(),
selected_model_is_default: false,
selected_model_protocol: None,
})
.expect("write runtime config");
@@ -964,7 +965,7 @@ fn app_config_model_selection_only_updates_model_overlay() {
)
.expect("write overlay");
let saved =
select_game_creator_model("new-model".to_string(), true, None).expect("select model");
select_game_creator_model("new-model".to_string(), true, None, None).expect("select model");
let effective = load_game_creator_app_config().expect("effective config");
assert_eq!(saved.config.selected_model_id, "new-model");
assert_eq!(effective.selected_model_id, "new-model");
@@ -986,13 +987,13 @@ fn model_selection_default_flag_round_trips() {
fs::create_dir_all(&root).expect("runtime config dir");
let _guard = use_test_runtime_config_dir(root.clone());
let saved =
select_game_creator_model("quality".to_string(), true, None).expect("select default model");
let saved = select_game_creator_model("quality".to_string(), true, None, None)
.expect("select default model");
assert_eq!(saved.config.selected_model_id, "quality");
assert!(saved.config.selected_model_is_default);
let saved =
select_game_creator_model("fast".to_string(), false, None).expect("select explicit model");
let saved = select_game_creator_model("fast".to_string(), false, None, None)
.expect("select explicit model");
assert_eq!(saved.config.selected_model_id, "fast");
assert!(!saved.config.selected_model_is_default);
@@ -1021,6 +1022,7 @@ fn app_config_write_rejects_invalid_api_kind() {
agent_llm: BTreeMap::new(),
selected_model_id: "default".to_string(),
selected_model_is_default: false,
selected_model_protocol: None,
});
assert!(result
@@ -1048,6 +1050,7 @@ fn app_config_write_rejects_invalid_reasoning_effort() {
agent_llm: BTreeMap::new(),
selected_model_id: "default".to_string(),
selected_model_is_default: false,
selected_model_protocol: None,
});
assert!(result
@@ -1075,6 +1078,7 @@ fn app_config_write_rejects_too_small_request_timeout() {
agent_llm: BTreeMap::new(),
selected_model_id: "default".to_string(),
selected_model_is_default: false,
selected_model_protocol: None,
});
assert!(result