chore: resolve pr 377 checks

This commit is contained in:
fawney19
2026-05-06 02:22:32 +08:00
502 changed files with 89553 additions and 21893 deletions

View File

@@ -568,7 +568,7 @@ async fn gateway_executes_kiro_claude_cli_sync_upstream_stream_via_local_finaliz
profile_arn: String,
debug_tag: String,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
fn hash_api_key(value: &str) -> String {
@@ -900,8 +900,8 @@ async fn gateway_executes_kiro_claude_cli_sync_upstream_stream_via_local_finaliz
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile").and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -1089,7 +1089,7 @@ async fn gateway_executes_kiro_claude_cli_sync_upstream_stream_via_local_finaliz
"proxy-node-kiro-cli-finalize-local"
);
assert_eq!(
seen_remote_execution_runtime_request.tls_profile,
seen_remote_execution_runtime_request.transport_profile_id,
"chrome_136"
);

View File

@@ -943,7 +943,7 @@ async fn gateway_executes_openai_chat_stream_with_custom_path_via_local_decision
metadata_source: String,
temperature_present: bool,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
fn hash_api_key(value: &str) -> String {
@@ -1258,8 +1258,8 @@ async fn gateway_executes_openai_chat_stream_with_custom_path_via_local_decision
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile").and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -1391,7 +1391,10 @@ async fn gateway_executes_openai_chat_stream_with_custom_path_via_local_decision
seen_execution_runtime_request.proxy_node_id,
"proxy-node-openai-custom-stream"
);
assert_eq!(seen_execution_runtime_request.tls_profile, "chrome_136");
assert_eq!(
seen_execution_runtime_request.transport_profile_id,
"chrome_136"
);
let stored_candidates = request_candidate_repository
.list_by_request_id("trace-openai-chat-custom-stream-123")

View File

@@ -43,7 +43,7 @@ async fn gateway_executes_openai_responses_compact_stream_via_local_decision_gat
instructions: String,
store_present: bool,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
fn hash_api_key(value: &str) -> String {
@@ -398,8 +398,8 @@ async fn gateway_executes_openai_responses_compact_stream_via_local_decision_gat
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile").and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -534,7 +534,10 @@ async fn gateway_executes_openai_responses_compact_stream_via_local_decision_gat
seen_execution_runtime_request.proxy_node_id,
"proxy-node-openai-compact-local"
);
assert_eq!(seen_execution_runtime_request.tls_profile, "chrome_136");
assert_eq!(
seen_execution_runtime_request.transport_profile_id,
"chrome_136"
);
let stored_candidates = request_candidate_repository
.list_by_request_id("trace-openai-compact-local-123")

View File

@@ -37,7 +37,7 @@ async fn gateway_executes_kiro_claude_cli_stream_via_local_provider_catalog_cand
current_content: String,
debug_tag: String,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
fn crc32(data: &[u8]) -> u32 {
@@ -404,8 +404,8 @@ async fn gateway_executes_kiro_claude_cli_stream_via_local_provider_catalog_cand
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile").and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -549,7 +549,10 @@ async fn gateway_executes_kiro_claude_cli_stream_via_local_provider_catalog_cand
seen_execution_runtime_request.proxy_node_id,
"proxy-node-kiro-cli-local-stream"
);
assert_eq!(seen_execution_runtime_request.tls_profile, "chrome_136");
assert_eq!(
seen_execution_runtime_request.transport_profile_id,
"chrome_136"
);
let stored_candidates = request_candidate_repository
.list_by_request_id("trace-kiro-cli-local-stream-123")
@@ -588,7 +591,7 @@ async fn gateway_executes_claude_cli_stream_via_local_decision_gate_without_wait
metadata_mode: String,
metadata_source: String,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
fn hash_api_key(value: &str) -> String {
@@ -866,8 +869,8 @@ async fn gateway_executes_claude_cli_stream_via_local_decision_gate_without_wait
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile").and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -992,7 +995,10 @@ async fn gateway_executes_claude_cli_stream_via_local_decision_gate_without_wait
seen_execution_runtime_request.proxy_node_id,
"proxy-node-claude-cli-local"
);
assert_eq!(seen_execution_runtime_request.tls_profile, "chrome_136");
assert_eq!(
seen_execution_runtime_request.transport_profile_id,
"chrome_136"
);
let stored_candidates = request_candidate_repository
.list_by_request_id("trace-claude-cli-local-stream-123")
@@ -1037,7 +1043,7 @@ async fn gateway_executes_claude_code_cli_stream_via_local_decision_gate_with_lo
metadata_source: String,
assistant_content: serde_json::Value,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
fn hash_api_key(value: &str) -> String {
@@ -1365,8 +1371,8 @@ async fn gateway_executes_claude_code_cli_stream_via_local_decision_gate_with_lo
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile").and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -1517,7 +1523,7 @@ async fn gateway_executes_claude_code_cli_stream_via_local_decision_gate_with_lo
"proxy-node-claude-code-cli-local"
);
assert_eq!(
seen_execution_runtime_request.tls_profile,
seen_execution_runtime_request.transport_profile_id,
"claude_code_nodejs"
);
@@ -1557,7 +1563,7 @@ async fn gateway_executes_claude_chat_stream_via_local_decision_gate_with_local_
metadata_mode: String,
metadata_source: String,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
fn hash_api_key(value: &str) -> String {
@@ -1838,8 +1844,8 @@ async fn gateway_executes_claude_chat_stream_via_local_decision_gate_with_local_
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile").and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -1950,7 +1956,10 @@ async fn gateway_executes_claude_chat_stream_via_local_decision_gate_with_local_
seen_execution_runtime_request.proxy_node_id,
"proxy-node-claude-chat-stream"
);
assert_eq!(seen_execution_runtime_request.tls_profile, "chrome_136");
assert_eq!(
seen_execution_runtime_request.transport_profile_id,
"chrome_136"
);
let stored_candidates = request_candidate_repository
.list_by_request_id("trace-claude-chat-local-stream-123")

