mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
Fix/api key concurrency runtime miss (#309)
* test(cli): 覆盖 API key 并发等待与超时路径 * feat(scheduler): API key 并发饱和时等待可用槽位 * fix(proxy): 区分 API key 并发受限与真正的 runtime miss * fix(outcome): runtime miss 仅归因真实执行候选 * feat(api-keys): 统一 concurrent_limit 默认值与校验辅助 * feat(admin): 独立 Key 接口支持 concurrent_limit * feat(admin): 用户 API Key 路由支持 concurrent_limit * feat(public): 自助 API Key 路由支持 concurrent_limit * feat(import): 导入与存储层持久化 concurrent_limit * feat(frontend): 同步 API Key concurrent_limit 类型定义 * feat(frontend): 独立 Key 表单支持 concurrent_limit * feat(frontend): 管理员用户 API Key 表单支持 concurrent_limit * feat(frontend): 自助 API Key 页面支持 concurrent_limit * chore(fmt): 统一 runtime 归因相关 Rust 格式 * chore(fmt): 统一 admin API key 路由 Rust 格式 * chore(fmt): 统一 public 路由与相关测试 Rust 格式 * fix(test): 对齐 no-execution usage 归因断言 * test(middleware): 固定 access log tracing 用例线程模型 * fix(frontend): 提取用户 API Key payload 默认并发辅助 * fix(frontend): 保留用户 Key 的 concurrent_limit 默认值 * fix(api-keys): remove hardcoded concurrent limit default --------- Co-authored-by: fawney19 <elky0401@gmail.com>
This commit is contained in:
@@ -447,6 +447,7 @@ async fn gateway_handles_admin_api_keys_create_locally_with_trusted_admin_princi
|
||||
assert_eq!(payload["name"], json!("standalone-key"));
|
||||
assert_eq!(payload["is_standalone"], json!(true));
|
||||
assert_eq!(payload["rate_limit"], serde_json::Value::Null);
|
||||
assert_eq!(payload["concurrent_limit"], serde_json::Value::Null);
|
||||
assert_eq!(payload["allowed_providers"], json!(["openai"]));
|
||||
assert_eq!(payload["allowed_api_formats"], json!(["openai:chat"]));
|
||||
assert_eq!(payload["allowed_models"], json!(["gpt-4.1"]));
|
||||
@@ -515,6 +516,7 @@ async fn gateway_handles_admin_api_keys_update_locally_with_trusted_admin_princi
|
||||
.json(&json!({
|
||||
"name": "renamed-key",
|
||||
"rate_limit": null,
|
||||
"concurrent_limit": 12,
|
||||
"allowed_providers": ["gemini"],
|
||||
"allowed_api_formats": ["gemini:chat"],
|
||||
"allowed_models": ["gemini-2.5-pro"],
|
||||
@@ -531,6 +533,7 @@ async fn gateway_handles_admin_api_keys_update_locally_with_trusted_admin_princi
|
||||
assert_eq!(payload["id"], json!("key-123"));
|
||||
assert_eq!(payload["name"], json!("renamed-key"));
|
||||
assert_eq!(payload["rate_limit"], serde_json::Value::Null);
|
||||
assert_eq!(payload["concurrent_limit"], json!(12));
|
||||
assert_eq!(payload["allowed_providers"], json!(["gemini"]));
|
||||
assert_eq!(payload["allowed_api_formats"], json!(["gemini:chat"]));
|
||||
assert_eq!(payload["allowed_models"], json!(["gemini-2.5-pro"]));
|
||||
|
||||
@@ -629,6 +629,7 @@ async fn gateway_handles_admin_user_api_key_routes_locally_with_trusted_admin_pr
|
||||
.expect("json body should parse");
|
||||
assert_eq!(create_payload["name"], "new-key");
|
||||
assert_eq!(create_payload["rate_limit"], 90);
|
||||
assert_eq!(create_payload["concurrent_limit"], serde_json::Value::Null);
|
||||
assert_eq!(
|
||||
create_payload["message"],
|
||||
"API Key创建成功,请妥善保存完整密钥"
|
||||
@@ -651,6 +652,7 @@ async fn gateway_handles_admin_user_api_key_routes_locally_with_trusted_admin_pr
|
||||
.json(&json!({
|
||||
"name": "renamed",
|
||||
"rate_limit": 120,
|
||||
"concurrent_limit": 9,
|
||||
}))
|
||||
.send()
|
||||
.await
|
||||
@@ -664,6 +666,7 @@ async fn gateway_handles_admin_user_api_key_routes_locally_with_trusted_admin_pr
|
||||
assert_eq!(update_payload["name"], "renamed");
|
||||
assert_eq!(update_payload["is_locked"], false);
|
||||
assert_eq!(update_payload["rate_limit"], 120);
|
||||
assert_eq!(update_payload["concurrent_limit"], 9);
|
||||
assert_eq!(update_payload["message"], "API Key更新成功");
|
||||
|
||||
let lock_response = client
|
||||
|
||||
Reference in New Issue
Block a user