Merge remote-tracking branch 'origin/pr/377' into codex/pr-376-377-383-384-combined

# Conflicts:
#	apps/aether-gateway/src/tests/frontdoor/public_support/dashboard.rs
#	crates/aether-data/src/lifecycle/backfill.rs
#	crates/aether-data/src/repository/usage/postgres/mod.rs
This commit is contained in:
fawney19
2026-05-06 02:36:57 +08:00
42 changed files with 1063 additions and 70 deletions

View File

@@ -877,6 +877,7 @@ async fn gateway_handles_admin_stats_provider_performance_locally_with_trusted_a
);
row.response_time_ms = Some((index * 100) as u64);
row.first_byte_time_ms = Some((index * 10) as u64);
row.request_metadata = Some(json!({ "upstream_is_stream": true }));
row
})
.collect::<Vec<_>>();
@@ -956,7 +957,7 @@ async fn gateway_handles_admin_stats_provider_performance_locally_with_trusted_a
let payload: serde_json::Value = response.json().await.expect("json body should parse");
assert_eq!(payload["summary"]["request_count"], 12);
assert_eq!(payload["summary"]["success_rate"], 91.67);
assert_eq!(payload["summary"]["avg_output_tps"], 18.46);
assert_eq!(payload["summary"]["avg_output_tps"], 20.17);
assert_eq!(payload["summary"]["avg_first_byte_time_ms"], 55.0);
assert_eq!(payload["summary"]["avg_response_time_ms"], 590.91);
@@ -968,7 +969,7 @@ async fn gateway_handles_admin_stats_provider_performance_locally_with_trusted_a
assert_eq!(payload["providers"][0]["error_count"], 1);
assert_eq!(payload["providers"][0]["success_rate"], 90.91);
assert_eq!(payload["providers"][0]["output_tokens"], 199);
assert_eq!(payload["providers"][0]["avg_output_tps"], 18.18);
assert_eq!(payload["providers"][0]["avg_output_tps"], 20.2);
assert_eq!(payload["providers"][0]["avg_first_byte_time_ms"], 55.0);
assert_eq!(payload["providers"][0]["avg_response_time_ms"], 550.0);
assert_eq!(payload["providers"][0]["p90_response_time_ms"], 910);
@@ -991,7 +992,7 @@ async fn gateway_handles_admin_stats_provider_performance_locally_with_trusted_a
assert_eq!(payload["timeline"].as_array().map(Vec::len), Some(2));
assert_eq!(payload["timeline"][0]["date"], "2024-03-21T05:00:00+00:00");
assert_eq!(payload["timeline"][0]["provider_id"], "provider-1");
assert_eq!(payload["timeline"][0]["avg_output_tps"], 18.18);
assert_eq!(payload["timeline"][0]["avg_output_tps"], 20.2);
assert_eq!(payload["timeline"][0]["success_rate"], 90.91);
assert_eq!(payload["timeline"][1]["provider_id"], "provider-2");
assert_eq!(

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

@@ -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")