fix: separate verification and ICDB maintenance with live session leases
This commit is contained in:
1 parent
2587d33c5a
commit
477a5a46e3
15 files changed
+420
-194
No files matched your search
@@ -65,28 +65,25 @@ def test_verification_refuses_uploader_exclusive_lock_before_native_work(tmp_pat
|
||||
monkeypatch.setattr(runner, '_run_verify_serialized', lambda *a, **k: pytest.fail('native work bypassed lock'))
|
||||
try:
|
||||
result = runner.run_verify(runner.VerifyRequest(library, 'Block', tmp_path/'out'))
|
||||
assert result.status == 'BLOCKED' and not result.safe_to_continue
|
||||
assert result.status == 'FAIL' and result.safe_to_continue
|
||||
finally:
|
||||
handle.Close()
|
||||
|
||||
|
||||
def test_unsafe_verify_retains_lease_and_persistent_blocker(tmp_path, monkeypatch):
|
||||
def test_unsafe_verify_records_failure_without_persistent_library_blocker(tmp_path, monkeypatch):
|
||||
import json
|
||||
import cbb_refresh_verify.verify_runner as runner
|
||||
import cbb_refresh_verify.library_lock as locks
|
||||
library = tmp_path/'lib.lmc'; library.touch()
|
||||
evidence = tmp_path/'out'; evidence.mkdir()
|
||||
(evidence/'session-release.json').write_text(json.dumps({'library': str(library),
|
||||
'block': 'Block', 'worker_exited': True, 'safe_to_continue': True}))
|
||||
monkeypatch.setattr(runner, '_run_verify_serialized', lambda *a, **k:
|
||||
runner.VerifyResult('FAIL', safe_to_continue=False))
|
||||
runner.VerifyResult('FAIL', safe_to_continue=False, evidence_path=evidence/'result.json'))
|
||||
result = runner.run_verify(runner.VerifyRequest(library, 'Block', tmp_path/'out'))
|
||||
assert not result.safe_to_continue
|
||||
assert locks.blocker_path(library).is_file()
|
||||
with pytest.raises(locks.LibraryBusy):
|
||||
with locks.LibraryLock(library): pass
|
||||
# Simulate OS handle loss on process exit; persistent marker still blocks.
|
||||
with locks._guard:
|
||||
owner = locks._owners.pop(str((tmp_path/'.lib.cbb-upload.lock').resolve()).casefold(), None)
|
||||
if owner: owner['handle'].Close()
|
||||
with pytest.raises(locks.LibraryBusy):
|
||||
with locks.LibraryLock(library): pass
|
||||
assert not locks.blocker_path(library).exists()
|
||||
with locks.LibraryLock(library): pass
|
||||
|
||||
|
||||
def test_explicit_release_requires_fresh_proof_and_never_deletes_sidecar(tmp_path, monkeypatch):
|
||||
|
||||
Reference in new issue
Block a user