Merge branch 'sophie' into hugo-shipping-notice

This commit is contained in:
hugo committed 2026-08-17 22:19:24 +08:00
commit 260465b72d
7 files changed
+162 -16

No files matched your search

+20 -5
View File
@@ -416,7 +416,8 @@ def test_file_check_tool_start_records_chat_log_bind_context(app, client, monkey
assert resolve_run_id_for_chat_log(session_id='bind-on-start', query='执行 RoHS 检核') == run_id
def test_file_check_tool_no_data_does_not_create_run_or_bind_context(app, client, monkeypatch):
def test_file_check_tool_no_data_creates_bound_completed_run_with_full_progress(app, client, monkeypatch):
"""无待检资料也要给本轮对话一条可展示 100% 进度的完成批次。"""
with app.app_context():
app.config['INTEGRATION_API_KEY'] = 'secret'
admin = _mk_admin()
@@ -446,15 +447,29 @@ def test_file_check_tool_no_data_does_not_create_run_or_bind_context(app, client
data = res.get_json()
assert data['ok'] is False
assert data['error_code'] == 'no_data_to_check'
assert 'run' not in data
run_id = data['run']['run_id']
with app.app_context():
after_count = ScheduleRun.query.filter_by(schedule_task_id=task_id).count()
assert after_count == before_count
assert after_count == before_count + 1
run = db.session.get(ScheduleRun, run_id)
assert run.status == 'success'
assert run.total_count == 0
assert run.success_count == 0
assert run.failed_count == 0
assert run.skipped_count == 0
assert run.finished_at is not None
from app.services.file_check_tools.chat_log_run_binding import resolve_run_id_for_chat_log
assert resolve_run_id_for_chat_log(turn_id='no-data-turn') is None
assert resolve_run_id_for_chat_log(session_id='no-data-session', query='立即执行检核') is None
assert resolve_run_id_for_chat_log(turn_id='no-data-turn') == run_id
assert resolve_run_id_for_chat_log(session_id='no-data-session', query='立即执行检核') == run_id
progress_res = client.get(
f'/api/workspace/file-check/runs/{run_id}',
headers={'X-Username': 'admin'},
)
assert progress_res.status_code == 200
assert progress_res.get_json()['run']['progress_percent'] == 100
def test_file_check_tool_no_data_keeps_existing_running_conflict_priority(app, client, monkeypatch):