View File

@@ -25,7 +25,7 @@ async fn gateway_executes_gemini_chat_stream_via_local_decision_gate_with_local_
metadata_source: String,
tool_config_present: bool,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
fn hash_api_key(value: &str) -> String {
@@ -331,8 +331,8 @@ async fn gateway_executes_gemini_chat_stream_via_local_decision_gate_with_local_
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile").and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -441,7 +441,10 @@ async fn gateway_executes_gemini_chat_stream_via_local_decision_gate_with_local_
seen_execution_runtime_request.proxy_node_id,
"proxy-node-gemini-chat-stream"
);
assert_eq!(seen_execution_runtime_request.tls_profile, "chrome_136");
assert_eq!(
seen_execution_runtime_request.transport_profile_id,
"chrome_136"
);
let stored_candidates = request_candidate_repository
.list_by_request_id("trace-gemini-chat-local-stream-1")

View File

@@ -25,7 +25,7 @@ async fn gateway_executes_gemini_cli_stream_via_local_decision_gate_with_local_s
metadata_source: String,
tool_config_present: bool,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
fn hash_api_key(value: &str) -> String {
@@ -308,8 +308,8 @@ async fn gateway_executes_gemini_cli_stream_via_local_decision_gate_with_local_s
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile").and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -418,7 +418,10 @@ async fn gateway_executes_gemini_cli_stream_via_local_decision_gate_with_local_s
seen_execution_runtime_request.proxy_node_id,
"proxy-node-gemini-cli-local"
);
assert_eq!(seen_execution_runtime_request.tls_profile, "chrome_136");
assert_eq!(
seen_execution_runtime_request.transport_profile_id,
"chrome_136"
);
let stored_candidates = request_candidate_repository
.list_by_request_id("trace-gemini-cli-local-stream-123")
@@ -457,7 +460,7 @@ async fn gateway_executes_gemini_cli_stream_via_local_decision_gate_after_oauth_
metadata_source: String,
tool_config_present: bool,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
#[derive(Debug, Clone)]
@@ -782,8 +785,8 @@ async fn gateway_executes_gemini_cli_stream_via_local_decision_gate_after_oauth_
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile").and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -927,7 +930,10 @@ async fn gateway_executes_gemini_cli_stream_via_local_decision_gate_after_oauth_
seen_execution_runtime_request.proxy_node_id,
"proxy-node-gemini-cli-oauth-local"
);
assert_eq!(seen_execution_runtime_request.tls_profile, "chrome_136");
assert_eq!(
seen_execution_runtime_request.transport_profile_id,
"chrome_136"
);
let stored_candidates = request_candidate_repository
.list_by_request_id("trace-gemini-cli-oauth-local-stream-123")

View File

