feat: AirPlan V2 — 全专家插件强制路由 + 事件系统规范化
P0-8 扩大: do_mode.py finish_worker 全专家插件强制路由 - GUI→XDB, network→NDB, C/C++→SDB, done→Rvr, blocked/failed→Dbg - 证据去重: 已有 xdbSessions/ndbSessions/sdbReports/rvrReviewed 则跳过 P1-GAP17: 事件 emit 规范化 - 新增 7 个事件常量 (TASK_ENTERED, TASK_FINISHED, ENGINE_ENTERED 等) - 全部 emit 调用替换字符串字面量为常量,零残留 - 30 个事件类型常量全部定义且唯一 P1-GAP18: 事件日志原子轮转 - emit 计数器每 128 次检查轮转,避免每次 emit 读文件 - 清除未使用的 _emit_with_completion/_pending_merge_complete - 原子轮转: tempfile+os.replace 保证不损坏 eng 极端接管: 强制调用全部专家插件 (Dbg/XDB/NDB/SDB/Rvr) commands/do.md: 更新为全专家插件路由文档 全量测试: 69 通过, 0 失败 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
90
test_xdb_sdb_ndb.py
Executable file
90
test_xdb_sdb_ndb.py
Executable file
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Xdb/Sdb/Ndb Mode 功能测试"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import tempfile
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent / "lib"))
|
||||
|
||||
def test_xdb_enter():
|
||||
"""测试 GUI 验证器初始化"""
|
||||
from air_runtime.modes.xdb_sdb_ndb_modes import xdb_enter
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
project_root = Path(tmpdir)
|
||||
|
||||
result = xdb_enter(project_root)
|
||||
assert "state_path" in result
|
||||
assert Path(result["state_path"]).exists()
|
||||
|
||||
print("✓ Xdb 初始化测试通过")
|
||||
return True
|
||||
|
||||
|
||||
def test_sdb_enter():
|
||||
"""测试静态分析器初始化"""
|
||||
from air_runtime.modes.xdb_sdb_ndb_modes import sdb_enter
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
project_root = Path(tmpdir)
|
||||
|
||||
result = sdb_enter(project_root)
|
||||
assert "state_path" in result
|
||||
assert Path(result["state_path"]).exists()
|
||||
|
||||
print("✓ Sdb 初始化测试通过")
|
||||
return True
|
||||
|
||||
|
||||
def test_ndb_enter():
|
||||
"""测试网络调试器初始化"""
|
||||
from air_runtime.modes.xdb_sdb_ndb_modes import ndb_enter
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
project_root = Path(tmpdir)
|
||||
|
||||
result = ndb_enter(project_root)
|
||||
assert "state_path" in result
|
||||
assert Path(result["state_path"]).exists()
|
||||
|
||||
print("✓ Ndb 初始化测试通过")
|
||||
return True
|
||||
|
||||
|
||||
def main():
|
||||
print("=" * 50)
|
||||
print("Xdb/Sdb/Ndb Mode 功能测试")
|
||||
print("=" * 50)
|
||||
|
||||
tests = [
|
||||
("Xdb 初始化", test_xdb_enter),
|
||||
("Sdb 初始化", test_sdb_enter),
|
||||
("Ndb 初始化", test_ndb_enter),
|
||||
]
|
||||
|
||||
passed = 0
|
||||
failed = 0
|
||||
|
||||
for name, test_fn in tests:
|
||||
try:
|
||||
test_fn()
|
||||
passed += 1
|
||||
except Exception as e:
|
||||
print(f"✗ {name} 失败: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
failed += 1
|
||||
|
||||
print("=" * 50)
|
||||
print(f"测试结果: {passed} 通过, {failed} 失败")
|
||||
print("=" * 50)
|
||||
|
||||
return failed == 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
success = main()
|
||||
sys.exit(0 if success else 1)
|
||||
Reference in New Issue
Block a user