From 679f33b8cc205483ab3fb25ab99f92a9bfd2b2d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E7=99=BD=E5=8F=94?= <11794527+absfan@user.noreply.gitee.com> Date: Fri, 6 Nov 2026 11:34:25 +0800 Subject: [PATCH] fix: keep prelaunch release-probe failures from stopping independent work --- src/cbb_refresh_verify/verify_runner.py | 2 +- tests/test_review_backend_followup.py | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/cbb_refresh_verify/verify_runner.py b/src/cbb_refresh_verify/verify_runner.py index 6005bef..7c9690d 100644 --- a/src/cbb_refresh_verify/verify_runner.py +++ b/src/cbb_refresh_verify/verify_runner.py @@ -579,7 +579,7 @@ def run_verify(request, *, progress=None, flag_reader=None, process_runner=None, library_lock.__enter__() except LibraryBusy as error: return VerifyResult('FAIL', stderr=str(error), error_category='LIBRARY_IN_USE') - except (OSError, pywintypes.error) as error: + except (OSError, ValueError, RuntimeError, pywintypes.error) as error: return VerifyResult('FAIL', stderr=str(error), error_category='LIBRARY_ACCESS_FAILED') release_confirmed = False result = _run_verify_serialized( diff --git a/tests/test_review_backend_followup.py b/tests/test_review_backend_followup.py index ff1db32..c270507 100644 --- a/tests/test_review_backend_followup.py +++ b/tests/test_review_backend_followup.py @@ -110,3 +110,28 @@ def test_change_report_storage_failure_does_not_invent_unfinished_native_write(s assert result.change_report['status'] == 'UNCONFIRMED' assert 'report disk full' in result.detail assert not management.unfinished_operations(request.evidence_dir) + + +def test_bad_history_evidence_location_does_not_turn_prelaunch_error_into_unreleased_session(tmp_path, monkeypatch): + from cbb_refresh_verify import library_lock as locks, verify_runner as runner + library=tmp_path/'lib.lmc';library.touch() + locks._persist_blocker(library,lease_id='c'*32) + monkeypatch.setattr(runner,'_run_verify_serialized',lambda *a,**kw:pytest.fail('invalid evidence launched native work')) + result=runner.run_verify(runner.VerifyRequest(library,'Target',tmp_path/'evidence')) + assert result.safe_to_continue and result.error_category=='LIBRARY_ACCESS_FAILED' + assert locks.blocker_path(library).exists() + + +def test_history_probe_timeout_does_not_stop_next_independent_library(tmp_path, monkeypatch): + from cbb_refresh_verify import library_lock as locks, verify_runner as runner + a=tmp_path/'A/lib.lmc';a.parent.mkdir();a.touch() + b=tmp_path/'B/lib.lmc';b.parent.mkdir();b.touch() + locks._persist_blocker(a,lease_id='d'*32) + def timeout(*args):raise RuntimeError('OWNER_QUERY_TIMEOUT') + monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners',timeout) + calls=[] + monkeypatch.setattr(runner,'_run_verify_serialized',lambda req,**kw: + calls.append(req.lmc_file) or runner.VerifyResult('PASS')) + results=runner.run_batch([runner.VerifyRequest(p,'Target',tmp_path/'evidence') for p in (a,b)]) + assert [r.status for r in results]==['FAIL','PASS'] + assert results[0].safe_to_continue and calls==[b]