@@ -2605,7 +2605,7 @@ async fn gateway_executes_openai_chat_sync_with_custom_path_via_local_decision_g
metadata_source: String,
temperature_present: bool,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
fn hash_api_key(value: &str) -> String {
@@ -2890,8 +2890,9 @@ async fn gateway_executes_openai_chat_sync_with_custom_path_via_local_decision_g
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile")
.and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -3018,7 +3019,10 @@ async fn gateway_executes_openai_chat_sync_with_custom_path_via_local_decision_g
seen_execution_runtime_request.proxy_node_id,
"proxy-node-openai-custom-path"
);
assert_eq!(seen_execution_runtime_request.tls_profile, "chrome_136");
assert_eq!(
seen_execution_runtime_request.transport_profile_id,
"chrome_136"
);
tokio::time::sleep(std::time::Duration::from_millis(100)).await;
assert!(

View File

@@ -61,7 +61,7 @@ async fn gateway_executes_claude_code_cli_sync_via_local_decision_gate_with_loca
metadata_source: String,
assistant_content: serde_json::Value,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
fn hash_api_key(value: &str) -> String {
@@ -393,8 +393,9 @@ async fn gateway_executes_claude_code_cli_sync_via_local_decision_gate_with_loca
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile")
.and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -559,7 +560,7 @@ async fn gateway_executes_claude_code_cli_sync_via_local_decision_gate_with_loca
"proxy-node-claude-code-cli-local"
);
assert_eq!(
seen_execution_runtime_request.tls_profile,
seen_execution_runtime_request.transport_profile_id,
"claude_code_nodejs"
);

View File

@@ -57,7 +57,7 @@ async fn gateway_executes_kiro_claude_cli_sync_via_local_provider_catalog_candid
profile_arn: String,
debug_tag: String,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
fn crc32(data: &[u8]) -> u32 {
@@ -430,8 +430,8 @@ async fn gateway_executes_kiro_claude_cli_sync_via_local_provider_catalog_candid
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile").and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -579,7 +579,10 @@ async fn gateway_executes_kiro_claude_cli_sync_via_local_provider_catalog_candid
seen_execution_runtime_request.proxy_node_id,
"proxy-node-kiro-cli-local-sync"
);
assert_eq!(seen_execution_runtime_request.tls_profile, "chrome_136");
assert_eq!(
seen_execution_runtime_request.transport_profile_id,
"chrome_136"
);
let stored_candidates = request_candidate_repository
.list_by_request_id("trace-kiro-cli-local-sync-123")

View File

@@ -56,7 +56,7 @@ async fn gateway_executes_claude_chat_sync_via_local_decision_gate_with_local_sy
metadata_mode: String,
metadata_source: String,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
fn hash_api_key(value: &str) -> String {
@@ -335,8 +335,9 @@ async fn gateway_executes_claude_chat_sync_via_local_decision_gate_with_local_sy
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile")
.and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -459,7 +460,10 @@ async fn gateway_executes_claude_chat_sync_via_local_decision_gate_with_local_sy
seen_execution_runtime_request.proxy_node_id,
"proxy-node-claude-chat-local"
);
assert_eq!(seen_execution_runtime_request.tls_profile, "chrome_136");
assert_eq!(
seen_execution_runtime_request.transport_profile_id,
"chrome_136"
);
let stored_candidates = request_candidate_repository
.list_by_request_id("trace-claude-chat-local-123")

View File

@@ -56,7 +56,7 @@ async fn gateway_executes_claude_cli_sync_via_local_decision_gate_with_local_syn
metadata_mode: String,
metadata_source: String,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
fn hash_api_key(value: &str) -> String {
@@ -335,8 +335,9 @@ async fn gateway_executes_claude_cli_sync_via_local_decision_gate_with_local_syn
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile")
.and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -467,7 +468,10 @@ async fn gateway_executes_claude_cli_sync_via_local_decision_gate_with_local_syn
seen_execution_runtime_request.proxy_node_id,
"proxy-node-claude-cli-local"
);
assert_eq!(seen_execution_runtime_request.tls_profile, "chrome_136");
assert_eq!(
seen_execution_runtime_request.transport_profile_id,
"chrome_136"
);
let stored_candidates = request_candidate_repository
.list_by_request_id("trace-claude-cli-local-sync-123")

View File

@@ -43,7 +43,7 @@ async fn gateway_executes_openai_responses_sync_via_local_decision_gate_with_loc
metadata_origin: String,
store_present: bool,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
fn hash_api_key(value: &str) -> String {
@@ -364,8 +364,9 @@ async fn gateway_executes_openai_responses_sync_via_local_decision_gate_with_loc
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile")
.and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -499,7 +500,10 @@ async fn gateway_executes_openai_responses_sync_via_local_decision_gate_with_loc
seen_execution_runtime_request.proxy_node_id,
"proxy-node-openai-cli-local"
);
assert_eq!(seen_execution_runtime_request.tls_profile, "chrome_136");
assert_eq!(
seen_execution_runtime_request.transport_profile_id,
"chrome_136"
);
let stored_candidates = request_candidate_repository
.list_by_request_id("trace-openai-cli-local-123")

View File

@@ -55,7 +55,7 @@ async fn gateway_executes_gemini_cli_sync_via_local_decision_gate_with_local_syn
metadata_source: String,
tool_config_present: bool,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
fn hash_api_key(value: &str) -> String {
@@ -333,8 +333,9 @@ async fn gateway_executes_gemini_cli_sync_via_local_decision_gate_with_local_syn
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile")
.and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -452,7 +453,10 @@ async fn gateway_executes_gemini_cli_sync_via_local_decision_gate_with_local_syn
seen_execution_runtime_request.proxy_node_id,
"proxy-node-gemini-cli-local"
);
assert_eq!(seen_execution_runtime_request.tls_profile, "chrome_136");
assert_eq!(
seen_execution_runtime_request.transport_profile_id,
"chrome_136"
);
let stored_candidates = request_candidate_repository
.list_by_request_id("trace-gemini-cli-local-sync-123")
@@ -775,7 +779,7 @@ async fn gateway_executes_gemini_cli_sync_via_local_decision_gate_after_oauth_re
metadata_source: String,
tool_config_present: bool,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
#[derive(Debug, Clone)]
@@ -1095,8 +1099,9 @@ async fn gateway_executes_gemini_cli_sync_via_local_decision_gate_after_oauth_re
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile")
.and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -1240,7 +1245,10 @@ async fn gateway_executes_gemini_cli_sync_via_local_decision_gate_after_oauth_re
seen_execution_runtime_request.proxy_node_id,
"proxy-node-gemini-cli-oauth-local"
);
assert_eq!(seen_execution_runtime_request.tls_profile, "chrome_136");
assert_eq!(
seen_execution_runtime_request.transport_profile_id,
"chrome_136"
);
let stored_candidates = request_candidate_repository
.list_by_request_id("trace-gemini-cli-oauth-local-sync-123")

