This commit is contained in:
@@ -518,6 +518,42 @@ def test_ppt_audit_run_vision_queues_background_audit(client, monkeypatch):
|
||||
assert captured['max_files'] == 1
|
||||
|
||||
|
||||
def test_ppt_audit_trigger_aider_heal_accepts_issue_summary(client, monkeypatch):
|
||||
"""視覺 QA failed 常只有 issues_found;AiderHeal 應可吃診斷摘要派工。"""
|
||||
from services import aider_heal_executor as svc
|
||||
|
||||
captured = {}
|
||||
|
||||
def fake_execute_code_fix(**kwargs):
|
||||
captured.update(kwargs)
|
||||
return {
|
||||
'success': True,
|
||||
'action': 'CODE_FIX',
|
||||
'message': '已派出 AiderHeal',
|
||||
'commit_sha': None,
|
||||
'reverted': False,
|
||||
}
|
||||
|
||||
monkeypatch.setattr(svc, 'execute_code_fix', fake_execute_code_fix)
|
||||
|
||||
r = client.post(
|
||||
'/observability/ppt_audit/trigger_aider_heal',
|
||||
json={
|
||||
'pptx_filename': 'ocbot_daily_20260517.pptx',
|
||||
'issue_summary': 'S1: 圖表被切掉:右側圖例超出邊界',
|
||||
},
|
||||
)
|
||||
data = r.get_json()
|
||||
|
||||
assert r.status_code == 200
|
||||
assert data['ok'] is True
|
||||
assert captured['error_type'] == 'ppt_vision_audit_failure'
|
||||
assert captured['target_file'] == 'services/ppt_generator.py'
|
||||
assert 'ocbot_daily_20260517.pptx' in captured['error_message']
|
||||
assert '圖表被切掉' in captured['error_message']
|
||||
assert captured['context']['issue_summary'] == 'S1: 圖表被切掉:右側圖例超出邊界'
|
||||
|
||||
|
||||
# ──────────────────────────────────────────────────────────────────────────
|
||||
# /observability/host_health
|
||||
# ──────────────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user