Rename local candidate resolution entrypoints

This commit is contained in:
fawney19
2026-04-27 16:55:58 +08:00
parent 07fba70a90
commit 3e0293ac28
10 changed files with 35 additions and 35 deletions

View File

@@ -197,7 +197,7 @@ mod tests {
use super::super::candidate_affinity_cache::remember_scheduler_affinity_for_candidate; use super::super::candidate_affinity_cache::remember_scheduler_affinity_for_candidate;
use super::super::candidate_transport_ranking_facts::resolve_cached_candidate_transport_ranking_facts; use super::super::candidate_transport_ranking_facts::resolve_cached_candidate_transport_ranking_facts;
use super::{PlannerAppState, SchedulerMinimalCandidateSelectionCandidate}; use super::{PlannerAppState, SchedulerMinimalCandidateSelectionCandidate};
use crate::ai_pipeline::planner::candidate_resolution::filter_and_rank_local_execution_candidates; use crate::ai_pipeline::planner::candidate_resolution::resolve_and_rank_local_execution_candidates;
use crate::data::auth::GatewayAuthApiKeySnapshot; use crate::data::auth::GatewayAuthApiKeySnapshot;
use crate::data::GatewayDataState; use crate::data::GatewayDataState;
use crate::tunnel::TunnelAttachmentRecord; use crate::tunnel::TunnelAttachmentRecord;
@@ -997,7 +997,7 @@ mod tests {
.expect("state should build") .expect("state should build")
.with_data_state_for_tests(data_state); .with_data_state_for_tests(data_state);
let (ranked, skipped) = filter_and_rank_local_execution_candidates( let (ranked, skipped) = resolve_and_rank_local_execution_candidates(
PlannerAppState::new(&state), PlannerAppState::new(&state),
vec![ vec![
sample_priority_candidate( sample_priority_candidate(
@@ -1074,7 +1074,7 @@ mod tests {
.expect("state should build") .expect("state should build")
.with_data_state_for_tests(data_state); .with_data_state_for_tests(data_state);
let (ranked, skipped) = filter_and_rank_local_execution_candidates( let (ranked, skipped) = resolve_and_rank_local_execution_candidates(
PlannerAppState::new(&state), PlannerAppState::new(&state),
vec![ vec![
sample_priority_candidate( sample_priority_candidate(
@@ -1147,7 +1147,7 @@ mod tests {
.expect("state should build") .expect("state should build")
.with_data_state_for_tests(data_state); .with_data_state_for_tests(data_state);
let (ranked, skipped) = filter_and_rank_local_execution_candidates( let (ranked, skipped) = resolve_and_rank_local_execution_candidates(
PlannerAppState::new(&state), PlannerAppState::new(&state),
vec![ vec![
sample_priority_candidate( sample_priority_candidate(
@@ -1207,7 +1207,7 @@ mod tests {
.expect("state should build") .expect("state should build")
.with_data_state_for_tests(data_state); .with_data_state_for_tests(data_state);
let (ranked, skipped) = filter_and_rank_local_execution_candidates( let (ranked, skipped) = resolve_and_rank_local_execution_candidates(
PlannerAppState::new(&state), PlannerAppState::new(&state),
vec![ vec![
sample_priority_candidate( sample_priority_candidate(
@@ -1287,7 +1287,7 @@ mod tests {
.expect("state should build") .expect("state should build")
.with_data_state_for_tests(data_state); .with_data_state_for_tests(data_state);
let (ranked, skipped) = filter_and_rank_local_execution_candidates( let (ranked, skipped) = resolve_and_rank_local_execution_candidates(
PlannerAppState::new(&state), PlannerAppState::new(&state),
vec![ vec![
sample_priority_candidate( sample_priority_candidate(
@@ -1365,7 +1365,7 @@ mod tests {
&cached_candidate, &cached_candidate,
); );
let (ranked, skipped) = filter_and_rank_local_execution_candidates( let (ranked, skipped) = resolve_and_rank_local_execution_candidates(
PlannerAppState::new(&state), PlannerAppState::new(&state),
vec![ vec![
sample_priority_candidate( sample_priority_candidate(
@@ -1449,7 +1449,7 @@ mod tests {
&cached_candidate, &cached_candidate,
); );
let (ranked, skipped) = filter_and_rank_local_execution_candidates( let (ranked, skipped) = resolve_and_rank_local_execution_candidates(
PlannerAppState::new(&state), PlannerAppState::new(&state),
vec![ vec![
cached_candidate, cached_candidate,
@@ -1550,7 +1550,7 @@ mod tests {
&cached_candidate, &cached_candidate,
); );
let (ranked, skipped) = filter_and_rank_local_execution_candidates( let (ranked, skipped) = resolve_and_rank_local_execution_candidates(
PlannerAppState::new(&state), PlannerAppState::new(&state),
vec![ vec![
cached_candidate, cached_candidate,
@@ -1651,7 +1651,7 @@ mod tests {
&cached_candidate, &cached_candidate,
); );
let (ranked, skipped) = filter_and_rank_local_execution_candidates( let (ranked, skipped) = resolve_and_rank_local_execution_candidates(
PlannerAppState::new(&state), PlannerAppState::new(&state),
vec![ vec![
cached_candidate, cached_candidate,

View File

@@ -37,7 +37,7 @@ impl SkippedLocalExecutionCandidate {
} }
} }
pub(crate) async fn filter_and_rank_local_execution_candidates( pub(crate) async fn resolve_and_rank_local_execution_candidates(
state: PlannerAppState<'_>, state: PlannerAppState<'_>,
candidates: Vec<SchedulerMinimalCandidateSelectionCandidate>, candidates: Vec<SchedulerMinimalCandidateSelectionCandidate>,
client_api_format: &str, client_api_format: &str,
@@ -50,7 +50,7 @@ pub(crate) async fn filter_and_rank_local_execution_candidates(
Vec<SkippedLocalExecutionCandidate>, Vec<SkippedLocalExecutionCandidate>,
) { ) {
let requested_model = requested_model.trim(); let requested_model = requested_model.trim();
filter_and_rank_local_execution_candidates_with_gate( resolve_and_rank_local_execution_candidates_with_gate(
state, state,
candidates, candidates,
client_api_format, client_api_format,
@@ -70,7 +70,7 @@ pub(crate) async fn filter_and_rank_local_execution_candidates(
.await .await
} }
pub(crate) async fn filter_and_rank_local_execution_candidates_without_transport_pair_gate( pub(crate) async fn resolve_and_rank_local_execution_candidates_without_transport_pair_gate(
state: PlannerAppState<'_>, state: PlannerAppState<'_>,
candidates: Vec<SchedulerMinimalCandidateSelectionCandidate>, candidates: Vec<SchedulerMinimalCandidateSelectionCandidate>,
client_api_format: &str, client_api_format: &str,
@@ -83,7 +83,7 @@ pub(crate) async fn filter_and_rank_local_execution_candidates_without_transport
Vec<SkippedLocalExecutionCandidate>, Vec<SkippedLocalExecutionCandidate>,
) { ) {
let requested_model = requested_model.map(str::trim); let requested_model = requested_model.map(str::trim);
filter_and_rank_local_execution_candidates_with_gate( resolve_and_rank_local_execution_candidates_with_gate(
state, state,
candidates, candidates,
client_api_format, client_api_format,
@@ -102,7 +102,7 @@ pub(crate) async fn filter_and_rank_local_execution_candidates_without_transport
.await .await
} }
async fn filter_and_rank_local_execution_candidates_with_gate<F>( async fn resolve_and_rank_local_execution_candidates_with_gate<F>(
state: PlannerAppState<'_>, state: PlannerAppState<'_>,
candidates: Vec<SchedulerMinimalCandidateSelectionCandidate>, candidates: Vec<SchedulerMinimalCandidateSelectionCandidate>,
client_api_format: &str, client_api_format: &str,

View File

@@ -11,7 +11,7 @@ use crate::ai_pipeline::planner::candidate_metadata::{
LocalExecutionCandidateMetadataParts, LocalExecutionCandidateMetadataParts,
}; };
use crate::ai_pipeline::planner::candidate_resolution::{ use crate::ai_pipeline::planner::candidate_resolution::{
extract_pool_sticky_session_token, filter_and_rank_local_execution_candidates, extract_pool_sticky_session_token, resolve_and_rank_local_execution_candidates,
SkippedLocalExecutionCandidate, SkippedLocalExecutionCandidate,
}; };
use crate::ai_pipeline::planner::common::extract_requested_model_from_request; use crate::ai_pipeline::planner::common::extract_requested_model_from_request;
@@ -107,7 +107,7 @@ pub(crate) async fn materialize_local_same_format_provider_candidate_attempts(
current_unix_secs(), current_unix_secs(),
) )
.await?; .await?;
let (candidates, skipped_candidates) = filter_and_rank_local_execution_candidates( let (candidates, skipped_candidates) = resolve_and_rank_local_execution_candidates(
planner_state, planner_state,
candidates, candidates,
spec_metadata.api_format, spec_metadata.api_format,

View File

@@ -14,7 +14,7 @@ use crate::ai_pipeline::planner::candidate_metadata::{
build_local_execution_candidate_metadata, build_local_execution_candidate_metadata,
build_local_execution_candidate_metadata_for_candidate, LocalExecutionCandidateMetadataParts, build_local_execution_candidate_metadata_for_candidate, LocalExecutionCandidateMetadataParts,
}; };
use crate::ai_pipeline::planner::candidate_resolution::filter_and_rank_local_execution_candidates_without_transport_pair_gate; use crate::ai_pipeline::planner::candidate_resolution::resolve_and_rank_local_execution_candidates_without_transport_pair_gate;
use crate::ai_pipeline::planner::decision_input::{ use crate::ai_pipeline::planner::decision_input::{
build_local_authenticated_decision_input, resolve_local_authenticated_decision_input, build_local_authenticated_decision_input, resolve_local_authenticated_decision_input,
}; };
@@ -90,7 +90,7 @@ pub(super) async fn materialize_local_gemini_files_candidate_attempts(
) )
.await?; .await?;
let (candidates, skipped_candidates) = let (candidates, skipped_candidates) =
filter_and_rank_local_execution_candidates_without_transport_pair_gate( resolve_and_rank_local_execution_candidates_without_transport_pair_gate(
planner_state, planner_state,
candidates, candidates,
GEMINI_FILES_CLIENT_API_FORMAT, GEMINI_FILES_CLIENT_API_FORMAT,

View File

@@ -13,7 +13,7 @@ use crate::ai_pipeline::planner::candidate_metadata::{
build_local_execution_candidate_metadata_for_candidate, LocalExecutionCandidateMetadataParts, build_local_execution_candidate_metadata_for_candidate, LocalExecutionCandidateMetadataParts,
}; };
use crate::ai_pipeline::planner::candidate_resolution::{ use crate::ai_pipeline::planner::candidate_resolution::{
extract_pool_sticky_session_token, filter_and_rank_local_execution_candidates, extract_pool_sticky_session_token, resolve_and_rank_local_execution_candidates,
SkippedLocalExecutionCandidate, SkippedLocalExecutionCandidate,
}; };
use crate::ai_pipeline::planner::decision_input::{ use crate::ai_pipeline::planner::decision_input::{
@@ -153,7 +153,7 @@ async fn materialize_local_openai_image_candidate_attempts(
input.required_capabilities.as_ref(), input.required_capabilities.as_ref(),
LocalCandidatePersistencePolicyKind::ImageDecision, LocalCandidatePersistencePolicyKind::ImageDecision,
); );
let (candidates, skipped_candidates) = filter_and_rank_local_execution_candidates( let (candidates, skipped_candidates) = resolve_and_rank_local_execution_candidates(
state, state,
candidates, candidates,
api_format, api_format,

View File

@@ -15,7 +15,7 @@ use crate::ai_pipeline::planner::candidate_metadata::{
build_local_execution_candidate_metadata_for_candidate, LocalExecutionCandidateMetadataParts, build_local_execution_candidate_metadata_for_candidate, LocalExecutionCandidateMetadataParts,
}; };
use crate::ai_pipeline::planner::candidate_resolution::{ use crate::ai_pipeline::planner::candidate_resolution::{
extract_pool_sticky_session_token, filter_and_rank_local_execution_candidates, extract_pool_sticky_session_token, resolve_and_rank_local_execution_candidates,
SkippedLocalExecutionCandidate, SkippedLocalExecutionCandidate,
}; };
use crate::ai_pipeline::planner::common::extract_requested_model_from_request; use crate::ai_pipeline::planner::common::extract_requested_model_from_request;
@@ -165,7 +165,7 @@ async fn materialize_local_video_create_candidate_attempts(
input.required_capabilities.as_ref(), input.required_capabilities.as_ref(),
LocalCandidatePersistencePolicyKind::VideoDecision, LocalCandidatePersistencePolicyKind::VideoDecision,
); );
let (candidates, skipped_candidates) = filter_and_rank_local_execution_candidates( let (candidates, skipped_candidates) = resolve_and_rank_local_execution_candidates(
state, state,
candidates, candidates,
api_format, api_format,

View File

@@ -14,7 +14,7 @@ use crate::ai_pipeline::planner::candidate_metadata::{
LocalExecutionCandidateMetadataParts, LocalExecutionCandidateMetadataParts,
}; };
use crate::ai_pipeline::planner::candidate_resolution::{ use crate::ai_pipeline::planner::candidate_resolution::{
extract_pool_sticky_session_token, filter_and_rank_local_execution_candidates, extract_pool_sticky_session_token, resolve_and_rank_local_execution_candidates,
SkippedLocalExecutionCandidate, SkippedLocalExecutionCandidate,
}; };
use crate::ai_pipeline::planner::candidate_source::auth_snapshot_allows_cross_format_candidate; use crate::ai_pipeline::planner::candidate_source::auth_snapshot_allows_cross_format_candidate;
@@ -174,7 +174,7 @@ pub(super) async fn materialize_local_standard_candidate_attempts(
} }
} }
} }
let (candidates, skipped_candidates) = filter_and_rank_local_execution_candidates( let (candidates, skipped_candidates) = resolve_and_rank_local_execution_candidates(
planner_state, planner_state,
candidates, candidates,
spec_metadata.api_format, spec_metadata.api_format,

View File

@@ -14,7 +14,7 @@ use crate::ai_pipeline::planner::candidate_metadata::{
LocalExecutionCandidateMetadataParts, LocalExecutionCandidateMetadataParts,
}; };
use crate::ai_pipeline::planner::candidate_resolution::{ use crate::ai_pipeline::planner::candidate_resolution::{
extract_pool_sticky_session_token, filter_and_rank_local_execution_candidates, extract_pool_sticky_session_token, resolve_and_rank_local_execution_candidates,
SkippedLocalExecutionCandidate, SkippedLocalExecutionCandidate,
}; };
use crate::ai_pipeline::planner::materialization_policy::{ use crate::ai_pipeline::planner::materialization_policy::{
@@ -130,7 +130,7 @@ pub(crate) async fn materialize_local_openai_chat_candidate_attempts(
input.required_capabilities.as_ref(), input.required_capabilities.as_ref(),
LocalCandidatePersistencePolicyKind::OpenAiChatDecision, LocalCandidatePersistencePolicyKind::OpenAiChatDecision,
); );
let (candidates, skipped_candidates) = filter_and_rank_local_execution_candidates( let (candidates, skipped_candidates) = resolve_and_rank_local_execution_candidates(
planner_state, planner_state,
candidates, candidates,
"openai:chat", "openai:chat",

View File

@@ -18,7 +18,7 @@ use crate::ai_pipeline::planner::candidate_metadata::{
LocalExecutionCandidateMetadataParts, LocalExecutionCandidateMetadataParts,
}; };
use crate::ai_pipeline::planner::candidate_resolution::{ use crate::ai_pipeline::planner::candidate_resolution::{
extract_pool_sticky_session_token, filter_and_rank_local_execution_candidates, extract_pool_sticky_session_token, resolve_and_rank_local_execution_candidates,
SkippedLocalExecutionCandidate, SkippedLocalExecutionCandidate,
}; };
use crate::ai_pipeline::planner::candidate_source::auth_snapshot_allows_cross_format_candidate; use crate::ai_pipeline::planner::candidate_source::auth_snapshot_allows_cross_format_candidate;
@@ -230,7 +230,7 @@ pub(crate) async fn materialize_local_openai_responses_candidate_attempts(
} }
} }
} }
let (candidates, skipped_candidates) = filter_and_rank_local_execution_candidates( let (candidates, skipped_candidates) = resolve_and_rank_local_execution_candidates(
planner_state, planner_state,
candidates, candidates,
spec_metadata.api_format, spec_metadata.api_format,

View File

@@ -447,8 +447,8 @@ fn ai_pipeline_planner_separates_local_candidate_resolution_from_ranking() {
"candidate_resolution.rs should rank eligible candidates before applying pool-internal account scheduling" "candidate_resolution.rs should rank eligible candidates before applying pool-internal account scheduling"
); );
for pattern in [ for pattern in [
"pub(crate) async fn filter_and_rank_local_execution_candidates(", "pub(crate) async fn resolve_and_rank_local_execution_candidates(",
"pub(crate) async fn filter_and_rank_local_execution_candidates_without_transport_pair_gate(", "pub(crate) async fn resolve_and_rank_local_execution_candidates_without_transport_pair_gate(",
"pub(crate) async fn read_candidate_transport_snapshot(", "pub(crate) async fn read_candidate_transport_snapshot(",
] { ] {
assert!( assert!(
@@ -475,7 +475,7 @@ fn ai_pipeline_planner_separates_local_candidate_resolution_from_ranking() {
for forbidden in [ for forbidden in [
"struct SkippedLocalExecutionCandidate", "struct SkippedLocalExecutionCandidate",
"async fn current_local_execution_candidate_skip_reason(", "async fn current_local_execution_candidate_skip_reason(",
"pub(crate) async fn filter_and_rank_local_execution_candidates(", "pub(crate) async fn resolve_and_rank_local_execution_candidates(",
"resolve_transport_proxy_snapshot_with_tunnel_affinity", "resolve_transport_proxy_snapshot_with_tunnel_affinity",
] { ] {
assert!( assert!(
@@ -499,7 +499,7 @@ fn ai_pipeline_planner_separates_local_candidate_resolution_from_ranking() {
for forbidden in [ for forbidden in [
"apply_scheduler_candidate_ranking", "apply_scheduler_candidate_ranking",
"rank_eligible_local_execution_candidates", "rank_eligible_local_execution_candidates",
"filter_and_rank_local_execution_candidates", "resolve_and_rank_local_execution_candidates",
] { ] {
assert!( assert!(
!candidate_affinity_cache.contains(forbidden), !candidate_affinity_cache.contains(forbidden),
@@ -524,7 +524,7 @@ fn ai_pipeline_planner_separates_local_candidate_resolution_from_ranking() {
for forbidden in [ for forbidden in [
"apply_scheduler_candidate_ranking", "apply_scheduler_candidate_ranking",
"rank_eligible_local_execution_candidates", "rank_eligible_local_execution_candidates",
"filter_and_rank_local_execution_candidates", "resolve_and_rank_local_execution_candidates",
] { ] {
assert!( assert!(
!candidate_transport_ranking_facts.contains(forbidden), !candidate_transport_ranking_facts.contains(forbidden),
@@ -1326,7 +1326,7 @@ fn ai_pipeline_specialized_files_attempts_consume_eligible_local_candidates_with
); );
assert!( assert!(
specialized_files_support specialized_files_support
.contains("filter_and_rank_local_execution_candidates_without_transport_pair_gate("), .contains("resolve_and_rank_local_execution_candidates_without_transport_pair_gate("),
"specialized files support should source runtime gating from candidate_resolution" "specialized files support should source runtime gating from candidate_resolution"
); );
assert!( assert!(