Remove ranked minimal selection compatibility helper

This commit is contained in:
fawney19
2026-04-27 15:52:26 +08:00
parent e5e09b49f4
commit e9f03d8d29
11 changed files with 103 additions and 161 deletions

View File

@@ -4,8 +4,8 @@ use aether_scheduler_core::{
auth_constraints_allow_api_format, collect_global_model_names_for_required_capability,
enumerate_minimal_candidate_selection, normalize_api_format,
resolve_requested_global_model_name, row_supports_requested_model,
BuildMinimalCandidateSelectionInput, SchedulerAuthConstraints,
SchedulerMinimalCandidateSelectionCandidate, SchedulerPriorityMode,
EnumerateMinimalCandidateSelectionInput, SchedulerAuthConstraints,
SchedulerMinimalCandidateSelectionCandidate,
};
use async_trait::async_trait;
use std::collections::BTreeSet;
@@ -77,7 +77,7 @@ pub(crate) async fn enumerate_minimal_candidate_selection_with_required_capabili
return Ok(Vec::new());
};
let auth_constraints = auth_snapshot.map(auth_snapshot_constraints);
enumerate_minimal_candidate_selection(BuildMinimalCandidateSelectionInput {
enumerate_minimal_candidate_selection(EnumerateMinimalCandidateSelectionInput {
rows,
normalized_api_format: &normalized_api_format,
requested_model_name,
@@ -85,8 +85,6 @@ pub(crate) async fn enumerate_minimal_candidate_selection_with_required_capabili
require_streaming,
required_capabilities,
auth_constraints: auth_constraints.as_ref(),
affinity_key: None,
priority_mode: SchedulerPriorityMode::Provider,
})
}
@@ -172,12 +170,6 @@ pub(crate) async fn read_global_model_names_for_api_format(
Ok(model_names.into_iter().collect())
}
fn auth_snapshot_affinity_key(auth_snapshot: Option<&GatewayAuthApiKeySnapshot>) -> Option<&str> {
auth_snapshot
.map(|snapshot| snapshot.api_key_id.trim())
.filter(|value| !value.is_empty())
}
fn auth_snapshot_constraints(snapshot: &GatewayAuthApiKeySnapshot) -> SchedulerAuthConstraints {
SchedulerAuthConstraints {
allowed_providers: snapshot

View File

@@ -24,8 +24,8 @@ use aether_data_contracts::repository::video_tasks::{
UpsertVideoTask, VideoTaskLookupKey, VideoTaskStatus, VideoTaskWriteRepository,
};
use aether_scheduler_core::{
build_ranked_minimal_candidate_selection, BuildMinimalCandidateSelectionInput,
SchedulerAuthConstraints, SchedulerPriorityMode,
enumerate_minimal_candidate_selection, EnumerateMinimalCandidateSelectionInput,
SchedulerAuthConstraints,
};
use serde_json::json;
@@ -622,18 +622,17 @@ async fn data_state_reads_minimal_candidate_selection_with_auth_filters() {
.map(|items| items.to_vec()),
};
let selection = build_ranked_minimal_candidate_selection(BuildMinimalCandidateSelectionInput {
rows,
normalized_api_format: "openai:chat",
requested_model_name: "gpt-4.1",
resolved_global_model_name: "gpt-4.1",
require_streaming: false,
required_capabilities: None,
auth_constraints: Some(&auth_constraints),
affinity_key: Some(auth_snapshot.api_key_id.as_str()),
priority_mode: SchedulerPriorityMode::Provider,
})
.expect("selection should read");
let selection =
enumerate_minimal_candidate_selection(EnumerateMinimalCandidateSelectionInput {
rows,
normalized_api_format: "openai:chat",
requested_model_name: "gpt-4.1",
resolved_global_model_name: "gpt-4.1",
require_streaming: false,
required_capabilities: None,
auth_constraints: Some(&auth_constraints),
})
.expect("selection should read");
assert_eq!(selection.len(), 2);
assert_eq!(selection[0].provider_id, "provider-1");