Rename ranked minimal candidate reads

This commit is contained in:
fawney19
2026-04-27 15:28:20 +08:00
parent 44930532dc
commit dda6f34a07
4 changed files with 36 additions and 33 deletions

View File

@@ -14,7 +14,7 @@ use aether_scheduler_core::SchedulerMinimalCandidateSelectionCandidate;
use crate::cache::SchedulerAffinityTarget;
use crate::data::auth::GatewayAuthApiKeySnapshot;
use crate::data::candidate_selection::{
read_minimal_candidate_selection, MinimalCandidateSelectionRowSource,
read_ranked_minimal_candidate_selection, MinimalCandidateSelectionRowSource,
};
use crate::data::GatewayDataState;
use crate::{AppState, GatewayError};
@@ -86,7 +86,7 @@ async fn same_priority_candidates_are_distributed_by_affinity_key() {
let state = GatewayDataState::with_candidate_selection_and_quota_for_tests(candidates, quotas);
let auth_snapshot = sample_auth_snapshot("affinity-key-1");
let selection = read_minimal_candidate_selection(
let selection = read_ranked_minimal_candidate_selection(
&state,
"openai:chat",
"gpt-4.1",

View File

@@ -7,7 +7,7 @@ use aether_scheduler_core::{
resolve_requested_global_model_name, SchedulerMinimalCandidateSelectionCandidate,
};
use crate::data::candidate_selection::read_minimal_candidate_selection;
use crate::data::candidate_selection::read_ranked_minimal_candidate_selection;
use crate::data::GatewayDataState;
use super::super::{
@@ -119,7 +119,7 @@ fn scheduler_candidate_is_serializable() {
}
#[tokio::test]
async fn read_minimal_candidate_selection_resolves_provider_model_alias() {
async fn read_ranked_minimal_candidate_selection_resolves_provider_model_alias() {
let mut row = sample_row();
row.global_model_name = "gpt-5".to_string();
row.model_provider_model_name = "gpt-5.2".to_string();
@@ -135,9 +135,10 @@ async fn read_minimal_candidate_selection_resolves_provider_model_alias() {
let quotas = Arc::new(InMemoryProviderQuotaRepository::seed(vec![]));
let state = GatewayDataState::with_candidate_selection_and_quota_for_tests(candidates, quotas);
let selection = read_minimal_candidate_selection(&state, "openai:chat", "gpt-5.2", false, None)
.await
.expect("selection should succeed");
let selection =
read_ranked_minimal_candidate_selection(&state, "openai:chat", "gpt-5.2", false, None)
.await
.expect("selection should succeed");
assert_eq!(selection.len(), 1);
assert_eq!(selection[0].global_model_name, "gpt-5");
@@ -145,7 +146,7 @@ async fn read_minimal_candidate_selection_resolves_provider_model_alias() {
}
#[tokio::test]
async fn read_minimal_candidate_selection_keeps_all_rows_supporting_requested_model() {
async fn read_ranked_minimal_candidate_selection_keeps_all_rows_supporting_requested_model() {
let mut exact = sample_row();
exact.provider_id = "provider-exact".to_string();
exact.endpoint_id = "endpoint-exact".to_string();
@@ -177,9 +178,10 @@ async fn read_minimal_candidate_selection_keeps_all_rows_supporting_requested_mo
let quotas = Arc::new(InMemoryProviderQuotaRepository::seed(vec![]));
let state = GatewayDataState::with_candidate_selection_and_quota_for_tests(candidates, quotas);
let selection = read_minimal_candidate_selection(&state, "openai:chat", "gpt-5", false, None)
.await
.expect("selection should succeed");
let selection =
read_ranked_minimal_candidate_selection(&state, "openai:chat", "gpt-5", false, None)
.await
.expect("selection should succeed");
let provider_ids = selection
.iter()
@@ -193,7 +195,7 @@ async fn read_minimal_candidate_selection_keeps_all_rows_supporting_requested_mo
}
#[tokio::test]
async fn read_minimal_candidate_selection_allows_resolved_global_model_in_auth_snapshot() {
async fn read_ranked_minimal_candidate_selection_allows_resolved_global_model_in_auth_snapshot() {
let mut row = sample_row();
row.global_model_name = "gpt-5".to_string();
row.global_model_mappings = Some(vec!["gpt-5(?:\\.\\d+)?".to_string()]);
@@ -213,7 +215,7 @@ async fn read_minimal_candidate_selection_allows_resolved_global_model_in_auth_s
auth_snapshot.user_allowed_models = Some(vec!["gpt-5".to_string()]);
auth_snapshot.api_key_allowed_models = Some(vec!["gpt-5".to_string()]);
let selection = read_minimal_candidate_selection(
let selection = read_ranked_minimal_candidate_selection(
&state,
"openai:chat",
"gpt-5.2",