View File

@@ -55,7 +55,7 @@ async fn gateway_executes_gemini_chat_sync_via_local_decision_gate_with_local_sy
metadata_source: String,
tool_config_present: bool,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
fn hash_api_key(value: &str) -> String {
@@ -333,8 +333,9 @@ async fn gateway_executes_gemini_chat_sync_via_local_decision_gate_with_local_sy
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile")
.and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -442,7 +443,10 @@ async fn gateway_executes_gemini_chat_sync_via_local_decision_gate_with_local_sy
seen_execution_runtime_request.proxy_node_id,
"proxy-node-gemini-chat-local"
);
assert_eq!(seen_execution_runtime_request.tls_profile, "chrome_136");
assert_eq!(
seen_execution_runtime_request.transport_profile_id,
"chrome_136"
);
let stored_candidates = request_candidate_repository
.list_by_request_id("trace-gemini-chat-local-123")

View File

@@ -119,7 +119,7 @@ fn admin_wrapped_state_owns_billing_capabilities() {
let admin_request =
read_workspace_module_tree("apps/aether-gateway/src/handlers/admin/request/mod.rs");
for pattern in [
"pub(crate) fn has_postgres_pool(&self) -> bool",
"pub(crate) fn has_wallet_data_writer(&self) -> bool",
"pub(crate) async fn list_admin_billing_collectors(",
"pub(crate) async fn read_admin_billing_collector(",
"pub(crate) async fn create_admin_billing_collector(",

View File

@@ -4701,6 +4701,7 @@ fn retired_api_format_occurrences_are_whitelisted() {
"crates/aether-ai-formats/src/protocol/matrix.rs",
"crates/aether-ai-formats/src/protocol/registry.rs",
"crates/aether-data/src/migrate.rs",
"crates/aether-data/src/lifecycle/migrate/tests.rs",
"crates/aether-usage-runtime/src/report.rs",
"frontend/src/api/endpoints/types/__tests__/api-format.spec.ts",
];

View File

@@ -23,6 +23,10 @@ pub(super) fn assert_no_sqlx_queries(root_relative_path: &str) {
let patterns = [
"sqlx::query(",
"sqlx::query_scalar",
"sqlx::postgres::PgRow",
"sqlx::Row",
"PostgresPoolFactory",
"PostgresPool",
"query_scalar::<",
"QueryBuilder<",
];

View File

@@ -311,8 +311,8 @@ fn scheduler_candidate_runtime_paths_depend_on_scheduler_core_and_state_trait()
"candidate/runtime.rs should depend on core selectable predicate helper"
);
assert!(
runtime.contains("SchedulerAffinityTarget"),
"candidate/runtime.rs should depend on core SchedulerAffinityTarget"
!runtime.contains("SchedulerAffinityTarget"),
"candidate/runtime.rs should keep affinity out of runtime eligibility checks"
);
assert!(
runtime.contains("auth_api_key_concurrency_limit_reached"),

View File

@@ -1,5 +1,9 @@
use super::*;
fn production_source(source: &str) -> &str {
source.split("#[cfg(test)]").next().unwrap_or(source)
}
#[test]
fn handlers_do_not_inline_sql_queries() {
assert_no_sqlx_queries("src/handlers");
@@ -10,11 +14,157 @@ fn gateway_runtime_does_not_inline_sql_queries() {
assert_no_sqlx_queries("src/state/runtime");
}
#[test]
fn aether_data_bootstrap_snapshot_is_built_from_schema_sources() {
let build_rs = read_workspace_file("crates/aether-data/build.rs");
assert!(
build_rs.contains("schema/bootstrap/postgres/manifest.txt"),
"build.rs should source the bootstrap snapshot from schema/bootstrap/postgres"
);
let compose_schema = read_workspace_file("crates/aether-data/schema/compose_schema.sh");
assert!(
compose_schema.contains("check_bootstrap_sources"),
"compose_schema.sh should still validate bootstrap source fragments"
);
assert!(
!compose_schema.contains("bootstrap/postgres/20260413020000_empty_database_snapshot.sql"),
"compose_schema.sh should not depend on the outer bootstrap artifact anymore"
);
let bootstrap = read_workspace_file("crates/aether-data/src/lifecycle/bootstrap/postgres.rs");
assert!(
bootstrap.contains("include_str!(concat!(env!(\"OUT_DIR\"), \"/empty_database_snapshot.sql\"))"),
"lifecycle/bootstrap/postgres.rs should embed the generated bootstrap snapshot from OUT_DIR"
);
assert!(
!bootstrap
.contains("../../../bootstrap/postgres/20260413020000_empty_database_snapshot.sql"),
"lifecycle/bootstrap/postgres.rs should not read the outer bootstrap artifact directly"
);
let provider_catalog =
read_workspace_file("crates/aether-data/src/repository/provider_catalog/postgres.rs");
assert!(
!provider_catalog.contains("../../../bootstrap/postgres/20260413020000_empty_database_snapshot.sql"),
"provider_catalog tests should use the shared bootstrap snapshot constant instead of the outer bootstrap artifact"
);
}
#[test]
fn aether_data_backend_pool_modules_do_not_own_maintenance_sql() {
for path in [
"crates/aether-data/src/backend/postgres.rs",
"crates/aether-data/src/backend/mysql.rs",
"crates/aether-data/src/backend/sqlite.rs",
] {
let source = read_workspace_file(path);
let production = production_source(&source);
for forbidden in [
"run_table_maintenance(",
"aggregate_wallet_daily_usage(",
"aggregate_stats_hourly(",
"aggregate_stats_daily(",
"find_system_config_value(",
"list_system_config_entries(",
"upsert_system_config_entry(",
"read_admin_system_stats(",
"sqlx::query(",
"sqlx::query_scalar",
"sqlx::raw_sql(",
] {
assert!(
!production.contains(forbidden),
"{path} should stay focused on pool and repository construction instead of owning maintenance SQL via {forbidden}"
);
}
}
let maintenance = read_workspace_file("crates/aether-data/src/backend/maintenance.rs");
for pattern in [
"Self::Postgres(postgres) => postgres.run_table_maintenance(table_names).await",
"Self::Mysql(mysql) => mysql.run_table_maintenance(table_names).await",
"Self::Sqlite(sqlite) => sqlite.run_table_maintenance(table_names).await",
"Self::Postgres(postgres) => postgres.aggregate_wallet_daily_usage(input).await",
"Self::Mysql(mysql) => mysql.aggregate_wallet_daily_usage(input).await",
"Self::Sqlite(sqlite) => sqlite.aggregate_wallet_daily_usage(input).await",
"Self::Postgres(postgres) => postgres.aggregate_stats_hourly(input).await",
"Self::Mysql(mysql) => mysql.aggregate_stats_hourly(input).await",
"Self::Sqlite(sqlite) => sqlite.aggregate_stats_hourly(input).await",
"Self::Postgres(postgres) => postgres.aggregate_stats_daily(input).await",
"Self::Mysql(mysql) => mysql.aggregate_stats_daily(input).await",
"Self::Sqlite(sqlite) => sqlite.aggregate_stats_daily(input).await",
] {
assert!(
maintenance.contains(pattern),
"backend/maintenance.rs should own SQL-driver maintenance dispatch {pattern}"
);
}
}
#[test]
fn testkit_does_not_copy_aether_business_schema_sql() {
let owner_relay_baseline =
read_workspace_file("crates/aether-testkit/src/bin/multi_instance_owner_relay_baseline.rs");
for forbidden in [
"CREATE TYPE proxynodestatus",
"CREATE TABLE IF NOT EXISTS system_configs",
"CREATE TABLE IF NOT EXISTS proxy_nodes",
"CREATE TABLE IF NOT EXISTS proxy_node_events",
"PgConnection::connect",
"sqlx::{Connection, Executor, PgConnection}",
] {
assert!(
!owner_relay_baseline.contains(forbidden),
"owner relay baseline should use aether-data schema bootstrap instead of copying business schema SQL via {forbidden}"
);
}
assert!(
owner_relay_baseline.contains("prepare_aether_postgres_schema(&postgres_url).await?"),
"owner relay baseline should prepare business schema through aether-testkit's aether-data helper"
);
let postgres_testkit = read_workspace_file("crates/aether-testkit/src/postgres.rs");
for required in [
"pub async fn prepare_aether_postgres_schema",
"DataBackends::from_config",
".prepare_database_for_startup()",
".run_database_migrations()",
] {
assert!(
postgres_testkit.contains(required),
"testkit Postgres helper should delegate Aether schema setup to aether-data via {required}"
);
}
}
#[test]
fn gateway_main_keeps_database_export_import_driver_selection_in_data_layer() {
let main_rs = read_workspace_file("apps/aether-gateway/src/main.rs");
for forbidden in [
"PostgresPoolFactory",
"MysqlPoolFactory",
"SqlitePoolFactory",
"to_postgres_config()",
] {
assert!(
!main_rs.contains(forbidden),
"main.rs should delegate database export/import driver selection to aether-data instead of {forbidden}"
);
}
for required in ["export_database_jsonl", "import_database_jsonl"] {
assert!(
main_rs.contains(required),
"main.rs should use aether-data {required}"
);
}
}
#[test]
fn wallet_repository_does_not_reexport_settlement_types() {
let wallet_mod = read_workspace_file("crates/aether-data/src/repository/wallet/mod.rs");
let wallet_types = read_workspace_file("crates/aether-data/src/repository/wallet/types.rs");
let wallet_sql = read_workspace_file("crates/aether-data/src/repository/wallet/sql.rs");
let wallet_sql = read_workspace_file("crates/aether-data/src/repository/wallet/postgres.rs");
let wallet_memory = read_workspace_file("crates/aether-data/src/repository/wallet/memory.rs");
assert!(
@@ -35,7 +185,7 @@ fn wallet_repository_does_not_reexport_settlement_types() {
);
assert!(
!wallet_sql.contains("impl SettlementWriteRepository"),
"wallet/sql.rs should not implement SettlementWriteRepository"
"wallet/postgres.rs should not implement SettlementWriteRepository"
);
assert!(
!wallet_memory.contains("impl SettlementWriteRepository"),
@@ -57,8 +207,9 @@ fn gateway_system_config_types_are_owned_by_aether_data() {
let state_core = read_workspace_file("apps/aether-gateway/src/data/state/core.rs");
for pattern in [
"backend.list_system_config_entries().await",
"upsert_system_config_entry(key, value, description)",
"backends.list_system_config_entries().await",
".upsert_system_config_entry(key, value, description)",
"backends.read_admin_system_stats().await",
"AdminSystemStats::default()",
] {
assert!(
@@ -66,6 +217,17 @@ fn gateway_system_config_types_are_owned_by_aether_data() {
"data/state/core.rs should use shared system DTO path {pattern}"
);
}
let data_backends = read_workspace_file("crates/aether-data/src/backend/maintenance.rs");
for pattern in [
"postgres.list_system_config_entries().await",
"mysql.list_system_config_entries().await",
"sqlite.list_system_config_entries().await",
] {
assert!(
data_backends.contains(pattern),
"aether-data backends should own driver-specific system config dispatch {pattern}"
);
}
for pattern in [
"|(key, value, description, updated_at_unix_secs)|",
"Ok((0, 0, 0, 0))",
@@ -180,6 +342,7 @@ fn gateway_auth_data_layer_does_not_keep_ldap_row_wrapper() {
"fn map_ldap_user_auth_row(",
"Result<Option<StoredLdapAuthUserRow>, DataLayerError>",
"existing.user.",
"map_user_auth_row(row)",
] {
assert!(
!gateway_auth_state.contains(pattern),
@@ -187,13 +350,14 @@ fn gateway_auth_data_layer_does_not_keep_ldap_row_wrapper() {
);
}
let user_sql = read_workspace_file("crates/aether-data/src/repository/users/postgres.rs");
for pattern in [
"Result<Option<StoredUserAuthRecord>, DataLayerError>",
"return map_user_auth_row(row).map(Some);",
] {
assert!(
gateway_auth_state.contains(pattern),
"data/state/auth.rs should use shared user auth record directly via {pattern}"
user_sql.contains(pattern),
"aether-data user repository should use shared user auth record directly via {pattern}"
);
}
}

View File

@@ -909,7 +909,7 @@ async fn gateway_returns_conflict_for_admin_create_user_when_writer_unavailable(
let mut state = AppState::new().expect("gateway should build");
state =
state.with_data_state_for_tests(crate::data::GatewayDataState::with_user_reader_for_tests(
Arc::new(InMemoryUserReadRepository::seed_auth_users(Vec::new())),
Arc::new(InMemoryUserReadRepository::seed_auth_users(Vec::new()).read_only()),
));
state.auth_user_store = None;
state.auth_wallet_store = None;
@@ -1032,9 +1032,9 @@ async fn gateway_returns_conflict_for_admin_update_user_when_writer_unavailable(
}
}));
let user_repository = Arc::new(InMemoryUserReadRepository::seed_auth_users(vec![
sample_admin_user("user-1"),
]));
let user_repository = Arc::new(
InMemoryUserReadRepository::seed_auth_users(vec![sample_admin_user("user-1")]).read_only(),
);
let (upstream_url, upstream_handle) = start_server(upstream).await;
let mut state = AppState::new()

View File

@@ -23,7 +23,7 @@ async fn gateway_executes_gemini_files_download_via_local_decision_gate_with_loc
auth_header_value: String,
endpoint_tag: String,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
let decision_hits = Arc::new(Mutex::new(0usize));
@@ -126,8 +126,9 @@ async fn gateway_executes_gemini_files_download_via_local_decision_gate_with_loc
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile")
.and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -258,7 +259,10 @@ async fn gateway_executes_gemini_files_download_via_local_decision_gate_with_loc
seen_execution_runtime_request.proxy_node_id,
"proxy-node-gemini-files-download-local"
);
assert_eq!(seen_execution_runtime_request.tls_profile, "chrome_136");
assert_eq!(
seen_execution_runtime_request.transport_profile_id,
"chrome_136"
);
let stored_candidates = request_candidate_repository
.list_by_request_id("trace-gemini-files-download-local-123")

View File

@@ -21,7 +21,7 @@ async fn gateway_executes_gemini_files_upload_via_local_decision_gate_with_local
body_bytes_b64: String,
endpoint_tag: String,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
let decision_hits = Arc::new(Mutex::new(0usize));
@@ -154,8 +154,9 @@ async fn gateway_executes_gemini_files_upload_via_local_decision_gate_with_local
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile")
.and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -277,7 +278,10 @@ async fn gateway_executes_gemini_files_upload_via_local_decision_gate_with_local
seen_execution_runtime_request.proxy_node_id,
"proxy-node-gemini-files-upload-local"
);
assert_eq!(seen_execution_runtime_request.tls_profile, "chrome_136");
assert_eq!(
seen_execution_runtime_request.transport_profile_id,
"chrome_136"
);
let stored_candidates = request_candidate_repository
.list_by_request_id("trace-gemini-files-upload-local-123")

View File

@@ -4303,7 +4303,8 @@ async fn gateway_returns_service_unavailable_for_users_me_detail_update_without_
]),
now + chrono::Duration::hours(1),
);
let user_repository = Arc::new(InMemoryUserReadRepository::seed_auth_users(vec![user]));
let user_repository =
Arc::new(InMemoryUserReadRepository::seed_auth_users(vec![user]).read_only());
let (gateway_url, upstream_hits, gateway_handle, upstream_handle) =
start_auth_gateway_with_builder(|| {
let data_state =
@@ -4453,7 +4454,8 @@ async fn gateway_returns_service_unavailable_for_users_me_password_change_withou
]),
now + chrono::Duration::hours(1),
);
let user_repository = Arc::new(InMemoryUserReadRepository::seed_auth_users(vec![user]));
let user_repository =
Arc::new(InMemoryUserReadRepository::seed_auth_users(vec![user]).read_only());
let (gateway_url, upstream_hits, gateway_handle, upstream_handle) =
start_auth_gateway_with_builder(|| {
let data_state =
@@ -4819,7 +4821,8 @@ async fn gateway_returns_service_unavailable_for_users_me_preferences_update_wit
]),
now + chrono::Duration::hours(1),
);
let user_repository = Arc::new(InMemoryUserReadRepository::seed_auth_users(vec![user]));
let user_repository =
Arc::new(InMemoryUserReadRepository::seed_auth_users(vec![user]).read_only());
let (gateway_url, upstream_hits, gateway_handle, upstream_handle) =
start_auth_gateway_with_builder(|| {
let data_state =
@@ -8298,7 +8301,8 @@ async fn gateway_returns_service_unavailable_for_users_me_model_capabilities_upd
]),
now + chrono::Duration::hours(1),
);
let user_repository = Arc::new(InMemoryUserReadRepository::seed_auth_users(vec![user]));
let user_repository =
Arc::new(InMemoryUserReadRepository::seed_auth_users(vec![user]).read_only());
let (gateway_url, upstream_hits, gateway_handle, upstream_handle) =
start_auth_gateway_with_builder(|| {
let data_state =

View File

@@ -528,7 +528,7 @@ async fn gateway_handles_admin_dashboard_stats_locally_without_proxying_upstream
assert_eq!(payload["today"]["tokens"], 17_450);
assert_eq!(payload["today"]["cost"], json!(2.5));
assert_eq!(payload["cost_stats"]["cost_savings"], json!(0.025));
assert_eq!(payload["stats"][2]["subValue"], json!("节省 $0.01"));
assert_eq!(payload["stats"][2]["subValue"], json!("节省 $0.03"));
assert_eq!(payload["stats"][0]["value"], json!("2"));
assert_eq!(payload["stats"][1]["value"], json!("17.4K"));
assert_eq!(

View File

@@ -42,7 +42,7 @@ async fn gateway_executes_gemini_video_create_via_local_decision_gate_with_local
metadata_source: String,
store_present: bool,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
fn hash_api_key(value: &str) -> String {
@@ -350,8 +350,9 @@ async fn gateway_executes_gemini_video_create_via_local_decision_gate_with_local
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile")
.and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -465,7 +466,10 @@ async fn gateway_executes_gemini_video_create_via_local_decision_gate_with_local
seen_execution_runtime_request.proxy_node_id,
"proxy-node-gemini-video-local"
);
assert_eq!(seen_execution_runtime_request.tls_profile, "chrome_136");
assert_eq!(
seen_execution_runtime_request.transport_profile_id,
"chrome_136"
);
let stored_candidates = request_candidate_repository
.list_by_request_id("trace-gemini-video-local-123")

View File

@@ -47,7 +47,7 @@ async fn gateway_executes_openai_video_create_via_local_decision_gate_with_local
metadata_source: String,
store_present: bool,
proxy_node_id: String,
tls_profile: String,
transport_profile_id: String,
}
fn hash_api_key(value: &str) -> String {
@@ -362,8 +362,9 @@ async fn gateway_executes_openai_video_create_via_local_decision_gate_with_local
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
tls_profile: payload
.get("tls_profile")
transport_profile_id: payload
.get("transport_profile")
.and_then(|value| value.get("profile_id"))
.and_then(|value| value.as_str())
.unwrap_or_default()
.to_string(),
@@ -479,7 +480,10 @@ async fn gateway_executes_openai_video_create_via_local_decision_gate_with_local
seen_execution_runtime_request.proxy_node_id,
"proxy-node-openai-video-local"
);
assert_eq!(seen_execution_runtime_request.tls_profile, "chrome_136");
assert_eq!(
seen_execution_runtime_request.transport_profile_id,
"chrome_136"
);
let stored_candidates = request_candidate_repository
.list_by_request_id("trace-openai-video-local-123")