fix: keep prelaunch release-probe failures from stopping independent work

This commit is contained in:
阿白叔 committed 2026-11-06 11:34:25 +08:00
1 parent 8eefecd9f0
commit 679f33b8cc
2 files changed
+26 -1

No files matched your search

+1 -1
View File
@@ -579,7 +579,7 @@ def run_verify(request, *, progress=None, flag_reader=None, process_runner=None,
library_lock.__enter__() library_lock.__enter__()
except LibraryBusy as error: except LibraryBusy as error:
return VerifyResult('FAIL', stderr=str(error), error_category='LIBRARY_IN_USE') 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') return VerifyResult('FAIL', stderr=str(error), error_category='LIBRARY_ACCESS_FAILED')
release_confirmed = False release_confirmed = False
result = _run_verify_serialized( result = _run_verify_serialized(
+25
View File
@@ -110,3 +110,28 @@ def test_change_report_storage_failure_does_not_invent_unfinished_native_write(s
assert result.change_report['status'] == 'UNCONFIRMED' assert result.change_report['status'] == 'UNCONFIRMED'
assert 'report disk full' in result.detail assert 'report disk full' in result.detail
assert not management.unfinished_operations(request.evidence_dir) 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]