fix: filter candidate rows to resolved global model name only

This commit is contained in:
fawney19
2026-04-28 01:12:27 +08:00
parent 9a67497d8c
commit 032dcf40e7
2 changed files with 9 additions and 7 deletions

View File

@@ -48,7 +48,12 @@ pub(crate) async fn read_requested_model_rows(
return Ok(None); return Ok(None);
}; };
Ok(Some((resolved_global_model_name, rows))) let resolved_rows = rows
.into_iter()
.filter(|row| row.global_model_name == resolved_global_model_name)
.collect();
Ok(Some((resolved_global_model_name, resolved_rows)))
} }
pub(crate) async fn enumerate_minimal_candidate_selection_with_required_capabilities( pub(crate) async fn enumerate_minimal_candidate_selection_with_required_capabilities(

View File

@@ -152,7 +152,7 @@ async fn enumerate_minimal_candidate_selection_resolves_provider_model_alias() {
} }
#[tokio::test] #[tokio::test]
async fn enumerate_minimal_candidate_selection_keeps_all_rows_supporting_requested_model() { async fn enumerate_minimal_candidate_selection_keeps_only_resolved_global_model_rows() {
let mut exact = sample_row(); let mut exact = sample_row();
exact.provider_id = "provider-exact".to_string(); exact.provider_id = "provider-exact".to_string();
exact.endpoint_id = "endpoint-exact".to_string(); exact.endpoint_id = "endpoint-exact".to_string();
@@ -199,11 +199,8 @@ async fn enumerate_minimal_candidate_selection_keeps_all_rows_supporting_request
.iter() .iter()
.map(|candidate| candidate.provider_id.as_str()) .map(|candidate| candidate.provider_id.as_str())
.collect::<Vec<_>>(); .collect::<Vec<_>>();
assert_eq!(provider_ids, vec!["provider-exact", "provider-mapped"]); assert_eq!(provider_ids, vec!["provider-exact"]);
assert_eq!( assert_eq!(selection[0].selected_provider_model_name, "gpt-5");
selection[1].selected_provider_model_name,
"claude-sonnet-upstream"
);
} }
#[tokio::test] #[tokio::test]