Unify candidate ranking pipeline

This commit is contained in:
fawney19
2026-04-27 12:34:03 +08:00
parent 9b866a6d17
commit 3b542434a2
46 changed files with 3635 additions and 1914 deletions

View File

@@ -423,6 +423,7 @@ fn ai_pipeline_planner_separates_local_candidate_eligibility_from_affinity_ranki
for pattern in [
"mod candidate_affinity;",
"mod candidate_eligibility;",
"mod candidate_resolution;",
"mod candidate_preparation;",
] {
assert!(
@@ -431,19 +432,30 @@ fn ai_pipeline_planner_separates_local_candidate_eligibility_from_affinity_ranki
);
}
let candidate_eligibility =
read_workspace_file("apps/aether-gateway/src/ai_pipeline/planner/candidate_eligibility.rs");
let candidate_resolution =
read_workspace_file("apps/aether-gateway/src/ai_pipeline/planner/candidate_resolution.rs");
for pattern in [
"pub(crate) async fn filter_and_rank_local_execution_candidates(",
"pub(crate) async fn filter_and_rank_local_execution_candidates_without_transport_pair_gate(",
"pub(crate) async fn read_candidate_transport_snapshot(",
] {
assert!(
candidate_eligibility.contains(pattern),
"planner/candidate_eligibility.rs should own {pattern}"
candidate_resolution.contains(pattern),
"planner/candidate_resolution.rs should own {pattern}"
);
}
let candidate_eligibility =
read_workspace_file("apps/aether-gateway/src/ai_pipeline/planner/candidate_eligibility.rs");
assert!(
candidate_eligibility.contains("pub(crate) use super::candidate_resolution::*;"),
"planner/candidate_eligibility.rs should remain a compatibility shim"
);
assert!(
!candidate_eligibility.contains("async fn filter_and_rank_local_execution_candidates("),
"planner/candidate_eligibility.rs should not keep resolution implementation"
);
let candidate_affinity =
read_workspace_file("apps/aether-gateway/src/ai_pipeline/planner/candidate_affinity.rs");
assert!(
@@ -1233,11 +1245,11 @@ fn ai_pipeline_specialized_files_attempts_consume_eligible_local_candidates_with
assert!(
specialized_files_support
.contains("filter_and_rank_local_execution_candidates_without_transport_pair_gate("),
"specialized files support should source runtime gating from candidate_eligibility"
"specialized files support should source runtime gating from candidate_resolution"
);
assert!(
!specialized_files_support.contains("rank_local_execution_candidates("),
"specialized files support should not bypass candidate_eligibility with raw affinity ranking"
"specialized files support should not bypass candidate_resolution with raw affinity ranking"
);
let specialized_files_decision = read_workspace_file(

View File

@@ -254,12 +254,20 @@ fn scheduler_candidate_runtime_paths_depend_on_scheduler_core_and_state_trait()
"selection.rs should not depend on gateway-local SchedulerAffinityTarget"
);
assert!(
selection.contains("reorder_candidates_by_scheduler_health_in_core"),
"selection.rs should depend on core candidate reorder helper"
selection.contains("enumerate_scheduler_candidates("),
"selection.rs should delegate candidate enumeration"
);
assert!(
selection.contains("collect_selectable_candidates_from_keys"),
"selection.rs should depend on core selectable-candidate collector"
selection.contains("read_candidate_runtime_selection_snapshot("),
"selection.rs should delegate runtime snapshot loading"
);
assert!(
selection.contains("resolve_scheduler_candidate_selectability("),
"selection.rs should delegate selectability resolution"
);
assert!(
selection.contains("rank_scheduler_candidates("),
"selection.rs should delegate final ranking"
);
for pattern in [
"async fn collect_selectable_candidates(",
@@ -282,8 +290,10 @@ fn scheduler_candidate_runtime_paths_depend_on_scheduler_core_and_state_trait()
"read_provider_concurrent_limits(",
"read_provider_key_rpm_states(",
"candidate_is_selectable_with_runtime_state",
"collect_selectable_candidates_from_keys",
"auth_api_key_concurrency_limit_reached",
"build_provider_concurrent_limit_map(",
"reorder_candidates_by_scheduler_health",
] {
assert!(
!selection.contains(pattern),
@@ -558,8 +568,8 @@ fn scheduler_candidate_runtime_paths_depend_on_scheduler_core_and_state_trait()
let planner_candidate_affinity =
read_workspace_file("apps/aether-gateway/src/ai_pipeline/planner/candidate_affinity.rs");
assert!(
planner_candidate_affinity
.contains("aether_scheduler_core::SchedulerMinimalCandidateSelectionCandidate"),
planner_candidate_affinity.contains("use aether_scheduler_core::{")
&& planner_candidate_affinity.contains("SchedulerMinimalCandidateSelectionCandidate"),
"planner/candidate_affinity.rs should depend directly on core minimal candidate DTO"
);
assert!(