refactor: 拆分 Rust gateway/executor 大文件为模块目录结构,拆分 Python gateway.py 为子模块

Rust 侧:
- executor.rs 拆分为 executor/ 目录 (plan_builders, stream, sync, submission)
- 新增 kiro_stream/, local_finalize/, local_stream/ 模块目录
- 新增 video_tasks.rs
- 测试文件 ai_execute/files/video 拆分为子目录
- handlers/headers/control/constants 扩展支持新模块

Python 侧:
- gateway.py 拆分为 24 个子模块 (routes, shared, contract, chat, cli, video, files, finalize, reporting 等)
- 新增 antigravity/gemini_cli/kiro 的 rust_http 适配层
- upstream_fetcher 增加 Rust sidecar 支持
- executor_plan/candidate/pipeline 适配调整

测试:
- 对应拆分 test_internal_gateway_routes 为子目录
- 新增 rust_http 相关测试
This commit is contained in:
fawney19
2026-03-23 17:19:15 +08:00
parent 455234e797
commit eaf8475f9e
163 changed files with 58913 additions and 13692 deletions

View File

@@ -536,6 +536,7 @@ class TestPipelineAuthentication:
mock_request = MagicMock()
mock_request.headers = {
"x-aether-gateway": "rust-phase3b",
"x-aether-execution-path": "public_proxy_after_executor_miss",
"x-aether-auth-user-id": "user-123",
"x-aether-auth-api-key-id": "key-123",
"x-aether-auth-balance-remaining": "42.5",
@@ -565,7 +566,9 @@ class TestPipelineAuthentication:
mock_db.query.side_effect = [user_query, api_key_query]
mock_adapter = MagicMock()
mock_adapter.extract_api_key.side_effect = AssertionError("trusted auth should short-circuit")
mock_adapter.extract_api_key.side_effect = AssertionError(
"trusted auth should short-circuit"
)
with patch.object(
pipeline.auth_service,
@@ -580,6 +583,7 @@ class TestPipelineAuthentication:
assert mock_request.state.user_id == "user-123"
assert mock_request.state.api_key_id == "key-123"
assert mock_request.state.prefetched_balance_remaining == 42.5
assert mock_request.state.gateway_execution_path == "public_proxy_after_executor_miss"
@pytest.mark.asyncio
async def test_authenticate_client_trusted_gateway_balance_denied(
@@ -617,7 +621,9 @@ class TestPipelineAuthentication:
mock_db.query.side_effect = [user_query, api_key_query]
mock_adapter = MagicMock()
mock_adapter.extract_api_key.side_effect = AssertionError("trusted auth should short-circuit")
mock_adapter.extract_api_key.side_effect = AssertionError(
"trusted auth should short-circuit"
)
from src.core.exceptions import BalanceInsufficientException