diff --git a/apps/aether-gateway/src/data/state/testing/mod.rs b/apps/aether-gateway/src/data/state/testing/mod.rs index 230c77a3d..0babed923 100644 --- a/apps/aether-gateway/src/data/state/testing/mod.rs +++ b/apps/aether-gateway/src/data/state/testing/mod.rs @@ -1,10 +1,15 @@ use std::collections::BTreeMap; use std::sync::{Arc, RwLock}; +use aether_data::repository::routing_profiles::InMemoryRoutingGroupRepository; use aether_data_contracts::repository::candidates::RequestCandidateRepository; use aether_data_contracts::repository::pool_scores::PoolMemberScoreRepository; use aether_data_contracts::repository::quota::ProviderQuotaRepository; +use aether_data_contracts::repository::routing_profiles::{ + StoredRoutingGroup, StoredRoutingGroupBinding, StoredRoutingGroupVersion, +}; use aether_data_contracts::repository::usage::UsageRepository; +use aether_routing_core::RoutingGroupConfig; use super::{ AnnouncementReadRepository, AnnouncementWriteRepository, AuthApiKeyReadRepository, @@ -892,6 +897,30 @@ impl GatewayDataState { self } + #[cfg(test)] + pub(crate) fn with_system_default_routing_group_for_tests(self) -> Self { + let now = 1; + let repository = Arc::new(InMemoryRoutingGroupRepository::seed( + [StoredRoutingGroup { + id: "system-default".to_string(), + name: "system-default".to_string(), + description: Some("test system default routing strategy".to_string()), + enabled: true, + is_system_default: true, + sort_order: 0, + config_json: serde_json::to_value(RoutingGroupConfig::default()) + .expect("default routing config should serialize"), + version: 1, + created_at: now, + updated_at: now, + published_at: Some(now), + }], + std::iter::empty::(), + std::iter::empty::(), + )); + self.with_routing_group_repository_for_tests(repository) + } + #[cfg(test)] pub(crate) fn with_auth_api_key_reader( mut self, diff --git a/apps/aether-gateway/src/tests/ai_execute/finalize_local.rs b/apps/aether-gateway/src/tests/ai_execute/finalize_local.rs index 2a699a237..3bac90c5d 100644 --- a/apps/aether-gateway/src/tests/ai_execute/finalize_local.rs +++ b/apps/aether-gateway/src/tests/ai_execute/finalize_local.rs @@ -1877,7 +1877,8 @@ async fn gateway_executes_openai_chat_antigravity_cross_format_sync_via_local_fi Arc::clone(&request_candidate_repository), Arc::clone(&usage_repository), DEVELOPMENT_ENCRYPTION_KEY, - ), + ) + .with_system_default_routing_group_for_tests(), ); let gateway = build_router_with_state(gateway_state); let (gateway_url, gateway_handle) = start_server(gateway).await; diff --git a/apps/aether-gateway/src/tests/ai_execute/finalize_local_cli/cross_format.rs b/apps/aether-gateway/src/tests/ai_execute/finalize_local_cli/cross_format.rs index d5d79c9a2..613dc13d0 100644 --- a/apps/aether-gateway/src/tests/ai_execute/finalize_local_cli/cross_format.rs +++ b/apps/aether-gateway/src/tests/ai_execute/finalize_local_cli/cross_format.rs @@ -1425,7 +1425,8 @@ async fn gateway_executes_openai_responses_antigravity_cross_format_upstream_str Arc::clone(&request_candidate_repository), Arc::clone(&usage_repository), DEVELOPMENT_ENCRYPTION_KEY, - ), + ) + .with_system_default_routing_group_for_tests(), ) .with_oauth_refresh_coordinator_for_tests(oauth_refresh); let gateway = build_router_with_state(gateway_state); diff --git a/apps/aether-gateway/src/tests/ai_execute/finalize_local_provider/gemini.rs b/apps/aether-gateway/src/tests/ai_execute/finalize_local_provider/gemini.rs index 509186eab..25da1ed30 100644 --- a/apps/aether-gateway/src/tests/ai_execute/finalize_local_provider/gemini.rs +++ b/apps/aether-gateway/src/tests/ai_execute/finalize_local_provider/gemini.rs @@ -2004,7 +2004,8 @@ async fn gateway_executes_antigravity_gemini_cli_sync_upstream_stream_via_local_ Arc::clone(&request_candidate_repository), Arc::clone(&usage_repository), DEVELOPMENT_ENCRYPTION_KEY, - ), + ) + .with_system_default_routing_group_for_tests(), ) .with_oauth_refresh_coordinator_for_tests(oauth_refresh); let gateway = build_router_with_state(gateway_state); diff --git a/apps/aether-gateway/src/tests/ai_execute/stream_provider_gemini/local_cli.rs b/apps/aether-gateway/src/tests/ai_execute/stream_provider_gemini/local_cli.rs index 5de65b509..5e2e11b21 100644 --- a/apps/aether-gateway/src/tests/ai_execute/stream_provider_gemini/local_cli.rs +++ b/apps/aether-gateway/src/tests/ai_execute/stream_provider_gemini/local_cli.rs @@ -1915,6 +1915,7 @@ async fn gateway_executes_antigravity_gemini_cli_stream_via_local_decision_gate_ Arc::clone(&request_candidate_repository), DEVELOPMENT_ENCRYPTION_KEY, ) + .with_system_default_routing_group_for_tests() .with_system_config_values_for_tests([( crate::constants::ANTIGRAVITY_BEARER_BRIDGE_CONFIG_KEY.to_string(), json!({ diff --git a/apps/aether-gateway/src/tests/ai_execute/sync/gemini/cli.rs b/apps/aether-gateway/src/tests/ai_execute/sync/gemini/cli.rs index 6beb48a01..707a995d1 100644 --- a/apps/aether-gateway/src/tests/ai_execute/sync/gemini/cli.rs +++ b/apps/aether-gateway/src/tests/ai_execute/sync/gemini/cli.rs @@ -2234,7 +2234,8 @@ async fn gateway_executes_antigravity_gemini_cli_sync_via_local_decision_gate_af provider_catalog_repository, Arc::clone(&request_candidate_repository), DEVELOPMENT_ENCRYPTION_KEY, - ), + ) + .with_system_default_routing_group_for_tests(), ) .with_oauth_refresh_coordinator_for_tests(oauth_refresh); let gateway = build_router_with_state(gateway_state);