V10.578 修正 Code Review timeout 誤報
All checks were successful
CD Pipeline / deploy (push) Successful in 1m5s

This commit is contained in:
OoO
2026-06-04 11:32:07 +08:00
parent 5f7073798a
commit 3f528dade3
6 changed files with 33 additions and 3 deletions

View File

@@ -482,6 +482,31 @@ def test_hermes_scan_defaults_to_static_scan_without_ollama(monkeypatch):
assert pipeline.state["severity_summary"]["medium"] == 1
def test_static_scan_accepts_multiline_requests_timeout(monkeypatch):
"""多行 requests 呼叫已帶 timeout 時,不應被誤報為未設定 timeout。"""
monkeypatch.delenv("CODE_REVIEW_HERMES_LLM_SCAN_ENABLED", raising=False)
_stub_logger(monkeypatch)
svc_mod = _reload_pipeline()
pipeline = _make_pipeline(svc_mod)
findings = pipeline._hermes_scan({
"services/foo.py": (
"import requests\n"
"def safe(url, timeout_s):\n"
" return requests.get(\n"
" url,\n"
" timeout=timeout_s,\n"
" )\n"
)
})
assert not any(
finding["description"] == "HTTP request 未設定 timeout可能拖住 worker"
for finding in findings
)
assert pipeline.state["severity_summary"]["medium"] == 0
def test_flag_true_still_uses_ollama_before_claude(monkeypatch):
"""flag=true 也不得跳過 OllamaOllama 成功時 Claude/Gemini 都不呼叫"""
monkeypatch.setenv('CODE_REVIEW_USE_CLAUDE', 'true')